java.lang.Object
org.maxicp.cp.engine.core.AbstractCPConstraint
org.maxicp.cp.engine.constraints.seqvar.Precedence
- All Implemented Interfaces:
CPConstraint,ConcreteConstraint<ConcreteCPModel>
-
Constructor Summary
ConstructorsConstructorDescriptionPrecedence(CPSeqVar seqVar, boolean appearTogether, int... order) Ensures that a list of nodes appears in a given relative order within the sequence, if they appear.Precedence(CPSeqVar seqVar, int... order) Ensures that a list of nodes appears in a given relative order within the sequence, if they appear Example of a solution: order = [1, 3, 5, 9] seqVar = 1 -> 2 -> 3 -> 4 -> 5 -> 8 Note that nodes can be put in between and some nodes in `order` may be excluded Example of a non solution (since 1 cannot appear before 5): order = [1, 3, 5, 9] seqVar = 5 -> 2 -> 4 -> 1 -> 8 -
Method Summary
Methods inherited from class org.maxicp.cp.engine.core.AbstractCPConstraint
getSolver, isActive, isScheduled, priority, registerDelta, setActive, setScheduled, updateDeltas
-
Constructor Details
-
Precedence
Ensures that a list of nodes appears in a given relative order within the sequence, if they appear Example of a solution: order = [1, 3, 5, 9] seqVar = 1 -> 2 -> 3 -> 4 -> 5 -> 8 Note that nodes can be put in between and some nodes in `order` may be excluded Example of a non solution (since 1 cannot appear before 5): order = [1, 3, 5, 9] seqVar = 5 -> 2 -> 4 -> 1 -> 8- Parameters:
seqVar- sequence variableorder- nodes that must respect the given ordering if they are included in the sequence
-
Precedence
Ensures that a list of nodes appears in a given relative order within the sequence, if they appear. Example of a solution: order = [1, 3, 5, 9]. seqVar = 1 -> 2 -> 3 -> 4 -> 5 -> 8. Note that nodes can be put in between and some nodes in `order` may be excluded, provided thatappearTogetheris set to false. Example of a non solution (since 1 cannot appear before 5): order = [1, 3, 5, 9]. seqVar = 5 -> 2 -> 4 -> 1 -> 8.- Parameters:
seqVar- sequence variableappearTogether- if set to true, all nodes in order must appear together. Requiring one means requiring all of them, and excluding one means excluding all of themorder- nodes that must respect the given ordering if they are included in the sequence
-
-
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
-
propagate
public void propagate()Description copied from interface:CPConstraintPropagates the constraint.- Specified by:
propagatein interfaceCPConstraint- Overrides:
propagatein classAbstractCPConstraint
-