CGAL 5.1 - CGAL and Solvers
MixedIntegerProgramVariable Class Reference

#include <Concepts/MixedIntegerProgramTraits.h>

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

Operations

Variable_type variable_type () const
 Returns the variable type. More...
 
void set_variable_type (Variable_type t)
 Sets/Changes the variable type. More...
 
const std::string & name () const
 Returns the name of the variable. More...
 
void set_name (const std::string &n)
 Sets the name of the variable. More...
 
int index () const
 Returns the index of the variable. More...
 
void set_index (int idx)
 Sets the index of the variable. More...
 
const MixedIntegerProgramTraitssolver () const
 Returns the solver that owns this variable. More...
 
MixedIntegerProgramTraitssolver ()
 
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...
 
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). More...
 
static FT infinity ()
 Gets the infinity threshold (e.g., 1e20). More...
 

Member Typedef Documentation

◆ FT

typedef unspecified_type MixedIntegerProgramVariable::FT

Member Enumeration Documentation

◆ Variable_type

A variable can be continuous, integer, or binary.

Enumerator
CONTINUOUS 
INTEGER 
BINARY 

Constructor & Destructor Documentation

◆ MixedIntegerProgramVariable()

MixedIntegerProgramVariable::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.

Member Function Documentation

◆ get_bounds()

void MixedIntegerProgramVariable::get_bounds ( FT lb,
FT ub 
) const

Gets both lower and upper bounds.

◆ index()

int MixedIntegerProgramVariable::index ( ) const

Returns the index of the variable.

◆ infinity()

static FT MixedIntegerProgramVariable::infinity ( )
static

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

Values greater than this value are considered as infinity.

◆ lower_bound()

FT MixedIntegerProgramVariable::lower_bound ( ) const

Gets the lower bound.

◆ name()

const std::string& MixedIntegerProgramVariable::name ( ) const

Returns the name of the variable.

◆ set_bounds()

void MixedIntegerProgramVariable::set_bounds ( FT  lb,
FT  ub 
)

Sets both lower and upper bounds.

◆ set_index()

void MixedIntegerProgramVariable::set_index ( int  idx)

Sets the index of the variable.

◆ set_lower_bound()

void MixedIntegerProgramVariable::set_lower_bound ( FT  lb)

Sets the lower bound.

◆ set_name()

void MixedIntegerProgramVariable::set_name ( const std::string &  n)

Sets the name of the variable.

◆ set_solution_value()

void MixedIntegerProgramVariable::set_solution_value ( FT  value)

Sets the solution value (should be called internally by the solver).

◆ set_upper_bound()

void MixedIntegerProgramVariable::set_upper_bound ( FT  ub)

Sets the upper bound.

◆ set_variable_type()

void MixedIntegerProgramVariable::set_variable_type ( Variable_type  t)

Sets/Changes the variable type.

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

◆ solver() [1/2]

MixedIntegerProgramTraits* MixedIntegerProgramVariable::solver ( )

◆ solver() [2/2]

const MixedIntegerProgramTraits* MixedIntegerProgramVariable::solver ( ) const

Returns the solver that owns this variable.

◆ upper_bound()

FT MixedIntegerProgramVariable::upper_bound ( ) const

Gets the upper bound.

◆ variable_type()

Variable_type MixedIntegerProgramVariable::variable_type ( ) const

Returns the variable type.