choco
Class Solver

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.Solver
All Implemented Interfaces:
Entity
Direct Known Subclasses:
BendersSolver, JumpSolver, PalmSolver

public class Solver
extends AbstractEntity

This class serves both as a factory and as a handler for AbstractGlobalSearchSolvers:


Field Summary
protected  boolean doMaximize
          Maximization / Minimization problem
protected  boolean firstSolution
          do we want to explore one or all solutions (default=one solution)
 int loggingMaxDepth
          maximal search depth for logging statements
protected  int nodeLimit
           
protected  Var objective
          The variable modelling the objective function
static int PROPAGATION
           
protected  boolean restart
          Do we want to restart a new search after each solution
static int SEARCH
           
static int SILENT
           
static int SOLUTION
           
protected  AbstractGlobalSearchSolver solver
          The object controlling the global search exploration
protected  int timeLimit
           
protected  IValIterator valIterator
          Value iterator
protected  IValSelector valSelector
          Value selector
protected  IVarSelector varSelector
          Variable selector
 
Fields inherited from class choco.AbstractEntity
hook, problem
 
Constructor Summary
Solver(AbstractProblem pb)
           
 
Method Summary
 void addGoal(AbstractIntBranching branching)
           
 void attachGoal(AbstractIntBranching branching)
           
protected static void flushLog(java.util.logging.Logger log)
           
static void flushLogs()
           
protected  void generateGoal(AbstractProblem pb)
           
 void generateSearchSolver(AbstractProblem pb)
           
 IGlobalSearchLimit getEncounteredLimit()
          If a limit has been encounteres, return the involved limit
 boolean getFirstSolution()
           
 int getNbSolutions()
          returns the number of solutions encountered during the search
 java.lang.Number getOptimumValue()
           
 AbstractGlobalSearchSolver getSearchSolver()
           
 boolean isEncounteredLimit()
          Checks if a limit has been encountered
 void launch()
          commands the solver to start
 void setDoMaximize(boolean doMaximize)
          a boolean indicating if the solver minize or maximize the objective function
 void setFirstSolution(boolean firstSolution)
          Sets wether only the first solution must be found
 void setLoggingMaxDepth(int loggingMaxDepth)
           
 void setNodeLimit(int nodeLimit)
          Sets the node limit i.e. the maximal number of nodes explored by the search algorithm
 void setObjective(Var objective)
          Set the variable to optimize
 void setRestart(boolean restart)
          set the optimization strategy: - restart or not after each solution found
 void setTimeLimit(int timeLimit)
          Sets the time limit i.e. the maximal time before stopping the search algorithm
 void setValIterator(IValIterator valIterator)
          Sets the value iterator the search should use
 void setValSelector(IValSelector valSelector)
          Sets the value selector the search should use
 void setVarSelector(IVarSelector varSelector)
          Sets the variable selector the search solver should use.
static void setVerbosity(int verbosity)
           
protected static void setVerbosity(java.util.logging.Logger logger, java.util.logging.Level level)
          Sets the level of log for the Logger and the Handler.
 
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

objective

protected Var objective
The variable modelling the objective function


doMaximize

protected boolean doMaximize
Maximization / Minimization problem


loggingMaxDepth

public int loggingMaxDepth
maximal search depth for logging statements


restart

protected boolean restart
Do we want to restart a new search after each solution


firstSolution

protected boolean firstSolution
do we want to explore one or all solutions (default=one solution)


solver

protected AbstractGlobalSearchSolver solver
The object controlling the global search exploration


varSelector

protected IVarSelector varSelector
Variable selector


valIterator

protected IValIterator valIterator
Value iterator


valSelector

protected IValSelector valSelector
Value selector


timeLimit

protected int timeLimit

nodeLimit

protected int nodeLimit

SILENT

public static final int SILENT
See Also:
Constant Field Values

SOLUTION

public static final int SOLUTION
See Also:
Constant Field Values

SEARCH

public static final int SEARCH
See Also:
Constant Field Values

PROPAGATION

public static final int PROPAGATION
See Also:
Constant Field Values
Constructor Detail

Solver

public Solver(AbstractProblem pb)
Method Detail

setLoggingMaxDepth

public void setLoggingMaxDepth(int loggingMaxDepth)

getSearchSolver

public AbstractGlobalSearchSolver getSearchSolver()

generateSearchSolver

public void generateSearchSolver(AbstractProblem pb)

generateGoal

protected void generateGoal(AbstractProblem pb)

attachGoal

public void attachGoal(AbstractIntBranching branching)

addGoal

public void addGoal(AbstractIntBranching branching)

launch

public void launch()
commands the solver to start


getNbSolutions

public int getNbSolutions()
returns the number of solutions encountered during the search

Returns:
the number of solutions to the problem that were encountered during the search

setTimeLimit

public void setTimeLimit(int timeLimit)
Sets the time limit i.e. the maximal time before stopping the search algorithm


setNodeLimit

public void setNodeLimit(int nodeLimit)
Sets the node limit i.e. the maximal number of nodes explored by the search algorithm


getFirstSolution

public boolean getFirstSolution()
Returns:
true if only the first solution must be found

setFirstSolution

public void setFirstSolution(boolean firstSolution)
Sets wether only the first solution must be found


setVarSelector

public void setVarSelector(IVarSelector varSelector)
Sets the variable selector the search solver should use.


setValIterator

public void setValIterator(IValIterator valIterator)
Sets the value iterator the search should use


setValSelector

public void setValSelector(IValSelector valSelector)
Sets the value selector the search should use


setRestart

public void setRestart(boolean restart)
set the optimization strategy: - restart or not after each solution found

Parameters:
restart -

setDoMaximize

public void setDoMaximize(boolean doMaximize)
a boolean indicating if the solver minize or maximize the objective function

Parameters:
doMaximize -

setObjective

public void setObjective(Var objective)
Set the variable to optimize

Parameters:
objective -

getOptimumValue

public java.lang.Number getOptimumValue()

isEncounteredLimit

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


getEncounteredLimit

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


setVerbosity

public static void setVerbosity(int verbosity)

flushLogs

public static void flushLogs()

setVerbosity

protected static void setVerbosity(java.util.logging.Logger logger,
                                   java.util.logging.Level level)
Sets the level of log for the Logger and the Handler. This means that inherited loggers will have at least same level if they do not have custom handler.

Parameters:
logger - the logger to modify its level
level - the new level

flushLog

protected static void flushLog(java.util.logging.Logger log)