We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 18b4d2a + 1cacfaf commit 44038aaCopy full SHA for 44038aa
17 files changed
Cargo.lock
Cargo.toml
@@ -32,7 +32,7 @@ human-panic = "2.0.3"
32
clap-markdown = "0.1.5"
33
platform-info = "2.0.5"
34
derive_more = {version = "2.0", features = ["add", "display"]}
35
-petgraph = "0.8.2"
+petgraph = "0.8.3"
36
strum = {version = "0.27.2", features = ["derive"]}
37
documented = "0.9.2"
38
dirs = "6.0.0"
src/simulation/prices.rs
@@ -116,17 +116,13 @@ pub fn calculate_prices_and_reduced_costs(
116
117
let (new_prices, reduced_costs_for_candidates) = match model.parameters.pricing_strategy {
118
// Use raw shadow prices and reduced costs
119
- PricingStrategy::ShadowPrices => (
120
- shadow_prices.with_levies(model, year),
121
- reduced_costs_for_candidates,
122
- ),
+ PricingStrategy::ShadowPrices => (shadow_prices, reduced_costs_for_candidates),
123
// Adjust prices for scarcity and then remove this adjustment from reduced costs
124
PricingStrategy::ScarcityAdjusted => {
125
let adjusted_prices = shadow_prices
126
.clone()
127
- .with_scarcity_adjustment(solution.iter_activity_duals())
128
- .with_levies(model, year);
129
- let unadjusted_prices = shadow_prices.with_levies(model, year);
+ .with_scarcity_adjustment(solution.iter_activity_duals());
+ let unadjusted_prices = shadow_prices;
130
let mut reduced_costs_for_candidates = reduced_costs_for_candidates;
131
132
// Remove adjustment
@@ -160,34 +156,6 @@ pub fn calculate_prices_and_reduced_costs(
160
156
pub struct CommodityPrices(BTreeMap<(CommodityID, RegionID, TimeSliceID), MoneyPerFlow>);
161
157
162
158
impl CommodityPrices {
163
- /// Add prices based on levies/incentives.
164
- ///
165
- /// If a commodity already has a price based on the previous dual-based calculation, we choose
166
- /// the higher of the two.
167
168
- /// # Arguments
169
170
- /// * `model` - The model
171
- /// * `year` - The milestone year of interest
172
- fn with_levies(mut self, model: &Model, year: u32) -> Self {
173
- for (region_id, time_slice) in
174
- iproduct!(model.iter_regions(), model.time_slice_info.iter_ids())
175
- {
176
- let levy_key = (region_id.clone(), year, time_slice.clone());
177
- for commodity in model.commodities.values() {
178
- if let Some(levy) = commodity.levies.get(&levy_key) {
179
- let key = (commodity.id.clone(), region_id.clone(), time_slice.clone());
180
- self.0
181
- .entry(key)
182
- .and_modify(|price| *price = price.max(levy.value))
183
- .or_insert(levy.value);
184
- }
185
186
187
-
188
- self
189
190
191
159
/// Remove the impact of scarcity on prices.
192
///
193
/// # Arguments
tests/data/missing_commodity/assets.csv
@@ -5,10 +5,10 @@ asset_id,process_id,region_id,agent_id,commission_year,decommission_year,capacit
5
3,GASCGT,GBR,A0_ELC,2020,2040,2.43
6
4,RGASBR,GBR,A0_RES,2020,2040,2900.0
7
5,RELCHP,GBR,A0_RES,2020,2040,399.98
8
-6,RBIOBL,GBR,A0_RES,2030,,355.83840587648046
+6,RBIOBL,GBR,A0_RES,2030,,365.58184058764806
9
7,GASCGT,GBR,A0_ELC,2030,2040,0.7616137306985262
10
-8,BIOPLL,GBR,A0_BPL,2030,,449.480091633449
11
-9,BIOPRO,GBR,A0_BPD,2030,,448.35639140436535
12
-10,RBIOBL,GBR,A0_RES,2040,,3655.8189696
13
-11,BIOPLL,GBR,A0_BPL,2040,,2282.060105834934
14
-12,BIOPRO,GBR,A0_BPD,2040,,2276.354955570347
+8,BIOPLL,GBR,A0_BPL,2030,,461.7875881107132
+9,BIOPRO,GBR,A0_BPD,2030,,460.6331191404365
+10,RBIOBL,GBR,A0_RES,2040,,3646.0755348888324
+11,BIOPLL,GBR,A0_BPL,2040,,2269.7526093576694
+12,BIOPRO,GBR,A0_BPD,2040,,2264.078227834276
0 commit comments