Skip to main content

IntoComputedShape

Trait IntoComputedShape 

Source
pub trait IntoComputedShape<SolId, SInfo>: SolutionShape<SolId, SInfo>
where SolId: Id, SInfo: SolInfo, Self::SolObj: Uncomputed<SolId, Self::Obj, SInfo> + IntoComputed, Self::SolOpt: Uncomputed<SolId, Self::Opt, SInfo> + IntoComputed,
{ type Computed<Out: Outcome>: SolutionShape<SolId, SInfo, Obj = Self::Obj, Opt = Self::Opt, SolObj = Computed<Self::SolObj, SolId, Self::Obj, Out, SInfo>, SolOpt = Computed<Self::SolOpt, SolId, Self::Opt, Out, SInfo>> + HasY<Out> + Serialize + for<'a> Deserialize<'a> + Debug; // Required methods fn into_computed<Out: Outcome>( self, y: Arc<TypeCodom<Out>>, ) -> Self::Computed<Out>; fn extract<Out: Outcome>( comp: Self::Computed<Out>, ) -> (Self, Arc<TypeCodom<Out>>); }

Required Associated Types§

Source

type Computed<Out: Outcome>: SolutionShape<SolId, SInfo, Obj = Self::Obj, Opt = Self::Opt, SolObj = Computed<Self::SolObj, SolId, Self::Obj, Out, SInfo>, SolOpt = Computed<Self::SolOpt, SolId, Self::Opt, Out, SInfo>> + HasY<Out> + Serialize + for<'a> Deserialize<'a> + Debug

The computed type wrapping Self with an objective value.

This type must implement HasY to provide access to the objective function output.

Required Methods§

Source

fn into_computed<Out: Outcome>( self, y: Arc<TypeCodom<Out>>, ) -> Self::Computed<Out>

Converts this uncomputed solution into a computed one with an objective value.

§Type Parameters
  • Cod - The [Codomain] defining the output structure
  • Out - The outcome type from the objective function
§Parameters
  • y - The objective function output to associate with this solution
§Returns

A computed solution containing both self and y.

Source

fn extract<Out: Outcome>( comp: Self::Computed<Out>, ) -> (Self, Arc<TypeCodom<Out>>)

Extracts the uncomputed solution and objective value from a computed solution.

This is the inverse operation of into_computed, decomposing a computed solution back into its constituent parts.

§Type Parameters
  • Cod - The [Codomain] of the objective value
  • Out - The Outcome type
§Parameters
  • comp - The computed solution to decompose
§Returns

A tuple of (uncomputed_solution, objective_value).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<SolObj, SolId, Obj, SInfo> IntoComputedShape<SolId, SInfo> for Lone<SolObj, SolId, Obj, SInfo>
where SolId: Id, Obj: Domain, SInfo: SolInfo, SolObj: Uncomputed<SolId, Obj, SInfo>,

Source§

type Computed<Out: Outcome> = Lone<Computed<SolObj, SolId, Obj, Out, SInfo>, SolId, Obj, SInfo>

Source§

impl<SolObj, SolOpt, SolId, Obj, Opt, SInfo> IntoComputedShape<SolId, SInfo> for Pair<SolObj, SolOpt, SolId, Obj, Opt, SInfo>
where SolId: Id, Obj: Domain, Opt: Domain, SInfo: SolInfo, SolObj: Uncomputed<SolId, Obj, SInfo>, SolOpt: Uncomputed<SolId, Opt, SInfo>,

Source§

type Computed<Out: Outcome> = Pair<Computed<SolObj, SolId, Obj, Out, SInfo>, Computed<SolOpt, SolId, Opt, Out, SInfo>, SolId, Obj, Opt, SInfo>