javax.constraints.impl.search
Class AbstractSolver

java.lang.Object
  extended by javax.constraints.impl.search.AbstractSolver
All Implemented Interfaces:
Solver
Direct Known Subclasses:
SolverWithGoals

public abstract class AbstractSolver
extends java.lang.Object
implements Solver

This class defines different solving methods for a given Problem including different flavors of such methods as: solve, solveAll, findSolution, minimize, maximize


Constructor Summary
AbstractSolver()
           
AbstractSolver(Problem problem)
           
 
Method Summary
 void addReversibleAction(ReversibleAction action)
          Adds an application-specific action that will be executed during backtracking.
 void addSearchStrategy(SearchStrategy strategy)
          This method adds this strategy to the end of the strategy execution list.
 void addSearchStrategy(ValueSelector valueSelector)
          This method creates a new instance of the default search strategy, resets its valueSelector, and adds this strategy to the end of the strategy execution lists.
 void addSearchStrategy(Var[] vars)
          This method creates a new instance of the default search strategy, resets its vars, and adds this strategy to the end of the strategy execution lists.
 void addSearchStrategy(Var[] vars, ValueSelector valueSelector)
          This method creates a new instance of the default search strategy, resets its vars and valueSelector, and adds this strategy to the end of the strategy execution lists.
 void addSearchStrategy(Var[] vars, ValueSelectorType valueSelectorType)
          This method creates a new instance of the default search strategy, resets its vars and valueSelector, and adds this strategy to the end of the strategy execution lists.
 void addSearchStrategy(Var[] vars, VarSelector varSelector)
          This method creates a new instance of the default search strategy, resets its vars and varSelector, and adds this strategy to the end of the strategy execution lists.
 void addSearchStrategy(Var[] vars, VarSelectorType varSelectorType)
          This method creates a new instance of the default search strategy, resets its vars and varSelector, and adds this strategy to the end of the strategy execution lists.
 void addSearchStrategy(Var[] vars, VarSelectorType varSelectorType, ValueSelectorType valueSelectorType)
          This method creates a new instance of the default search strategy, resets its vars, varSelector, and valueSelector, and then adds this strategy to the end of the strategy execution list.
 void addSearchStrategy(Var[] vars, VarSelector varSelector, ValueSelector valueSelector)
          This method creates a new instance of the default search strategy, resets its vars, varSelector, and valueSelector, and then adds this strategy to the end of the strategy execution list.
 void addSolution(Solution solution)
          Adds a solution to the current array of solutions
 void addStrategyLogVariables()
          This methods adds the strategy getStrategyLogVariables() to the end of the strategy execution lists.
 boolean applySolution(int solutionNumber)
          This method tries to resolve the problem by applying the existing Solution at the "solutionNumber"-th index of the array of solutions (Accessible by getSolutions();).
abstract  boolean applySolution(Solution solution)
          This method tries to resolve the problem by applying the Solution "solution" to the problem, and returns true if "solution" satisfies all of the posted constraints, false otherwise.
 boolean checkTimeLimit()
          Validates in the difference between the current time and the getTimeLimitStart() time is more than getTimeLimit()
 void clearSolutions()
           
 Solution[] findAllSolutions()
          This method attempts to find all solutions for the Problem.
 Solution findOptimalSolution(Objective objective, Var objectiveVar)
          This method is equivalent to findOptimalSolution(Objective.MINIMIZE,objectiveVar,OptimizationStrategy.NATIVE) It is usually overridden by an implementation.
 Solution findOptimalSolution(Objective objective, Var objectiveVar, OptimizationStrategy optStrategy)
          This method attempts to find the solution that minimizes/maximizes the objective variable.
 Solution findOptimalSolution(Var objectiveVar)
          This method is equivalent to findOptimalSolution(Objective.MINIMIZE,objectiveVar)
 Solution findOptimalSolutionBasic(Objective objective, Var objectiveVar)
          This method is similar to findOptimalSolution(Objective objective, Var objectiveVar) but uses the common (no solver-specific) implementation
 Solution findOptimalSolutionDichotomize(Objective objective, Var objectiveVar)
          The actual minimization algorithm executes a dichotomized search.
 Solution findOptimalSolutionDichotomize(Var objectiveVar)
          This method is equivalent to findOptimalSolutionCommon(Objective.MINIMIZE,objectiveVar)
 Solution findSolution()
          This method is equivalent to findSolution(DO_NOT_RESTORE); It means that the problem state will always be restored even when a solution is found.
abstract  Solution findSolution(ProblemState restoreOrNot)
          This method attempts to find a solution of the problem, for which the solver was defined.
 int getMaxNumberOfSolutions()
          Returns the maximal number of solutions any search can look for.
 int getNumberOfSolutions()
          Returns the number of the last solution found, or 0 if no solutions have been found yet (or the search for a solution was not yet launched).
 int getOptimizationTolerance()
          Returns the current tolerance for the method findOptimalSolution()
 Problem getProblem()
          Returns the Problem for which this solver was created
 java.util.Vector<SearchStrategy> getSearchStrategies()
           
 SearchStrategy getSearchStrategy()
          Returns a SearchStrategy that is currently used by the solver
 Solution getSolution()
          Returns the first (or only) solution
 Solution getSolution(int i)
          Returns the i-th Solution
 Solution[] getSolutions()
          Returns an array of Solutions, containing all found solutions.
 long getSolverStartTime()
           
 SearchStrategy getStrategyLogVariables()
          Returns a search strategy that logs all variables
 int getTimeLimit()
          Returns the duration, in milliseconds, of the imposed time limit on searches.
 int getTimeLimitGlobal()
          Returns the duration, in milliseconds, of the imposed time limit on global search of all solutions or an optimal solution.
 long getTimeLimitStart()
          Returns the time, in milliseconds, at which the time limit began counting.
 boolean isTimeLimitExceeded()
          Returns true if the time limit expired during a search, or false if not.
 boolean isTraceExecution()
           
 boolean isTraceSolutions()
           
 void log(java.lang.String text)
           
 void logStats()
          This method logs execution statistics such as a number of choice points, number of failures, used memory, etc.
abstract  SearchStrategy newSearchStrategy()
          This method returns a new default search strategy
 void restoreProblem()
          Restores a previously saved problem
 void saveProblem()
          Creates a copy of the problem in its current state
 void setMaxNumberOfSolutions(int maxNumberOfSolutions)
          Sets the limit on the maximal number of solutions any search can look for.
 void setOptimizationTolerance(int tolerance)
          Specifies a tolerance for the method findOptimalSolution().
 void setProblem(Problem problem)
          Set the Problem with which this solver should work
 void setSearchStrategy(SearchStrategy strategy)
          Define a searchStrategy that will be used by find solutions methods
 void setSearchStrategy(Var[] vars)
          Define a searchStrategy that will be used by find solutions methods.
 void setSearchStrategy(Var[] vars, ValueSelector valueSelector)
          Define a searchStrategy that will be used by find solutions methods.
 void setSearchStrategy(Var[] vars, VarSelector varSelector)
          Define a searchStrategy that will be used by find solutions methods.
 void setSearchStrategy(Var[] vars, VarSelector varSelector, ValueSelector valueSelector)
          Define a searchStrategy that will be used by find solutions methods.
 void setSolverStartTime(long solverStartTime)
           
 void setTimeLimit(int mills)
          Sets the duration, in milliseconds, of the time limit on searches.
 void setTimeLimitExceeded(boolean exceeded)
          Sets whether or not the time limit has expired.
 void setTimeLimitGlobal(int mills)
          Sets the duration, in milliseconds, of the time limit on global search of all solutions or an optimal solution.
 void setTimeLimitStart()
          Sets the start time as the system current time, for counting milliseconds to the time limit.
 SolutionIterator solutionIterator()
          Creates a solution iterator that allows a user to search and navigate through multiple solutions.
 void traceExecution(boolean flag)
          This method forces each search strategy to log itself each time when solver calls its method execute
 void traceFailures(boolean flag)
          If flag is true, all failures will be traced (logged)
 void traceSolutions(boolean trueOrFalse)
          This method forces the execution to log intermediate solutions during optimization search
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.constraints.Solver
trace, trace, trace
 

Constructor Detail

AbstractSolver

public AbstractSolver()

AbstractSolver

public AbstractSolver(Problem problem)
Method Detail

addReversibleAction

public void addReversibleAction(ReversibleAction action)
Adds an application-specific action that will be executed during backtracking.

Parameters:
action - the action to be executed during backtracking.

addSearchStrategy

public void addSearchStrategy(SearchStrategy strategy)
This method adds this strategy to the end of the strategy execution list.

Specified by:
addSearchStrategy in interface Solver
Parameters:
strategy -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

addSearchStrategy

public void addSearchStrategy(ValueSelector valueSelector)
This method creates a new instance of the default search strategy, resets its valueSelector, and adds this strategy to the end of the strategy execution lists.

Parameters:
valueSelector -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

addSearchStrategy

public void addSearchStrategy(Var[] vars)
This method creates a new instance of the default search strategy, resets its vars, and adds this strategy to the end of the strategy execution lists.

Specified by:
addSearchStrategy in interface Solver
Parameters:
vars -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

addSearchStrategy

public void addSearchStrategy(Var[] vars,
                              ValueSelector valueSelector)
This method creates a new instance of the default search strategy, resets its vars and valueSelector, and adds this strategy to the end of the strategy execution lists.

Specified by:
addSearchStrategy in interface Solver
Parameters:
vars -
valueSelector -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

addSearchStrategy

public void addSearchStrategy(Var[] vars,
                              ValueSelectorType valueSelectorType)
This method creates a new instance of the default search strategy, resets its vars and valueSelector, and adds this strategy to the end of the strategy execution lists.

Specified by:
addSearchStrategy in interface Solver
Parameters:
vars -
valueSelectorType -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

addSearchStrategy

public void addSearchStrategy(Var[] vars,
                              VarSelector varSelector)
This method creates a new instance of the default search strategy, resets its vars and varSelector, and adds this strategy to the end of the strategy execution lists.

Specified by:
addSearchStrategy in interface Solver
Parameters:
vars -
varSelector -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

addSearchStrategy

public void addSearchStrategy(Var[] vars,
                              VarSelectorType varSelectorType)
This method creates a new instance of the default search strategy, resets its vars and varSelector, and adds this strategy to the end of the strategy execution lists.

Specified by:
addSearchStrategy in interface Solver
Parameters:
vars -
varSelectorType -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

addSearchStrategy

public void addSearchStrategy(Var[] vars,
                              VarSelectorType varSelectorType,
                              ValueSelectorType valueSelectorType)
This method creates a new instance of the default search strategy, resets its vars, varSelector, and valueSelector, and then adds this strategy to the end of the strategy execution list.

Specified by:
addSearchStrategy in interface Solver
Parameters:
vars -
varSelectorType -
valueSelectorType -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

addSearchStrategy

public void addSearchStrategy(Var[] vars,
                              VarSelector varSelector,
                              ValueSelector valueSelector)
This method creates a new instance of the default search strategy, resets its vars, varSelector, and valueSelector, and then adds this strategy to the end of the strategy execution list.

Specified by:
addSearchStrategy in interface Solver
Parameters:
vars -
varSelector -
valueSelector -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

addSolution

public void addSolution(Solution solution)
Adds a solution to the current array of solutions


addStrategyLogVariables

public void addStrategyLogVariables()
This methods adds the strategy getStrategyLogVariables() to the end of the strategy execution lists.

Specified by:
addStrategyLogVariables in interface Solver

applySolution

public boolean applySolution(int solutionNumber)
This method tries to resolve the problem by applying the existing Solution at the "solutionNumber"-th index of the array of solutions (Accessible by getSolutions();). Equivalent to calling applySolution(getSolution(solutionNumber)); Returns true if the Solution satisfies all of the posted constraints, false otherwise.

Parameters:
solutionNumber - the Solution object being tested on the problem.
Returns:
true if the solution with "solutionNumber" satisfies all posted constraints, false otherwise.
See Also:
Solver#getSolution(), Solver.getSolution(int), Solver#applySolution(Solution)

applySolution

public abstract boolean applySolution(Solution solution)
This method tries to resolve the problem by applying the Solution "solution" to the problem, and returns true if "solution" satisfies all of the posted constraints, false otherwise.

Parameters:
solution - the Solution object being tested on the problem.
Returns:
true if the Solution satisfies all posted constraints, false otherwise.

checkTimeLimit

public boolean checkTimeLimit()
Validates in the difference between the current time and the getTimeLimitStart() time is more than getTimeLimit()

Returns:
true if yes, false if no.

clearSolutions

public void clearSolutions()

findAllSolutions

public Solution[] findAllSolutions()
This method attempts to find all solutions for the Problem. It uses the default search strategy or the strategy defined by the latest method setSearchStrategy(). It returns an array of found solutions or null if there are no solutions. A user has to be careful not to overload the available memory because the number of found solutions could be huge. The process of finding all solutions can be also controlled by: The common implementation is based on the SolutionIterator.

Specified by:
findAllSolutions in interface Solver
Returns:
Solution[]

findOptimalSolution

public Solution findOptimalSolution(Objective objective,
                                    Var objectiveVar)
This method is equivalent to findOptimalSolution(Objective.MINIMIZE,objectiveVar,OptimizationStrategy.NATIVE) It is usually overridden by an implementation. If not, this implementation uses findOptimalSolution(objective, objectiveVar, OptimizationStrategy.BASIC);

Specified by:
findOptimalSolution in interface Solver
Parameters:
objectiveVar -
Returns:
Solution if a solution is found, null if there are no solutions.

findOptimalSolution

public Solution findOptimalSolution(Objective objective,
                                    Var objectiveVar,
                                    OptimizationStrategy optStrategy)
This method attempts to find the solution that minimizes/maximizes the objective variable. It uses the search strategy defined by the method setSearchStrategy(strategy). The optimization process can be also controlled by:
At the same time the time for one iteration inside optimization loop (a search of one solution) can be also limited by the use of the special type of search strategy.
The problem state after the execution of this method is always restored. All variables that were added to the problems (plus the objectiveVar) will have their assigned values saved inside the optimal solution.

Specified by:
findOptimalSolution in interface Solver
Parameters:
objective - Objective.MINIMIZE or Objective.MAXIMIZE
objectiveVar - the variable that is being minimized/maximized
optStrategy - OptimizationStrategy
Returns:
Solution if a solution is found, null if there are no solutions.

findOptimalSolution

public Solution findOptimalSolution(Var objectiveVar)
This method is equivalent to findOptimalSolution(Objective.MINIMIZE,objectiveVar)

Specified by:
findOptimalSolution in interface Solver
Parameters:
objectiveVar -
Returns:
Solution if a solution is found, null if there are no solutions.

findOptimalSolutionBasic

public Solution findOptimalSolutionBasic(Objective objective,
                                         Var objectiveVar)
This method is similar to findOptimalSolution(Objective objective, Var objectiveVar) but uses the common (no solver-specific) implementation

Parameters:
objective - Objective.MINIMIZE or Objective.MAXIMIZE
objectiveVar - the variable that is being minimized/maximized
Returns:
Solution if a solution is found, null if there are no solutions.

findOptimalSolutionDichotomize

public Solution findOptimalSolutionDichotomize(Objective objective,
                                               Var objectiveVar)
The actual minimization algorithm executes a dichotomized search. During the search it modifies an interval [objectiveMin; objectiveMax]. First it is trying to find a solution in the [objectiveMin; objectiveMid]. If it fails, it is looking at [objectiveMid+1; objectiveMax]. During this process it switches the search target: one time in looks at in the upper half of the selected interval, another time - to the lower half. Successful search stops when objectiveMax - objectiveMin <= tolerance.


findOptimalSolutionDichotomize

public Solution findOptimalSolutionDichotomize(Var objectiveVar)
This method is equivalent to findOptimalSolutionCommon(Objective.MINIMIZE,objectiveVar)

Parameters:
objectiveVar -
Returns:
Solution if a solution is found, null if there are no solutions.

findSolution

public Solution findSolution()
This method is equivalent to findSolution(DO_NOT_RESTORE); It means that the problem state will always be restored even when a solution is found.

Specified by:
findSolution in interface Solver
Returns:
a Solution if the search is successful or null.

findSolution

public abstract Solution findSolution(ProblemState restoreOrNot)
This method attempts to find a solution of the problem, for which the solver was defined. It uses the search strategy defined by the method setSearchStrategy(). It returns the found solution (if any) or null. It also saves the solution and makes it available through the method getSolution(). If a solution is not found, the problem state is restored to that of before the invocation of this method. If a solution is found, the problem state will be restored only if the parameter "restore" is true. Otherwise all problem variables will be instantiated with the solution values. The search can be limited by time, number of failed attempts, etc.

Specified by:
findSolution in interface Solver
Parameters:
restoreOrNot - defines if the problem state should be restored after a solution is found
Returns:
a Solution if the search is successful or null

getMaxNumberOfSolutions

public int getMaxNumberOfSolutions()
Returns the maximal number of solutions any search can look for. A value of -1 indicates infinity, i.e. that there is no limitation on the maximal number of solutions. The default value is -1.

Specified by:
getMaxNumberOfSolutions in interface Solver
Returns:
the maximal number of solutions any search can look for. A value of -1 indicates infinity, i.e. that there is no limitation on the maximal number of solutions. The default value is -1.

getNumberOfSolutions

public int getNumberOfSolutions()
Returns the number of the last solution found, or 0 if no solutions have been found yet (or the search for a solution was not yet launched).

Specified by:
getNumberOfSolutions in interface Solver
Returns:
the number of the last solution found, or 0 if no solution have been found yet (or the search for a solution was not yet launched).

getOptimizationTolerance

public int getOptimizationTolerance()
Description copied from interface: Solver
Returns the current tolerance for the method findOptimalSolution()

Specified by:
getOptimizationTolerance in interface Solver
Returns:
the current tolerance for the method findOptimalSolution()

getProblem

public Problem getProblem()
Description copied from interface: Solver
Returns the Problem for which this solver was created

Specified by:
getProblem in interface Solver
Returns:
the Problem for which this solver was created

getSearchStrategies

public java.util.Vector<SearchStrategy> getSearchStrategies()

getSearchStrategy

public SearchStrategy getSearchStrategy()
Description copied from interface: Solver
Returns a SearchStrategy that is currently used by the solver

Specified by:
getSearchStrategy in interface Solver
Returns:
a SearchStrategy that is currently used by the solver to solve the problem

getSolution

public Solution getSolution()
Returns the first (or only) solution

Returns:
the first (or only) solution

getSolution

public Solution getSolution(int i)
Returns the i-th Solution

Specified by:
getSolution in interface Solver
Returns:
the i-th Solution
See Also:
findAllSolutions()

getSolutions

public Solution[] getSolutions()
Returns an array of Solutions, containing all found solutions.

Returns:
an array of all found solutions

getSolverStartTime

public long getSolverStartTime()

getStrategyLogVariables

public SearchStrategy getStrategyLogVariables()
Description copied from interface: Solver
Returns a search strategy that logs all variables

Specified by:
getStrategyLogVariables in interface Solver
Returns:
a a search strategy that logs all variables

getTimeLimit

public int getTimeLimit()
Returns the duration, in milliseconds, of the imposed time limit on searches.

Specified by:
getTimeLimit in interface Solver
Returns:
the duration, in milliseconds, of the imposed time limit on searches.

getTimeLimitGlobal

public int getTimeLimitGlobal()
Returns the duration, in milliseconds, of the imposed time limit on global search of all solutions or an optimal solution.

Specified by:
getTimeLimitGlobal in interface Solver
Returns:
the duration, in milliseconds, of the imposed time limit on global search of all solutions or an optimal solution.

getTimeLimitStart

public long getTimeLimitStart()
Returns the time, in milliseconds, at which the time limit began counting.

Specified by:
getTimeLimitStart in interface Solver
Returns:
the time, in milliseconds, at which the time limit began counting.

isTimeLimitExceeded

public boolean isTimeLimitExceeded()
Returns true if the time limit expired during a search, or false if not. In the case of exceeding the time limit, the Solution returned by solve() is null. The boolean returned by this method can be used to distinguish between "no solution existed" and "time limit expired", when the Solution returned is null.

Returns:
true if the time limit expired during a search, or false if not.

isTraceExecution

public boolean isTraceExecution()
Returns:
true if the search strategies are set to be traced

isTraceSolutions

public boolean isTraceSolutions()
Returns:
true if intermediate solutions are set to be traced during optimization

log

public void log(java.lang.String text)

logStats

public void logStats()
This method logs execution statistics such as a number of choice points, number of failures, used memory, etc. This method is expected to be specific for different reference implementations

Specified by:
logStats in interface Solver

newSearchStrategy

public abstract SearchStrategy newSearchStrategy()
This method returns a new default search strategy

Specified by:
newSearchStrategy in interface Solver
Returns:
a new default search strategy

restoreProblem

public void restoreProblem()
Restores a previously saved problem

Specified by:
restoreProblem in interface Solver

saveProblem

public void saveProblem()
Creates a copy of the problem in its current state

Specified by:
saveProblem in interface Solver

setMaxNumberOfSolutions

public void setMaxNumberOfSolutions(int maxNumberOfSolutions)
Sets the limit on the maximal number of solutions any search can look for. A value of -1 indicates infinity, i.e. that there is no limitation on the maximal number of solutions. The default value is -1.

Specified by:
setMaxNumberOfSolutions in interface Solver
Parameters:
maxNumberOfSolutions - the new limit for the maximal number of solutions any search can look for.

setOptimizationTolerance

public void setOptimizationTolerance(int tolerance)
Description copied from interface: Solver
Specifies a tolerance for the method findOptimalSolution(). If the difference between newly found solution and a previous one is less or equal "tolerance" then the last solution is considered to be the optimal one. By default, the optimization tolerance is 0.

Specified by:
setOptimizationTolerance in interface Solver

setProblem

public void setProblem(Problem problem)
Description copied from interface: Solver
Set the Problem with which this solver should work

Specified by:
setProblem in interface Solver

setSearchStrategy

public void setSearchStrategy(SearchStrategy strategy)
Define a searchStrategy that will be used by find solutions methods

Specified by:
setSearchStrategy in interface Solver
Parameters:
strategy -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

setSearchStrategy

public void setSearchStrategy(Var[] vars)
Define a searchStrategy that will be used by find solutions methods. This methods takes the default search strategy, and resets its vars.

Specified by:
setSearchStrategy in interface Solver
Parameters:
vars -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

setSearchStrategy

public void setSearchStrategy(Var[] vars,
                              ValueSelector valueSelector)
Define a searchStrategy that will be used by find solutions methods. This methods takes the default search strategy, and resets its vars and valueSelector.

Specified by:
setSearchStrategy in interface Solver
Parameters:
vars -
valueSelector -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

setSearchStrategy

public void setSearchStrategy(Var[] vars,
                              VarSelector varSelector)
Define a searchStrategy that will be used by find solutions methods. This methods takes the default search strategy, and resets its vars and varSelector.

Specified by:
setSearchStrategy in interface Solver
Parameters:
vars -
varSelector -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

setSearchStrategy

public void setSearchStrategy(Var[] vars,
                              VarSelector varSelector,
                              ValueSelector valueSelector)
Define a searchStrategy that will be used by find solutions methods. This methods takes the default search strategy, and resets its vars, varSelector, and valueSelector.

Specified by:
setSearchStrategy in interface Solver
Parameters:
vars -
varSelector -
valueSelector -
See Also:
AbstractSolver#findSolution()} {@link AbstractSolver#findOptimalSolution(Var)}

setSolverStartTime

public void setSolverStartTime(long solverStartTime)

setTimeLimit

public void setTimeLimit(int mills)
Sets the duration, in milliseconds, of the time limit on searches.

Specified by:
setTimeLimit in interface Solver
Parameters:
mills - the new time limit in milliseconds

setTimeLimitExceeded

public void setTimeLimitExceeded(boolean exceeded)
Sets whether or not the time limit has expired.

Parameters:
exceeded - true if the time limit exceeded, false otherwise.

setTimeLimitGlobal

public void setTimeLimitGlobal(int mills)
Sets the duration, in milliseconds, of the time limit on global search of all solutions or an optimal solution.

Specified by:
setTimeLimitGlobal in interface Solver
Parameters:
mills - the new global time limit in milliseconds

setTimeLimitStart

public void setTimeLimitStart()
Sets the start time as the system current time, for counting milliseconds to the time limit.

Specified by:
setTimeLimitStart in interface Solver

solutionIterator

public SolutionIterator solutionIterator()
Creates a solution iterator that allows a user to search and navigate through multiple solutions.

Specified by:
solutionIterator in interface Solver
Returns:
a solution iterator

traceExecution

public void traceExecution(boolean flag)
This method forces each search strategy to log itself each time when solver calls its method execute

Specified by:
traceExecution in interface Solver
Parameters:
flag - boolean

traceFailures

public void traceFailures(boolean flag)
If flag is true, all failures will be traced (logged)

Specified by:
traceFailures in interface Solver
Parameters:
flag -

traceSolutions

public void traceSolutions(boolean trueOrFalse)
This method forces the execution to log intermediate solutions during optimization search

Specified by:
traceSolutions in interface Solver
Parameters:
trueOrFalse - boolean