FRAMES NO FRAMES

Class IlcBox

Definition file: ilsolver/ilcbox.h
Include file: <ilsolver/ilosolver.h>

Instances of the class IlcBox are multidimensional boxes that appear in multidimensional placement problems. To solve packing or placement problems, you may need to be able to place boxes within a given container. In such a situation, both the boxes to place and the container to hold them are instances of the class IlcBox.

To specify the containment constraint that a given container holds a given box, use the member function IlcBox::contains.

Backtracking and Reversibility

All the member functions and operators defined for this class and capable of modifying constrained variables are reversible. In particular, the changes made by constraint-posting functions are made with reversible assignments. Thus the value of the domain, and the constraints posted on any constrained variable are restored when Solver backtracks.

For more information, see IloBox.

See Also:

Constructor and Destructor Summary
public IlcBox(IlcInt dimensions, IlcIntVarArray origin, IlcIntArray size)
Method Summary
public IlcConstraintcontains(IlcBox box)
public IlcBooldoesNotOverlapInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)
public IlcBooldoesOverlapInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)
public IlcBooldoesPrecedeInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)
public IlcIntgetDimensions()
public IlcBoxI *getImpl() const
public IlcConstraintgetNotOverlapConstraint()
public IlcAnygetObject() const
public IlcIntVargetOrigin(IlcInt dimension)
public IlcIntgetSize(IlcInt dimension)
public IloSolvergetSolver() const
public IlcBoolisContained(IlcBox box)
public IlcConstraintnotOverlapInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)
public IlcBoolnotOverlapInDimensionKnown(IlcBox box1, IlcBox box2, IlcInt dimension)
public IlcConstraintoverlapInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)
public IlcBooloverlapInDimensionKnown(IlcBox box1, IlcBox box2, IlcInt dimension)
public IlcConstraintprecedenceInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)
public IlcBoolprecedenceInDimensionKnown(IlcBox box1, IlcBox box2, IlcInt dimension)
public voidsetObject(IlcAny object)
Inherited Methods from IlcConstraint
getImpl, getName, getObject, getParentDemon, getSolver, isFalse, isTrue, setName, setObject
Inherited Methods from IlcDemon
getConstraint, getImpl, getSolver, operator=
Constructor and Destructor Detail

IlcBox

public IlcBox(IlcInt dimensions, IlcIntVarArray origin, IlcIntArray size)

This constructor creates a box according to the specifications passed in the parameters. The parameter dimensions indicates the number of dimensions the box has. The arrays origin and size must contain the same number of elements as the number of dimensions of the box. In dimension i, the box extends from origin[i] to origin[i] + size[i]. For example, the statement

 IlcBox(2,IlcIntVarArray(s,2,IlcIntVar(s,3,3),IlcIntVar(s,0,0)), IlcIntArray(s,2,8,4));

creates a box as shown in the illustration below.


Method Detail

contains

public IlcConstraint contains(IlcBox box)

This member function creates a constraint that requires the invoking box to contain box. The parameter box should have the same number of dimensions as the invoking box.

This member function is reversible. That is, if a failure causes Solver to backtrack to an earlier choice point, the effect of the contains statement is undone automatically.


doesNotOverlapInDimension

public IlcBool doesNotOverlapInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)

This member function returns IlcTrue if the corresponding notOverlapInDimension constraint is verified. Otherwise, it returns IlcFalse.


doesOverlapInDimension

public IlcBool doesOverlapInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)

This member function returns IlcTrue if the corresponding overlapInDimension constraint is verified. Otherwise, it returns IlcFalse.


doesPrecedeInDimension

public IlcBool doesPrecedeInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)

This member function returns IlcTrue if the corresponding precedenceInDimension constraint is verified. Otherwise, it returns IlcFalse.


getDimensions

public IlcInt getDimensions()

This member function returns the number of dimensions of the invoking box.


getImpl

public IlcBoxI * getImpl() const

This member function returns the implementation object of the invoking object. You can use this member function to check whether a constraint is empty.


getNotOverlapConstraint

public IlcConstraint getNotOverlapConstraint()

This member function returns a constraint that specifies that none of the boxes contained in the invoking box can overlap simultaneously along all of their dimensions.

The filter level of this constraint can be set using IloSolver::setFilterLevel. Currently two filter levels are allowed, IlcLow, the default, and IlcBasic, which is slower but propagates more. You can specify the default filter level of this constraint using the method IloSolver::setDefaultFilterLevel.


getObject

public IlcAny getObject() const

This member function returns the object associated with the invoking box.


getOrigin

public IlcIntVar getOrigin(IlcInt dimension)

This member function returns the origin of the invoking box along dimension dimension.


getSize

public IlcInt getSize(IlcInt dimension)

This member function returns the length of the invoking box along dimension dimension.


getSolver

public IloSolver getSolver() const

This member function returns the solver associated with the invoking box.


isContained

public IlcBool isContained(IlcBox box)

This member function returns IlcTrue if the invoking box object is contained in box. Otherwise, it returns IlcFalse.


notOverlapInDimension

public IlcConstraint notOverlapInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)

This member function specifies the constraint that if box1 and box2 are contained in the invoking box, then box1 and box2 must not overlap along dimension dimension.


notOverlapInDimensionKnown

public IlcBool notOverlapInDimensionKnown(IlcBox box1, IlcBox box2, IlcInt dimension)

This member function returns IlcTrue if the truth value of the corresponding notOverlapInDimension constraint is known. Otherwise, it returns IlcFalse.


overlapInDimension

public IlcConstraint overlapInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)

This member function specifies the constraint that if box1 and box2 are contained in the invoking box, then box1 and box2 must overlap along dimension dimension.


overlapInDimensionKnown

public IlcBool overlapInDimensionKnown(IlcBox box1, IlcBox box2, IlcInt dimension)

This member function returns IlcTrue if the truth value of the corresponding overlapInDimension constraint is known. Otherwise, it returns IlcFalse.


precedenceInDimension

public IlcConstraint precedenceInDimension(IlcBox box1, IlcBox box2, IlcInt dimension)

This member function specifies the constraint that if box1 and box2 are contained in the invoking box, then box1 must precede box2 in dimension.


precedenceInDimensionKnown

public IlcBool precedenceInDimensionKnown(IlcBox box1, IlcBox box2, IlcInt dimension)

This member function returns IlcTrue if the truth value of the corresponding precedenceInDimension constraint is known. Otherwise, it returns IlcFalse.


setObject

public void setObject(IlcAny object)

This member function sets the object associated with the invoking box to object.