CGAL 5.1 - CGAL and Solvers
MixedIntegerProgramLinearObjective< FT > Class Template Reference

#include <Concepts/MixedIntegerProgramTraits.h>

Definition

template<typename FT>
class MixedIntegerProgramLinearObjective< FT >

MixedIntegerProgramLinearObjective is a concept of the linear objective function in a Mixed Integer Programming (MIP) problem.

Has Models:
CGAL::Linear_objective<FT>

Types

enum  Sense { MINIMIZE, MAXIMIZE, UNDEFINED }
 The objective sense (i.e., optimization direction). More...
 

Creation

 MixedIntegerProgramLinearObjective (MixedIntegerProgramTraits *solver, Sense sense)
 Constructs a linear objective, initialized with the solver it belongs to and the objective sense. More...
 

Operations

void set_sense (Sense sense)
 Sets the objective sense. More...
 
Sense sense () const
 Gets the objective sense. 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 the objective (i.e., removes all variables, resets the objective sense to UNDEFINED). More...
 

Member Enumeration Documentation

◆ Sense

template<typename FT >
enum MixedIntegerProgramLinearObjective::Sense

The objective sense (i.e., optimization direction).

Enumerator
MINIMIZE 
MAXIMIZE 
UNDEFINED 

Constructor & Destructor Documentation

◆ MixedIntegerProgramLinearObjective()

Constructs a linear objective, initialized with the solver it belongs to and the objective sense.

Member Function Documentation

◆ add_coefficient()

template<typename FT >
void MixedIntegerProgramLinearObjective< FT >::add_coefficient ( const MixedIntegerProgramVariable var,
FT  coeff 
)

Adds a coefficient to a variable of the constraint.

◆ clear()

template<typename FT >
void MixedIntegerProgramLinearObjective< FT >::clear ( )

Clears the objective (i.e., removes all variables, resets the objective sense to UNDEFINED).

Useful to reuse the object to define a new linear objective.

◆ coefficients()

template<typename FT >
const std::unordered_map<const MixedIntegerProgramVariable*, FT>& MixedIntegerProgramLinearObjective< FT >::coefficients ( ) const

Returns the coefficients of the constraint.

◆ get_coefficient()

template<typename FT >
FT MixedIntegerProgramLinearObjective< FT >::get_coefficient ( const MixedIntegerProgramVariable var) const

Gets the coefficient of the variable in this constraint.

◆ offset()

template<typename FT >
FT MixedIntegerProgramLinearObjective< FT >::offset ( ) const

Gets the constant term.

◆ sense()

template<typename FT >
Sense MixedIntegerProgramLinearObjective< FT >::sense ( ) const

Gets the objective sense.

◆ set_coefficients()

template<typename FT >
void MixedIntegerProgramLinearObjective< FT >::set_coefficients ( const std::unordered_map< const MixedIntegerProgramVariable *, FT > &  coeffs)

Sets the coefficients of the constraint.

◆ set_offset()

template<typename FT >
void MixedIntegerProgramLinearObjective< FT >::set_offset ( FT  value)

Sets the constant term.

◆ set_sense()

template<typename FT >
void MixedIntegerProgramLinearObjective< FT >::set_sense ( Sense  sense)

Sets the objective sense.