fn calculate_marginal_cost_prices<'a, I, J>(
activity_for_existing: I,
activity_for_candidates: J,
shadow_prices: &CommodityPrices,
year: u32,
markets_to_price: &HashSet<(CommodityID, RegionID)>,
) -> HashMap<(CommodityID, RegionID, TimeSliceID), MoneyPerFlow>where
I: Iterator<Item = (&'a AssetRef, &'a TimeSliceID, Activity)>,
J: Iterator<Item = (&'a AssetRef, &'a TimeSliceID, Activity)>,Expand description
Calculate marginal cost prices for a set of commodities.
This pricing strategy aims to incorporate the marginal cost of commodity production into the price.
For a given asset, a marginal cost can be calculated for each SED/SVD output, which is the sum of:
- Generic activity costs: Activity-related costs not tied to a specific SED/SVD output (variable operating costs, cost of purchasing inputs, plus all levies and flow costs not associated with specific SED/SVD outputs). These are shared over all SED/SVD outputs according to their flow coefficients.
- Commodity-specific activity costs: flow costs/levies for the specific SED/SVD output.
For example, consider an asset A(SED) -> B(SED) + 2C(SED) + D(OTH), with the following costs:
- Variable operating cost: 5 per unit activity
- Production levy on C: 3 per unit flow
- Production levy on D: 4 per unit flow
- Shadow price of A: 1 per unit flow
Then:
- Generic activity cost per activity = (1 + 5 + 4) = 10
- Generic activity cost per SED/SVD output = 10 / (1 + 2) = 3.333
- Marginal cost of B = 3.333
- Marginal cost of C = 3.333 + 3 = 6.333
If any existing assets produce a given commodity in a particular region and time slice, the price is taken from the asset with the highest marginal cost among those existing assets. If no existing assets produce the commodity in that region and time slice (in particular, this will occur when there’s no demand for the commodity), then candidate assets are considered: we take the price from the candidate asset with the lowest marginal cost, assuming full utilisation (i.e. the single candidate asset that would be most competitive if a small amount of demand was added).
Note: this should be similar to the “shadow price” strategy, which is also based on marginal costs of the most expensive producer, but may be more successful in cases where there are
§Arguments
activity_for_existing- Iterator over activity from optimisation solution for existing assetsactivity_for_candidates- Iterator over activity from optimisation solution for candidate assets. Note: we only need the keys, since we assume full utilisation for candidates.annual_activities- Map of annual activities for each asset computed bycalculate_annual_activities. This only needs to include existing assets.shadow_prices- Shadow prices for all commoditiesyear- The year for which prices are being calculatedmarkets_to_price- Set of markets to calculate full cost prices for
§Returns
A map of marginal cost prices for the specified markets in all time slices