Struct Problem

Source
pub struct Problem { /* private fields */ }
Expand description

A CPLEX problem instance

Implementations§

Source§

impl Problem

Source

pub fn new<S>(env: Environment, name: S) -> Result<Self>
where S: AsRef<str>,

Create a new CPLEX problem from a CPLEX environmant

Source

pub fn add_variable(&mut self, var: Variable) -> Result<VariableId>

Add a variable to the problem.

The id for the Variable is returned.

Source

pub fn add_variables(&mut self, vars: Vec<Variable>) -> Result<Vec<VariableId>>

Add an array of variables to the problem.

The id for the variables are returned, in the same order they have been given in the input.

Source

pub fn add_constraint(&mut self, constraint: Constraint) -> Result<ConstraintId>

Add a constraint to the problem.

The id for the constraint is returned.

Source

pub fn add_constraints( &mut self, con: Vec<Constraint>, ) -> Result<Vec<ConstraintId>>

Add an array of constraints to the problem.

The id for the constraints are returned, in the same order they have been given in the input.

Source

pub fn set_objective( self, ty: ObjectiveType, obj: Vec<(VariableId, f64)>, ) -> Result<Self>

Set the objective coefficients.

Source

pub fn set_objective_type(self, ty: ObjectiveType) -> Result<Self>

Change the objective type. Default: ObjectiveType::Minimize.

Source

pub fn write<S>(&self, name: S) -> Result<()>
where S: AsRef<str>,

Write the problem to a file named name.

Source

pub fn add_initial_soln( &mut self, vars: &[VariableId], values: &[f64], ) -> Result<()>

Add an initial solution to the problem.

vars is an array of indices (i.e. the result of prob.add_variable) and values are their values.

Source

pub fn solve_as(self, pt: ProblemType) -> Result<Solution>

Solve the Problem, returning a Solution object with the result.

Trait Implementations§

Source§

impl Drop for Problem

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Problem

Auto Trait Implementations§

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, 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.