Module org.maxicp

Class CPSeqVarViewFlip

java.lang.Object
org.maxicp.cp.engine.core.CPSeqVarViewFlip
All Implemented Interfaces:
Serializable, CPSeqVar, CPVar, Expression, SeqExpression, ConcreteSeqVar, ConcreteVar, SeqVar, Var

public class CPSeqVarViewFlip extends Object implements CPSeqVar
See Also:
  • Constructor Details

    • CPSeqVarViewFlip

      public CPSeqVarViewFlip(CPSeqVar seqVar)
  • Method Details

    • getSolver

      public CPSolver getSolver()
      Description copied from interface: CPSeqVar
      Returns the solver in which this variable was created.
      Specified by:
      getSolver in interface CPSeqVar
      Returns:
      the solver in which this variable was created.
    • isFixed

      public boolean isFixed()
      Description copied from interface: CPSeqVar
      Returns true if every node is either a member or an excluded node.
      Specified by:
      isFixed in interface CPSeqVar
      Specified by:
      isFixed in interface CPVar
      Specified by:
      isFixed in interface Expression
      Specified by:
      isFixed in interface SeqVar
      Returns:
      true if every node is either a member or an excluded node.
    • getNodeVar

      public CPNodeVar getNodeVar(int node)
      Description copied from interface: CPSeqVar
      Returns the variable related to a node.
      Specified by:
      getNodeVar in interface CPSeqVar
      Parameters:
      node - node.
      Returns:
      variable related to a node.
    • isNodeRequired

      public CPBoolVar isNodeRequired(int node)
      Description copied from interface: CPSeqVar
      Gives a variable telling if a given node must be visited
      Specified by:
      isNodeRequired in interface CPSeqVar
      Specified by:
      isNodeRequired in interface SeqVar
      Parameters:
      node - node in the sequence
      Returns:
      variable set to true if the node must be visited
    • fillNode

      public int fillNode(int[] dest, SeqStatus status)
      Description copied from interface: CPSeqVar
      Copies the nodes matching a status into an array.
      Specified by:
      fillNode in interface CPSeqVar
      Specified by:
      fillNode in interface SeqVar
      Parameters:
      dest - an array large enough dest.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

      public int nNode(SeqStatus status)
      Description copied from interface: CPSeqVar
      Gives the number of nodes matching a status.
      Specified by:
      nNode in interface CPSeqVar
      Specified by:
      nNode in interface SeqVar
      Parameters:
      status - status that must be matched by the nodes.
      Returns:
      the number of nodes matching the status.
    • nNode

      public int nNode()
      Description copied from interface: CPSeqVar
      Gives the total number of nodes.
      Specified by:
      nNode in interface CPSeqVar
      Specified by:
      nNode in interface SeqVar
      Returns:
      the total number of nodes.
    • isNode

      public boolean isNode(int node, SeqStatus status)
      Description copied from interface: CPSeqVar
      Tells if a node is matching a status.
      Specified by:
      isNode in interface CPSeqVar
      Specified by:
      isNode in interface SeqVar
      Parameters:
      node - node.
      status - status that must be matched by the node.
      Returns:
      true if the node is matching the status.
    • start

      public int start()
      Description copied from interface: CPSeqVar
      First member of the sequence
      Specified by:
      start in interface CPSeqVar
      Specified by:
      start in interface SeqVar
      Returns:
      first member of the sequence
    • end

      public int end()
      Description copied from interface: CPSeqVar
      Last member of the sequence
      Specified by:
      end in interface CPSeqVar
      Specified by:
      end in interface SeqVar
      Returns:
      last member of the sequence
    • memberAfter

      public int memberAfter(int node)
      Description copied from interface: CPSeqVar
      Returns the member following another member in the sequence.
      Specified by:
      memberAfter in interface CPSeqVar
      Specified by:
      memberAfter in interface SeqVar
      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: CPSeqVar
      Returns the member preceding another member in the sequence.
      Specified by:
      memberBefore in interface CPSeqVar
      Specified by:
      memberBefore in interface SeqVar
      Parameters:
      node - member within the sequence.
      Returns:
      member preceding the given node in the sequence.
    • fillPred

      public int fillPred(int node, int[] dest, SeqStatus status)
      Description copied from interface: CPSeqVar
      Copies the predecessors of a node matching a status into an array.
      Specified by:
      fillPred in interface CPSeqVar
      Specified by:
      fillPred in interface SeqVar
      Parameters:
      node - node.
      dest - an array large enough
      status - 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: CPSeqVar
      Copies the predecessors of a node into an array.
      Specified by:
      fillPred in interface CPSeqVar
      Specified by:
      fillPred in interface SeqVar
      Parameters:
      node - node.
      dest - an array large enough dest.length >= nPred(node).
      Returns:
      the number of predecessors and dest[0,...,nPred(node)-1] contains the predecessors in an arbitrary order.
    • nPred

      public int nPred(int node)
      Description copied from interface: CPSeqVar
      Returns the number of predecessors of a node.
      Specified by:
      nPred in interface CPSeqVar
      Specified by:
      nPred in interface SeqVar
      Parameters:
      node - node.
      Returns:
      the number of predecessors.
    • fillSucc

      public int fillSucc(int node, int[] dest, SeqStatus status)
      Description copied from interface: CPSeqVar
      Copies the successors of a node matching a status into an array.
      Specified by:
      fillSucc in interface CPSeqVar
      Specified by:
      fillSucc in interface SeqVar
      Parameters:
      node - node.
      dest - an array large enough dest.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: CPSeqVar
      Copies the successors of a node into an array.
      Specified by:
      fillSucc in interface CPSeqVar
      Specified by:
      fillSucc in interface SeqVar
      Parameters:
      node - node.
      dest - an array large enough dest.length >= nSucc(node).
      Returns:
      the number of successors and dest[0,...,nSucc(node)-1] contains the successors in an arbitrary order.
    • nSucc

      public int nSucc(int node)
      Description copied from interface: CPSeqVar
      Returns the number of successors of a node.
      Specified by:
      nSucc in interface CPSeqVar
      Specified by:
      nSucc in interface SeqVar
      Parameters:
      node - node.
      Returns:
      the number of successors matching the status.
    • fillInsert

      public int fillInsert(int node, int[] dest)
      Description copied from interface: CPSeqVar
      Fills an array with the insertions for a node. Equivalent to fillPred(node, dest, MEMBER).
      Specified by:
      fillInsert in interface CPSeqVar
      Specified by:
      fillInsert in interface SeqVar
      Parameters:
      node - node.
      dest - an array large enough dest.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: CPSeqVar
      Returns the number of insertions of a node.
      Specified by:
      nInsert in interface CPSeqVar
      Specified by:
      nInsert in interface SeqVar
      Parameters:
      node - node.
      Returns:
      the number of insertions of a node.
    • hasEdge

      public boolean hasEdge(int from, int to)
      Description copied from interface: CPSeqVar
      Tells if a directed edge exists between two nodes.
      Specified by:
      hasEdge in interface CPSeqVar
      Specified by:
      hasEdge in interface SeqVar
      Parameters:
      from - origin of the edge.
      to - destination of the edge.
      Returns:
      true if the directed edge exists between two nodes.
    • hasInsert

      public boolean hasInsert(int prev, int node)
      Description copied from interface: CPSeqVar
      Tells 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)).
      Specified by:
      hasInsert in interface CPSeqVar
      Specified by:
      hasInsert in interface SeqVar
      Parameters:
      prev - a member node.
      node - an insertable node.
      Returns:
      true if the node can be inserted after the given member.
    • exclude

      public void exclude(int node)
      Description copied from interface: CPSeqVar
      Excludes a node from the sequence.
      Specified by:
      exclude in interface CPSeqVar
      Parameters:
      node - node to be excluded.
    • require

      public void require(int node)
      Description copied from interface: CPSeqVar
      Requires a node in the sequence.
      Specified by:
      require in interface CPSeqVar
      Parameters:
      node - node to be required.
    • insert

      public void insert(int prev, int node)
      Description copied from interface: CPSeqVar
      Inserts a node in the sequence after a given member. Requires the node if it was not required yet.
      Specified by:
      insert in interface CPSeqVar
      Parameters:
      prev - member after which the node will be inserted.
      node - node inserted in the sequence.
    • notBetween

      public void notBetween(int prev, int node, int succ)
      Description copied from interface: CPSeqVar
      Forbids 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:
      notBetween in interface CPSeqVar
      Parameters:
      prev - origin of the subsequence, a member node
      node - node in the middle of the subsequence
      succ - end of the subsequence, a member node
    • whenFixed

      public void whenFixed(Runnable f)
      Description copied from interface: CPSeqVar
      Asks that the closure is called whenever the domain is fixed CPSeqVar.isFixed().
      Specified by:
      whenFixed in interface CPSeqVar
      Parameters:
      f - the closure.
    • whenInsert

      public void whenInsert(Runnable f)
      Description copied from interface: CPSeqVar
      Asks that the closure is called whenever an insertion happens.
      Specified by:
      whenInsert in interface CPSeqVar
      Parameters:
      f - the closure.
    • whenInsertRemoved

      public void whenInsertRemoved(Runnable f)
      Description copied from interface: CPSeqVar
      Asks that the closure is called whenever an insertion is removed.
      Specified by:
      whenInsertRemoved in interface CPSeqVar
      Parameters:
      f - the closure.
    • whenExclude

      public void whenExclude(Runnable f)
      Description copied from interface: CPSeqVar
      Asks that the closure is called whenever an exclusion happens.
      Specified by:
      whenExclude in interface CPSeqVar
      Parameters:
      f - the closure.
    • whenRequire

      public void whenRequire(Runnable f)
      Description copied from interface: CPSeqVar
      Asks that the closure is called a node is required.
      Specified by:
      whenRequire in interface CPSeqVar
      Parameters:
      f - the closure.
    • propagateOnFix

      public void propagateOnFix(CPConstraint c)
      Description copied from interface: CPSeqVar
      Asks that CPConstraint.propagate() is called whenever the domain is fixed CPSeqVar.isFixed() In such a state the variable is fixed and we say that a fix event occurs.
      Specified by:
      propagateOnFix in interface CPSeqVar
      Parameters:
      c - the constraint for which the CPConstraint.propagate() method should be called on fix events of this variable.
    • propagateOnInsertRemoved

      public void propagateOnInsertRemoved(CPConstraint c)
      Description copied from interface: CPSeqVar
      Asks that CPConstraint.propagate() is called whenever an insertion is removed We say that a removeInsert event occurs.
      Specified by:
      propagateOnInsertRemoved in interface CPSeqVar
      Parameters:
      c - the constraint for which the CPConstraint.propagate() method should be called on removeInsert events of this variable.
    • propagateOnInsert

      public void propagateOnInsert(CPConstraint c)
      Description copied from interface: CPSeqVar
      Asks that CPConstraint.propagate() is called whenever an insertion happens. We say that an insert event occurs.
      Specified by:
      propagateOnInsert in interface CPSeqVar
      Parameters:
      c - the constraint for which the CPConstraint.propagate() method should be called on insert events of this variable.
    • propagateOnExclude

      public void propagateOnExclude(CPConstraint c)
      Description copied from interface: CPSeqVar
      Asks that CPConstraint.propagate() is called whenever an exclusion happens. We say that an exclude event occurs.
      Specified by:
      propagateOnExclude in interface CPSeqVar
      Parameters:
      c - the constraint for which the CPConstraint.propagate() method should be called on exclude events of this variable.
    • propagateOnRequire

      public void propagateOnRequire(CPConstraint c)
      Description copied from interface: CPSeqVar
      Asks that CPConstraint.propagate() is called whenever a node is required. We say that an require event occurs.
      Specified by:
      propagateOnRequire in interface CPSeqVar
      Parameters:
      c - the constraint for which the CPConstraint.propagate() method should be called on require events of this variable.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getModelProxy

      public ModelProxy getModelProxy()
      Description copied from interface: Expression
      Returns the ModelDispatcher linked to this Expression
      Specified by:
      getModelProxy in interface Expression
      Specified by:
      getModelProxy in interface Var