Package org.jacop.constraints.diffn
Class Diffn
java.lang.Object
org.jacop.constraints.DecomposedConstraint<Constraint>
org.jacop.constraints.Constraint
org.jacop.constraints.diffn.Nooverlap
org.jacop.constraints.diffn.Diffn
Diffn constraint assures that any two rectangles from a vector of rectangles
does not overlap in at least one direction. It is a simple implementation which
does not use sophisticated techniques for efficient backtracking.
- Version:
- 4.9
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List
<Constraint> private static final boolean
private static final boolean
(package private) Comparator
<Diffn.Event> (package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
Fields inherited from class org.jacop.constraints.diffn.Nooverlap
doAreaCheck, idNumber, overlapping, rectangle, stamp, store, strict, trace, traceNarr, x, y
Fields inherited from class org.jacop.constraints.Constraint
atomicExecution, consistencyPruningEvents, constraintScope, earlyTerminationOK, increaseWeight, numberId, scope
Fields inherited from class org.jacop.constraints.DecomposedConstraint
queueIndex
-
Constructor Summary
ConstructorsConstructorDescriptionIt specifies a diffn constraint.It specifies a diffn constraint.Diffn
(List<? extends IntVar> o1, List<? extends IntVar> o2, List<? extends IntVar> l1, List<? extends IntVar> l2) It constructs a diff constraint.Diffn
(List<? extends IntVar> o1, List<? extends IntVar> o2, List<? extends IntVar> l1, List<? extends IntVar> l2, boolean strict) It constructs a diff constraint.It specifies a diff constraint.It specifies a diff constraint.It constructs a diff constraint.It constructs a diff constraint. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private boolean
void
consistency
(Store store) It is a (most probably incomplete) consistency function which removes the values from variables domains.It returns an array list of constraint which are used to decompose this constraint.void
imposeDecomposition
(Store store) It imposes DiffnDecomposed in a given store.private void
profile()
private void
sweepPruning
(Rectangle r, BitSet o, int dim) toString()
It produces a string representation of a constraint state.private void
updateSweepLine
(List<Interval> sweepLine, Diffn.Event e) Methods inherited from class org.jacop.constraints.diffn.Nooverlap
energyCheck, getDefaultConsistencyPruningEvent, impose, notSatisfied, prune, pruning, satisfied
Methods inherited from class org.jacop.constraints.Constraint
afc, arguments, cleanAfterFailure, getConsistencyPruningEvent, getGuideConstraint, getGuideValue, getGuideVariable, grounded, grounded, id, impose, increaseWeight, intArrayToString, long2int, numberArgs, queueVariable, removeConstraint, requiresMonotonicity, setConsistencyPruningEvent, setConstraintScope, setScope, setScope, setScope, setScope, setScope, setWatchedVariableGrounded, supplyGuideFeedback, updateAFC, watchedVariableGrounded
Methods inherited from class org.jacop.constraints.DecomposedConstraint
checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
-
Field Details
-
debug
private static final boolean debug- See Also:
-
debugNarr
private static final boolean debugNarr- See Also:
-
eventComparator
Comparator<Diffn.Event> eventComparator -
constraints
-
auxVar
-
profileSubtract
static final int profileSubtract- See Also:
-
profileAdd
static final int profileAdd- See Also:
-
pruneStart
static final int pruneStart- See Also:
-
pruneEnd
static final int pruneEnd- See Also:
-
-
Constructor Details
-
Diffn
It specifies a diff constraint.- Parameters:
rectangles
- list of rectangles which can not overlap in at least one dimension.
-
Diffn
It specifies a diff constraint.- Parameters:
rectangles
- list of rectangles which can not overlap in at least one dimension.strict
- true- zero size rectangles need to be between other rectangles; false- these rectangles can be anywhere
-
Diffn
It constructs a diff constraint.- Parameters:
origin1
- list of variables denoting origin of the rectangle in the first dimension.origin2
- list of variables denoting origin of the rectangle in the second dimension.length1
- list of variables denoting length of the rectangle in the first dimension.length2
- list of variables denoting length of the rectangle in the second dimension.
-
Diffn
public Diffn(IntVar[] origin1, IntVar[] origin2, IntVar[] length1, IntVar[] length2, boolean strict) It constructs a diff constraint.- Parameters:
origin1
- list of variables denoting origin of the rectangle in the first dimension.origin2
- list of variables denoting origin of the rectangle in the second dimension.length1
- list of variables denoting length of the rectangle in the first dimension.length2
- list of variables denoting length of the rectangle in the second dimension.strict
- true- zero size rectangles need to be between other rectangles; false- these rectangles can be anywhere
-
Diffn
It specifies a diffn constraint.- Parameters:
rectangles
- list of rectangles which can not overlap in at least one dimension.
-
Diffn
It specifies a diffn constraint.- Parameters:
rectangles
- list of rectangles which can not overlap in at least one dimension.strict
- true- zero size rectangles need to be between other rectangles; false- these rectangles can be anywhere
-
Diffn
public Diffn(List<? extends IntVar> o1, List<? extends IntVar> o2, List<? extends IntVar> l1, List<? extends IntVar> l2) It constructs a diff constraint.- Parameters:
o1
- list of variables denoting origin of the rectangle in the first dimension.o2
- list of variables denoting origin of the rectangle in the second dimension.l1
- list of variables denoting length of the rectangle in the first dimension.l2
- list of variables denoting length of the rectangle in the second dimension.
-
Diffn
public Diffn(List<? extends IntVar> o1, List<? extends IntVar> o2, List<? extends IntVar> l1, List<? extends IntVar> l2, boolean strict) It constructs a diff constraint.- Parameters:
o1
- list of variables denoting origin of the rectangle in the first dimension.o2
- list of variables denoting origin of the rectangle in the second dimension.l1
- list of variables denoting length of the rectangle in the first dimension.l2
- list of variables denoting length of the rectangle in the second dimension.strict
- true- zero size rectangles need to be between other rectangles; false- these rectangles can be anywhere
-
-
Method Details
-
consistency
Description copied from class:Constraint
It is a (most probably incomplete) consistency function which removes the values from variables domains. Only values which do not have any support in a solution space are removed.- Overrides:
consistency
in classNooverlap
- Parameters:
store
- constraint store within which the constraint consistency is being checked.
-
areaCheck
private void areaCheck() -
profile
private void profile() -
sweepPruning
-
updateSweepLine
-
blocking
-
imposeDecomposition
It imposes DiffnDecomposed in a given store.- Overrides:
imposeDecomposition
in classConstraint
- Parameters:
store
- the constraint store to which the constraint is imposed to.
-
decompose
Description copied from class:Constraint
It returns an array list of constraint which are used to decompose this constraint. It actually creates a decomposition (possibly also creating variables), but it does not impose the constraint.- Overrides:
decompose
in classConstraint
- Parameters:
store
- the constraint store in which context the decomposition takes place.- Returns:
- an array list of constraints used to decompose this constraint.
-
auxiliaryVariables
- Overrides:
auxiliaryVariables
in classDecomposedConstraint<Constraint>
- Returns:
- null if no auxiliary variables were created, otherwise a list with variables.
-
toString
Description copied from class:Constraint
It produces a string representation of a constraint state.
-