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
-
public class Diffn extends Nooverlap
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.8
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDiffn.Event
-
Field Summary
Fields Modifier and Type Field Description private static booleandebugprivate static booleandebugNarr(package private) java.util.Comparator<Diffn.Event>eventComparator(package private) static intprofileAdd(package private) static intprofileSubtract(package private) static intpruneEnd(package private) static intpruneStart-
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
Constructors Constructor Description Diffn(java.util.List<? extends java.util.List<? extends IntVar>> rectangles)It specifies a diffn constraint.Diffn(java.util.List<? extends java.util.List<? extends IntVar>> rectangles, boolean strict)It specifies a diffn constraint.Diffn(java.util.List<? extends IntVar> o1, java.util.List<? extends IntVar> o2, java.util.List<? extends IntVar> l1, java.util.List<? extends IntVar> l2)It constructs a diff constraint.Diffn(java.util.List<? extends IntVar> o1, java.util.List<? extends IntVar> o2, java.util.List<? extends IntVar> l1, java.util.List<? extends IntVar> l2, boolean strict)It constructs a diff constraint.Diffn(IntVar[][] rectangles)It specifies a diff constraint.Diffn(IntVar[][] rectangles, boolean strict)It specifies a diff constraint.Diffn(IntVar[] origin1, IntVar[] origin2, IntVar[] length1, IntVar[] length2)It constructs a diff constraint.Diffn(IntVar[] origin1, IntVar[] origin2, IntVar[] length1, IntVar[] length2, boolean strict)It constructs a diff constraint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidareaCheck()private booleanblocking(java.util.List<Interval> sweepLine, int start, int end, int length)voidconsistency(Store store)It is a (most probably incomplete) consistency function which removes the values from variables domains.private voidprofile()private voidsweepPruning(Rectangle r, java.util.BitSet o, int dim)java.lang.StringtoString()It produces a string representation of a constraint state.private voidupdateSweepLine(java.util.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, decompose, getConsistencyPruningEvent, getGuideConstraint, getGuideValue, getGuideVariable, grounded, grounded, id, impose, imposeDecomposition, increaseWeight, intArrayToString, numberArgs, queueVariable, removeConstraint, requiresMonotonicity, setConsistencyPruningEvent, setConstraintScope, setScope, setScope, setScope, setScope, setScope, setWatchedVariableGrounded, supplyGuideFeedback, updateAFC, watchedVariableGrounded
-
Methods inherited from class org.jacop.constraints.DecomposedConstraint
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
-
-
-
-
Field Detail
-
debug
private static final boolean debug
- See Also:
- Constant Field Values
-
debugNarr
private static final boolean debugNarr
- See Also:
- Constant Field Values
-
eventComparator
java.util.Comparator<Diffn.Event> eventComparator
-
profileSubtract
static final int profileSubtract
- See Also:
- Constant Field Values
-
profileAdd
static final int profileAdd
- See Also:
- Constant Field Values
-
pruneStart
static final int pruneStart
- See Also:
- Constant Field Values
-
pruneEnd
static final int pruneEnd
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Diffn
public Diffn(IntVar[][] rectangles)
It specifies a diff constraint.- Parameters:
rectangles- list of rectangles which can not overlap in at least one dimension.
-
Diffn
public Diffn(IntVar[][] rectangles, boolean strict)
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
public Diffn(IntVar[] origin1, IntVar[] origin2, IntVar[] length1, IntVar[] length2)
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
public Diffn(java.util.List<? extends java.util.List<? extends IntVar>> rectangles)
It specifies a diffn constraint.- Parameters:
rectangles- list of rectangles which can not overlap in at least one dimension.
-
Diffn
public Diffn(java.util.List<? extends java.util.List<? extends IntVar>> rectangles, boolean strict)
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(java.util.List<? extends IntVar> o1, java.util.List<? extends IntVar> o2, java.util.List<? extends IntVar> l1, java.util.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(java.util.List<? extends IntVar> o1, java.util.List<? extends IntVar> o2, java.util.List<? extends IntVar> l1, java.util.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 Detail
-
consistency
public void consistency(Store store)
Description copied from class:ConstraintIt 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:
consistencyin classNooverlap- Parameters:
store- constraint store within which the constraint consistency is being checked.
-
areaCheck
private void areaCheck()
-
profile
private void profile()
-
sweepPruning
private void sweepPruning(Rectangle r, java.util.BitSet o, int dim)
-
updateSweepLine
private void updateSweepLine(java.util.List<Interval> sweepLine, Diffn.Event e)
-
blocking
private boolean blocking(java.util.List<Interval> sweepLine, int start, int end, int length)
-
toString
public java.lang.String toString()
Description copied from class:ConstraintIt produces a string representation of a constraint state.
-
-