GHOST
|
#include <fix_value.hpp>
Public Member Functions | |
FixValue (const std::vector< int > &variables_index, int value) | |
FixValue (const std::vector< Variable > &variables, int value) | |
Public Member Functions inherited from ghost::Constraint | |
Constraint (const std::vector< int > &variables_index) | |
Constraint (const std::vector< Variable > &variables) | |
Constraint (const Constraint &other)=default | |
Default copy contructor. More... | |
Constraint (Constraint &&other)=default | |
Default move contructor. More... | |
Constraint & | operator= (const Constraint &other)=delete |
Copy assignment operator disabled. More... | |
Constraint & | operator= (Constraint &&other)=delete |
Move assignment operator disabled. More... | |
virtual | ~Constraint ()=default |
Default virtual destructor. More... | |
bool | has_variable (int var_id) const |
Additional Inherited Members | |
Protected Member Functions inherited from ghost::Constraint | |
virtual void | conditional_update_data_structures (const std::vector< Variable * > &variables, int index, int new_value) |
double | get_current_error () const |
int | get_id () const |
Inline method to get the unique id of the Constraint object. More... | |
Implementation of the FixValue constraint, forcing variables in its scope taking a given value.
This constraint must be avoided if possible. If some variables x must be fixed to a value v, it is more efficient to directly declare these variables in the ghost::ModelBuilder with a singleton domain {v}. However, it makes sense to use this contraint to fix the value of some variables in permutation problems.
ghost::global_constraints::FixValue::FixValue | ( | const std::vector< int > & | variables_index, |
int | value | ||
) |
Constructor with a vector of variable IDs. This vector is internally used by ghost::Constraint to know what variables from the global variable vector it is handling.
variables_index | a const reference to a vector of IDs of variables composing the constraint. |
value | a value integer such that all variables in the scope must be equals to this value. |
ghost::global_constraints::FixValue::FixValue | ( | const std::vector< Variable > & | variables, |
int | value | ||
) |
Constructor with a vector of variable.
variables | a const reference to a vector of variables composing the constraint. |
value | a value integer such that all variables in the scope must be equals to this value. |