Module org.maxicp

Interface SeqVar

All Superinterfaces:
Expression, SeqExpression, Serializable, Var
All Known Subinterfaces:
ConcreteSeqVar, CPSeqVar, SymbolicSeqVar
All Known Implementing Classes:
CPSeqVarImpl, CPSeqVarViewFlip, SeqVarImpl

public interface SeqVar extends Var, SeqExpression
  • Method Summary

    Modifier and Type
    Method
    Description
    Should be implemented by all subclasses, but not used directly.
    int
    end()
    Last member of the sequence
    int
    fillInsert(int node, int[] dest)
    Fills an array with the insertions for a node.
    int
    fillNode(int[] dest, SeqStatus status)
    Copies the nodes matching a status into an array.
    default int
    fillPred(int node, int[] dest)
    Copies the predecessors of a node into an array.
    int
    fillPred(int node, int[] dest, SeqStatus status)
    Copies the predecessors of a node matching a status into an array.
    default int
    fillSucc(int node, int[] dest)
    Copies the successors of a node into an array.
    int
    fillSucc(int node, int[] dest, SeqStatus status)
    Copies the successors of a node matching a status into an array.
    boolean
    hasEdge(int from, int to)
    Tells if a directed edge exists between two nodes.
    boolean
    hasInsert(int prev, int node)
    Tells if an insertion is valid.
    default boolean
    True if the expression is fixed
    boolean
    isNode(int node, SeqStatus status)
    Tells if a node is matching a status.
    isNodeRequired(int node)
    Gives a variable telling if a given node must be visited
    default SeqVar
    Apply a function on all sub-expressions of this expression and returns a new expression of the same type.
    int
    memberAfter(int node)
    Returns the member following another member in the sequence.
    int
    memberBefore(int node)
    Returns the member preceding another member in the sequence.
    int
    nInsert(int node)
    Returns the number of insertions of a node.
    int
    Gives the total number of nodes.
    int
    nNode(SeqStatus status)
    Gives the number of nodes matching a status.
    int
    nPred(int node)
    Returns the number of predecessors of a node.
    int
    nSucc(int node)
    Returns the number of successors of a node.
    int
    First member of the sequence

    Methods inherited from interface org.maxicp.modeling.algebra.Expression

    getModelProxy, subexpressions

    Methods inherited from interface org.maxicp.modeling.Var

    getModelProxy
  • Method Details

    • isFixed

      default boolean isFixed()
      Description copied from interface: Expression
      True if the expression is fixed
      Specified by:
      isFixed in interface Expression
    • mapSubexpressions

      default SeqVar mapSubexpressions(Function<Expression,Expression> f)
      Description copied from interface: Expression
      Apply a function on all sub-expressions of this expression and returns a new expression of the same type. This function should return a value that is of the same class as the object that was given to it.
      Specified by:
      mapSubexpressions in interface Expression
    • computeSubexpressions

      default Collection<Expression> computeSubexpressions()
      Description copied from interface: Expression
      Should be implemented by all subclasses, but not used directly. Use subexpressions() instead, which is a cached version of this. Returns a collection that contains all sub-expressions of this expression. It should not be modified. In practice, it should actually be unmutable or a copy.
      Specified by:
      computeSubexpressions in interface Expression
    • fillNode

      int fillNode(int[] dest, SeqStatus status)
      Copies the nodes matching a status into an array.
      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

      int nNode(SeqStatus status)
      Gives the number of nodes matching a status.
      Parameters:
      status - status that must be matched by the nodes.
      Returns:
      the number of nodes matching the status.
    • nNode

      int nNode()
      Gives the total number of nodes.
      Returns:
      the total number of nodes.
    • isNode

      boolean isNode(int node, SeqStatus status)
      Tells if a node is matching a status.
      Parameters:
      node - node.
      status - status that must be matched by the node.
      Returns:
      true if the node is matching the status.
    • start

      int start()
      First member of the sequence
      Returns:
      first member of the sequence
    • end

      int end()
      Last member of the sequence
      Returns:
      last member of the sequence
    • memberAfter

      int memberAfter(int node)
      Returns the member following another member in the sequence.
      Parameters:
      node - member within the sequence.
      Returns:
      member following the given node in the sequence.
    • memberBefore

      int memberBefore(int node)
      Returns the member preceding another member in the sequence.
      Parameters:
      node - member within the sequence.
      Returns:
      member preceding the given node in the sequence.
    • fillPred

      int fillPred(int node, int[] dest, SeqStatus status)
      Copies the predecessors of a node matching a status into an array.
      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

      default int fillPred(int node, int[] dest)
      Copies the predecessors of a node into an array.
      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

      int nPred(int node)
      Returns the number of predecessors of a node.
      Parameters:
      node - node.
      Returns:
      the number of predecessors.
    • fillSucc

      int fillSucc(int node, int[] dest, SeqStatus status)
      Copies the successors of a node matching a status into an array.
      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

      default int fillSucc(int node, int[] dest)
      Copies the successors of a node into an array.
      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

      int nSucc(int node)
      Returns the number of successors of a node.
      Parameters:
      node - node.
      Returns:
      the number of successors matching the status.
    • fillInsert

      int fillInsert(int node, int[] dest)
      Fills an array with the insertions for a node. Equivalent to fillPred(node, dest, MEMBER).
      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

      int nInsert(int node)
      Returns the number of insertions of a node.
      Parameters:
      node - node.
      Returns:
      the number of insertions of a node.
    • hasEdge

      boolean hasEdge(int from, int to)
      Tells if a directed edge exists between two nodes.
      Parameters:
      from - origin of the edge.
      to - destination of the edge.
      Returns:
      true if the directed edge exists between two nodes.
    • hasInsert

      boolean hasInsert(int prev, int node)
      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)).
      Parameters:
      prev - a member node.
      node - an insertable node.
      Returns:
      true if the node can be inserted after the given member.
    • isNodeRequired

      BoolVar isNodeRequired(int node)
      Gives a variable telling if a given node must be visited
      Parameters:
      node - node in the sequence
      Returns:
      variable set to true if the node must be visited