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 protectedAbstractSolverContext(FormulaManager fmgr)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description FormulaManagergetFormulaManager()Get the formula manager, which is used for formula manipulation.protected static voidloadLibrariesWithFallback(Consumer<String> loader, List<String> librariesForFirstTry, List<String> librariesForSecondTry)This method loads the given libraries.OptimizationProverEnvironmentnewOptimizationProverEnvironment(SolverContext.ProverOptions... options)Create a fresh newOptimizationProverEnvironmentwhich encapsulates an assertion stack and allows solving optimization queries.protected abstract OptimizationProverEnvironmentnewOptimizationProverEnvironment0(Set<SolverContext.ProverOptions> pSet)ProverEnvironmentnewProverEnvironment(SolverContext.ProverOptions... options)Create a fresh newProverEnvironmentwhich encapsulates an assertion stack and can be used to check formulas for unsatisfiability.protected abstract ProverEnvironmentnewProverEnvironment0(Set<SolverContext.ProverOptions> options)InterpolatingProverEnvironment<?>newProverEnvironmentWithInterpolation(SolverContext.ProverOptions... options)Create a fresh newInterpolatingProverEnvironmentwhich encapsulates an assertion stack and allows generating and retrieve interpolants for unsatisfiable formulas.protected abstract InterpolatingProverEnvironment<?>newProverEnvironmentWithInterpolation0(Set<SolverContext.ProverOptions> pSet)protected abstract booleansupportsAssumptionSolving()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:SolverContextGet the formula manager, which is used for formula manipulation.- Specified by:
getFormulaManagerin interfaceSolverContext
-
newProverEnvironment
public final ProverEnvironment newProverEnvironment(SolverContext.ProverOptions... options)
Description copied from interface:SolverContextCreate a fresh newProverEnvironmentwhich encapsulates an assertion stack and can be used to check formulas for unsatisfiability.- Specified by:
newProverEnvironmentin interfaceSolverContext- Parameters:
options- Options specified for the prover environment. All the options specified inSolverContext.ProverOptionsare 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:SolverContextCreate a fresh newInterpolatingProverEnvironmentwhich 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 theInterpolatingProverEnvironmentinterface, and return an Object of this type here.- Specified by:
newProverEnvironmentWithInterpolationin interfaceSolverContext- Parameters:
options- Options specified for the prover environment. All the options specified inSolverContext.ProverOptionsare 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:SolverContextCreate a fresh newOptimizationProverEnvironmentwhich encapsulates an assertion stack and allows solving optimization queries.- Specified by:
newOptimizationProverEnvironmentin interfaceSolverContext- Parameters:
options- Options specified for the prover environment. All the options specified inSolverContext.ProverOptionsare 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 UnsupportedOperationExceptionin 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.
-
-