pub struct Problem { /* private fields */ }
Expand description
A CPLEX problem instance
Implementations§
Source§impl Problem
impl Problem
Sourcepub fn new<S>(env: Environment, name: S) -> Result<Self>
pub fn new<S>(env: Environment, name: S) -> Result<Self>
Create a new CPLEX problem from a CPLEX environmant
Sourcepub fn add_variable(&mut self, var: Variable) -> Result<VariableId>
pub fn add_variable(&mut self, var: Variable) -> Result<VariableId>
Add a variable to the problem.
The id for the Variable is returned.
Sourcepub fn add_variables(&mut self, vars: Vec<Variable>) -> Result<Vec<VariableId>>
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.
Sourcepub fn add_constraint(&mut self, constraint: Constraint) -> Result<ConstraintId>
pub fn add_constraint(&mut self, constraint: Constraint) -> Result<ConstraintId>
Add a constraint to the problem.
The id for the constraint is returned.
Sourcepub fn add_constraints(
&mut self,
con: Vec<Constraint>,
) -> Result<Vec<ConstraintId>>
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.
Sourcepub fn set_objective(
self,
ty: ObjectiveType,
obj: Vec<(VariableId, f64)>,
) -> Result<Self>
pub fn set_objective( self, ty: ObjectiveType, obj: Vec<(VariableId, f64)>, ) -> Result<Self>
Set the objective coefficients.
Sourcepub fn set_objective_type(self, ty: ObjectiveType) -> Result<Self>
pub fn set_objective_type(self, ty: ObjectiveType) -> Result<Self>
Change the objective type. Default: ObjectiveType::Minimize
.
Sourcepub fn add_initial_soln(
&mut self,
vars: &[VariableId],
values: &[f64],
) -> Result<()>
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.
Sourcepub fn solve_as(self, pt: ProblemType) -> Result<Solution>
pub fn solve_as(self, pt: ProblemType) -> Result<Solution>
Solve the Problem, returning a Solution
object with the
result.