GHOST
Public Member Functions | List of all members
ghost::global_constraints::FixValue Class Reference

#include <fix_value.hpp>

Inheritance diagram for ghost::global_constraints::FixValue:
Inheritance graph
Collaboration diagram for ghost::global_constraints::FixValue:
Collaboration graph

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...
 
Constraintoperator= (const Constraint &other)=delete
 Copy assignment operator disabled. More...
 
Constraintoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FixValue() [1/2]

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.

Parameters
variables_indexa const reference to a vector of IDs of variables composing the constraint.
valuea value integer such that all variables in the scope must be equals to this value.

◆ FixValue() [2/2]

ghost::global_constraints::FixValue::FixValue ( const std::vector< Variable > &  variables,
int  value 
)

Constructor with a vector of variable.

Parameters
variablesa const reference to a vector of variables composing the constraint.
valuea value integer such that all variables in the scope must be equals to this value.

The documentation for this class was generated from the following file: