fn solve_investment_order_for_year(
graph: &CommoditiesGraph,
commodities: &CommodityMap,
) -> Vec<MarketSet>Expand description
Analyse the commodity graph for a given year to determine the order in which investment decisions should be made.
Steps:
- Initialise an
InvestmentGraphfrom theCommodityGraphfor the given year, filtering to only include SVD/SED commodities (all edges between them, primary and secondary, are kept). - Condense strongly connected components (cycles) into
MarketSet::Cyclenodes. - Perform a topological sort on the condensed graph.
- Compute layers for investment based on the topological order, grouping independent sets into
MarketSet::Layers.
Arguments:
graph- Commodity graph for this year, frombuild_commodity_graphs_for_modelcommodities- All commodities with their types and demand specifications
ยงReturns
A Vec of MarketSets in the order they should be solved, with cycles grouped into
MarketSet::Cycles and independent sets grouped into MarketSet::Layers.