Loading...
Searching...
No Matches
idol::Ctr Class Reference

Description

Definition at line 29 of file Ctr.h.

Public Methods

 Ctr (Env &t_env, TempCtr &&t_temp_ctr, std::string t_name="")
 Ctr (Env &t_env, const TempCtr &t_temp_ctr, std::string t_name="")
 Ctr (Env &t_env, CtrType t_type, double t_constant, std::string t_name="")
unsigned int index (const Model &t_index) const
const std::string & name () const
unsigned int id () const
bool is_in (const Model &t_model) const
const ValueT & get (const Annotation< ValueT > &t_annotation) const
void set (const Annotation< ValueT > &t_annotation, ArgsT &&...t_args) const

Public Static Methods

template<unsigned int N = 1, unsigned int I = 0>
static Vector< Ctr, N - I > make_vector (Env &t_env, const Dim< N > &t_dim, CtrType t_type, double t_constant, const std::string &t_name="")

Protected Methods

auto & versions ()
void create_version (const Model &t_model, unsigned int t_index, ArgsT &&...t_args) const
void remove_version (const Model &t_model) const

Friends

class impl::Env

Constructor & Destructor Documentation

◆ Ctr() [1/3]

idol::Ctr::Ctr ( Env & t_env,
TempCtr && t_temp_ctr,
std::string t_name = "" )

Constructor.

Creates a new constraint in the optimization environment.

If no name is given, a unique name in the environment is given.

Parameters
t_envThe optimization environment.
t_temp_ctrThe temporary constraint used to create the default version of the constraint.
t_nameThe given name for the constraint.

◆ Ctr() [2/3]

idol::Ctr::Ctr ( Env & t_env,
const TempCtr & t_temp_ctr,
std::string t_name = "" )

Constructor.

Creates a new constraint in the optimization environment.

If no name is given, a unique name in the environment is given.

Parameters
t_envThe optimization environment.
t_temp_ctrThe temporary constraint used to create the default version of the constraint.
t_nameThe given name for the constraint.

◆ Ctr() [3/3]

idol::Ctr::Ctr ( Env & t_env,
CtrType t_type,
double t_constant,
std::string t_name = "" )

Constructor.

Creates a new constraint in the optimization environment.

If no name is given, a unique name in the environment is given.

Parameters
t_envThe optimization environment.
t_typeThe type of the constraint in its default version.
t_constantThe right hand-side of the constraint in its default version.
t_nameThe given name for the constraint.

Methods Documentation

◆ create_version()

void idol::Object< CtrVersion, Ctr >::create_version ( const Model & t_model,
unsigned int t_index,
ArgsT &&... t_args ) const
inlineprotectedinherited

Definition at line 34 of file Object.h.

◆ get()

const ValueT & idol::Object< CtrVersion, Ctr >::get ( const Annotation< ValueT > & t_annotation) const
inlineinherited

Returns the value of the given annotation t_annotation associated to the object.

If no value is found, the default value of the annotation is returned. If no default value was set, an exception is thrown.

Template Parameters
ValueTThe value type of the annotation.
Parameters
t_annotationThe annotation.
Returns
The value of the annotation.

Definition at line 78 of file Object.h.

◆ id()

unsigned int idol::Object< CtrVersion, Ctr >::id ( ) const
inlinenodiscardinherited

Returns the id of the optimization object.

Returns
The id of the optimization object.

Definition at line 60 of file Object.h.

◆ is_in()

bool idol::Object< CtrVersion, Ctr >::is_in ( const Model & t_model) const
inlinenodiscardinherited

Returns true if the optimization object is part of the model t_model, false otherwise.

Parameters
t_modelThe model.
Returns
True if the optimization object is part of the model t_model, false otherwise.

Definition at line 67 of file Object.h.

◆ make_vector()

template<unsigned int N = 1, unsigned int I = 0>
Vector< Ctr, N - I > idol::Ctr::make_vector ( Env & t_env,
const Dim< N > & t_dim,
CtrType t_type,
double t_constant,
const std::string & t_name = "" )
inlinestatic

Creates a (nested) vector of constraints.

Example:

Env env;
auto constraint = Ctr::make_vector(env, Dim<2>(m, n), LessOrEqual, 0., "constraint");
std::cout << constraint[1][4].name() << std::endl; // "constraint_1_4"
static Vector< Ctr, N - I > make_vector(Env &t_env, const Dim< N > &t_dim, CtrType t_type, double t_constant, const std::string &t_name="")
Definition Ctr.h:92
Template Parameters
NThe dimension of the (nested) vector.
IUsed for recursion.
Parameters
t_envThe environment to store the constraints.
t_dimThe number of elements in each dimension.
t_typeThe type of the constraints.
t_constantThe right hand-side of the constraints.
t_nameThe given name of the constraints.
Returns
A (nested) vector of constraints.

Definition at line 92 of file Ctr.h.

◆ name()

const std::string & idol::Object< CtrVersion, Ctr >::name ( ) const
inlinenodiscardinherited

Returns the name of the optimization object.

Returns
The name of the optimization object.

Definition at line 54 of file Object.h.

◆ remove_version()

void idol::Object< CtrVersion, Ctr >::remove_version ( const Model & t_model) const
inlineprotectedinherited

Definition at line 38 of file Object.h.

◆ set()

void idol::Object< CtrVersion, Ctr >::set ( const Annotation< ValueT > & t_annotation,
ArgsT &&... t_args ) const
inlineinherited

Sets the value of the given annotation t_annotation associated to the object.

Template Parameters
ValueTThe value type of the annotation.
ArgsTThe parameter pack types for constructing the value of the annotation.
Parameters
t_annotationThe annotation.
t_argsThe parameter pack arguments used to construct "in place" the value of the annotation.

Definition at line 96 of file Object.h.

◆ versions()

auto & idol::Object< CtrVersion, Ctr >::versions ( )
inlinenodiscardprotectedinherited

Definition at line 29 of file Object.h.

◆ impl::Env

friend class impl::Env
friend

Definition at line 30 of file Ctr.h.