public final class Solver extends Object implements KodkodSolver
formula
in
first order relational logic; finite bounds
on
the value of each relation
constrained by the formula; and
a set of options
specifying, among other global
parameters, the length of bitvectors that describe the meaning of
integer expressions
in the given formula. The options are
usually reused between invocations to the solve
methods, so they are specified as a part of the solver state.
A Solver
takes as input a relational problem and produces a
satisfying model or an instance
of it, if one exists. It can also
produce a proof
of unsatisfiability for problems with no models,
if the options
specify the use of a
proof logging SAT solver.
options: Options
Constructor and Description |
---|
Solver()
Constructs a new Solver with the default options.
|
Solver(Options options)
Constructs a new Solver with the given options.
|
Modifier and Type | Method and Description |
---|---|
void |
free()
Releases the resources, if any, associated with this solver.
|
Options |
options()
Returns the Options object used by this Solver
to guide translation of formulas from first-order
logic to cnf.
|
Solution |
solve(Formula formula,
Bounds bounds)
Attempts to satisfy the given
formula and bounds with respect to
this.options or, optionally, prove the problem's unsatisfiability. |
Iterator<Solution> |
solveAll(Formula formula,
Bounds bounds)
Attempts to find all solutions to the given formula with respect to the specified bounds or
to prove the formula's unsatisfiability.
|
String |
toString() |
public Solver()
this.options' = new Options()
public Solver(Options options)
this.options' = options
NullPointerException
- options = nullpublic void free()
free
in interface KodkodSolver
KodkodSolver.free()
public Options options()
options
in interface KodkodSolver
public Solution solve(Formula formula, Bounds bounds) throws HigherOrderDeclException, UnboundLeafException, AbortedException
formula
and bounds
with respect to
this.options
or, optionally, prove the problem's unsatisfiability. If the method
completes normally, the result is a solution containing either an
instance of the given problem or, optionally, a proof of
its unsatisfiability. An unsatisfiability
proof will be constructed iff this.options.solver
specifies a SATProver and
this.options.logTranslation > 0
.solve
in interface KodkodSolver
Solution
|
some sol.instance() =>
sol.instance() in MODELS(formula, bounds, this.options) else
UNSAT(formula, bound, this.options)NullPointerException
- formula = null || bounds = nullUnboundLeafException
- the formula contains an undeclared variable or a relation not mapped by the given boundsHigherOrderDeclException
- the formula contains a higher order declaration that cannot
be skolemized, or it can be skolemized but this.options.skolemDepth
is insufficiently largeAbortedException
- this solving task was abortedOptions
,
Solution
,
Instance
,
Proof
public Iterator<Solution> solveAll(Formula formula, Bounds bounds) throws HigherOrderDeclException, UnboundLeafException, AbortedException
NullPointerException
- formula = null || bounds = nullUnboundLeafException
- the formula contains an undeclared variable or
a relation not mapped by the given boundsHigherOrderDeclException
- the formula contains a higher order declaration that cannot
be skolemized, or it can be skolemized but this.options.skolemize is false.AbortedException
- this solving task was interrupted with a call to Thread.interrupt on this threadIllegalStateException
- !this.options.solver().incremental()Solution
,
Options
,
Proof
public String toString()
toString
in class Object
Object.toString()
© Emina Torlak 2005-present