Java Reference

Java Reference

Pack

Detailed Description

Definition at line 18 of file Pack.java.

Public Member Functions

synchronized void delete ()
 
 Pack (Solver s, IntVar[] vars, int number_of_bins)
 
void addWeightedSumLessOrEqualConstantDimension (long[] weights, long[] bounds)
 Dimensions are additional constraints than can restrict what is possible with the pack constraint. More...
 
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]'. More...
 
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]'. More...
 
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]. More...
 
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]. More...
 
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. More...
 
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. More...
 
void addCountUsedBinDimension (IntVar count_var)
 This dimension links 'count_var' to the actual number of bins used in the pack. More...
 
void addCountAssignedItemsDimension (IntVar count_var)
 This dimension links 'count_var' to the actual number of items assigned to a bin in the pack. More...
 
void post ()
 This method is called when the constraint is processed by the solver. More...
 
void clearAll ()
 
void propagateDelayed ()
 
void initialPropagate ()
 This method performs the initial propagation of the constraint. More...
 
void propagate ()
 
void oneDomain (int var_index)
 
String toString ()
 
boolean isUndecided (int var_index, int bin_index)
 
void setImpossible (int var_index, int bin_index)
 
void assign (int var_index, int bin_index)
 
boolean isAssignedStatusKnown (int var_index)
 
boolean isPossible (int var_index, int bin_index)
 
IntVar assignVar (int var_index, int bin_index)
 
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)
 Accepts the given visitor. More...
 
void postAndPropagate ()
 Calls Post and then Propagate to initialize the constraints. More...
 
boolean isCastConstraint ()
 Is the constraint created by a cast from expression to integer variable? More...
 
IntVar var ()
 Creates a Boolean variable representing the status of the constraint (false = constraint is violated, true = constraint is satisfied). More...
 
Solver solver ()
 
void freezeQueue ()
 This method freezes the propagation queue. More...
 
void unfreezeQueue ()
 This method unfreezes the propagation queue. More...
 
void enqueueDelayedDemon (Demon d)
 This method pushes the demon onto the propagation queue. More...
 
void enqueueVar (Demon d)
 
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...
 
String name ()
 Object naming. More...
 
void setName (String name)
 
boolean hasName ()
 Returns whether the object has been named or not. More...
 
String baseName ()
 Returns a base name for automatic naming. More...
 

Protected Member Functions

 Pack (long cPtr, boolean cMemoryOwn)
 

Constructor & Destructor Documentation

◆ Pack() [1/2]

Pack ( long  cPtr,
boolean  cMemoryOwn 
)
inlineprotected

Definition at line 21 of file Pack.java.

◆ Pack() [2/2]

Pack ( Solver  s,
IntVar[]  vars,
int  number_of_bins 
)
inline

Definition at line 46 of file Pack.java.

Member Function Documentation

◆ accept()

void accept ( ModelVisitor  visitor)
inline

Accepts the given visitor.

Reimplemented from Constraint.

Definition at line 194 of file Pack.java.

◆ addCountAssignedItemsDimension()

void addCountAssignedItemsDimension ( IntVar  count_var)
inline

This dimension links 'count_var' to the actual number of items assigned to a bin in the pack.

Definition at line 109 of file Pack.java.

◆ addCountUsedBinDimension()

void addCountUsedBinDimension ( IntVar  count_var)
inline

This dimension links 'count_var' to the actual number of bins used in the pack.

Definition at line 102 of file Pack.java.

◆ addSumVariableWeightsLessOrEqualConstantDimension()

void addSumVariableWeightsLessOrEqualConstantDimension ( IntVar[]  usage,
long[]  capacity 
)
inline

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.

Definition at line 88 of file Pack.java.

◆ addWeightedSumEqualVarDimension() [1/2]

void addWeightedSumEqualVarDimension ( long[]  weights,
IntVar[]  loads 
)
inline

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].

Definition at line 74 of file Pack.java.

◆ addWeightedSumEqualVarDimension() [2/2]

void addWeightedSumEqualVarDimension ( LongBinaryOperator  weights,
IntVar[]  loads 
)
inline

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].

Definition at line 81 of file Pack.java.

◆ addWeightedSumLessOrEqualConstantDimension() [1/3]

void addWeightedSumLessOrEqualConstantDimension ( long[]  weights,
long[]  bounds 
)
inline

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]'.

Definition at line 53 of file Pack.java.

◆ addWeightedSumLessOrEqualConstantDimension() [2/3]

void addWeightedSumLessOrEqualConstantDimension ( LongBinaryOperator  weights,
long[]  bounds 
)
inline

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.

Definition at line 67 of file Pack.java.

◆ addWeightedSumLessOrEqualConstantDimension() [3/3]

void addWeightedSumLessOrEqualConstantDimension ( LongUnaryOperator  weights,
long[]  bounds 
)
inline

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.

Definition at line 60 of file Pack.java.

◆ addWeightedSumOfAssignedDimension()

void addWeightedSumOfAssignedDimension ( long[]  weights,
IntVar  cost_var 
)
inline

This dimension enforces that cost_var == sum of weights[i] for all objects 'i' assigned to a bin.

Definition at line 95 of file Pack.java.

◆ assign()

void assign ( int  var_index,
int  bin_index 
)
inline

Definition at line 149 of file Pack.java.

◆ assignAllPossibleToBin()

void assignAllPossibleToBin ( int  bin_index)
inline

Definition at line 178 of file Pack.java.

◆ assignAllRemainingItems()

void assignAllRemainingItems ( )
inline

Definition at line 186 of file Pack.java.

◆ assignFirstPossibleToBin()

void assignFirstPossibleToBin ( int  bin_index)
inline

Definition at line 182 of file Pack.java.

◆ assignVar()

IntVar assignVar ( int  var_index,
int  bin_index 
)
inline

Definition at line 161 of file Pack.java.

◆ baseName()

String baseName ( )
inlineinherited

Returns a base name for automatic naming.

Reimplemented in BooleanVar.

Definition at line 115 of file PropagationBaseObject.java.

◆ clearAll()

void clearAll ( )
inline

Definition at line 117 of file Pack.java.

◆ delete()

synchronized void delete ( )
inline

Reimplemented from Constraint.

Definition at line 35 of file Pack.java.

◆ enqueueDelayedDemon()

void enqueueDelayedDemon ( Demon  d)
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 72 of file PropagationBaseObject.java.

◆ enqueueVar()

void enqueueVar ( Demon  d)
inlineinherited

Definition at line 76 of file PropagationBaseObject.java.

◆ freezeQueue()

void freezeQueue ( )
inlineinherited

This method freezes the propagation queue.

It is useful when you need to apply multiple modifications at once.

Definition at line 58 of file PropagationBaseObject.java.

◆ hasName()

boolean hasName ( )
inlineinherited

Returns whether the object has been named or not.

Definition at line 108 of file PropagationBaseObject.java.

◆ initialPropagate()

void initialPropagate ( )
inline

This method performs the initial propagation of the constraint.

It is called just after the post.

Reimplemented from Constraint.

Definition at line 125 of file Pack.java.

◆ isAssignedStatusKnown()

boolean isAssignedStatusKnown ( int  var_index)
inline

Definition at line 153 of file Pack.java.

◆ isCastConstraint()

boolean isCastConstraint ( )
inlineinherited

Is the constraint created by a cast from expression to integer variable?

Definition at line 77 of file gen/java/com/google/ortools/constraintsolver/Constraint.java.

◆ isPossible()

boolean isPossible ( int  var_index,
int  bin_index 
)
inline

Definition at line 157 of file Pack.java.

◆ isUndecided()

boolean isUndecided ( int  var_index,
int  bin_index 
)
inline

Definition at line 141 of file Pack.java.

◆ name()

String name ( )
inlineinherited

Object naming.

Definition at line 97 of file PropagationBaseObject.java.

◆ oneDomain()

void oneDomain ( int  var_index)
inline

Definition at line 133 of file Pack.java.

◆ post()

void post ( )
inline

This method is called when the constraint is processed by the solver.

Its main usage is to attach demons to variables.

Reimplemented from Constraint.

Definition at line 113 of file Pack.java.

◆ postAndPropagate()

void postAndPropagate ( )
inlineinherited

Calls Post and then Propagate to initialize the constraints.

This is usually done in the root node.

Definition at line 63 of file gen/java/com/google/ortools/constraintsolver/Constraint.java.

◆ propagate()

void propagate ( )
inline

Definition at line 129 of file Pack.java.

◆ propagateDelayed()

void propagateDelayed ( )
inline

Definition at line 121 of file Pack.java.

◆ removeAllPossibleFromBin()

void removeAllPossibleFromBin ( int  bin_index)
inline

Definition at line 174 of file Pack.java.

◆ reset_action_on_fail()

void reset_action_on_fail ( )
inlineinherited

This method clears the failure callback.

Definition at line 83 of file PropagationBaseObject.java.

◆ set_variable_to_clean_on_fail()

void set_variable_to_clean_on_fail ( IntVar  v)
inlineinherited

Shortcut for variable cleaner.

Definition at line 90 of file PropagationBaseObject.java.

◆ setAssigned()

void setAssigned ( int  var_index)
inline

Definition at line 166 of file Pack.java.

◆ setImpossible()

void setImpossible ( int  var_index,
int  bin_index 
)
inline

Definition at line 145 of file Pack.java.

◆ setName()

void setName ( String  name)
inlineinherited

Definition at line 101 of file PropagationBaseObject.java.

◆ setUnassigned()

void setUnassigned ( int  var_index)
inline

Definition at line 170 of file Pack.java.

◆ solver()

Solver solver ( )
inlineinherited

Definition at line 50 of file PropagationBaseObject.java.

◆ toString()

String toString ( )
inline

Reimplemented from Constraint.

Definition at line 137 of file Pack.java.

◆ unassignAllRemainingItems()

void unassignAllRemainingItems ( )
inline

Definition at line 190 of file Pack.java.

◆ unfreezeQueue()

void unfreezeQueue ( )
inlineinherited

This method unfreezes the propagation queue.

All modifications that happened when the queue was frozen will be processed.

Definition at line 65 of file PropagationBaseObject.java.

◆ var()

IntVar var ( )
inlineinherited

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.

Definition at line 84 of file gen/java/com/google/ortools/constraintsolver/Constraint.java.


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