CYCLUS

A GreedyPreconditioner conditions an ExchangeGraph for a GreedySolver by ordering the RequestGroups and ExchangeNodes within each RequestGroup weighted by their commodity's importance.
The Graph is conditioned inplace.
Commodity weights are provided to the conditioner via its constructor. A larger weight implies a higher level of importance for solving.
The conditioning weight for a node is calculated as $w_cond_i = w_commod_i * (1 + {{p_i}}{1 + {p_i}})$, where $w_cond_i$ is the calculated conditioning weight, $w_commod_i$ is node $i$'s commodity's weight, and ${p_i}$ is the average preference of all bid arcs associated with node $i$.
First, the ExchangeNodes of each RequestGroup are sorted according to their conditioning weights. Then, the average weight of each RequestGroup is determined. Finally, each RequestGroup is sorted according to their average weight.
Consider the following commoditytoweight mapping: {"spam": 5, "eggs": 2}. Now consider two RequestGroups with the following commodities: #. g1 = {"eggs", "spam", "eggs"} #. g2 = {"eggs", "spam"} And the following preferencecommodity mapping: {g1: {"spam": 3/4, "eggs": 1/4}, g2: {"spam": 1, "eggs": 1}.
First, the groups will be ordered by conditioning weights: #. g1 = {"spam", "eggs", "eggs"} #. g2 = {"spam", "eggs"}
Finally, the groups themselves will be ordered by average weight: #. {g2, g1}
Definition at line 60 of file greedy_preconditioner.h.
#include <greedy_preconditioner.h>
Public Types  
enum  WgtOrder { REVERSE, END } 
Public Member Functions  
void  Condition (ExchangeGraph *graph) 
bool  GroupComp (const RequestGroup::Ptr l, const RequestGroup::Ptr r) 
bool  NodeComp (const ExchangeNode::Ptr l, const ExchangeNode::Ptr r) 
GreedyPreconditioner ()  
GreedyPreconditioner (const std::map< std::string, double > &commod_weights)  
GreedyPreconditioner (const std::map< std::string, double > &commod_weights, WgtOrder order)  
the order of commodity weights
Enumerator  

REVERSE  
END 
a flag for commodity weights given in the reverse order, i.e, lightest first default flag, indicating heaviestfirst ordering 
Definition at line 63 of file greedy_preconditioner.h.
cyclus::GreedyPreconditioner::GreedyPreconditioner  (  ) 
constructor if weights are given in heaviestfirst order
Definition at line 28 of file greedy_preconditioner.cc.
cyclus::GreedyPreconditioner::GreedyPreconditioner  (  const std::map< std::string, double > &  commod_weights  ) 
Definition at line 30 of file greedy_preconditioner.cc.
cyclus::GreedyPreconditioner::GreedyPreconditioner  (  const std::map< std::string, double > &  commod_weights, 
WgtOrder  order  
) 
constructor if weights may not be given in heaviestfirst order
Definition at line 37 of file greedy_preconditioner.cc.
void cyclus::GreedyPreconditioner::Condition  (  ExchangeGraph *  graph  ) 
conditions the graph as described above
KeyError  if a commodity is in the graph but not in the weight mapping 
Definition at line 45 of file greedy_preconditioner.cc.

inline 
a comparitor for ordering containers of Request::Ptrs in descending order based on their average commodity weight
Definition at line 96 of file greedy_preconditioner.h.

inline 
a comparitor for ordering containers of ExchangeNode::Ptrs in descending order based on their commodity's weight
Definition at line 87 of file greedy_preconditioner.h.