Class MoveSeq

  • All Implemented Interfaces:
    Move

    public class MoveSeq
    extends Object
    implements Move
    BETA: This a work-in-progress. It is certainly not bug free, specially the repair method may lead to unexpected behavior. A move made of two or more moves. The i^th move is called when the i-1 ^th returns false. Created by cprudhom on 29/10/2015. Project: choco.
    Since:
    29/10/2015
    Author:
    Charles Prud'homme
    • Constructor Detail

      • MoveSeq

        public MoveSeq​(Model model,
                       Move... moves)
        Create a move which sequentially apply a move. When a move can not be extended, the next one is used.
        Parameters:
        model - a model
        moves - list of moves to apply
    • Method Detail

      • init

        public boolean init()
        Description copied from interface: Move
        Called before the search starts. Also initializes the search strategy.
        Specified by:
        init in interface Move
        Returns:
        false if something goes wrong, true otherwise
      • extend

        public boolean extend​(Solver solver)
        Description copied from interface: Move
        Performs a move when the CSP associated to the current node of the search space is not proven to be not consistent.
        Specified by:
        extend in interface Move
        Parameters:
        solver - reference the solver
        Returns:
        true if an extension can be done, false when no more extension is possible.
      • repair

        public boolean repair​(Solver solver)
        Description copied from interface: Move
        Performs a move when the CSP associated to the current node of the search space is proven to be not consistent.
        Specified by:
        repair in interface Move
        Parameters:
        solver - reference the solver
        Returns:
        true if a reparation can be done, false when no more reparation is possible.
      • setTopDecisionPosition

        public void setTopDecisionPosition​(int position)
        Description copied from interface: Move
        Indicates the position of decision made just before selecting this move. When only one "terminal" move is declared, the top decision decision is -1. When dealing with a sequence of Move, the position is the one of the last decision of the previous move. In consequence, when backtracking, the right move can be applied or stopped when needed. This has to be declared on the first call to Move.extend(Solver) and is checked on Move.repair(Solver).
        Specified by:
        setTopDecisionPosition in interface Move
        Parameters:
        position - position of the last decision taken before applying this move
      • getStrategy

        public <V extends VariableAbstractStrategy<V> getStrategy()
        Description copied from interface: Move
        Returns the search strategy in use.
        Specified by:
        getStrategy in interface Move
        Type Parameters:
        V - the type of variable managed by the strategy
        Returns:
        the current search strategy
      • setStrategy

        public <V extends Variable> void setStrategy​(AbstractStrategy<V> aStrategy)
        Description copied from interface: Move
        Defines a search strategy, that is, a service which computes and returns decisions.
        Specified by:
        setStrategy in interface Move
        Type Parameters:
        V - the type of variable managed by the strategy
        Parameters:
        aStrategy - a search strategy
      • removeStrategy

        public void removeStrategy()
        Description copied from interface: Move
        Erases the defined search strategy.
        Specified by:
        removeStrategy in interface Move
      • getChildMoves

        public List<Move> getChildMoves()
        Description copied from interface: Move
        Returns the child moves or null Some Move only accepts one single move as child.
        Specified by:
        getChildMoves in interface Move
        Returns:
        the child moves
      • setChildMoves

        public void setChildMoves​(List<Move> someMoves)
        Description copied from interface: Move
        Overrides this child moves (if possible and if any). Some Move only accepts one single move as child.
        Specified by:
        setChildMoves in interface Move
        Parameters:
        someMoves - a new child move