Package org.sosy_lab.java_smt.basicimpl
Class AbstractSolverContext
- java.lang.Object
-
- org.sosy_lab.java_smt.basicimpl.AbstractSolverContext
-
- All Implemented Interfaces:
AutoCloseable
,SolverContext
public abstract class AbstractSolverContext extends Object implements SolverContext
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.sosy_lab.java_smt.api.SolverContext
SolverContext.ProverOptions
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSolverContext(FormulaManager fmgr)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description FormulaManager
getFormulaManager()
Get the formula manager, which is used for formula manipulation.protected static void
loadLibrariesWithFallback(Consumer<String> loader, List<String> librariesForFirstTry, List<String> librariesForSecondTry)
This method loads the given libraries.OptimizationProverEnvironment
newOptimizationProverEnvironment(SolverContext.ProverOptions... options)
Create a fresh newOptimizationProverEnvironment
which encapsulates an assertion stack and allows solving optimization queries.protected abstract OptimizationProverEnvironment
newOptimizationProverEnvironment0(Set<SolverContext.ProverOptions> pSet)
ProverEnvironment
newProverEnvironment(SolverContext.ProverOptions... options)
Create a fresh newProverEnvironment
which encapsulates an assertion stack and can be used to check formulas for unsatisfiability.protected abstract ProverEnvironment
newProverEnvironment0(Set<SolverContext.ProverOptions> options)
InterpolatingProverEnvironment<?>
newProverEnvironmentWithInterpolation(SolverContext.ProverOptions... options)
Create a fresh newInterpolatingProverEnvironment
which encapsulates an assertion stack and allows generating and retrieve interpolants for unsatisfiable formulas.protected abstract InterpolatingProverEnvironment<?>
newProverEnvironmentWithInterpolation0(Set<SolverContext.ProverOptions> pSet)
protected abstract boolean
supportsAssumptionSolving()
Whether the solver supports solving under some given assumptions (with all corresponding features) by itself, i.e., whetherBasicProverEnvironment.isUnsatWithAssumptions(java.util.Collection)
andBasicProverEnvironment.isUnsatWithAssumptions(java.util.Collection)
are fully implemented.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.sosy_lab.java_smt.api.SolverContext
close, getSolverName, getStatistics, getVersion
-
-
-
-
Constructor Detail
-
AbstractSolverContext
protected AbstractSolverContext(FormulaManager fmgr)
-
-
Method Detail
-
getFormulaManager
public final FormulaManager getFormulaManager()
Description copied from interface:SolverContext
Get the formula manager, which is used for formula manipulation.- Specified by:
getFormulaManager
in interfaceSolverContext
-
newProverEnvironment
public final ProverEnvironment newProverEnvironment(SolverContext.ProverOptions... options)
Description copied from interface:SolverContext
Create a fresh newProverEnvironment
which encapsulates an assertion stack and can be used to check formulas for unsatisfiability.- Specified by:
newProverEnvironment
in interfaceSolverContext
- Parameters:
options
- Options specified for the prover environment. All the options specified inSolverContext.ProverOptions
are turned off by default.
-
newProverEnvironment0
protected abstract ProverEnvironment newProverEnvironment0(Set<SolverContext.ProverOptions> options)
-
newProverEnvironmentWithInterpolation
public final InterpolatingProverEnvironment<?> newProverEnvironmentWithInterpolation(SolverContext.ProverOptions... options)
Description copied from interface:SolverContext
Create a fresh newInterpolatingProverEnvironment
which encapsulates an assertion stack and allows generating and retrieve interpolants for unsatisfiable formulas. If the SMT solver is able to handle satisfiability tests with assumptions please consider implementing theInterpolatingProverEnvironment
interface, and return an Object of this type here.- Specified by:
newProverEnvironmentWithInterpolation
in interfaceSolverContext
- Parameters:
options
- Options specified for the prover environment. All the options specified inSolverContext.ProverOptions
are turned off by default.
-
newProverEnvironmentWithInterpolation0
protected abstract InterpolatingProverEnvironment<?> newProverEnvironmentWithInterpolation0(Set<SolverContext.ProverOptions> pSet)
-
newOptimizationProverEnvironment
public final OptimizationProverEnvironment newOptimizationProverEnvironment(SolverContext.ProverOptions... options)
Description copied from interface:SolverContext
Create a fresh newOptimizationProverEnvironment
which encapsulates an assertion stack and allows solving optimization queries.- Specified by:
newOptimizationProverEnvironment
in interfaceSolverContext
- Parameters:
options
- Options specified for the prover environment. All the options specified inSolverContext.ProverOptions
are turned off by default.
-
newOptimizationProverEnvironment0
protected abstract OptimizationProverEnvironment newOptimizationProverEnvironment0(Set<SolverContext.ProverOptions> pSet)
-
supportsAssumptionSolving
protected abstract boolean supportsAssumptionSolving()
Whether the solver supports solving under some given assumptions (with all corresponding features) by itself, i.e., whetherBasicProverEnvironment.isUnsatWithAssumptions(java.util.Collection)
andBasicProverEnvironment.isUnsatWithAssumptions(java.util.Collection)
are fully implemented.Otherwise, i.e., if this method returns
false
, the solver does not need to support this feature and may simplythrow UnsupportedOperationException
in the respective methods. This class will wrap the prover environments and provide an implementation of the feature.This method is expected to always return the same value. Otherwise, the behavior of this class is undefined.
-
loadLibrariesWithFallback
protected static void loadLibrariesWithFallback(Consumer<String> loader, List<String> librariesForFirstTry, List<String> librariesForSecondTry) throws UnsatisfiedLinkError
This method loads the given libraries.If the first list of libraries can not be loaded, the second list is used as a fallback. The two lists of libraries can be used to differ between libraries specific to Unix/Linux and Windows.
If the first try aborts after a few steps, we do not clean up partially loaded libraries, but directly start the second try.
Each list is applied in the given ordering.
- Parameters:
loader
- the loading mechanism that will be used for loading each single library.librariesForFirstTry
- list of library names that will be loaded, if possible.librariesForSecondTry
- list of library names that will be loaded, after the first attempt (using librariesForFirstTry) has failed.- Throws:
UnsatisfiedLinkError
- if neither the first nor second try returned a successful loading process.
-
-