pub struct DispatchRun<'model, 'run> {
model: &'model Model,
existing_assets: &'run [AssetRef],
candidate_assets: &'run [AssetRef],
commodities: &'run [CommodityID],
input_prices: Option<&'run CommodityPrices>,
year: u32,
}
Expand description
Provides the interface for running the dispatch optimisation.
The caller can allow the dispatch run to return without error when demand is not met by calling
the with_unmet_demand_allowed
method.
For a detailed description, please see the dispatch optimisation formulation.
Fields§
§model: &'model Model
§existing_assets: &'run [AssetRef]
§candidate_assets: &'run [AssetRef]
§commodities: &'run [CommodityID]
§input_prices: Option<&'run CommodityPrices>
§year: u32
Implementations§
Source§impl<'model, 'run> DispatchRun<'model, 'run>
impl<'model, 'run> DispatchRun<'model, 'run>
Sourcepub fn new(model: &'model Model, assets: &'run [AssetRef], year: u32) -> Self
pub fn new(model: &'model Model, assets: &'run [AssetRef], year: u32) -> Self
Create a new DispatchRun
for the specified model and assets for a given year
Sourcepub fn with_candidates(self, candidate_assets: &'run [AssetRef]) -> Self
pub fn with_candidates(self, candidate_assets: &'run [AssetRef]) -> Self
Include the specified candidate assets in the dispatch run
Sourcepub fn with_commodity_subset(self, commodities: &'run [CommodityID]) -> Self
pub fn with_commodity_subset(self, commodities: &'run [CommodityID]) -> Self
Only apply commodity balance constraints to the specified subset of commodities
Sourcepub fn with_input_prices(self, input_prices: &'run CommodityPrices) -> Self
pub fn with_input_prices(self, input_prices: &'run CommodityPrices) -> Self
Explicitly provide prices for certain input commodities
Sourcepub fn run(
self,
run_description: &str,
writer: &mut DataWriter,
) -> Result<Solution<'model>>
pub fn run( self, run_description: &str, writer: &mut DataWriter, ) -> Result<Solution<'model>>
Sourcefn run_no_save(&self) -> Result<Solution<'model>>
fn run_no_save(&self) -> Result<Solution<'model>>
Run dispatch without saving the results.
This is an internal function as callers always want to save results.
Sourcefn run_without_unmet_demand(
&self,
commodities: &[CommodityID],
) -> Result<Solution<'model>, ModelError>
fn run_without_unmet_demand( &self, commodities: &[CommodityID], ) -> Result<Solution<'model>, ModelError>
Run dispatch without unmet demand variables
Sourcefn get_regions_and_commodities_with_unmet_demand(
&self,
commodities: &[CommodityID],
) -> Result<IndexSet<(RegionID, CommodityID)>>
fn get_regions_and_commodities_with_unmet_demand( &self, commodities: &[CommodityID], ) -> Result<IndexSet<(RegionID, CommodityID)>>
Run dispatch to diagnose which regions and commodities have unmet demand
Sourcefn run_internal(
&self,
commodities: &[CommodityID],
allow_unmet_demand: bool,
) -> Result<Solution<'model>, ModelError>
fn run_internal( &self, commodities: &[CommodityID], allow_unmet_demand: bool, ) -> Result<Solution<'model>, ModelError>
Run dispatch for specified commodities, optionally including unmet demand variables
Auto Trait Implementations§
impl<'model, 'run> Freeze for DispatchRun<'model, 'run>
impl<'model, 'run> RefUnwindSafe for DispatchRun<'model, 'run>
impl<'model, 'run> !Send for DispatchRun<'model, 'run>
impl<'model, 'run> !Sync for DispatchRun<'model, 'run>
impl<'model, 'run> Unpin for DispatchRun<'model, 'run>
impl<'model, 'run> UnwindSafe for DispatchRun<'model, 'run>
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
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>
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>
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