DispatchRun

Struct DispatchRun 

Source
pub struct DispatchRun<'model, 'run> {
    model: &'model Model,
    existing_assets: &'run [AssetRef],
    flexible_capacity_assets: &'run [AssetRef],
    candidate_assets: &'run [AssetRef],
    markets_to_balance: &'run [(CommodityID, RegionID)],
    input_prices: Option<&'run CommodityPrices>,
    year: u32,
    capacity_margin: f64,
}
Expand description

Provides the interface for running the dispatch optimisation.

The run will attempt to meet unmet demand: if the solver reports infeasibility the implementation will rerun including unmet-demand variables to identify offending markets and provide a clearer error message.

For a detailed description, please see the dispatch optimisation formulation.

Fields§

§model: &'model Model§existing_assets: &'run [AssetRef]§flexible_capacity_assets: &'run [AssetRef]§candidate_assets: &'run [AssetRef]§markets_to_balance: &'run [(CommodityID, RegionID)]§input_prices: Option<&'run CommodityPrices>§year: u32§capacity_margin: f64

Implementations§

Source§

impl<'model, 'run> DispatchRun<'model, 'run>

Source

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

Source

pub fn with_flexible_capacity_assets( self, flexible_capacity_assets: &'run [AssetRef], capacity_margin: f64, ) -> Self

Include the specified flexible capacity assets in the dispatch run

Source

pub fn with_candidates(self, candidate_assets: &'run [AssetRef]) -> Self

Include the specified candidate assets in the dispatch run

Source

pub fn with_market_balance_subset( self, markets_to_balance: &'run [(CommodityID, RegionID)], ) -> Self

Only apply commodity balance constraints to the specified subset of markets

Source

pub fn with_input_prices(self, input_prices: &'run CommodityPrices) -> Self

Explicitly provide prices for certain input commodities

Source

pub fn run( &self, run_description: &str, writer: &mut DataWriter, ) -> Result<Solution<'model>>

Perform the dispatch optimisation.

§Arguments
  • run_description - Which dispatch run for the current year this is
  • writer - For saving output data
§Returns

A solution containing new commodity flows for assets and prices for (some) commodities or an error.

Source

fn run_without_unmet_demand_variables( &self, markets_to_balance: &[(CommodityID, RegionID)], input_prices: Option<&CommodityPrices>, ) -> Result<Solution<'model>, ModelError>

Run dispatch without unmet demand variables

Source

fn run_internal( &self, markets_to_balance: &[(CommodityID, RegionID)], allow_unmet_demand: bool, input_prices: Option<&CommodityPrices>, ) -> Result<Solution<'model>, ModelError>

Run dispatch to balance the specified markets, 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.