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 TypeMethodDescriptionvoid
accept
(ModelVisitor visitor) Accepts the given visitor.void
addCountAssignedItemsDimension
(IntVar count_var) This dimension links 'count_var' to the actual number of items
assigned to a bin in the pack.void
addCountUsedBinDimension
(IntVar count_var) This dimension links 'count_var' to the actual number of bins used in the
pack.void
addSumVariableWeightsLessOrEqualConstantDimension
(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.void
addWeightedSumEqualVarDimension
(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].void
addWeightedSumEqualVarDimension
(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].void
addWeightedSumLessOrEqualConstantDimension
(long[] weights, long[] bounds) Dimensions are additional constraints than can restrict what is
possible with the pack constraint.void
addWeightedSumLessOrEqualConstantDimension
(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]'.void
addWeightedSumLessOrEqualConstantDimension
(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]'.void
addWeightedSumOfAssignedDimension
(long[] weights, IntVar cost_var) This dimension enforces that cost_var == sum of weights[i] for
all objects 'i' assigned to a bin.void
assign
(int var_index, int bin_index) void
assignAllPossibleToBin
(int bin_index) void
void
assignFirstPossibleToBin
(int bin_index) assignVar
(int var_index, int bin_index) void
clearAll()
void
delete()
protected void
finalize()
static long
void
This method performs the initial propagation of the
constraint.boolean
isAssignedStatusKnown
(int var_index) boolean
isPossible
(int var_index, int bin_index) boolean
isUndecided
(int var_index, int bin_index) void
oneDomain
(int var_index) void
post()
This method is called when the constraint is processed by the
solver.void
void
void
removeAllPossibleFromBin
(int bin_index) void
setAssigned
(int var_index) void
setImpossible
(int var_index, int bin_index) void
setUnassigned
(int var_index) static long
swigRelease
(Pack obj) toString()
void
Methods inherited from class com.google.ortools.constraintsolver.Constraint
getCPtr, isCastConstraint, postAndPropagate, swigRelease, var
Methods 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, unfreezeQueue
Methods 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:
finalize
in classConstraint
-
delete
public void delete()- Overrides:
delete
in 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:Constraint
This method is called when the constraint is processed by the
solver. Its main usage is to attach demons to variables.- Overrides:
post
in classConstraint
-
clearAll
public void clearAll() -
propagateDelayed
public void propagateDelayed() -
initialPropagate
public void initialPropagate()Description copied from class:Constraint
This method performs the initial propagation of the
constraint. It is called just after the post.- Overrides:
initialPropagate
in classConstraint
-
propagate
public void propagate() -
oneDomain
public void oneDomain(int var_index) -
toString
- Overrides:
toString
in 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:Constraint
Accepts the given visitor.- Overrides:
accept
in classConstraint
-