Module org.maxicp
Class NoOverlapWithPositionDecomposition
java.lang.Object
org.maxicp.cp.engine.core.AbstractCPConstraint
org.maxicp.cp.engine.constraints.scheduling.NoOverlapWithPositionDecomposition
- All Implemented Interfaces:
CPConstraint,ConcreteConstraint<ConcreteCPModel>
A constraint that enforces a permutation (ordering) of interval variables,
typically used for routing/scheduling problems such as TSP or job sequencing.
This constraint models a sequence of visits where:
- Each interval represents a visit/task to be scheduled
posOfInterval[i]gives the position of interval i in the sequenceintervalInPos[p]gives the interval at position p in the sequence
The constraint enforces:
- Inverse permutation relationship between posOfInterval and intervalInPos
- No overlap between intervals
- Minimum transition times between consecutive intervals (if specified)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CPIntVar[]intervalInPos[i] is the node at position i in the tourfinal CPIntervalVar[]Intervalsfinal intNumber of intervalsfinal CPIntVar[]posOfInterval[i] is the position of node i in the tour -
Constructor Summary
ConstructorsConstructorDescriptionNoOverlapWithPositionDecomposition(CPIntervalVar[] intervals, CPIntVar[] posOfInterval, CPIntVar[] intervalInPos) Creates a permutation constraint with zero transition times.NoOverlapWithPositionDecomposition(CPIntervalVar[] intervals, CPIntVar[] posOfInterval, CPIntVar[] intervalInPos, int[][] minTransition) Creates a permutation constraint with minimum transition times between intervals. -
Method Summary
Modifier and TypeMethodDescriptionvoidpost()Initializes the constraint when it is posted to the solver.Methods inherited from class org.maxicp.cp.engine.core.AbstractCPConstraint
getSolver, isActive, isScheduled, priority, propagate, registerDelta, setActive, setScheduled, updateDeltas
-
Field Details
-
n
public final int nNumber of intervals -
intervals
Intervals -
posOfInterval
posOfInterval[i] is the position of node i in the tour -
intervalInPos
intervalInPos[i] is the node at position i in the tour
-
-
Constructor Details
-
NoOverlapWithPositionDecomposition
public NoOverlapWithPositionDecomposition(CPIntervalVar[] intervals, CPIntVar[] posOfInterval, CPIntVar[] intervalInPos) Creates a permutation constraint with zero transition times.- Parameters:
intervals- the interval variables to be sequenced (all intervals must belong to the same solver)posOfInterval- position variables:posOfInterval[i]is the position of interval i (domain 0..n-1)intervalInPos- inverse position variables:intervalInPos[p]is the interval at position p (domain 0..n-1)
-
NoOverlapWithPositionDecomposition
public NoOverlapWithPositionDecomposition(CPIntervalVar[] intervals, CPIntVar[] posOfInterval, CPIntVar[] intervalInPos, int[][] minTransition) Creates a permutation constraint with minimum transition times between intervals.The transition time matrix must satisfy the triangular inequality property, i.e., for all i, j, k:
minTransition[i][j] <= minTransition[i][k] + minTransition[k][j].- Parameters:
intervals- the interval variables to be sequenced (all intervals must belong to the same solver)posOfInterval- position variables:posOfInterval[i]is the position of interval i (domain 0..n-1)intervalInPos- inverse position variables:intervalInPos[p]is the interval at position p (domain 0..n-1)minTransition- a square matrix whereminTransition[i][j]is the minimum transition time from interval i to interval j. Must have dimensions n×n where n is the number of intervals.- Throws:
AssertionError- if the matrix dimensions don't match the number of intervalsAssertionError- if the triangular inequality is violated
-
-
Method Details
-
post
public void post()Description copied from interface:CPConstraintInitializes the constraint when it is posted to the solver.- Specified by:
postin interfaceCPConstraint- Overrides:
postin classAbstractCPConstraint
-