CYCLUS
|
The GreedySolver provides the implementation for a "greedy" solution to a resource exchange graph.
Given an ExchangeGraph, the greedy solver will march through each RequestGroup in the graph, matching request nodes "greedily" with supply nodes. Each request node will attempt to be supplied by supplier arcs as long as those supplier arcs have some excess capacity. The possible suppliers will be ordered by descending preference. The algorithm terminates when one of the following conditions is met: 1) All RequestGroups are satisfied 2) All SupplySets are at capacity
Definition at line 64 of file greedy_solver.h.
#include <greedy_solver.h>
Protected Member Functions | |
virtual double | SolveGraph () |
Additional Inherited Members | |
Static Public Member Functions inherited from cyclus::ExchangeSolver | |
static double | Cost (const Arc &a, bool exclusive_orders=kDefaultExclusive) |
Static Public Attributes inherited from cyclus::ExchangeSolver | |
static const bool | kDefaultExclusive = true |
Protected Attributes inherited from cyclus::ExchangeSolver | |
bool | exclusive_orders_ |
ExchangeGraph * | graph_ |
Context * | sim_ctx_ |
bool | verbose_ |
cyclus::GreedySolver::GreedySolver | ( | ) |
GreedySolver constructor.
exclusive_orders | a flag for enforcing integral, quantized orders |
c | a conditioner to use before solving a graph instance |
Definition at line 32 of file greedy_solver.cc.
|
explicit |
Definition at line 23 of file greedy_solver.cc.
|
explicit |
Definition at line 28 of file greedy_solver.cc.
cyclus::GreedySolver::GreedySolver | ( | bool | exclusive_orders, |
GreedyPreconditioner * | c ) |
Definition at line 19 of file greedy_solver.cc.
|
virtual |
Definition at line 36 of file greedy_solver.cc.
Definition at line 102 of file greedy_solver.h.
the capacity of the arc
StateError | if either ExchangeNode does not have a ExchangeNodeGroup |
a | the arc |
u_curr_qty | the current quantity assigned to the unode (if solving piecemeal) |
v_curr_qty | the current quantity assigned to the vnode (if solving piecemeal) |
Definition at line 82 of file greedy_solver.cc.
|
inline |
Definition at line 125 of file greedy_solver.h.
|
inline |
Definition at line 119 of file greedy_solver.h.
double cyclus::GreedySolver::Capacity | ( | ExchangeNode::Ptr | n, |
const Arc & | a, | ||
bool | min_cap, | ||
double | curr_qty ) |
the capacity of a node
StateError | if ExchangeNode does not have a ExchangeNodeGroup |
n | the node |
min_cap | whether to use the minimum or maximum capacity value. In general, nodes that represent bids use the minimum (i.e., the capacities represents a less-than constraint) and nodes that represent requests use the maximum value (i.e., the capacities represents a greater-than constraint). |
curr_qty | the currently allocated node quantity (if solving piecemeal) |
Definition at line 96 of file greedy_solver.cc.
|
inline |
Definition at line 122 of file greedy_solver.h.
void cyclus::GreedySolver::Condition | ( | ) |
Uses the provided (or a default) GreedyPreconditioner to condition the solver's ExchangeGraph so that RequestGroups are ordered by average preference and commodity weight.
Definition at line 41 of file greedy_solver.cc.
void cyclus::GreedySolver::Init | ( | ) |
Initialize member values based on the given graph.
Definition at line 46 of file greedy_solver.cc.
|
protectedvirtual |
the GreedySolver solves an ExchangeGraph by iterating over each RequestGroup and matching requests with the minimum bids possible, starting from the beginning of the the respective request and bid containers.
Implements cyclus::ExchangeSolver.
Definition at line 62 of file greedy_solver.cc.