Package org.jacop.constraints
Class DisjointConditional
- java.lang.Object
-
- org.jacop.constraints.DecomposedConstraint<Constraint>
-
- org.jacop.constraints.Constraint
-
- org.jacop.constraints.Diff
-
- org.jacop.constraints.DisjointConditional
-
- All Implemented Interfaces:
SatisfiedPresent
,Stateful
,UsesQueueVariable
public class DisjointConditional extends Diff
DisjointConditional constraint assures that any two rectangles from a vector of rectangles does not overlap in at least one direction. The execption from this rule is specified on the list of tuple [recti, rectj, C], where recti and rectj are integers representing given rectangles positions on the list of rectangles (starting from 1) and C is FDV 0..1. When C=1 then rectnagles must not overlap otherwise the overlaping is not checked.- Version:
- 4.7
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<? extends IntVar>[]
condVariables
(package private) DisjointCondVar[]
evalRects
ExclusiveList
exclusionList
It specifies what rectangles can conditionally overlap.(package private) static java.util.concurrent.atomic.AtomicInteger
idNumber
(package private) static boolean
trace
(package private) static boolean
traceNarr
-
Fields inherited from class org.jacop.constraints.Diff
currentStore, dimIthMinComparator, doProfile, rectangles, stamp, variableQueue
-
Fields inherited from class org.jacop.constraints.Constraint
afcWeight, atomicExecution, consistencyPruningEvents, constraintScope, earlyTerminationOK, increaseWeight, numberId, scope, watchedVariableGrounded
-
Fields inherited from class org.jacop.constraints.DecomposedConstraint
queueIndex
-
-
Constructor Summary
Constructors Constructor Description DisjointConditional(java.util.List<? extends IntVar> o1, java.util.List<? extends IntVar> o2, java.util.List<? extends IntVar> l1, java.util.List<? extends IntVar> l2, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition)
It constructs a disjoint conditional constraint.DisjointConditional(java.util.List<? extends IntVar> o1, java.util.List<? extends IntVar> o2, java.util.List<? extends IntVar> l1, java.util.List<? extends IntVar> l2, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition, boolean profile)
It constructs a disjoint conditional constraint.DisjointConditional(java.util.List<java.util.List<? extends IntVar>> rectangles, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition)
It creates Disjoint conditional constraint.DisjointConditional(java.util.List<java.util.List<? extends IntVar>> rectangles, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition, boolean profile)
It creates Disjoint conditional constraint.DisjointConditional(Rectangle[] rectangles, ExclusiveList exclusionList, boolean doProfile)
It specifies a diff constraint.DisjointConditional(IntVar[][] rectangles, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition)
It creates Disjoint conditional constraint.DisjointConditional(IntVar[][] rectangles, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition, boolean profile)
It creates Disjoint conditional constraint.DisjointConditional(IntVar[] origin1, IntVar[] origin2, IntVar[] length1, IntVar[] length2, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition)
It constructs a disjoint conditional constraint.DisjointConditional(IntVar[] o1, IntVar[] o2, IntVar[] l1, IntVar[] l2, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition, boolean profile)
It constructs a disjoint conditional constraint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) boolean
checkRect(RectangleWithCondition r)
(package private) boolean
conditionChanged(java.util.Set<IntVar> fdvQueue, int j)
(package private) boolean
doesNotFit(int j, Rectangle r, Profile barrier)
(package private) int
findMaxLength(int i, int length, Rectangle r)
(package private) boolean
findRectangles(Rectangle r, int index, java.util.List<IntRectangle> UsedRect, java.util.List<RectangleWithCondition> ProfileCandidates, java.util.List<RectangleWithCondition> OverlappingRects, java.util.Set<IntVar> fdvQueue)
void
impose(Store store)
It imposes the constraint in a given store.(package private) Interval
minForbiddenInterval(int start, int i, Rectangle r, java.util.List<IntRectangle> ConsideredRect, int minI)
(package private) void
narrowIthCondition(int i, Rectangle r, java.util.List<IntRectangle> UsedRect, java.util.List<RectangleWithCondition> ProfileCandidates)
(package private) void
narrowRectangleCondition(Rectangle r, java.util.List<IntRectangle> UsedRect, java.util.List<RectangleWithCondition> ProfileCandidates)
(package private) void
narrowRectangles(java.util.Set<IntVar> fdvQueue)
(package private) boolean
notFit(int i, Rectangle r, java.util.List<IntRectangle> ConsideredRect)
(package private) void
profileCheckInterval(Store store, DisjointConditionalProfile Profile, int limit, IntVar Start, IntVar Duration, int _min, int _max, IntVar Resources)
(package private) void
profileCheckRectangle(DisjointConditionalProfile Profile, Rectangle r, int i, int j)
(package private) void
profileNarrowingCondition(int i, Rectangle r, java.util.List<RectangleWithCondition> ProfileCandidates)
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 org.jacop.constraints.Diff
consistency, containsChangedVariable, getDefaultConsistencyPruningEvent, getRectangles, intervalOverlap, narrowRectangle, profileCheckRectangle, profileNarrowing, queueVariable, removeLevel
-
Methods inherited from class org.jacop.constraints.Constraint
afc, arguments, cleanAfterFailure, decompose, getConsistencyPruningEvent, getGuideConstraint, getGuideValue, getGuideVariable, grounded, grounded, id, impose, imposeDecomposition, increaseWeight, intArrayToString, long2int, numberArgs, removeConstraint, requiresMonotonicity, setConsistencyPruningEvent, setConstraintScope, setScope, setScope, setScope, setScope, setScope, setWatchedVariableGrounded, supplyGuideFeedback, toInt, toInt, updateAFC, watchedVariableGrounded
-
Methods inherited from class org.jacop.constraints.DecomposedConstraint
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jacop.api.Stateful
isStateful
-
-
-
-
Field Detail
-
idNumber
static java.util.concurrent.atomic.AtomicInteger idNumber
-
trace
static final boolean trace
- See Also:
- Constant Field Values
-
traceNarr
static final boolean traceNarr
- See Also:
- Constant Field Values
-
condVariables
java.util.List<? extends IntVar>[] condVariables
-
evalRects
DisjointCondVar[] evalRects
-
exclusionList
public ExclusiveList exclusionList
It specifies what rectangles can conditionally overlap.
-
-
Constructor Detail
-
DisjointConditional
public DisjointConditional(Rectangle[] rectangles, ExclusiveList exclusionList, boolean doProfile)
It specifies a diff constraint.- Parameters:
rectangles
- list of rectangles which can not overlap in at least one dimension.exclusionList
- it is a list of exclusive items. Each item consists of two ints and a variable.doProfile
- should the constraint compute and use the profile functionality.
-
DisjointConditional
public DisjointConditional(java.util.List<java.util.List<? extends IntVar>> rectangles, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition)
It creates Disjoint conditional constraint.- Parameters:
rectangles
- the rectangles within a constraint.exceptionIndices
- a list of pairs of conditionally overlaping rectangles.exceptionCondition
- a variable specifying if a corresponding pair is nonoverlapping.
-
DisjointConditional
public DisjointConditional(java.util.List<java.util.List<? extends IntVar>> rectangles, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition, boolean profile)
It creates Disjoint conditional constraint.- Parameters:
rectangles
- the rectangles within a constraint.exceptionIndices
- it specifies a list of pairs, where each pair specifies two rectangles which conditionally overlap.exceptionCondition
- a variable specifying if a corresponding pair is nonoverlapping.profile
- it specifies if the profiles are used and computed within the constraint.
-
DisjointConditional
public DisjointConditional(java.util.List<? extends IntVar> o1, java.util.List<? extends IntVar> o2, java.util.List<? extends IntVar> l1, java.util.List<? extends IntVar> l2, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition)
It constructs a disjoint conditional constraint.- Parameters:
o1
- variables specifying the origin in the first dimension.o2
- variables specifying the origin in the second dimension.l1
- variables specifying the length in the first dimension.l2
- variables specifying the length in the second dimension.exceptionIndices
- it specifies a list of pairs, where each pair specifies two rectangles which conditionally overlap.exceptionCondition
- a variable specifying if a corresponding pair is nonoverlapping.
-
DisjointConditional
public DisjointConditional(java.util.List<? extends IntVar> o1, java.util.List<? extends IntVar> o2, java.util.List<? extends IntVar> l1, java.util.List<? extends IntVar> l2, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition, boolean profile)
It constructs a disjoint conditional constraint.- Parameters:
o1
- variables specifying the origin in the first dimension.o2
- variables specifying the origin in the second dimension.l1
- variables specifying the length in the first dimension.l2
- variables specifying the length in the second dimension.exceptionIndices
- it specifies a list of pairs, where each pair specifies two rectangles which conditionally overlap.exceptionCondition
- a variable specifying if a corresponding pair is nonoverlapping.profile
- it specifies if the profiles are being computed and used within a constraint.
-
DisjointConditional
public DisjointConditional(IntVar[] origin1, IntVar[] origin2, IntVar[] length1, IntVar[] length2, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition)
It constructs a disjoint conditional constraint.- Parameters:
origin1
- variables specifying the origin in the first dimension.origin2
- variables specifying the origin in the second dimension.length1
- variables specifying the length in the first dimension.length2
- variables specifying the length in the second dimension.exceptionIndices
- it specifies a list of pairs, where each pair specifies two rectangles which conditionally overlap.exceptionCondition
- a variable specifying if a corresponding pair is nonoverlapping.
-
DisjointConditional
public DisjointConditional(IntVar[] o1, IntVar[] o2, IntVar[] l1, IntVar[] l2, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition, boolean profile)
It constructs a disjoint conditional constraint.- Parameters:
o1
- variables specifying the origin in the first dimension.o2
- variables specifying the origin in the second dimension.l1
- variables specifying the length in the first dimension.l2
- variables specifying the length in the second dimension.exceptionIndices
- list of rectangles that may not be consideredexceptionCondition
- conditions for rectangles that may not be consideredprofile
- it specifies if the profiles are being used and computed within that constraint.
-
DisjointConditional
public DisjointConditional(IntVar[][] rectangles, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition)
It creates Disjoint conditional constraint.- Parameters:
rectangles
- the rectangles within a constraint.exceptionIndices
- list of rectangles that may not be consideredexceptionCondition
- conditions for rectangles that may not be considered
-
DisjointConditional
public DisjointConditional(IntVar[][] rectangles, java.util.List<java.util.List<java.lang.Integer>> exceptionIndices, java.util.List<? extends IntVar> exceptionCondition, boolean profile)
It creates Disjoint conditional constraint.- Parameters:
rectangles
- the rectangles within a constraint.exceptionIndices
- list of rectangles that may not be consideredexceptionCondition
- conditions for rectangles that may not be consideredprofile
- it specifies if the profiles are being computed and used within that constraint.
-
-
Method Detail
-
checkRect
boolean checkRect(RectangleWithCondition r)
-
conditionChanged
boolean conditionChanged(java.util.Set<IntVar> fdvQueue, int j)
-
findMaxLength
int findMaxLength(int i, int length, Rectangle r)
-
findRectangles
boolean findRectangles(Rectangle r, int index, java.util.List<IntRectangle> UsedRect, java.util.List<RectangleWithCondition> ProfileCandidates, java.util.List<RectangleWithCondition> OverlappingRects, java.util.Set<IntVar> fdvQueue)
-
impose
public void impose(Store store)
Description copied from class:Constraint
It imposes the constraint in a given store.- Overrides:
impose
in classConstraint
- Parameters:
store
- the constraint store to which the constraint is imposed to.
-
minForbiddenInterval
Interval minForbiddenInterval(int start, int i, Rectangle r, java.util.List<IntRectangle> ConsideredRect, int minI)
-
narrowIthCondition
void narrowIthCondition(int i, Rectangle r, java.util.List<IntRectangle> UsedRect, java.util.List<RectangleWithCondition> ProfileCandidates)
-
narrowRectangleCondition
void narrowRectangleCondition(Rectangle r, java.util.List<IntRectangle> UsedRect, java.util.List<RectangleWithCondition> ProfileCandidates)
-
narrowRectangles
void narrowRectangles(java.util.Set<IntVar> fdvQueue)
- Overrides:
narrowRectangles
in classDiff
-
notFit
boolean notFit(int i, Rectangle r, java.util.List<IntRectangle> ConsideredRect)
-
profileCheckInterval
void profileCheckInterval(Store store, DisjointConditionalProfile Profile, int limit, IntVar Start, IntVar Duration, int _min, int _max, IntVar Resources)
-
profileCheckRectangle
void profileCheckRectangle(DisjointConditionalProfile Profile, Rectangle r, int i, int j)
-
profileNarrowingCondition
void profileNarrowingCondition(int i, Rectangle r, java.util.List<RectangleWithCondition> ProfileCandidates)
-
satisfied
public boolean satisfied()
Description copied from interface:SatisfiedPresent
It checks if the constraint is satisfied. It can return false even if constraint is satisfied but not all variables in its scope are grounded. It needs to return true if all variables in its scope are grounded and constraint is satisfied.Implementations of this interface for constraints that are not PrimitiveConstraint may require constraint imposition and consistency check as a requirement to work correctly.
- Specified by:
satisfied
in interfaceSatisfiedPresent
- Overrides:
satisfied
in classDiff
- Returns:
- true if constraint is possible to verify that it is satisfied.
-
toString
public java.lang.String toString()
Description copied from class:Constraint
It produces a string representation of a constraint state.
-
-