BaseModelTrait

Trait BaseModelTrait 

Source
pub trait BaseModelTrait {
    // Required methods
    fn new(name: Option<&str>) -> Self;
    fn free_variable<const N: usize>(
        &mut self,
        name: Option<&str>,
        shape: &[usize; N],
    ) -> Result<<LinearDomain<N> as VarDomainTrait<Self>>::Result, String>
       where Self: Sized;
    fn linear_variable<const N: usize, R>(
        &mut self,
        name: Option<&str>,
        dom: LinearDomain<N>,
    ) -> Result<<LinearDomain<N> as VarDomainTrait<Self>>::Result, String>
       where Self: Sized;
    fn linear_constraint<const N: usize>(
        &mut self,
        name: Option<&str>,
        dom: LinearDomain<N>,
        shape: &[usize],
        ptr: &[usize],
        subj: &[usize],
        cof: &[f64],
    ) -> Result<<LinearDomain<N> as ConstraintDomain<N, Self>>::Result, String>
       where Self: Sized;
    fn ranged_variable<const N: usize, R>(
        &mut self,
        name: Option<&str>,
        dom: LinearRangeDomain<N>,
    ) -> Result<<LinearRangeDomain<N> as VarDomainTrait<Self>>::Result, String>
       where Self: Sized;
    fn ranged_constraint<const N: usize>(
        &mut self,
        name: Option<&str>,
        dom: LinearRangeDomain<N>,
        shape: &[usize],
        ptr: &[usize],
        subj: &[usize],
        cof: &[f64],
    ) -> Result<<LinearRangeDomain<N> as ConstraintDomain<N, Self>>::Result, String>
       where Self: Sized;
    fn update(
        &mut self,
        idxs: &[usize],
        shape: &[usize],
        ptr: &[usize],
        subj: &[usize],
        cof: &[f64],
    ) -> Result<(), String>;
    fn write_problem<P>(&self, filename: P) -> Result<(), String>
       where P: AsRef<Path>;
    fn solve(
        &mut self,
        sol_bas: &mut Solution,
        sol_itr: &mut Solution,
        solitg: &mut Solution,
    ) -> Result<(), String>;
    fn objective(
        &mut self,
        name: Option<&str>,
        sense: Sense,
        subj: &[usize],
        cof: &[f64],
    ) -> Result<(), String>;

    // Provided method
    fn set_parameter<V>(
        &mut self,
        parname: V::Key,
        parval: V,
    ) -> Result<(), String>
       where V: SolverParameterValue<Self>,
             Self: Sized { ... }
}
Expand description

The trait defining basic functionality for an underlying model object. It defines functions for adding linear and ranged variables and constraints as well as for setting objective, parameters, updating constraints, and starting the optimizer.

Required Methods§

Source

fn new(name: Option<&str>) -> Self

Source

fn free_variable<const N: usize>( &mut self, name: Option<&str>, shape: &[usize; N], ) -> Result<<LinearDomain<N> as VarDomainTrait<Self>>::Result, String>
where Self: Sized,

Source

fn linear_variable<const N: usize, R>( &mut self, name: Option<&str>, dom: LinearDomain<N>, ) -> Result<<LinearDomain<N> as VarDomainTrait<Self>>::Result, String>
where Self: Sized,

Source

fn linear_constraint<const N: usize>( &mut self, name: Option<&str>, dom: LinearDomain<N>, shape: &[usize], ptr: &[usize], subj: &[usize], cof: &[f64], ) -> Result<<LinearDomain<N> as ConstraintDomain<N, Self>>::Result, String>
where Self: Sized,

Source

fn ranged_variable<const N: usize, R>( &mut self, name: Option<&str>, dom: LinearRangeDomain<N>, ) -> Result<<LinearRangeDomain<N> as VarDomainTrait<Self>>::Result, String>
where Self: Sized,

Source

fn ranged_constraint<const N: usize>( &mut self, name: Option<&str>, dom: LinearRangeDomain<N>, shape: &[usize], ptr: &[usize], subj: &[usize], cof: &[f64], ) -> Result<<LinearRangeDomain<N> as ConstraintDomain<N, Self>>::Result, String>
where Self: Sized,

Source

fn update( &mut self, idxs: &[usize], shape: &[usize], ptr: &[usize], subj: &[usize], cof: &[f64], ) -> Result<(), String>

Source

fn write_problem<P>(&self, filename: P) -> Result<(), String>
where P: AsRef<Path>,

Source

fn solve( &mut self, sol_bas: &mut Solution, sol_itr: &mut Solution, solitg: &mut Solution, ) -> Result<(), String>

Source

fn objective( &mut self, name: Option<&str>, sense: Sense, subj: &[usize], cof: &[f64], ) -> Result<(), String>

Provided Methods§

Source

fn set_parameter<V>(&mut self, parname: V::Key, parval: V) -> Result<(), String>
where V: SolverParameterValue<Self>, Self: Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl BaseModelTrait for mosekcomodel::dummy::Backend

Source§

impl BaseModelTrait for mosekcomodel::optserver::Backend