|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectomnics.AbstractSolver
public abstract class AbstractSolver
Represents the abstract implementation of the Solver interface.
| Field Summary | |
|---|---|
protected Analyzer |
analyzer
|
protected long |
endTime
|
protected int |
optimum
|
protected boolean |
paused
|
protected Problem |
problem
|
protected boolean |
running
|
protected Tuple |
solution
|
protected TupleSet |
solutions
|
protected int |
solutionsLimit
|
protected long |
startTime
|
protected int |
timeLimit
|
| Fields inherited from interface omnics.Solver |
|---|
BENCHMARK_FORMAT, DETAILED_FORMAT |
| Constructor Summary | |
|---|---|
AbstractSolver(Problem problem)
Creates a new instance of AbstractSolver |
|
| Method Summary | |
|---|---|
int |
eval(Tuple tuple)
Evaluates a tuple. |
Analyzer |
getAnalyzer()
|
long |
getEndTime()
|
Problem |
getProblem()
Returns a reference to the problem beeing solved. |
int |
getSolutionsLimit()
Returns the maximum number of solutions to be found. |
long |
getStartTime()
|
int |
getTimeLimit()
Returns the time limit (in seconds) imposed for the solver. |
boolean |
isPaused()
Returns true if the solver is paused. |
boolean |
isRunning()
Returns true if the solver is running. |
void |
logResult(java.lang.String filename,
int format)
Writes the result to a log file. |
int |
optimum()
Returns the optimum found so far. |
void |
printResult(java.io.PrintStream out)
|
void |
printResult(java.io.PrintStream out,
int format)
Prints the result of the algorithm. |
void |
save(java.lang.String filename)
Performs serialization and writes the solver object to a filename in binary form. |
void |
setAnalyzer(Analyzer analyzer)
|
void |
setEndTime(long endTime)
|
void |
setPaused(boolean paused)
Causes the solver to pause or to resume execution. |
void |
setProblem(Problem problem)
Sets a problem to be solved. |
protected void |
setRunning(boolean running)
|
void |
setSolutionsLimit(int solutionsLimit)
Impose a limit for the number of solutions to be found. |
void |
setStartTime(long startTime)
|
void |
setTimeLimit(int timeLimit)
Impose a time limit (in seconds) for the solver. |
Tuple |
solution()
Returns the current partial solution |
TupleSet |
solutions()
Returns the solutions found so far. |
Tuple |
solve()
Solves the problem and returns a single solution or null if a solution cannot be found. |
TupleSet |
solve(int solutionsLimit)
Solves the problem and returns a specified number of solutions or null if no solution can be found |
abstract TupleSet |
solveAll()
Solves the problem and returns all solutions or null if no solution can be found |
void |
stop()
Stops permanently the solver. |
long |
time()
Returns the time in miliseconds |
java.lang.String |
timeToString()
Returns the time in miliseconds |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Problem problem
protected Analyzer analyzer
protected Tuple solution
protected TupleSet solutions
protected int optimum
protected boolean running
protected boolean paused
protected int timeLimit
protected long startTime
protected long endTime
protected int solutionsLimit
| Constructor Detail |
|---|
public AbstractSolver(Problem problem)
| Method Detail |
|---|
public Problem getProblem()
Solver
getProblem in interface Solverpublic void setProblem(Problem problem)
Solver
setProblem in interface Solverproblem - the problem to be solvedProblempublic Analyzer getAnalyzer()
getAnalyzer in interface Solverpublic void setAnalyzer(Analyzer analyzer)
setAnalyzer in interface Solverpublic Tuple solution()
solution in interface Solverpublic TupleSet solutions()
solutions in interface Solverpublic int optimum()
optimum in interface Solverpublic long getStartTime()
public void setStartTime(long startTime)
public long getEndTime()
public void setEndTime(long endTime)
public long time()
public java.lang.String timeToString()
public int eval(Tuple tuple)
eval in interface SolverValuationStructure.MIN and
ValuationStructure.MAXValuationStructure
public void logResult(java.lang.String filename,
int format)
logResult in interface Solverfilename - a filenameformat - DETAILED_FORMAT or BENCHMARK_FORMAT;
public void printResult(java.io.PrintStream out,
int format)
Solver
printResult in interface Solverout - a PrintStreamformat - DETAILED_FORMAT or BENCHMARK_FORMAT;public void printResult(java.io.PrintStream out)
public boolean isRunning()
Solver
isRunning in interface Solverprotected void setRunning(boolean running)
public int getTimeLimit()
getTimeLimit in interface Solverpublic void setTimeLimit(int timeLimit)
setTimeLimit in interface Solverpublic int getSolutionsLimit()
public void setSolutionsLimit(int solutionsLimit)
public TupleSet solve(int solutionsLimit)
Solvernull if no solution can be found
solve in interface Solverpublic Tuple solve()
Solvernull if a solution cannot be found.
solve in interface Solvernull if the problem is inconsistentpublic void save(java.lang.String filename)
public void stop()
Solver
stop in interface Solverpublic boolean isPaused()
SolversetPaused(false) to resume the execution.
isPaused in interface Solvertrue if the solver is pause, false
if the solver is runningpublic void setPaused(boolean paused)
Solver
setPaused in interface Solverpaused - if true, the solver will pause, otherwise it will
resume executionpublic abstract TupleSet solveAll()
Solvernull if no solution can be found
solveAll in interface Solvernull if the problem
is inconsistent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||