Package org.sosy_lab.java_smt
Class SolverContextFactory
java.lang.Object
org.sosy_lab.java_smt.SolverContextFactory
Factory class for loading and generating solver contexts. Generates a
SolverContext
corresponding to the chosen solver.
Main entry point for JavaSMT.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSolverContextFactory(Configuration pConfig, LogManager pLogger, ShutdownNotifier pShutdownNotifier) This constructor uses the default JavaSMT loader for accessing native libraries.SolverContextFactory(Configuration pConfig, LogManager pLogger, ShutdownNotifier pShutdownNotifier, Consumer<String> pLoader) This constructor instantiates a factory for building solver contexts for a configured SMT solver (via the parameterpConfig). -
Method Summary
Modifier and TypeMethodDescriptionstatic SolverContextcreateSolverContext(Configuration config, LogManager logger, ShutdownNotifier shutdownNotifier) Shortcut for getting aSolverContext, the solver is selected using the configurationconfig.static SolverContextcreateSolverContext(Configuration config, LogManager logger, ShutdownNotifier shutdownNotifier, SolverContextFactory.Solvers solver) Shortcut for getting aSolverContext, the solver is selected using an argument.static SolverContextcreateSolverContext(Configuration config, LogManager logger, ShutdownNotifier shutdownNotifier, SolverContextFactory.Solvers solver, Consumer<String> loader) This is the most explicit method for getting aSolverContext, the solver, the logger, the shutdownNotifier, and the libraryLoader are provided as parameters by the caller.static SolverContextMinimalistic shortcut for creating a solver context.Create new context with solver chosen according to the supplied configuration.generateContext(SolverContextFactory.Solvers solverToCreate) Create new context with solver name supplied.
-
Constructor Details
-
SolverContextFactory
public SolverContextFactory(Configuration pConfig, LogManager pLogger, ShutdownNotifier pShutdownNotifier) throws InvalidConfigurationException This constructor uses the default JavaSMT loader for accessing native libraries. -
SolverContextFactory
public SolverContextFactory(Configuration pConfig, LogManager pLogger, ShutdownNotifier pShutdownNotifier, Consumer<String> pLoader) throws InvalidConfigurationException This constructor instantiates a factory for building solver contexts for a configured SMT solver (via the parameterpConfig). Each created context is independent of other contexts and uses its own environment for building formulas and querying the solver.- Parameters:
pConfig- The configuration to be used when instantiating JavaSMT and the solvers. By default, the configuration specifies the solver to use via the optionsolver.solver=.... This option can be overridden when calling the methodgenerateContext(Solvers).pLogger- The processing of log messages from SMT solvers (or their bindings) is handled via this LogManager.pShutdownNotifier- This central instance allows to request the termination of all operations in the created solver. Please note that the solver can decide on its own to accept the shutdown request and terminate its operation afterwards. We do not forcefully terminate any solver query eagerly. In general, a solver is of good nature, and maturely developed, and terminates accordingly.pLoader- The loading mechanism (loading method) in this class can be injected by the user and, e.g., can be used to search for the library binaries in more directories. This makes the loading process for native solvers like Boolector, CVC4, MathSAT, Z3 more flexible. For Java-based libraries (solvers like SMTInterpol or Princess, and also other dependences), this class is irrelevant and not accessed.- Throws:
InvalidConfigurationException
-
-
Method Details
-
generateContext
Create new context with solver chosen according to the supplied configuration.- Throws:
InvalidConfigurationException
-
generateContext
public SolverContext generateContext(SolverContextFactory.Solvers solverToCreate) throws InvalidConfigurationException Create new context with solver name supplied.- Throws:
InvalidConfigurationException- See Also:
-
createSolverContext
public static SolverContext createSolverContext(Configuration config, LogManager logger, ShutdownNotifier shutdownNotifier) throws InvalidConfigurationException Shortcut for getting aSolverContext, the solver is selected using the configurationconfig.- Throws:
InvalidConfigurationException
-
createSolverContext
public static SolverContext createSolverContext(Configuration config, LogManager logger, ShutdownNotifier shutdownNotifier, SolverContextFactory.Solvers solver) throws InvalidConfigurationException Shortcut for getting aSolverContext, the solver is selected using an argument.See
SolverContextFactory(Configuration, LogManager, ShutdownNotifier, Consumer)for documentation of accepted parameters.- Throws:
InvalidConfigurationException
-
createSolverContext
public static SolverContext createSolverContext(Configuration config, LogManager logger, ShutdownNotifier shutdownNotifier, SolverContextFactory.Solvers solver, Consumer<String> loader) throws InvalidConfigurationException This is the most explicit method for getting aSolverContext, the solver, the logger, the shutdownNotifier, and the libraryLoader are provided as parameters by the caller.See
SolverContextFactory(Configuration, LogManager, ShutdownNotifier, Consumer)for documentation of accepted parameters.- Throws:
InvalidConfigurationException
-
createSolverContext
public static SolverContext createSolverContext(SolverContextFactory.Solvers solver) throws InvalidConfigurationException Minimalistic shortcut for creating a solver context. Empty default configuration, no logging, and no shutdown notifier.- Parameters:
solver- Solver to initialize- Throws:
InvalidConfigurationException
-