@@ -12,9 +12,7 @@ use std::collections::{BTreeMap, HashMap, HashSet};
1212pub struct CommodityPrices ( BTreeMap < ( CommodityID , RegionID , TimeSliceID ) , f64 > ) ;
1313
1414impl CommodityPrices {
15- /// Calculate commodity prices based on the result of the dispatch optimisation.
16- ///
17- /// Missing prices will be calculated directly from the input data
15+ /// Calculate commodity prices based on the result of the dispatch optimisation
1816 pub fn from_model_and_solution ( model : & Model , solution : & Solution ) -> Self {
1917 let mut prices = CommodityPrices :: default ( ) ;
2018 let commodity_regions_updated = prices. add_from_solution ( solution) ;
@@ -46,7 +44,7 @@ impl CommodityPrices {
4644 ///
4745 /// # Returns
4846 ///
49- /// The set of commodities for which prices were added.
47+ /// The set of commodity/region pairs for which prices were added.
5048 fn add_from_solution ( & mut self , solution : & Solution ) -> HashSet < ( CommodityID , RegionID ) > {
5149 let mut commodity_regions_updated = HashSet :: new ( ) ;
5250
@@ -71,7 +69,8 @@ impl CommodityPrices {
7169 }
7270 }
7371
74- // Add the highest capacity dual for each commodity/timeslice to each commodity balance dual
72+ // Add the highest capacity dual for each commodity/region/timeslice to each commodity
73+ // balance dual
7574 for ( commodity_id, region_id, time_slice, dual) in solution. iter_commodity_balance_duals ( ) {
7675 let key = ( commodity_id. clone ( ) , region_id. clone ( ) , time_slice. clone ( ) ) ;
7776 let price = dual + highest_duals. get ( & key) . unwrap_or ( & 0.0 ) ;
@@ -86,7 +85,7 @@ impl CommodityPrices {
8685 ///
8786 /// # Arguments
8887 ///
89- /// * `commodity_ids ` - IDs of commodities to update
88+ /// * `commodity_regions ` - Commodity/region pairs to update
9089 /// * `time_slice_info` - Information about time slices
9190 fn add_remaining < ' a , I > ( & mut self , commodity_regions : I , time_slice_info : & TimeSliceInfo )
9291 where
@@ -100,7 +99,7 @@ impl CommodityPrices {
10099 }
101100 }
102101
103- /// Insert a price for the given commodity, time slice and region
102+ /// Insert a price for the given commodity, region and time slice
104103 pub fn insert (
105104 & mut self ,
106105 commodity_id : & CommodityID ,
@@ -116,7 +115,7 @@ impl CommodityPrices {
116115 ///
117116 /// # Returns
118117 ///
119- /// An iterator of tuples containing commodity ID, time slice and price.
118+ /// An iterator of tuples containing commodity ID, region ID, time slice and price.
120119 pub fn iter ( & self ) -> impl Iterator < Item = ( & CommodityID , & RegionID , & TimeSliceID , f64 ) > {
121120 self . 0
122121 . iter ( )
0 commit comments