CGAL 5.1 - CGAL and Solvers
|
#include <Concepts/MixedIntegerProgramTraits.h>
MixedIntegerProgramLinearConstraint
is a concept of a linear constraint in a Mixed Integer Programming (MIP) problem.
Creation | |
MixedIntegerProgramLinearConstraint (MixedIntegerProgramTraits *solver, FT lb, FT ub, const std::string &name, int idx) | |
Constructs a linear constraint, initialized with the solver it belongs to, the lower bound, upper bound, name, and index. More... | |
Operations | |
const std::string & | name () const |
Returns the name of the constraint. More... | |
void | set_name (const std::string &n) |
Sets the name of the constraint. More... | |
int | index () const |
Returns the index of the constraint. More... | |
void | set_index (int idx) |
Sets the index of the constraint. More... | |
const MixedIntegerProgramTraits * | solver () const |
Returns the solver that owns this constraint. More... | |
MixedIntegerProgramTraits * | solver () |
void | set_lower_bound (FT lb) |
Sets the lower bound. More... | |
void | set_upper_bound (FT ub) |
Sets the upper bound. More... | |
void | set_bounds (FT lb, FT ub) |
Sets both lower and upper bounds. More... | |
FT | lower_bound () const |
Gets the lower bound. More... | |
FT | upper_bound () const |
Gets the upper bound. More... | |
void | get_bounds (FT &lb, FT &ub) const |
Gets both lower and upper bounds. More... | |
void | set_coefficients (const std::unordered_map< const MixedIntegerProgramVariable *, FT > &coeffs) |
Sets the coefficients of the constraint. More... | |
void | add_coefficient (const MixedIntegerProgramVariable *var, FT coeff) |
Adds a coefficient to a variable of the constraint. More... | |
const std::unordered_map< const MixedIntegerProgramVariable *, FT > & | coefficients () const |
Returns the coefficients of the constraint. More... | |
FT | get_coefficient (const MixedIntegerProgramVariable *var) const |
Gets the coefficient of the variable in this constraint. More... | |
void | set_offset (FT value) |
Sets the constant term. More... | |
FT | offset () const |
Gets the constant term. More... | |
void | clear () |
Clears all variables and sets the constant term to zero. More... | |
static FT | infinity () |
Gets the infinity threshold (e.g., 1e20). More... | |
MixedIntegerProgramLinearConstraint< FT >::MixedIntegerProgramLinearConstraint | ( | MixedIntegerProgramTraits * | solver, |
FT | lb, | ||
FT | ub, | ||
const std::string & | name, | ||
int | idx | ||
) |
Constructs a linear constraint, initialized with the solver it belongs to, the lower bound, upper bound, name, and index.
void MixedIntegerProgramLinearConstraint< FT >::add_coefficient | ( | const MixedIntegerProgramVariable * | var, |
FT | coeff | ||
) |
Adds a coefficient to a variable of the constraint.
void MixedIntegerProgramLinearConstraint< FT >::clear | ( | ) |
Clears all variables and sets the constant term to zero.
Useful to reuse the object to define a new linear constraint.
const std::unordered_map<const MixedIntegerProgramVariable*, FT>& MixedIntegerProgramLinearConstraint< FT >::coefficients | ( | ) | const |
Returns the coefficients of the constraint.
void MixedIntegerProgramLinearConstraint< FT >::get_bounds | ( | FT & | lb, |
FT & | ub | ||
) | const |
Gets both lower and upper bounds.
FT MixedIntegerProgramLinearConstraint< FT >::get_coefficient | ( | const MixedIntegerProgramVariable * | var | ) | const |
Gets the coefficient of the variable in this constraint.
int MixedIntegerProgramLinearConstraint< FT >::index | ( | ) | const |
Returns the index of the constraint.
|
static |
Gets the infinity threshold (e.g., 1e20).
Values greater than this value are considered as infinity.
FT MixedIntegerProgramLinearConstraint< FT >::lower_bound | ( | ) | const |
Gets the lower bound.
const std::string& MixedIntegerProgramLinearConstraint< FT >::name | ( | ) | const |
Returns the name of the constraint.
FT MixedIntegerProgramLinearConstraint< FT >::offset | ( | ) | const |
Gets the constant term.
void MixedIntegerProgramLinearConstraint< FT >::set_bounds | ( | FT | lb, |
FT | ub | ||
) |
Sets both lower and upper bounds.
void MixedIntegerProgramLinearConstraint< FT >::set_coefficients | ( | const std::unordered_map< const MixedIntegerProgramVariable *, FT > & | coeffs | ) |
Sets the coefficients of the constraint.
void MixedIntegerProgramLinearConstraint< FT >::set_index | ( | int | idx | ) |
Sets the index of the constraint.
void MixedIntegerProgramLinearConstraint< FT >::set_lower_bound | ( | FT | lb | ) |
Sets the lower bound.
void MixedIntegerProgramLinearConstraint< FT >::set_name | ( | const std::string & | n | ) |
Sets the name of the constraint.
void MixedIntegerProgramLinearConstraint< FT >::set_offset | ( | FT | value | ) |
Sets the constant term.
void MixedIntegerProgramLinearConstraint< FT >::set_upper_bound | ( | FT | ub | ) |
Sets the upper bound.
MixedIntegerProgramTraits* MixedIntegerProgramLinearConstraint< FT >::solver | ( | ) |
const MixedIntegerProgramTraits* MixedIntegerProgramLinearConstraint< FT >::solver | ( | ) | const |
Returns the solver that owns this constraint.
FT MixedIntegerProgramLinearConstraint< FT >::upper_bound | ( | ) | const |
Gets the upper bound.