pub struct VariableMap {
activity_vars: IndexMap<(AssetRef, TimeSliceID), Col>,
existing_asset_var_idx: Range<usize>,
candidate_asset_var_idx: Range<usize>,
capacity_vars: IndexMap<AssetRef, Col>,
capacity_var_idx: Range<usize>,
unmet_demand_vars: IndexMap<(CommodityID, RegionID, TimeSliceID), Col>,
unmet_demand_var_idx: Range<usize>,
}Expand description
A map for easy lookup of variables in the problem.
The entries are ordered (see [IndexMap]).
We use this data structure for two things:
- In order define constraints for the optimisation
- To keep track of the combination of parameters that each variable corresponds to, for when we are reading the results of the optimisation.
Fields§
§activity_vars: IndexMap<(AssetRef, TimeSliceID), Col>§existing_asset_var_idx: Range<usize>§candidate_asset_var_idx: Range<usize>§capacity_vars: IndexMap<AssetRef, Col>§capacity_var_idx: Range<usize>§unmet_demand_vars: IndexMap<(CommodityID, RegionID, TimeSliceID), Col>§unmet_demand_var_idx: Range<usize>Implementations§
Source§impl VariableMap
impl VariableMap
Sourcefn new_with_activity_vars(
problem: &mut Problem,
model: &Model,
input_prices: Option<&CommodityPrices>,
existing_assets: &[AssetRef],
candidate_assets: &[AssetRef],
year: u32,
) -> Self
fn new_with_activity_vars( problem: &mut Problem, model: &Model, input_prices: Option<&CommodityPrices>, existing_assets: &[AssetRef], candidate_assets: &[AssetRef], year: u32, ) -> Self
Create a new VariableMap and add activity variables to the problem
§Arguments
problem- The optimisation problemmodel- The modelinput_prices- Optional explicit prices for input commoditiesexisting_assets- The asset poolcandidate_assets- Candidate assets for inclusion in active poolyear- Current milestone year
Sourcefn add_unmet_demand_variables(
&mut self,
problem: &mut Problem,
model: &Model,
markets_to_allow_unmet_demand: &[(CommodityID, RegionID)],
)
fn add_unmet_demand_variables( &mut self, problem: &mut Problem, model: &Model, markets_to_allow_unmet_demand: &[(CommodityID, RegionID)], )
Add unmet demand variables to the map and the problem
§Arguments
problem- The optimisation problemmodel- The modelmarkets_to_allow_unmet_demand- The subset of markets to add unmet demand variables for
Sourcefn get_activity_var(&self, asset: &AssetRef, time_slice: &TimeSliceID) -> Col
fn get_activity_var(&self, asset: &AssetRef, time_slice: &TimeSliceID) -> Col
Get the activity Variable corresponding to the given parameters.
Sourcefn get_unmet_demand_var(
&self,
commodity_id: &CommodityID,
region_id: &RegionID,
time_slice: &TimeSliceID,
) -> Col
fn get_unmet_demand_var( &self, commodity_id: &CommodityID, region_id: &RegionID, time_slice: &TimeSliceID, ) -> Col
Get the unmet demand Variable corresponding to the given parameters.
Sourcefn activity_var_keys(&self) -> Keys<'_, (AssetRef, TimeSliceID), Col>
fn activity_var_keys(&self) -> Keys<'_, (AssetRef, TimeSliceID), Col>
Iterate over the keys for activity variables
Sourcefn iter_capacity_vars(&self) -> impl Iterator<Item = (&AssetRef, Col)>
fn iter_capacity_vars(&self) -> impl Iterator<Item = (&AssetRef, Col)>
Iterate over capacity variables
Auto Trait Implementations§
impl Freeze for VariableMap
impl RefUnwindSafe for VariableMap
impl !Send for VariableMap
impl !Sync for VariableMap
impl Unpin for VariableMap
impl UnwindSafe for VariableMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more