Struct DispatchRun

Source
pub struct DispatchRun<'model, 'run> {
    model: &'model Model,
    existing_assets: &'run [AssetRef],
    candidate_assets: &'run [AssetRef],
    commodities: &'run [CommodityID],
    input_prices: Option<&'run HashMap<(CommodityID, RegionID, TimeSliceID), MoneyPerFlow>>,
    year: u32,
}
Expand description

Provides the interface for running the dispatch optimisation.

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 HashMap<(CommodityID, RegionID, TimeSliceID), MoneyPerFlow>>§year: u32

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_candidates(self, candidate_assets: &'run [AssetRef]) -> Self

Include the specified candidate assets in the dispatch run

Source

pub fn with_commodity_subset(self, commodities: &'run [CommodityID]) -> Self

Only apply commodity balance constraints to the specified subset of commodities

Source

pub fn with_input_prices( self, input_prices: &'run HashMap<(CommodityID, RegionID, TimeSliceID), MoneyPerFlow>, ) -> 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_no_save(&self) -> Result<Solution<'model>>

Run dispatch without saving the results.

This is an internal function as callers always want to save results.

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.