Package org.tweetyproject.arg.adf.sat
Class AsynchronousSatSolverState
- java.lang.Object
-
- org.tweetyproject.arg.adf.sat.AsynchronousSatSolverState
-
- All Implemented Interfaces:
java.lang.AutoCloseable,SatSolverState
public final class AsynchronousSatSolverState extends java.lang.Object implements SatSolverState
Executes all operations of the underlyingSatSolverStatein a (possibly) separate thread, determined by the providedExecutorService.- Author:
- Mathias Hofer
-
-
Constructor Summary
Constructors Constructor Description AsynchronousSatSolverState(SatSolverState delegate)AsynchronousSatSolverState(SatSolverState delegate, java.util.concurrent.ExecutorService executor)
-
Method Summary
Modifier and Type Method Description booleanadd(Clause clause)Adds the given clause to the solver state.voidassume(Atom proposition, boolean value)Assumes the truth value of the given proposition for the next call toSatSolverState.satisfiable().voidclose()booleansatisfiable()Computes if the current state is satisfiable.java.util.Set<Atom>witness()Returns a witness of the satisfiability of all the clauses in the state, ornullif the state is unsatisfiable.java.util.Set<Atom>witness(java.util.Collection<Atom> filter)
-
-
-
Constructor Detail
-
AsynchronousSatSolverState
public AsynchronousSatSolverState(SatSolverState delegate)
- Parameters:
delegate- the state
-
AsynchronousSatSolverState
public AsynchronousSatSolverState(SatSolverState delegate, java.util.concurrent.ExecutorService executor)
- Parameters:
delegate- the stateexecutor- the executor which is used to execute the calls to the delegate state
-
-
Method Detail
-
witness
public java.util.Set<Atom> witness()
Description copied from interface:SatSolverStateReturns a witness of the satisfiability of all the clauses in the state, ornullif the state is unsatisfiable.- Specified by:
witnessin interfaceSatSolverState- Returns:
- a witness if the state is sat, else returns
null
-
witness
public java.util.Set<Atom> witness(java.util.Collection<Atom> filter)
- Specified by:
witnessin interfaceSatSolverState
-
satisfiable
public boolean satisfiable()
Description copied from interface:SatSolverStateComputes if the current state is satisfiable. Also takes made assumptions into account.Note that it is up to the implementation if the current satisfiability status is cached or if it is computed for every call.
- Specified by:
satisfiablein interfaceSatSolverState- Returns:
- true if the state is satisfiable, false if it is not
-
assume
public void assume(Atom proposition, boolean value)
Description copied from interface:SatSolverStateAssumes the truth value of the given proposition for the next call toSatSolverState.satisfiable(). There can be multiple assumptions, all of them are gone after the nextSatSolverState.satisfiable()call.- Specified by:
assumein interfaceSatSolverState- Parameters:
proposition- the atom for which we assume a valuevalue- the value we assume
-
add
public boolean add(Clause clause)
Description copied from interface:SatSolverStateAdds the given clause to the solver state.- Specified by:
addin interfaceSatSolverState- Parameters:
clause- a clause containing only literals - no constants!- Returns:
- true if the clause could be added to the state, false if it failed
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceSatSolverState
-
-