Skip to main content

ModelWithProblem

Trait ModelWithProblem 

Source
pub trait ModelWithProblem {
    // Required methods
    fn vars(&self) -> Vec<Variable>;
    fn orig_vars(&self) -> Vec<Variable>;
    fn var(&self, var_id: VarId) -> Option<Variable>;
    fn n_vars(&self) -> usize;
    fn n_conss(&self) -> usize;
    fn find_cons(&self, name: &str) -> Option<Constraint>;
    fn conss(&self) -> Vec<Constraint>;
    fn cons_is_modifiable(&self, cons: &Constraint) -> bool;
    fn cons_is_removable(&self, cons: &Constraint) -> bool;
    fn cons_is_separated(&self, cons: &Constraint) -> bool;
    fn write(&self, path: &str, ext: &str) -> Result<(), Retcode>;
}
Expand description

A trait for optimization models with a problem created.

Required Methods§

Source

fn vars(&self) -> Vec<Variable>

Returns a vector of all variables in the optimization model.

Source

fn orig_vars(&self) -> Vec<Variable>

Returns a vector of all original variables in the optimization model.

Source

fn var(&self, var_id: VarId) -> Option<Variable>

Returns the variable with the given ID, if it exists.

Source

fn n_vars(&self) -> usize

Returns the number of variables in the optimization model.

Source

fn n_conss(&self) -> usize

Returns the number of constraints in the optimization model.

Source

fn find_cons(&self, name: &str) -> Option<Constraint>

Finds a constraint by name

Source

fn conss(&self) -> Vec<Constraint>

Returns a vector of all constraints in the optimization model.

Source

fn cons_is_modifiable(&self, cons: &Constraint) -> bool

Returns the modifiable flag of the given constraint

Source

fn cons_is_removable(&self, cons: &Constraint) -> bool

Returns the removable flag of the given constraint

Source

fn cons_is_separated(&self, cons: &Constraint) -> bool

Returns whether the constraint should be separated during LP processing

Source

fn write(&self, path: &str, ext: &str) -> Result<(), Retcode>

Writes the optimization model to a file with the given path and extension.

Implementors§