C++ Reference
C++ Reference: Routing
Detailed Description
Definition at line 5234 of file constraint_solver.h.
Public Member Functions | |
Pack (Solver *const s, const std::vector< IntVar * > &vars, int number_of_bins) | |
~Pack () override | |
void | AddWeightedSumLessOrEqualConstantDimension (const std::vector< int64 > &weights, const std::vector< int64 > &bounds) |
Dimensions are additional constraints than can restrict what is possible with the pack constraint. More... | |
void | AddWeightedSumLessOrEqualConstantDimension (Solver::IndexEvaluator1 weights, const std::vector< int64 > &bounds) |
This dimension imposes that for all bins b, the weighted sum (weights->Run(i)) of all objects i assigned to 'b' is less or equal to 'bounds[b]'. More... | |
void | AddWeightedSumLessOrEqualConstantDimension (Solver::IndexEvaluator2 weights, const std::vector< int64 > &bounds) |
This dimension imposes that for all bins b, the weighted sum (weights->Run(i, b) of all objects i assigned to 'b' is less or equal to 'bounds[b]'. More... | |
void | AddWeightedSumEqualVarDimension (const std::vector< int64 > &weights, const std::vector< IntVar * > &loads) |
This dimension imposes that for all bins b, the weighted sum (weights[i]) of all objects i assigned to 'b' is equal to loads[b]. More... | |
void | AddWeightedSumEqualVarDimension (Solver::IndexEvaluator2 weights, const std::vector< IntVar * > &loads) |
This dimension imposes that for all bins b, the weighted sum (weights->Run(i, b)) of all objects i assigned to 'b' is equal to loads[b]. More... | |
void | AddSumVariableWeightsLessOrEqualConstantDimension (const std::vector< IntVar * > &usage, const std::vector< int64 > &capacity) |
This dimension imposes: forall b in bins, sum (i in items: usage[i] * is_assigned(i, b)) <= capacity[b] where is_assigned(i, b) is true if and only if item i is assigned to the bin b. More... | |
void | AddWeightedSumOfAssignedDimension (const std::vector< int64 > &weights, IntVar *const cost_var) |
This dimension enforces that cost_var == sum of weights[i] for all objects 'i' assigned to a bin. More... | |
void | AddCountUsedBinDimension (IntVar *const count_var) |
This dimension links 'count_var' to the actual number of bins used in the pack. More... | |
void | AddCountAssignedItemsDimension (IntVar *const count_var) |
This dimension links 'count_var' to the actual number of items assigned to a bin in the pack. More... | |
void | Post () override |
This method is called when the constraint is processed by the solver. More... | |
void | ClearAll () |
void | PropagateDelayed () |
void | InitialPropagate () override |
This method performs the initial propagation of the constraint. More... | |
void | Propagate () |
void | OneDomain (int var_index) |
std::string | DebugString () const override |
bool | IsUndecided (int var_index, int bin_index) const |
void | SetImpossible (int var_index, int bin_index) |
void | Assign (int var_index, int bin_index) |
bool | IsAssignedStatusKnown (int var_index) const |
bool | IsPossible (int var_index, int bin_index) const |
IntVar * | AssignVar (int var_index, int bin_index) const |
void | SetAssigned (int var_index) |
void | SetUnassigned (int var_index) |
void | RemoveAllPossibleFromBin (int bin_index) |
void | AssignAllPossibleToBin (int bin_index) |
void | AssignFirstPossibleToBin (int bin_index) |
void | AssignAllRemainingItems () |
void | UnassignAllRemainingItems () |
void | Accept (ModelVisitor *const visitor) const override |
Accepts the given visitor. More... | |
void | PostAndPropagate () |
Calls Post and then Propagate to initialize the constraints. More... | |
bool | IsCastConstraint () const |
Is the constraint created by a cast from expression to integer variable? More... | |
virtual IntVar * | Var () |
Creates a Boolean variable representing the status of the constraint (false = constraint is violated, true = constraint is satisfied). More... | |
Solver * | solver () const |
void | FreezeQueue () |
This method freezes the propagation queue. More... | |
void | UnfreezeQueue () |
This method unfreezes the propagation queue. More... | |
void | EnqueueDelayedDemon (Demon *const d) |
This method pushes the demon onto the propagation queue. More... | |
void | EnqueueVar (Demon *const d) |
void | ExecuteAll (const SimpleRevFIFO< Demon * > &demons) |
void | EnqueueAll (const SimpleRevFIFO< Demon * > &demons) |
void | set_action_on_fail (Solver::Action a) |
void | reset_action_on_fail () |
This method clears the failure callback. More... | |
void | set_variable_to_clean_on_fail (IntVar *v) |
Shortcut for variable cleaner. More... | |
virtual std::string | name () const |
Object naming. More... | |
void | set_name (const std::string &name) |
bool | HasName () const |
Returns whether the object has been named or not. More... | |
virtual std::string | BaseName () const |
Returns a base name for automatic naming. More... | |
Constructor & Destructor Documentation
◆ Pack()
◆ ~Pack()
|
override |
Member Function Documentation
◆ Accept()
|
overridevirtual |
Accepts the given visitor.
Reimplemented from Constraint.
◆ AddCountAssignedItemsDimension()
void AddCountAssignedItemsDimension | ( | IntVar *const | count_var | ) |
This dimension links 'count_var' to the actual number of items assigned to a bin in the pack.
◆ AddCountUsedBinDimension()
void AddCountUsedBinDimension | ( | IntVar *const | count_var | ) |
This dimension links 'count_var' to the actual number of bins used in the pack.
◆ AddSumVariableWeightsLessOrEqualConstantDimension()
void AddSumVariableWeightsLessOrEqualConstantDimension | ( | const std::vector< IntVar * > & | usage, |
const std::vector< int64 > & | capacity | ||
) |
This dimension imposes: forall b in bins, sum (i in items: usage[i] * is_assigned(i, b)) <= capacity[b] where is_assigned(i, b) is true if and only if item i is assigned to the bin b.
This can be used to model shapes of items by linking variables of the same item on parallel dimensions with an allowed assignment constraint.
◆ AddWeightedSumEqualVarDimension() [1/2]
void AddWeightedSumEqualVarDimension | ( | const std::vector< int64 > & | weights, |
const std::vector< IntVar * > & | loads | ||
) |
This dimension imposes that for all bins b, the weighted sum (weights[i]) of all objects i assigned to 'b' is equal to loads[b].
◆ AddWeightedSumEqualVarDimension() [2/2]
void AddWeightedSumEqualVarDimension | ( | Solver::IndexEvaluator2 | weights, |
const std::vector< IntVar * > & | loads | ||
) |
This dimension imposes that for all bins b, the weighted sum (weights->Run(i, b)) of all objects i assigned to 'b' is equal to loads[b].
◆ AddWeightedSumLessOrEqualConstantDimension() [1/3]
void AddWeightedSumLessOrEqualConstantDimension | ( | const std::vector< int64 > & | weights, |
const std::vector< int64 > & | bounds | ||
) |
Dimensions are additional constraints than can restrict what is possible with the pack constraint.
It can be used to set capacity limits, to count objects per bin, to compute unassigned penalties... This dimension imposes that for all bins b, the weighted sum (weights[i]) of all objects i assigned to 'b' is less or equal 'bounds[b]'.
◆ AddWeightedSumLessOrEqualConstantDimension() [2/3]
void AddWeightedSumLessOrEqualConstantDimension | ( | Solver::IndexEvaluator1 | weights, |
const std::vector< int64 > & | bounds | ||
) |
This dimension imposes that for all bins b, the weighted sum (weights->Run(i)) of all objects i assigned to 'b' is less or equal to 'bounds[b]'.
Ownership of the callback is transferred to the pack constraint.
◆ AddWeightedSumLessOrEqualConstantDimension() [3/3]
void AddWeightedSumLessOrEqualConstantDimension | ( | Solver::IndexEvaluator2 | weights, |
const std::vector< int64 > & | bounds | ||
) |
This dimension imposes that for all bins b, the weighted sum (weights->Run(i, b) of all objects i assigned to 'b' is less or equal to 'bounds[b]'.
Ownership of the callback is transferred to the pack constraint.
◆ AddWeightedSumOfAssignedDimension()
void AddWeightedSumOfAssignedDimension | ( | const std::vector< int64 > & | weights, |
IntVar *const | cost_var | ||
) |
This dimension enforces that cost_var == sum of weights[i] for all objects 'i' assigned to a bin.
◆ Assign()
void Assign | ( | int | var_index, |
int | bin_index | ||
) |
◆ AssignAllPossibleToBin()
void AssignAllPossibleToBin | ( | int | bin_index | ) |
◆ AssignAllRemainingItems()
void AssignAllRemainingItems | ( | ) |
◆ AssignFirstPossibleToBin()
void AssignFirstPossibleToBin | ( | int | bin_index | ) |
◆ AssignVar()
IntVar * AssignVar | ( | int | var_index, |
int | bin_index | ||
) | const |
◆ BaseName()
|
virtualinherited |
Returns a base name for automatic naming.
Reimplemented in BooleanVar.
◆ ClearAll()
void ClearAll | ( | ) |
◆ DebugString()
|
overridevirtual |
Reimplemented from Constraint.
◆ EnqueueAll()
|
inherited |
◆ EnqueueDelayedDemon()
|
inlineinherited |
This method pushes the demon onto the propagation queue.
It will be processed directly if the queue is empty. It will be enqueued according to its priority otherwise.
Definition at line 3192 of file constraint_solver.h.
◆ EnqueueVar()
|
inlineinherited |
Definition at line 3193 of file constraint_solver.h.
◆ ExecuteAll()
|
inherited |
◆ FreezeQueue()
|
inlineinherited |
This method freezes the propagation queue.
It is useful when you need to apply multiple modifications at once.
Definition at line 3183 of file constraint_solver.h.
◆ HasName()
|
inherited |
Returns whether the object has been named or not.
◆ InitialPropagate()
|
overridevirtual |
This method performs the initial propagation of the constraint.
It is called just after the post.
Implements Constraint.
◆ IsAssignedStatusKnown()
bool IsAssignedStatusKnown | ( | int | var_index | ) | const |
◆ IsCastConstraint()
|
inherited |
Is the constraint created by a cast from expression to integer variable?
◆ IsPossible()
bool IsPossible | ( | int | var_index, |
int | bin_index | ||
) | const |
◆ IsUndecided()
bool IsUndecided | ( | int | var_index, |
int | bin_index | ||
) | const |
◆ name()
|
virtualinherited |
Object naming.
◆ OneDomain()
void OneDomain | ( | int | var_index | ) |
◆ Post()
|
overridevirtual |
This method is called when the constraint is processed by the solver.
Its main usage is to attach demons to variables.
Implements Constraint.
◆ PostAndPropagate()
|
inherited |
Calls Post and then Propagate to initialize the constraints.
This is usually done in the root node.
◆ Propagate()
void Propagate | ( | ) |
◆ PropagateDelayed()
void PropagateDelayed | ( | ) |
◆ RemoveAllPossibleFromBin()
void RemoveAllPossibleFromBin | ( | int | bin_index | ) |
◆ reset_action_on_fail()
|
inlineinherited |
This method clears the failure callback.
Definition at line 3206 of file constraint_solver.h.
◆ set_action_on_fail()
|
inlineinherited |
Definition at line 3200 of file constraint_solver.h.
◆ set_name()
|
inherited |
◆ set_variable_to_clean_on_fail()
|
inlineinherited |
Shortcut for variable cleaner.
Definition at line 3209 of file constraint_solver.h.
◆ SetAssigned()
void SetAssigned | ( | int | var_index | ) |
◆ SetImpossible()
void SetImpossible | ( | int | var_index, |
int | bin_index | ||
) |
◆ SetUnassigned()
void SetUnassigned | ( | int | var_index | ) |
◆ solver()
|
inlineinherited |
Definition at line 3179 of file constraint_solver.h.
◆ UnassignAllRemainingItems()
void UnassignAllRemainingItems | ( | ) |
◆ UnfreezeQueue()
|
inlineinherited |
This method unfreezes the propagation queue.
All modifications that happened when the queue was frozen will be processed.
Definition at line 3187 of file constraint_solver.h.
◆ Var()
|
virtualinherited |
Creates a Boolean variable representing the status of the constraint (false = constraint is violated, true = constraint is satisfied).
It returns nullptr if the constraint does not support this API.
The documentation for this class was generated from the following file: