CGAL 6.0.1 - CGAL and Solvers
Loading...
Searching...
No Matches
MixedIntegerProgramLinearConstraint< FT > Concept Reference

Definition

template<typename FT>
class MixedIntegerProgramLinearConstraint< FT >

MixedIntegerProgramLinearConstraint is a concept of a linear constraint in a Mixed Integer Programming (MIP) problem.

Has models
CGAL::Linear_constraint<FT>

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.
 

Operations

const std::string & name () const
 Returns the name of the constraint.
 
void set_name (const std::string &n)
 Sets the name of the constraint.
 
int index () const
 Returns the index of the constraint.
 
void set_index (int idx)
 Sets the index of the constraint.
 
const MixedIntegerProgramTraitssolver () const
 Returns the solver that owns this constraint.
 
MixedIntegerProgramTraitssolver ()
 
void set_lower_bound (FT lb)
 Sets the lower bound.
 
void set_upper_bound (FT ub)
 Sets the upper bound.
 
void set_bounds (FT lb, FT ub)
 Sets both lower and upper bounds.
 
FT lower_bound () const
 Gets the lower bound.
 
FT upper_bound () const
 Gets the upper bound.
 
void get_bounds (FT &lb, FT &ub) const
 Gets both lower and upper bounds.
 
void set_coefficients (const std::unordered_map< const MixedIntegerProgramVariable *, FT > &coeffs)
 Sets the coefficients of the constraint.
 
void add_coefficient (const MixedIntegerProgramVariable *var, FT coeff)
 Adds a coefficient to a variable of the constraint.
 
const std::unordered_map< const MixedIntegerProgramVariable *, FT > & coefficients () const
 Returns the coefficients of the constraint.
 
FT get_coefficient (const MixedIntegerProgramVariable *var) const
 Gets the coefficient of the variable in this constraint.
 
void set_offset (FT value)
 Sets the constant term.
 
FT offset () const
 Gets the constant term.
 
void clear ()
 Clears all variables and sets the constant term to zero.
 
static FT infinity ()
 Gets the infinity threshold (e.g., 1e20).
 

Member Function Documentation

◆ clear()

template<typename FT >
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.

◆ infinity()

template<typename FT >
static FT MixedIntegerProgramLinearConstraint< FT >::infinity ( )
static

Gets the infinity threshold (e.g., 1e20).

Values greater than this value are considered as infinity.