idol
A C++ Framework for Optimization
Loading...
Searching...
No Matches
idol::TempCtr Class Reference

#include <TempCtr.h>

Collaboration diagram for idol::TempCtr:
Collaboration graph

Public Member Functions

 TempCtr ()=default
 
 TempCtr (LinExpr< Var > &&t_lhs, CtrType t_type, double t_rhs)
 
 TempCtr (const TempCtr &t_src)=default
 
 TempCtr (TempCtr &&t_src) noexcept=default
 
TempCtroperator= (const TempCtr &t_src)=default
 
TempCtroperator= (TempCtr &&t_src) noexcept=default
 
LinExpr< Var > & lhs ()
 
const LinExpr< Var > & lhs () const
 
void set_lhs (LinExpr< Var > &&t_lhs)
 
CtrType type () const
 
double rhs () const
 
double & rhs ()
 
void set_rhs (double t_rhs)
 
void set_type (CtrType t_type)
 

Detailed Description

Temporary constraint class.

This class represents a constraint which has not been built yet by a Model. It contains all the arguments needed to create a real constraint as instantiated by the Ctr class. It is made of a row (see Row) and a type (see CtrType.rst.rst).

Typically, one creates a TempCtr by using the overloaded operators <=, >= and == between variable expressions (i.e., AffExpr) and constant terms (i.e., Constant).

Example 1:

...
model.add_ctr(x + y <= 1.);

Example 2 (equivalent to Example 1):

...
model.add_ctr(TempCtr(Row(x + y, 1.), LessOrEqual));
TempCtr()=default

Definition at line 41 of file TempCtr.h.

Constructor & Destructor Documentation

◆ TempCtr() [1/4]

idol::TempCtr::TempCtr ( )
default

Default constructor.

Creates an empty temporary constraint. The default type is LessOrEqual.

◆ TempCtr() [2/4]

idol::TempCtr::TempCtr ( LinExpr< Var > &&  t_lhs,
CtrType  t_type,
double  t_rhs 
)
inline

Constructor.

Creates a new temporary constraint.

Parameters
t_rowThe desired row.
t_typeThe desired constraint type.

Definition at line 60 of file TempCtr.h.

◆ TempCtr() [3/4]

idol::TempCtr::TempCtr ( const TempCtr t_src)
default

Copy constructor.

Parameters
t_srcThe object to copy.

◆ TempCtr() [4/4]

idol::TempCtr::TempCtr ( TempCtr &&  t_src)
defaultnoexcept

Move constructor.

Parameters
t_srcThe object to move.

Member Function Documentation

◆ lhs() [1/2]

LinExpr< Var > & idol::TempCtr::lhs ( )
inline

Definition at line 86 of file TempCtr.h.

◆ lhs() [2/2]

const LinExpr< Var > & idol::TempCtr::lhs ( ) const
inline

Definition at line 88 of file TempCtr.h.

◆ operator=() [1/2]

TempCtr & idol::TempCtr::operator= ( const TempCtr t_src)
default

Copy-assignment operator.

Parameters
t_srcThe object to copy.

◆ operator=() [2/2]

TempCtr & idol::TempCtr::operator= ( TempCtr &&  t_src)
defaultnoexcept

Move-assignment operator.

Parameters
t_srcThe object to move.

◆ rhs() [1/2]

double & idol::TempCtr::rhs ( )
inline

Definition at line 100 of file TempCtr.h.

◆ rhs() [2/2]

double idol::TempCtr::rhs ( ) const
inline

Definition at line 98 of file TempCtr.h.

◆ set_lhs()

void idol::TempCtr::set_lhs ( LinExpr< Var > &&  t_lhs)
inline

Definition at line 90 of file TempCtr.h.

◆ set_rhs()

void idol::TempCtr::set_rhs ( double  t_rhs)
inline

Definition at line 102 of file TempCtr.h.

◆ set_type()

void idol::TempCtr::set_type ( CtrType  t_type)
inline

Sets the type of the temporary constraint.

Parameters
t_typethe desired type.

Definition at line 108 of file TempCtr.h.

◆ type()

CtrType idol::TempCtr::type ( ) const
inline

Returns the temporary constraint type.

Returns
The temporary constraint type.

Definition at line 96 of file TempCtr.h.