CGAL 5.1.1 - CGAL and Solvers
MixedIntegerProgramVariable Concept Reference

Definition

MixedIntegerProgramVariable is a concept of a variable in a Mixed Integer Programming (MIP) problem.

Has Models:
CGAL::Variable<FT>

Types

enum  Variable_type { CONTINUOUS, INTEGER, BINARY }
 A variable can be continuous, integer, or binary. More...
 
typedef unspecified_type FT
 

Creation

 MixedIntegerProgramVariable (MixedIntegerProgramTraits *solver, Variable_type type, FT lb=, FT ub, const std::string &name, int idx)
 Constructs a variable initialized with the pointer of the solver it belongs to, the variable type, lower bound, upper bound, name, and index.
 

Operations

Variable_type variable_type () const
 Returns the variable type.
 
void set_variable_type (Variable_type t)
 Sets/Changes the variable type.
 
const std::string & name () const
 Returns the name of the variable.
 
void set_name (const std::string &n)
 Sets the name of the variable.
 
int index () const
 Returns the index of the variable.
 
void set_index (int idx)
 Sets the index of the variable.
 
const MixedIntegerProgramTraitssolver () const
 Returns the solver that owns this variable.
 
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.
 
FT solution_value (bool rounded=false) const
 Returns the value of the variable in the current solution. More...
 
void set_solution_value (FT value)
 Sets the solution value (should be called internally by the solver).
 
static FT infinity ()
 Gets the infinity threshold (e.g., 1e20). More...
 

Member Enumeration Documentation

◆ Variable_type

A variable can be continuous, integer, or binary.

Enumerator
CONTINUOUS 
INTEGER 
BINARY 

Member Function Documentation

◆ infinity()

static FT MixedIntegerProgramVariable::infinity ( )
static

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

Values greater than this value are considered as infinity.

◆ solution_value()

FT MixedIntegerProgramVariable::solution_value ( bool  rounded = false) const

Returns the value of the variable in the current solution.

Note
(1) Valid only if the program was successfully solved. (2) If the variable is integer and rounded == true, then the value will be rounded to the nearest integer.