JaCoP.constraints
Class Diff2

java.lang.Object
  extended by JaCoP.constraints.DecomposedConstraint
      extended by JaCoP.constraints.Constraint
          extended by JaCoP.constraints.Diff
              extended by JaCoP.constraints.Diff2

public class Diff2
extends Diff

Diff2 constraint assures that any two rectangles from a vector of rectangles does not overlap in at least one direction.

Version:
3.1
Author:
Krzysztof Kuchcinski and Radoslaw Szymanek

Field Summary
 int[] exclusiveList
          It specifies a list of pairs of rectangles which can overlap.
static java.lang.String[] xmlAttributes
          It specifies the arguments required to be saved by an XML format as well as the constructor being called to recreate an object from an XML format.
 
Fields inherited from class JaCoP.constraints.Diff
doProfile, rectangles
 
Fields inherited from class JaCoP.constraints.Constraint
atomicExecution, consistencyPruningEvents, earlyTerminationOK, id, increaseWeight, numberArgs, numberId
 
Fields inherited from class JaCoP.constraints.DecomposedConstraint
queueIndex
 
Constructor Summary
Diff2(java.util.ArrayList<? extends java.util.ArrayList<? extends IntVar>> rectangles)
          It creates a diff2 constraint.
Diff2(java.util.ArrayList<? extends java.util.ArrayList<? extends IntVar>> rectangles, boolean profile)
          It creates a diff2 constraint.
Diff2(java.util.ArrayList<? extends IntVar> o1, java.util.ArrayList<? extends IntVar> o2, java.util.ArrayList<? extends IntVar> l1, java.util.ArrayList<? extends IntVar> l2)
          It creates a diff2 constraint.
Diff2(java.util.ArrayList<java.util.ArrayList<IntVar>> rect, java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> exclusiveList)
          Conditional Diff2.
Diff2(java.util.ArrayList<IntVar> o1, java.util.ArrayList<IntVar> o2, java.util.ArrayList<IntVar> l1, java.util.ArrayList<IntVar> l2, boolean profile)
          It creates a diff2 constraint.
Diff2(IntVar[][] rectangles)
          It creates a diff2 constraint.
Diff2(IntVar[][] rect, java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> exclusive)
          Conditional Diff2.
Diff2(IntVar[][] rectangles, boolean profile)
          It creates a diff2 constraint.
Diff2(IntVar[] o1, IntVar[] o2, IntVar[] l1, IntVar[] l2)
          It creates a diff2 constraint.
Diff2(IntVar[] o1, IntVar[] o2, IntVar[] l1, IntVar[] l2, boolean profile)
          It creates a diff2 constraint.
Diff2(Rectangle[] rectangles, int[] exclusiveList, boolean doProfile)
          Conditional Diff2.
 
Method Summary
 java.lang.String id()
          It gives the id string of a constraint.
 void impose(Store store)
          It imposes the constraint in a given store.
 boolean satisfied()
          It checks if the constraint is satisfied.
 java.lang.String toString()
          It produces a string representation of a constraint state.
 
Methods inherited from class JaCoP.constraints.Diff
arguments, consistency, getConsistencyPruningEvent, increaseWeight, queueVariable, removeConstraint, removeLevel
 
Methods inherited from class JaCoP.constraints.Constraint
cleanAfterFailure, decompose, getGuideConstraint, getGuideValue, getGuideVariable, impose, imposeDecomposition, numberArgs, removeLevelLate, requiresMonotonicity, setConsistencyPruningEvent, supplyGuideFeedback
 
Methods inherited from class JaCoP.constraints.DecomposedConstraint
auxiliaryVariables, imposeDecomposition
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

exclusiveList

public int[] exclusiveList
It specifies a list of pairs of rectangles which can overlap.


xmlAttributes

public static java.lang.String[] xmlAttributes
It specifies the arguments required to be saved by an XML format as well as the constructor being called to recreate an object from an XML format.

Constructor Detail

Diff2

public Diff2(Rectangle[] rectangles,
             int[] exclusiveList,
             boolean doProfile)
Conditional Diff2. The rectangles that are specified on the list Exclusive list is specified contains pairs of rectangles that are excluded from checking that they must be non-overlapping. The rectangles are numbered from 1, for example list [1, 3, 3, 4] specifies that rectangles 1 and 3 as well as 3 and 4 can overlap each other.

Parameters:
rectangles - a list of rectangles.
exclusiveList - a list denoting the pair of rectangles, which can overlap
doProfile - should profile be computed and used.

Diff2

public Diff2(java.util.ArrayList<IntVar> o1,
             java.util.ArrayList<IntVar> o2,
             java.util.ArrayList<IntVar> l1,
             java.util.ArrayList<IntVar> l2,
             boolean profile)
It creates a diff2 constraint.

Parameters:
o1 - list of variables denoting the origin in the first dimension.
o2 - list of variables denoting the origin in the second dimension.
l1 - list of variables denoting the length in the first dimension.
l2 - list of variables denoting the length in the second dimension.
profile - specifies if the profile should be computed.

Diff2

public Diff2(java.util.ArrayList<? extends java.util.ArrayList<? extends IntVar>> rectangles)
It creates a diff2 constraint.

Parameters:
rectangles - list of rectangles with origins and lengths in both dimensions.

Diff2

public Diff2(java.util.ArrayList<? extends java.util.ArrayList<? extends IntVar>> rectangles,
             boolean profile)
It creates a diff2 constraint.

Parameters:
rectangles - list of rectangles with origins and lengths in both dimensions.
profile - specifies if the profile is computed and used.

Diff2

public Diff2(java.util.ArrayList<? extends IntVar> o1,
             java.util.ArrayList<? extends IntVar> o2,
             java.util.ArrayList<? extends IntVar> l1,
             java.util.ArrayList<? extends IntVar> l2)
It creates a diff2 constraint.

Parameters:
o1 - list of variables denoting the origin in the first dimension.
o2 - list of variables denoting the origin in the second dimension.
l1 - list of variables denoting the length in the first dimension.
l2 - list of variables denoting the length in the second dimension.

Diff2

public Diff2(IntVar[] o1,
             IntVar[] o2,
             IntVar[] l1,
             IntVar[] l2)
It creates a diff2 constraint.

Parameters:
o1 - list of variables denoting the origin in the first dimension.
o2 - list of variables denoting the origin in the second dimension.
l1 - list of variables denoting the length in the first dimension.
l2 - list of variables denoting the length in the second dimension.

Diff2

public Diff2(IntVar[] o1,
             IntVar[] o2,
             IntVar[] l1,
             IntVar[] l2,
             boolean profile)
It creates a diff2 constraint.

Parameters:
o1 - list of variables denoting the origin in the first dimension.
o2 - list of variables denoting the origin in the second dimension.
l1 - list of variables denoting the length in the first dimension.
l2 - list of variables denoting the length in the second dimension.
profile - specifies if the profile should be computed.

Diff2

public Diff2(IntVar[][] rectangles)
It creates a diff2 constraint.

Parameters:
rectangles - list of rectangles with origins and lengths in both dimensions.

Diff2

public Diff2(IntVar[][] rectangles,
             boolean profile)
It creates a diff2 constraint.

Parameters:
rectangles - list of rectangles with origins and lengths in both dimensions.
profile - specifies if the profile is computed and used.

Diff2

public Diff2(java.util.ArrayList<java.util.ArrayList<IntVar>> rect,
             java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> exclusiveList)
Conditional Diff2. The rectangles that are specified on the list Exclusive are excluded from checking that they must be non-overlapping. The rectangles are numbered from 1, for example list [[1,3], [3,4]] specifies that rectangles 1 and 3 as well as 3 and 4 can overlap each other.

Parameters:
rect - - list of rectangles, each rectangle represented by a list of variables.
exclusiveList - - list of rectangles pairs which can overlap.

Diff2

public Diff2(IntVar[][] rect,
             java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> exclusive)
Conditional Diff2. The rectangles that are specified on the list Exclusive are excluded from checking that they must be non-overlapping. The rectangles are numbered from 1, for example list [[1,3], [3,4]] specifies that rectangles 1 and 3 as well as 3 and 4 can overlap each other.

Parameters:
rect - - list of rectangles, each rectangle represented by a list of variables.
exclusive - - list of rectangles pairs which can overlap.
Method Detail

impose

public void impose(Store store)
Description copied from class: Constraint
It imposes the constraint in a given store.

Overrides:
impose in class Diff
Parameters:
store - the constraint store to which the constraint is imposed to.

satisfied

public boolean satisfied()
Description copied from class: Constraint
It checks if the constraint is satisfied. If this function is incorrectly implemented a constraint may not be satisfied in a solution.

Overrides:
satisfied in class Diff
Returns:
true if the constraint is for certain satisfied, false otherwise.

id

public java.lang.String id()
Description copied from class: Constraint
It gives the id string of a constraint.

Overrides:
id in class Diff
Returns:
string id of the constraint.

toString

public java.lang.String toString()
Description copied from class: Constraint
It produces a string representation of a constraint state.

Overrides:
toString in class Diff