|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectomnics.AbstractSolver
omnics.SystematicSolver
public abstract class SystematicSolver
Abstract class that describes a solver capable of exploring systematically the search space in order to find one or all solutions of a problem.
| Field Summary | |
|---|---|
protected AssignmentStrategy |
assignmentStrategy
|
protected long |
attempts
|
protected long |
backtrackCounter
|
protected BackwardStrategy |
backwardStrategy
|
protected BoundAlgorithm |
boundAlgorithm
|
protected VarSet |
candidates
|
protected VarSet[] |
candidatesMap
|
protected ConstraintSet[] |
constraintsMap
|
static boolean |
DEBUG
|
protected Domain[][] |
domainsMap
|
protected EventHandler |
eventHandler
|
protected Explainer |
explainer
|
protected Var |
failed
|
protected long |
failures
|
protected java.util.List<Filter> |
filters
|
protected boolean |
firingEvents
|
protected ForwardStrategy |
forwardStrategy
|
protected java.util.List<SolverListener> |
listeners
|
protected long |
longestBacktrack
|
protected java.util.Stack<Var> |
path
|
protected Tuple[] |
solutionMap
|
protected long |
thrashing
|
| Fields inherited from class omnics.AbstractSolver |
|---|
analyzer, endTime, optimum, paused, problem, running, solution, solutions, solutionsLimit, startTime, timeLimit |
| Fields inherited from interface omnics.Solver |
|---|
BENCHMARK_FORMAT, DETAILED_FORMAT |
| Constructor Summary | |
|---|---|
SystematicSolver(Problem problem)
Creates a new instance of SystematicSolver |
|
| Method Summary | |
|---|---|
void |
addFilter(Filter filter)
Adds a filter to the solver. |
void |
addListener(SolverListener listener)
|
protected void |
assign(Var var,
java.lang.Object value)
|
long |
attempts()
Returns the number of attemtps to extend the current solution. |
java.util.List<Var> |
candidates()
|
void |
copyCandidates()
Saves in memory a copy of the candidates |
void |
copyConstraints()
Saves in memory a copy of the problem constraints |
void |
copyDomain(Var var)
Saves in memory a copy of the variable 'var' |
void |
copySolution()
Saves in memory a copy of the solution |
Var |
current()
Returns the current variable. |
java.lang.String |
explain()
Constructs an explanation for: "why the problem is not consistent?" |
java.lang.String |
explain(Tuple tuple)
Constructs an explanation: "why this tuple is not good?" |
java.lang.String |
explain(Var var,
java.lang.Object val)
Constructs an explanation for: "why x=a is not good?" |
long |
failures()
Returns the number of failures (backward steps). |
AssignmentStrategy |
getAssignmentStrategy()
|
BackwardStrategy |
getBackwardStrategy()
|
BoundAlgorithm |
getBoundAlgorithm()
Returns the algorithm for bounding the problem. |
EventHandler |
getEventHandler()
|
Explainer |
getExplainer()
|
Var |
getFailed()
Returns the last node that failed. |
Filter |
getFilter(java.lang.String name)
Returns a certain filter. |
java.util.List<Filter> |
getFilters()
Returns the solver's filters. |
ForwardStrategy |
getForwardStrategy()
Returns the forward strategy: the heuristic used for selecting the next variable which will be instantiated. |
java.util.List<SolverListener> |
getListeners()
|
void |
initSolution(Tuple solution)
Sets the initial solution. |
boolean |
isApplyingFilters()
|
boolean |
isDynamicConstrained()
|
boolean |
isFiringEvents()
|
boolean |
isPaused()
Returns true if the solver is paused. |
Var |
last()
Returns the last variable on the solver path |
long |
longestBacktrack()
Returns the number of failures (backward steps). |
java.util.Stack<Var> |
path()
Returns the current path. |
void |
printResult(java.io.PrintStream out)
|
void |
printResult(java.io.PrintStream out,
int format)
Prints the result of the algorithm. |
void |
removeAllFilters()
Removes a filter from the solver. |
void |
removeFilter(Filter filter)
Removes a filter from the solver. |
void |
removeListener(SolverListener listener)
|
protected boolean |
resolveSingletons()
Resolves the singleton domains. |
void |
restoreCandidates(Var current)
Restores the solution saved when the current node was 'current' |
void |
restoreConstraints(Var current)
Restores the constraints of the problem saved when the current node was 'current' |
void |
restoreDomain(Var var,
Var current)
Restores the domain of 'var' saved when the current node was 'current' |
void |
restoreProblem(Var trigger)
Restores the problem to a specific point. |
void |
restoreSolution(Var current)
Restores the solution saved when the current node was 'current' |
void |
setApplyingFilters(boolean applyingFilters)
|
void |
setAssignmentStrategy(AssignmentStrategy assignmentStrategy)
|
void |
setBackwardStrategy(BackwardStrategy backwardStrategy)
|
void |
setBoundAlgorithm(BoundAlgorithm boundAlgorithm)
Sets an algorithm for bounding the problem. |
void |
setDynamicConstrained(boolean dynamicConstrained)
|
void |
setEventHandler(EventHandler eventHandler)
|
void |
setExplainer(Explainer explainer)
|
void |
setFailed(Var failed)
|
void |
setFiringEvents(boolean firingEvents)
|
void |
setForwardStrategy(ForwardStrategy forwardStrategy)
Sets the forward strategy: the heuristic used for selecting the next variable which will be instantiated. |
void |
setListeners(java.util.List<SolverListener> listeners)
|
void |
setPaused(boolean paused)
Causes the solver to pause or to resume execution. |
void |
stop()
Stops permanently the solver. |
| Methods inherited from class omnics.AbstractSolver |
|---|
eval, getAnalyzer, getEndTime, getProblem, getSolutionsLimit, getStartTime, getTimeLimit, isRunning, logResult, optimum, save, setAnalyzer, setEndTime, setProblem, setRunning, setSolutionsLimit, setStartTime, setTimeLimit, solution, solutions, solve, solve, solveAll, time, timeToString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected AssignmentStrategy assignmentStrategy
protected ForwardStrategy forwardStrategy
protected BackwardStrategy backwardStrategy
protected java.util.List<Filter> filters
protected BoundAlgorithm boundAlgorithm
protected Var failed
protected long attempts
protected long failures
protected long backtrackCounter
protected long longestBacktrack
protected long thrashing
protected java.util.Stack<Var> path
protected VarSet candidates
protected Tuple[] solutionMap
protected VarSet[] candidatesMap
protected Domain[][] domainsMap
protected ConstraintSet[] constraintsMap
protected EventHandler eventHandler
protected boolean firingEvents
protected java.util.List<SolverListener> listeners
protected Explainer explainer
public static boolean DEBUG
| Constructor Detail |
|---|
public SystematicSolver(Problem problem)
| Method Detail |
|---|
public void initSolution(Tuple solution)
public Var getFailed()
public void setFailed(Var failed)
public ForwardStrategy getForwardStrategy()
public void setForwardStrategy(ForwardStrategy forwardStrategy)
public AssignmentStrategy getAssignmentStrategy()
public void setAssignmentStrategy(AssignmentStrategy assignmentStrategy)
public BackwardStrategy getBackwardStrategy()
public void setBackwardStrategy(BackwardStrategy backwardStrategy)
public void addFilter(Filter filter)
public void removeFilter(Filter filter)
public void removeAllFilters()
public java.util.List<Filter> getFilters()
public Filter getFilter(java.lang.String name)
public BoundAlgorithm getBoundAlgorithm()
public void setBoundAlgorithm(BoundAlgorithm boundAlgorithm)
public Var current()
public java.util.Stack<Var> path()
public java.util.List<Var> candidates()
public long attempts()
public long failures()
public long longestBacktrack()
public Var last()
public void copyDomain(Var var)
public void restoreDomain(Var var,
Var current)
public void copyConstraints()
public void restoreConstraints(Var current)
public void copySolution()
public void restoreSolution(Var current)
public void copyCandidates()
public void restoreCandidates(Var current)
public void restoreProblem(Var trigger)
public void printResult(java.io.PrintStream out,
int format)
Solver
printResult in interface SolverprintResult in class AbstractSolverout - a PrintStreamformat - DETAILED_FORMAT or BENCHMARK_FORMAT;public void printResult(java.io.PrintStream out)
printResult in class AbstractSolverpublic boolean isApplyingFilters()
public void setApplyingFilters(boolean applyingFilters)
protected void assign(Var var,
java.lang.Object value)
protected boolean resolveSingletons()
public Explainer getExplainer()
public void setExplainer(Explainer explainer)
public java.lang.String explain()
public java.lang.String explain(Var var,
java.lang.Object val)
public java.lang.String explain(Tuple tuple)
public void addListener(SolverListener listener)
public void removeListener(SolverListener listener)
public java.util.List<SolverListener> getListeners()
public void setListeners(java.util.List<SolverListener> listeners)
public EventHandler getEventHandler()
public void setEventHandler(EventHandler eventHandler)
public boolean isFiringEvents()
public void setFiringEvents(boolean firingEvents)
public void stop()
Solver
stop in interface Solverstop in class AbstractSolverpublic boolean isPaused()
SolversetPaused(false) to resume the execution.
isPaused in interface SolverisPaused in class AbstractSolvertrue if the solver is pause, false
if the solver is runningpublic void setPaused(boolean paused)
Solver
setPaused in interface SolversetPaused in class AbstractSolverpaused - if true, the solver will pause, otherwise it will
resume executionpublic boolean isDynamicConstrained()
public void setDynamicConstrained(boolean dynamicConstrained)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||