Skip to content

Commit 44038aa

Browse files
authored
Merge branch 'main' into precompute_coefficients
2 parents 18b4d2a + 1cacfaf commit 44038aa

17 files changed

Lines changed: 2443 additions & 4332 deletions

Cargo.lock

Lines changed: 2 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ human-panic = "2.0.3"
3232
clap-markdown = "0.1.5"
3333
platform-info = "2.0.5"
3434
derive_more = {version = "2.0", features = ["add", "display"]}
35-
petgraph = "0.8.2"
35+
petgraph = "0.8.3"
3636
strum = {version = "0.27.2", features = ["derive"]}
3737
documented = "0.9.2"
3838
dirs = "6.0.0"

src/simulation/prices.rs

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,13 @@ pub fn calculate_prices_and_reduced_costs(
116116

117117
let (new_prices, reduced_costs_for_candidates) = match model.parameters.pricing_strategy {
118118
// Use raw shadow prices and reduced costs
119-
PricingStrategy::ShadowPrices => (
120-
shadow_prices.with_levies(model, year),
121-
reduced_costs_for_candidates,
122-
),
119+
PricingStrategy::ShadowPrices => (shadow_prices, reduced_costs_for_candidates),
123120
// Adjust prices for scarcity and then remove this adjustment from reduced costs
124121
PricingStrategy::ScarcityAdjusted => {
125122
let adjusted_prices = shadow_prices
126123
.clone()
127-
.with_scarcity_adjustment(solution.iter_activity_duals())
128-
.with_levies(model, year);
129-
let unadjusted_prices = shadow_prices.with_levies(model, year);
124+
.with_scarcity_adjustment(solution.iter_activity_duals());
125+
let unadjusted_prices = shadow_prices;
130126
let mut reduced_costs_for_candidates = reduced_costs_for_candidates;
131127

132128
// Remove adjustment
@@ -160,34 +156,6 @@ pub fn calculate_prices_and_reduced_costs(
160156
pub struct CommodityPrices(BTreeMap<(CommodityID, RegionID, TimeSliceID), MoneyPerFlow>);
161157

162158
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-
191159
/// Remove the impact of scarcity on prices.
192160
///
193161
/// # Arguments

tests/data/missing_commodity/assets.csv

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ asset_id,process_id,region_id,agent_id,commission_year,decommission_year,capacit
55
3,GASCGT,GBR,A0_ELC,2020,2040,2.43
66
4,RGASBR,GBR,A0_RES,2020,2040,2900.0
77
5,RELCHP,GBR,A0_RES,2020,2040,399.98
8-
6,RBIOBL,GBR,A0_RES,2030,,355.83840587648046
8+
6,RBIOBL,GBR,A0_RES,2030,,365.58184058764806
99
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
10+
8,BIOPLL,GBR,A0_BPL,2030,,461.7875881107132
11+
9,BIOPRO,GBR,A0_BPD,2030,,460.6331191404365
12+
10,RBIOBL,GBR,A0_RES,2040,,3646.0755348888324
13+
11,BIOPLL,GBR,A0_BPL,2040,,2269.7526093576694
14+
12,BIOPRO,GBR,A0_BPD,2040,,2264.078227834276

0 commit comments

Comments
 (0)