choco.search
Class AbstractGlobalSearchSolver

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractSolver
          extended by choco.search.AbstractGlobalSearchSolver
All Implemented Interfaces:
Entity
Direct Known Subclasses:
AbstractOptimize, AbstractRealOptimize, Solve

public abstract class AbstractGlobalSearchSolver
extends AbstractSolver

An abstract class for controlling tree search in various ways


Field Summary
 int baseWorld
          the index of the world where the search started
 int currentTraceIndex
          index of the current trace in the stack
static int DOWN_BRANCH
           
protected  IGlobalSearchLimit encounteredLimit
          indicates whether a limit was encountered in the alst incremental search
static int INIT_SEARCH
          constants for dirving the incremental search algorithm
 java.util.ArrayList limits
          A set of limits controlling the exploration
protected  int loggingMaxDepth
          maximal search depth for logging statements
 AbstractIntBranching mainGoal
          /** the goal that needs be solved to drive the exploration
 int nbSolutions
          count of the solutions found during search
 int nextMove
          search controller: a flag storing the next move in the search tree
static int OPEN_NODE
           
 boolean stopAtFirstSol
          indicates whether the control should stop after the first solution is found
 java.util.ArrayList traceStack
          a data structure storing the stack of choice contexts (for incremental search explorations)
static int UP_BRANCH
           
 
Fields inherited from class choco.AbstractSolver
logger, maxNbSolutionStored, solutions
 
Fields inherited from class choco.AbstractEntity
hook, problem
 
Constructor Summary
protected AbstractGlobalSearchSolver(AbstractProblem pb)
           
 
Method Summary
 void endTreeNode()
          called after a node is expanded in the search tree (choice point creation)
 void endTreeSearch()
          called before a new search tree is explored
 IGlobalSearchLimit getEncounteredLimit()
          If a limit has been encounteres, return the involved limit
 void incrementalRun()
          main entry point: searching for one solution Note: the initial propagation must be done before pushing any world level.
 boolean isEncounteredLimit()
          Checks if a limit has been encountered
 void newTreeNode()
          called before a node is expanded in the search tree (choice point creation)
 void newTreeSearch()
          called before a new search tree is explored
 java.lang.Boolean nextSolution()
           
 IntBranchingTrace popTrace()
           
 void popTraceUntil(int targetWorld)
           
 void postDynamicCut()
          called before going down into each branch of the choice point
 void printRuntimeStatistics()
          Print all statistics
 IntBranchingTrace pushTrace()
           
 void recordSolution()
          called when a solution is encountered: printing and, if needed, storing the solution
 void run()
          Deprecated. replaced by incrementalRun
 void setLoggingMaxDepth(int loggingMaxDepth)
          count of the backtracks made during search
 IntBranchingTrace topTrace()
           
 
Methods inherited from class choco.AbstractSolver
existsSolution, makeSolutionFromCurrentState, restoreBestSolution, showSolution, storeSolution
 
Methods inherited from class choco.AbstractEntity
getProblem, pretty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_SEARCH

public static final int INIT_SEARCH
constants for dirving the incremental search algorithm

See Also:
Constant Field Values

OPEN_NODE

public static final int OPEN_NODE
See Also:
Constant Field Values

UP_BRANCH

public static final int UP_BRANCH
See Also:
Constant Field Values

DOWN_BRANCH

public static final int DOWN_BRANCH
See Also:
Constant Field Values

traceStack

public java.util.ArrayList traceStack
a data structure storing the stack of choice contexts (for incremental search explorations)


currentTraceIndex

public int currentTraceIndex
index of the current trace in the stack


nextMove

public int nextMove
search controller: a flag storing the next move in the search tree


stopAtFirstSol

public boolean stopAtFirstSol
indicates whether the control should stop after the first solution is found


encounteredLimit

protected IGlobalSearchLimit encounteredLimit
indicates whether a limit was encountered in the alst incremental search


nbSolutions

public int nbSolutions
count of the solutions found during search


loggingMaxDepth

protected int loggingMaxDepth
maximal search depth for logging statements


mainGoal

public AbstractIntBranching mainGoal
/** the goal that needs be solved to drive the exploration


baseWorld

public int baseWorld
the index of the world where the search started


limits

public java.util.ArrayList limits
A set of limits controlling the exploration

Constructor Detail

AbstractGlobalSearchSolver

protected AbstractGlobalSearchSolver(AbstractProblem pb)
Method Detail

setLoggingMaxDepth

public void setLoggingMaxDepth(int loggingMaxDepth)
count of the backtracks made during search


run

public void run()
Deprecated. replaced by incrementalRun

main entry point: searching for one solution Note: the initial propagation must be done before pushing any world level. It is therefore kept before restoring a solution

Specified by:
run in class AbstractSolver

incrementalRun

public void incrementalRun()
main entry point: searching for one solution Note: the initial propagation must be done before pushing any world level. It is therefore kept before restoring a solution


newTreeSearch

public void newTreeSearch()
                   throws ContradictionException
called before a new search tree is explored

Throws:
ContradictionException

endTreeSearch

public void endTreeSearch()
called before a new search tree is explored


newTreeNode

public void newTreeNode()
                 throws ContradictionException
called before a node is expanded in the search tree (choice point creation)

Throws:
ContradictionException

endTreeNode

public void endTreeNode()
                 throws ContradictionException
called after a node is expanded in the search tree (choice point creation)

Throws:
ContradictionException

recordSolution

public void recordSolution()
called when a solution is encountered: printing and, if needed, storing the solution

Overrides:
recordSolution in class AbstractSolver

postDynamicCut

public void postDynamicCut()
                    throws ContradictionException
called before going down into each branch of the choice point

Throws:
ContradictionException

pushTrace

public IntBranchingTrace pushTrace()

popTrace

public IntBranchingTrace popTrace()

topTrace

public IntBranchingTrace topTrace()

popTraceUntil

public void popTraceUntil(int targetWorld)

nextSolution

public java.lang.Boolean nextSolution()

printRuntimeStatistics

public void printRuntimeStatistics()
Print all statistics


isEncounteredLimit

public boolean isEncounteredLimit()
Checks if a limit has been encountered

Returns:

getEncounteredLimit

public IGlobalSearchLimit getEncounteredLimit()
If a limit has been encounteres, return the involved limit