java.lang.Object
org.maxicp.cp.engine.core.CPSeqVarViewFlip
- All Implemented Interfaces:
Serializable,CPSeqVar,CPVar,Expression,SeqExpression,ConcreteSeqVar,ConcreteVar,SeqVar,Var
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintend()Last member of the sequencevoidexclude(int node) Excludes a node from the sequence.intfillInsert(int node, int[] dest) Fills an array with the insertions for a node.intCopies the nodes matching a status into an array.intfillPred(int node, int[] dest) Copies the predecessors of a node into an array.intCopies the predecessors of a node matching a status into an array.intfillSucc(int node, int[] dest) Copies the successors of a node into an array.intCopies the successors of a node matching a status into an array.Returns the ModelDispatcher linked to this ExpressiongetNodeVar(int node) Returns the variable related to a node.Returns the solver in which this variable was created.booleanhasEdge(int from, int to) Tells if a directed edge exists between two nodes.booleanhasInsert(int prev, int node) Tells if an insertion is valid.voidinsert(int prev, int node) Inserts a node in the sequence after a given member.booleanisFixed()Returns true if every node is either a member or an excluded node.booleanTells if a node is matching a status.isNodeRequired(int node) Gives a variable telling if a given node must be visitedintmemberAfter(int node) Returns the member following another member in the sequence.intmemberBefore(int node) Returns the member preceding another member in the sequence.intnInsert(int node) Returns the number of insertions of a node.intnNode()Gives the total number of nodes.intGives the number of nodes matching a status.voidnotBetween(int prev, int node, int succ) Forbids a subsequence of length 3 to appear, removing from the domain all sequences containing the sub-sequence given as input.intnPred(int node) Returns the number of predecessors of a node.intnSucc(int node) Returns the number of successors of a node.voidAsks thatCPConstraint.propagate()is called whenever an exclusion happens.voidAsks thatCPConstraint.propagate()is called whenever the domain is fixedCPSeqVar.isFixed()In such a state the variable is fixed and we say that a fix event occurs.voidAsks thatCPConstraint.propagate()is called whenever an insertion happens.voidAsks thatCPConstraint.propagate()is called whenever an insertion is removed We say that a removeInsert event occurs.voidAsks thatCPConstraint.propagate()is called whenever a node is required.voidrequire(int node) Requires a node in the sequence.intstart()First member of the sequencetoString()voidAsks that the closure is called whenever an exclusion happens.voidAsks that the closure is called whenever the domain is fixedCPSeqVar.isFixed().voidAsks that the closure is called whenever an insertion happens.voidAsks that the closure is called whenever an insertion is removed.voidAsks that the closure is called a node is required.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.maxicp.cp.engine.core.CPSeqVar
membersOrdered, membersOrdered, membersOrdered, toGraphVizMethods inherited from interface org.maxicp.modeling.algebra.Expression
subexpressionsMethods inherited from interface org.maxicp.modeling.SeqVar
computeSubexpressions, mapSubexpressions
-
Constructor Details
-
CPSeqVarViewFlip
-
-
Method Details
-
getSolver
Description copied from interface:CPSeqVarReturns the solver in which this variable was created. -
isFixed
public boolean isFixed()Description copied from interface:CPSeqVarReturns true if every node is either a member or an excluded node. -
getNodeVar
Description copied from interface:CPSeqVarReturns the variable related to a node.- Specified by:
getNodeVarin interfaceCPSeqVar- Parameters:
node- node.- Returns:
- variable related to a node.
-
isNodeRequired
Description copied from interface:CPSeqVarGives a variable telling if a given node must be visited- Specified by:
isNodeRequiredin interfaceCPSeqVar- Specified by:
isNodeRequiredin interfaceSeqVar- Parameters:
node- node in the sequence- Returns:
- variable set to true if the node must be visited
-
fillNode
Description copied from interface:CPSeqVarCopies the nodes matching a status into an array.- Specified by:
fillNodein interfaceCPSeqVar- Specified by:
fillNodein interfaceSeqVar- Parameters:
dest- an array large enoughdest.length >= nNode(status).status- status that must be matched by the nodes.- Returns:
- the number of nodes matching the status and
dest[0,...,nNode(status)-1]contains the nodes in an arbitrary order.
-
nNode
Description copied from interface:CPSeqVarGives the number of nodes matching a status. -
nNode
public int nNode()Description copied from interface:CPSeqVarGives the total number of nodes. -
isNode
Description copied from interface:CPSeqVarTells if a node is matching a status. -
start
public int start()Description copied from interface:CPSeqVarFirst member of the sequence -
end
public int end()Description copied from interface:CPSeqVarLast member of the sequence -
memberAfter
public int memberAfter(int node) Description copied from interface:CPSeqVarReturns the member following another member in the sequence.- Specified by:
memberAfterin interfaceCPSeqVar- Specified by:
memberAfterin interfaceSeqVar- Parameters:
node- member within the sequence.- Returns:
- member following the given node in the sequence.
-
memberBefore
public int memberBefore(int node) Description copied from interface:CPSeqVarReturns the member preceding another member in the sequence.- Specified by:
memberBeforein interfaceCPSeqVar- Specified by:
memberBeforein interfaceSeqVar- Parameters:
node- member within the sequence.- Returns:
- member preceding the given node in the sequence.
-
fillPred
Description copied from interface:CPSeqVarCopies the predecessors of a node matching a status into an array.- Specified by:
fillPredin interfaceCPSeqVar- Specified by:
fillPredin interfaceSeqVar- Parameters:
node- node.dest- an array large enoughstatus- status that must be matched by the predecessors.- Returns:
- the number of predecessors matching the status and
dest[0,...,nPred(node, status)-1]contains the predecessors in an arbitrary order.
-
fillPred
public int fillPred(int node, int[] dest) Description copied from interface:CPSeqVarCopies the predecessors of a node into an array. -
nPred
public int nPred(int node) Description copied from interface:CPSeqVarReturns the number of predecessors of a node. -
fillSucc
Description copied from interface:CPSeqVarCopies the successors of a node matching a status into an array.- Specified by:
fillSuccin interfaceCPSeqVar- Specified by:
fillSuccin interfaceSeqVar- Parameters:
node- node.dest- an array large enoughdest.length >= nSucc(node, status).status- status that must be matched by the nodes.- Returns:
- the number of successors matching the status and
dest[0,...,nSucc(node, status)-1]contains the successors in an arbitrary order.
-
fillSucc
public int fillSucc(int node, int[] dest) Description copied from interface:CPSeqVarCopies the successors of a node into an array. -
nSucc
public int nSucc(int node) Description copied from interface:CPSeqVarReturns the number of successors of a node. -
fillInsert
public int fillInsert(int node, int[] dest) Description copied from interface:CPSeqVarFills an array with the insertions for a node. Equivalent tofillPred(node, dest, MEMBER).- Specified by:
fillInsertin interfaceCPSeqVar- Specified by:
fillInsertin interfaceSeqVar- Parameters:
node- node.dest- an array large enoughdest.length >= nInsert(node).- Returns:
- the number of insertions and
dest[0,...,nInsert(node)-1]contains the insertions in an arbitrary order.
-
nInsert
public int nInsert(int node) Description copied from interface:CPSeqVarReturns the number of insertions of a node. -
hasEdge
public boolean hasEdge(int from, int to) Description copied from interface:CPSeqVarTells if a directed edge exists between two nodes. -
hasInsert
public boolean hasInsert(int prev, int node) Description copied from interface:CPSeqVarTells if an insertion is valid. An insert operation is valid iff - prev is a member node ; - node is an insertable node (either possible or a required node not yet inserted) ; -hasEdge(prev, node); -hasEdge(node, memberAfter(prev)). -
exclude
public void exclude(int node) Description copied from interface:CPSeqVarExcludes a node from the sequence. -
require
public void require(int node) Description copied from interface:CPSeqVarRequires a node in the sequence. -
insert
public void insert(int prev, int node) Description copied from interface:CPSeqVarInserts a node in the sequence after a given member. Requires the node if it was not required yet. -
notBetween
public void notBetween(int prev, int node, int succ) Description copied from interface:CPSeqVarForbids a subsequence of length 3 to appear, removing from the domain all sequences containing the sub-sequence given as input. For technical reasons, the two endpoints of the subsequence must belong to the current partial sequence.- Specified by:
notBetweenin interfaceCPSeqVar- Parameters:
prev- origin of the subsequence, a member nodenode- node in the middle of the subsequencesucc- end of the subsequence, a member node
-
whenFixed
Description copied from interface:CPSeqVarAsks that the closure is called whenever the domain is fixedCPSeqVar.isFixed(). -
whenInsert
Description copied from interface:CPSeqVarAsks that the closure is called whenever an insertion happens.- Specified by:
whenInsertin interfaceCPSeqVar- Parameters:
f- the closure.
-
whenInsertRemoved
Description copied from interface:CPSeqVarAsks that the closure is called whenever an insertion is removed.- Specified by:
whenInsertRemovedin interfaceCPSeqVar- Parameters:
f- the closure.
-
whenExclude
Description copied from interface:CPSeqVarAsks that the closure is called whenever an exclusion happens.- Specified by:
whenExcludein interfaceCPSeqVar- Parameters:
f- the closure.
-
whenRequire
Description copied from interface:CPSeqVarAsks that the closure is called a node is required.- Specified by:
whenRequirein interfaceCPSeqVar- Parameters:
f- the closure.
-
propagateOnFix
Description copied from interface:CPSeqVarAsks thatCPConstraint.propagate()is called whenever the domain is fixedCPSeqVar.isFixed()In such a state the variable is fixed and we say that a fix event occurs.- Specified by:
propagateOnFixin interfaceCPSeqVar- Parameters:
c- the constraint for which theCPConstraint.propagate()method should be called on fix events of this variable.
-
propagateOnInsertRemoved
Description copied from interface:CPSeqVarAsks thatCPConstraint.propagate()is called whenever an insertion is removed We say that a removeInsert event occurs.- Specified by:
propagateOnInsertRemovedin interfaceCPSeqVar- Parameters:
c- the constraint for which theCPConstraint.propagate()method should be called on removeInsert events of this variable.
-
propagateOnInsert
Description copied from interface:CPSeqVarAsks thatCPConstraint.propagate()is called whenever an insertion happens. We say that an insert event occurs.- Specified by:
propagateOnInsertin interfaceCPSeqVar- Parameters:
c- the constraint for which theCPConstraint.propagate()method should be called on insert events of this variable.
-
propagateOnExclude
Description copied from interface:CPSeqVarAsks thatCPConstraint.propagate()is called whenever an exclusion happens. We say that an exclude event occurs.- Specified by:
propagateOnExcludein interfaceCPSeqVar- Parameters:
c- the constraint for which theCPConstraint.propagate()method should be called on exclude events of this variable.
-
propagateOnRequire
Description copied from interface:CPSeqVarAsks thatCPConstraint.propagate()is called whenever a node is required. We say that an require event occurs.- Specified by:
propagateOnRequirein interfaceCPSeqVar- Parameters:
c- the constraint for which theCPConstraint.propagate()method should be called on require events of this variable.
-
toString
-
getModelProxy
Description copied from interface:ExpressionReturns the ModelDispatcher linked to this Expression- Specified by:
getModelProxyin interfaceExpression- Specified by:
getModelProxyin interfaceVar
-