omnics
Interface Solver

All Known Implementing Classes:
AbstractSolver, Backtracking, SystematicSolver

public interface Solver

Describes a general solver for a constraint satisfaction problem represented as a Problem instance.


Field Summary
static int BENCHMARK_FORMAT
           
static int DETAILED_FORMAT
           
 
Method Summary
 int eval(Tuple tuple)
          Evaluates a tuple and returns a value between ValuationStructure.MIN and ValuationStructure.MAX In case of classical satisfaction problem the returned values are ValuationStructure.ALLOWED(=MIN) or ValuationStructure.FORBIDDEN(=MAX)
 Analyzer getAnalyzer()
           
 Problem getProblem()
          Returns a reference to the problem beeing solved.
 int getTimeLimit()
          Returns the time limit that has been imposed.
 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 of the algorithm to a log file.
 int optimum()
          Returns the current optimum.
 void printResult(java.io.PrintStream out, int format)
          Prints the result of the algorithm.
 void setAnalyzer(Analyzer analyzer)
           
 void setPaused(boolean paused)
          Causes the solver to pause or to resume execution.
 void setProblem(Problem problem)
          Sets a problem to be solved.
 void setTimeLimit(int limit)
          Sets a limit for the solving process.
 Tuple solution()
          Returns the current (partial) solution.
 TupleSet solutions()
          Returns the solutions found and memorized 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
 TupleSet solveAll()
          Solves the problem and returns all solutions or null if no solution can be found
 void stop()
          Stops permanently the solver.
 

Field Detail

DETAILED_FORMAT

static final int DETAILED_FORMAT
See Also:
Constant Field Values

BENCHMARK_FORMAT

static final int BENCHMARK_FORMAT
See Also:
Constant Field Values
Method Detail

getProblem

Problem getProblem()
Returns a reference to the problem beeing solved.

Returns:
the problem beeing solved or null if no problem was specified yet.

setProblem

void setProblem(Problem problem)
Sets a problem to be solved.

Parameters:
problem - the problem to be solved
See Also:
Problem

getAnalyzer

Analyzer getAnalyzer()

setAnalyzer

void setAnalyzer(Analyzer analyzer)

getTimeLimit

int getTimeLimit()
Returns the time limit that has been imposed.


setTimeLimit

void setTimeLimit(int limit)
Sets a limit for the solving process. If the problem is not solved within the specified number of seconds, the solver is stoped.


isRunning

boolean isRunning()
Returns true if the solver is running.


stop

void stop()
Stops permanently the solver.


isPaused

boolean isPaused()
Returns true if the solver is paused. Use setPaused(false) to resume the execution.

Returns:
true if the solver is pause, false if the solver is running

setPaused

void setPaused(boolean paused)
Causes the solver to pause or to resume execution.

Parameters:
paused - if true, the solver will pause, otherwise it will resume execution

solve

Tuple solve()
Solves the problem and returns a single solution or null if a solution cannot be found.

Returns:
a solution or null if the problem is inconsistent

solve

TupleSet solve(int solutionsLimit)
Solves the problem and returns a specified number of solutions or null if no solution can be found


solveAll

TupleSet solveAll()
Solves the problem and returns all solutions or null if no solution can be found

Returns:
all solutions of the problem or null if the problem is inconsistent

solution

Tuple solution()
Returns the current (partial) solution.

Returns:
the current partial solution

solutions

TupleSet solutions()
Returns the solutions found and memorized so far.

Returns:
the solutions found

optimum

int optimum()
Returns the current optimum.

Returns:
the current optimum

eval

int eval(Tuple tuple)
Evaluates a tuple and returns a value between ValuationStructure.MIN and ValuationStructure.MAX In case of classical satisfaction problem the returned values are ValuationStructure.ALLOWED(=MIN) or ValuationStructure.FORBIDDEN(=MAX)

Returns:
a value between ValuationStructure.MIN and ValuationStructure.MAX
See Also:
ValuationStructure

printResult

void printResult(java.io.PrintStream out,
                 int format)
Prints the result of the algorithm.

Parameters:
out - a PrintStream
format - DETAILED_FORMAT or BENCHMARK_FORMAT;

logResult

void logResult(java.lang.String filename,
               int format)
Writes the result of the algorithm to a log file.

Parameters:
filename - a filename
format - DETAILED_FORMAT or BENCHMARK_FORMAT;