Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <constraint_solver.h>
Public Member Functions | |
Pack (Solver *s, const std::vector< IntVar * > &vars, int number_of_bins) | |
--— Pack --— | |
~Pack () override | |
void | AddWeightedSumLessOrEqualConstantDimension (const std::vector< int64_t > &weights, const std::vector< int64_t > &bounds) |
-------— API -------— | |
void | AddWeightedSumLessOrEqualConstantDimension (Solver::IndexEvaluator1 weights, const std::vector< int64_t > &bounds) |
void | AddWeightedSumLessOrEqualConstantDimension (Solver::IndexEvaluator2 weights, const std::vector< int64_t > &bounds) |
void | AddWeightedSumEqualVarDimension (const std::vector< int64_t > &weights, const std::vector< IntVar * > &loads) |
void | AddWeightedSumEqualVarDimension (Solver::IndexEvaluator2 weights, const std::vector< IntVar * > &loads) |
void | AddSumVariableWeightsLessOrEqualConstantDimension (const std::vector< IntVar * > &usage, const std::vector< int64_t > &capacity) |
void | AddWeightedSumOfAssignedDimension (const std::vector< int64_t > &weights, IntVar *cost_var) |
void | AddCountUsedBinDimension (IntVar *count_var) |
void | AddCountAssignedItemsDimension (IntVar *count_var) |
void | Post () override |
void | ClearAll () |
void | PropagateDelayed () |
void | InitialPropagate () override |
void | Propagate () |
void | OneDomain (int var_index) |
std::string | DebugString () const override |
--------------— Constraint class ----------------— | |
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 *visitor) const override |
Accepts the given visitor. | |
Public Member Functions inherited from operations_research::Constraint | |
Constraint (Solver *const solver) | |
Constraint (const Constraint &)=delete | |
This type is neither copyable nor movable. | |
Constraint & | operator= (const Constraint &)=delete |
~Constraint () override | |
void | PostAndPropagate () |
bool | IsCastConstraint () const |
Is the constraint created by a cast from expression to integer variable? | |
virtual IntVar * | Var () |
Public Member Functions inherited from operations_research::PropagationBaseObject | |
PropagationBaseObject (Solver *const s) | |
PropagationBaseObject (const PropagationBaseObject &)=delete | |
This type is neither copyable nor movable. | |
PropagationBaseObject & | operator= (const PropagationBaseObject &)=delete |
~PropagationBaseObject () override | |
std::string | DebugString () const override |
Solver * | solver () const |
void | FreezeQueue () |
void | UnfreezeQueue () |
void | EnqueueDelayedDemon (Demon *const d) |
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. | |
void | set_variable_to_clean_on_fail (IntVar *v) |
Shortcut for variable cleaner. | |
virtual std::string | name () const |
Object naming. | |
void | set_name (absl::string_view name) |
bool | HasName () const |
Returns whether the object has been named or not. | |
virtual std::string | BaseName () const |
Returns a base name for automatic naming. | |
Public Member Functions inherited from operations_research::BaseObject | |
BaseObject () | |
BaseObject (const BaseObject &)=delete | |
This type is neither copyable nor movable. | |
BaseObject & | operator= (const BaseObject &)=delete |
virtual | ~BaseObject () |
Definition at line 5705 of file constraint_solver.h.
|
overridevirtual |
Accepts the given visitor.
Reimplemented from operations_research::Constraint.
void operations_research::Pack::AddCountAssignedItemsDimension | ( | IntVar * | count_var | ) |
void operations_research::Pack::AddCountUsedBinDimension | ( | IntVar * | count_var | ) |
void operations_research::Pack::AddSumVariableWeightsLessOrEqualConstantDimension | ( | const std::vector< IntVar * > & | usage, |
const std::vector< int64_t > & | 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.
void operations_research::Pack::AddWeightedSumEqualVarDimension | ( | const std::vector< int64_t > & | weights, |
const std::vector< IntVar * > & | loads ) |
void operations_research::Pack::AddWeightedSumEqualVarDimension | ( | Solver::IndexEvaluator2 | weights, |
const std::vector< IntVar * > & | loads ) |
void operations_research::Pack::AddWeightedSumLessOrEqualConstantDimension | ( | const std::vector< int64_t > & | weights, |
const std::vector< int64_t > & | bounds ) |
-------— API -------—
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]'.
void operations_research::Pack::AddWeightedSumLessOrEqualConstantDimension | ( | Solver::IndexEvaluator1 | weights, |
const std::vector< int64_t > & | bounds ) |
void operations_research::Pack::AddWeightedSumLessOrEqualConstantDimension | ( | Solver::IndexEvaluator2 | weights, |
const std::vector< int64_t > & | bounds ) |
void operations_research::Pack::AddWeightedSumOfAssignedDimension | ( | const std::vector< int64_t > & | weights, |
IntVar * | cost_var ) |
void operations_research::Pack::Assign | ( | int | var_index, |
int | bin_index ) |
void operations_research::Pack::AssignAllPossibleToBin | ( | int | bin_index | ) |
void operations_research::Pack::AssignFirstPossibleToBin | ( | int | bin_index | ) |
IntVar * operations_research::Pack::AssignVar | ( | int | var_index, |
int | bin_index ) const |
|
overridevirtual |
--------------— Constraint class ----------------—
Reimplemented from operations_research::Constraint.
|
overridevirtual |
This method performs the initial propagation of the constraint. It is called just after the post.
Implements operations_research::Constraint.
bool operations_research::Pack::IsAssignedStatusKnown | ( | int | var_index | ) | const |
bool operations_research::Pack::IsPossible | ( | int | var_index, |
int | bin_index ) const |
bool operations_research::Pack::IsUndecided | ( | int | var_index, |
int | bin_index ) const |
void operations_research::Pack::OneDomain | ( | int | var_index | ) |
|
overridevirtual |
This method is called when the constraint is processed by the solver. Its main usage is to attach demons to variables.
Implements operations_research::Constraint.
void operations_research::Pack::RemoveAllPossibleFromBin | ( | int | bin_index | ) |
void operations_research::Pack::SetAssigned | ( | int | var_index | ) |
void operations_research::Pack::SetImpossible | ( | int | var_index, |
int | bin_index ) |
void operations_research::Pack::SetUnassigned | ( | int | var_index | ) |
void operations_research::Pack::UnassignAllRemainingItems | ( | ) |