Class SimpleSatSolverState

  • All Implemented Interfaces:
    AutoCloseable, SatSolverState

    public final class SimpleSatSolverState
    extends Object
    implements SatSolverState
    A dummy state that can be used in combination with non-incremental Sat-Solvers and SimpleIncrementalSatSolver at positions where a SatSolverState is required.

    Maintains an internal collection of disjunctions.

    Author:
    Mathias Hofer
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleSatSolverState​(net.sf.tweety.logics.pl.sat.SatSolver solver)  
    • Method Summary

      Modifier and Type Method Description
      boolean add​(Collection<net.sf.tweety.logics.pl.syntax.Disjunction> clauses)
      Adds the given set of clauses to the solver state.
      boolean add​(net.sf.tweety.logics.pl.syntax.Disjunction clause)
      Adds the given clause to the solver state.
      void assume​(net.sf.tweety.logics.pl.syntax.Proposition proposition, boolean value)
      Assumes the truth value of the given proposition for the next call to SatSolverState.satisfiable().
      void close()  
      net.sf.tweety.commons.Interpretation<net.sf.tweety.logics.pl.syntax.PlBeliefSet,​net.sf.tweety.logics.pl.syntax.PlFormula> witness()
      Returns a witness of the satisfiability of all the clauses in the state, or null if the state is unsatisfiable.
    • Constructor Detail

      • SimpleSatSolverState

        public SimpleSatSolverState​(net.sf.tweety.logics.pl.sat.SatSolver solver)
        Parameters:
        solver - the solver to use
    • Method Detail

      • witness

        public net.sf.tweety.commons.Interpretation<net.sf.tweety.logics.pl.syntax.PlBeliefSet,​net.sf.tweety.logics.pl.syntax.PlFormula> witness()
        Description copied from interface: SatSolverState
        Returns a witness of the satisfiability of all the clauses in the state, or null if the state is unsatisfiable.
        Specified by:
        witness in interface SatSolverState
        Returns:
        a witness if the state is sat, else returns null
      • assume

        public void assume​(net.sf.tweety.logics.pl.syntax.Proposition proposition,
                           boolean value)
        Description copied from interface: SatSolverState
        Assumes the truth value of the given proposition for the next call to SatSolverState.satisfiable(). There can be multiple assumptions, all of them are gone after the next SatSolverState.satisfiable() call.
        Specified by:
        assume in interface SatSolverState
        Parameters:
        proposition - the proposition for which we assume a value
        value - the value we assume
      • add

        public boolean add​(net.sf.tweety.logics.pl.syntax.Disjunction clause)
        Description copied from interface: SatSolverState
        Adds the given clause to the solver state.
        Specified by:
        add in interface SatSolverState
        Parameters:
        clause - a clause containing only literals - no constants!
        Returns:
        true if the clause could be added to the state, false if it failed
      • add

        public boolean add​(Collection<net.sf.tweety.logics.pl.syntax.Disjunction> clauses)
        Description copied from interface: SatSolverState
        Adds the given set of clauses to the solver state.

        If one of the clauses cannot be added, the rest of the clauses may or may not be added. Hence, there is no guarantee that this method tries to add the remaining clauses after the first fail. If this method however returns true, then all of the given clauses were successfully added to the state.

        Specified by:
        add in interface SatSolverState
        Parameters:
        clauses - a set of clauses
        Returns:
        true if all of the clauses could be added to the state, false if at least one clause failed