kodkod.engine.satlab
Class SATFactory

java.lang.Object
  extended by kodkod.engine.satlab.SATFactory

public abstract class SATFactory
extends java.lang.Object

A factory for generating SATSolver instances of a given type. Built-in support is provided for SAT4J solvers, the zchaff solver from Princeton, and the MiniSat solver by Niklas Eén and Niklas Sörensson.

Author:
Emina Torlak

Field Summary
static SATFactory DefaultSAT4J
          The factory that produces instances of the default sat4j solver.
static SATFactory LightSAT4J
          The factory that produces instances of the "light" sat4j solver.
static SATFactory MiniSat
          The factory that produces instances of Niklas Eén and Niklas Sörensson's MiniSat solver.
static SATFactory MiniSatProver
          The factory the produces proof logging instances of the MiniSat solver.
static SATFactory ZChaff
          The factory that produces instances of the zchaff solver from Princeton; the returned instances support only basic sat solver operations (adding variables/clauses, solving, and obtaining a satisfying solution, if any).
static SATFactory ZChaffMincost
          The factory the produces cost-minimizing instances of the zchaff solver from Princeton.
 
Method Summary
static SATFactory externalFactory(java.lang.String executable, java.lang.String options, java.lang.String tempInput, java.lang.String tempOutput)
          Returns a SATFactory that produces SATSolver wrappers for the external SAT solver specified by the executable parameter.
 boolean incremental()
          Returns true if the solvers returned by this.instance() are incremental; i.e.
abstract  SATSolver instance()
          Returns an instance of a SATSolver produced by this factory.
 boolean minimizer()
          Returns true if the solvers returned by this.instance() are SATMinSolvers.
 boolean prover()
          Returns true if the solvers returned by this.instance() are SATProvers.
static SATFactory sat4jFactory(java.lang.String solverName)
          Returns a SATFactory that produces instances of the specified SAT4J solver.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DefaultSAT4J

public static final SATFactory DefaultSAT4J
The factory that produces instances of the default sat4j solver.

See Also:
ASolverFactory.defaultSolver()

LightSAT4J

public static final SATFactory LightSAT4J
The factory that produces instances of the "light" sat4j solver. The light solver is suitable for solving many small instances of SAT problems.

See Also:
ASolverFactory.lightSolver()

ZChaff

public static final SATFactory ZChaff
The factory that produces instances of the zchaff solver from Princeton; the returned instances support only basic sat solver operations (adding variables/clauses, solving, and obtaining a satisfying solution, if any). ZChaff is not incremental.


ZChaffMincost

public static final SATFactory ZChaffMincost
The factory the produces cost-minimizing instances of the zchaff solver from Princeton. Note that cost minimization can incur a time and/or memory overhead during solving, so if you do not need this functionality, use the ZChaff factory instead. ZChaffMincost is not incremental.


MiniSatProver

public static final SATFactory MiniSatProver
The factory the produces proof logging instances of the MiniSat solver. Note that core extraction can incur a significant time overhead during solving, so if you do not need this functionality, use the MiniSat factory instead.


MiniSat

public static final SATFactory MiniSat
The factory that produces instances of Niklas Eén and Niklas Sörensson's MiniSat solver.

Method Detail

sat4jFactory

public static final SATFactory sat4jFactory(java.lang.String solverName)
Returns a SATFactory that produces instances of the specified SAT4J solver. For the list of available SAT4J solvers see org.sat4j.core.ASolverFactory#solverNames().

Returns:
a SATFactory that returns the instances of the specified SAT4J solver
See Also:
ASolverFactory.solverNames()
requires:
solverName is a valid solver name

externalFactory

public static final SATFactory externalFactory(java.lang.String executable,
                                               java.lang.String options,
                                               java.lang.String tempInput,
                                               java.lang.String tempOutput)
Returns a SATFactory that produces SATSolver wrappers for the external SAT solver specified by the executable parameter. The solver's input and output formats must conform to the SAT competition standards (http://www.satcompetition.org/2004/format-solvers2004.html). The solver will be called with the specified options, and the given tempInput file name will be used to store the generated CNF files. If the tempOutput string is empty, the solver specified by the executable string is assumed to write its output to standard out; otherwise, the solver is assumed to write its output to the tempOutput file. It is the caller's responsibility to delete the temporary file(s) when no longer needed. External solvers are never incremental.

Returns:
SATFactory that produces interruptible SATSolver wrappers for the specified external SAT solver

instance

public abstract SATSolver instance()
Returns an instance of a SATSolver produced by this factory.

Returns:
a SATSolver instance

prover

public boolean prover()
Returns true if the solvers returned by this.instance() are SATProvers. Otherwise returns false.

Returns:
true if the solvers returned by this.instance() are SATProvers. Otherwise returns false.

minimizer

public boolean minimizer()
Returns true if the solvers returned by this.instance() are SATMinSolvers. Otherwise returns false.

Returns:
true if the solvers returned by this.instance() are SATMinSolvers. Otherwise returns false.

incremental

public boolean incremental()
Returns true if the solvers returned by this.instance() are incremental; i.e. if clauses/variables can be added to the solver between multiple calls to solve().

Returns:
true if the solvers returned by this.instance() are incremental