Class Pack
java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.PropagationBaseObject
com.google.ortools.constraintsolver.Constraint
com.google.ortools.constraintsolver.Pack
-
Field Summary
Fields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ModelVisitor visitor) Accepts the given visitor.voidaddCountAssignedItemsDimension(IntVar count_var) This dimension links 'count_var' to the actual number of items
assigned to a bin in the pack.voidaddCountUsedBinDimension(IntVar count_var) This dimension links 'count_var' to the actual number of bins used in the
pack.voidaddSumVariableWeightsLessOrEqualConstantDimension(IntVar[] usage, long[] 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.voidaddWeightedSumEqualVarDimension(long[] weights, 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].voidaddWeightedSumEqualVarDimension(LongBinaryOperator weights, 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].voidaddWeightedSumLessOrEqualConstantDimension(long[] weights, long[] bounds) Dimensions are additional constraints than can restrict what is
possible with the pack constraint.voidaddWeightedSumLessOrEqualConstantDimension(LongBinaryOperator weights, long[] 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]'.voidaddWeightedSumLessOrEqualConstantDimension(LongUnaryOperator weights, long[] 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]'.voidaddWeightedSumOfAssignedDimension(long[] weights, IntVar cost_var) This dimension enforces that cost_var == sum of weights[i] for
all objects 'i' assigned to a bin.voidassign(int var_index, int bin_index) voidassignAllPossibleToBin(int bin_index) voidvoidassignFirstPossibleToBin(int bin_index) assignVar(int var_index, int bin_index) voidclearAll()voiddelete()protected voidfinalize()static longvoidThis method performs the initial propagation of the
constraint.booleanisAssignedStatusKnown(int var_index) booleanisPossible(int var_index, int bin_index) booleanisUndecided(int var_index, int bin_index) voidoneDomain(int var_index) voidpost()This method is called when the constraint is processed by the
solver.voidvoidvoidremoveAllPossibleFromBin(int bin_index) voidsetAssigned(int var_index) voidsetImpossible(int var_index, int bin_index) voidsetUnassigned(int var_index) static longswigRelease(Pack obj) toString()voidMethods inherited from class com.google.ortools.constraintsolver.Constraint
getCPtr, isCastConstraint, postAndPropagate, swigRelease, varMethods inherited from class com.google.ortools.constraintsolver.PropagationBaseObject
baseName, enqueueDelayedDemon, enqueueVar, freezeQueue, getCPtr, hasName, name, reset_action_on_fail, set_variable_to_clean_on_fail, setName, solver, swigRelease, unfreezeQueueMethods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease
-
Constructor Details
-
Pack
public Pack(long cPtr, boolean cMemoryOwn) -
Pack
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
protected void finalize()- Overrides:
finalizein classConstraint
-
delete
public void delete()- Overrides:
deletein classConstraint
-
addWeightedSumLessOrEqualConstantDimension
public void addWeightedSumLessOrEqualConstantDimension(long[] weights, long[] 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
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
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. -
addWeightedSumEqualVarDimension
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
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]. -
addSumVariableWeightsLessOrEqualConstantDimension
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. -
addWeightedSumOfAssignedDimension
This dimension enforces that cost_var == sum of weights[i] for
all objects 'i' assigned to a bin. -
addCountUsedBinDimension
This dimension links 'count_var' to the actual number of bins used in the
pack. -
addCountAssignedItemsDimension
This dimension links 'count_var' to the actual number of items
assigned to a bin in the pack. -
post
public void post()Description copied from class:ConstraintThis method is called when the constraint is processed by the
solver. Its main usage is to attach demons to variables.- Overrides:
postin classConstraint
-
clearAll
public void clearAll() -
propagateDelayed
public void propagateDelayed() -
initialPropagate
public void initialPropagate()Description copied from class:ConstraintThis method performs the initial propagation of the
constraint. It is called just after the post.- Overrides:
initialPropagatein classConstraint
-
propagate
public void propagate() -
oneDomain
public void oneDomain(int var_index) -
toString
- Overrides:
toStringin classConstraint
-
isUndecided
public boolean isUndecided(int var_index, int bin_index) -
setImpossible
public void setImpossible(int var_index, int bin_index) -
assign
public void assign(int var_index, int bin_index) -
isAssignedStatusKnown
public boolean isAssignedStatusKnown(int var_index) -
isPossible
public boolean isPossible(int var_index, int bin_index) -
assignVar
-
setAssigned
public void setAssigned(int var_index) -
setUnassigned
public void setUnassigned(int var_index) -
removeAllPossibleFromBin
public void removeAllPossibleFromBin(int bin_index) -
assignAllPossibleToBin
public void assignAllPossibleToBin(int bin_index) -
assignFirstPossibleToBin
public void assignFirstPossibleToBin(int bin_index) -
assignAllRemainingItems
public void assignAllRemainingItems() -
unassignAllRemainingItems
public void unassignAllRemainingItems() -
accept
Description copied from class:ConstraintAccepts the given visitor.- Overrides:
acceptin classConstraint
-