Module logicng

Class Backbone


  • public final class Backbone
    extends Object
    This class represents a backbone. A backbone of a formula is a set of literals (positive and/or negative) which are present in their respective polarity in every model of the given formula. Therefore, the literals must be set accordingly in order for the formula to evaluate to true.

    A backbone of a formula has up to three sets of variables

    1. Positive backbone variables: Variables that occur positive in each model of the formula
    2. Negative backbone variables: Variables that occur negative in each model of the formula
    3. Optional variables: Variables that are neither in the positive nor in the negative backbone. Therefore these variables can be assigned to true or false.
    All variable sets which were not computed are empty.
    Since:
    1.5.0
    Version:
    2.3.1
    • Method Detail

      • satBackbone

        public static Backbone satBackbone​(SortedSet<Variable> positiveBackbone,
                                           SortedSet<Variable> negativeBackbone,
                                           SortedSet<Variable> optionalVariables)
        Returns a new backbone for a satisfiable formula.
        Parameters:
        positiveBackbone - positive backbone variables
        negativeBackbone - negative backbone variables
        optionalVariables - optional variables
        Returns:
        the backbone
      • unsatBackbone

        public static Backbone unsatBackbone()
        Returns a new empty backbone for an unsatisfiable formula.
        Returns:
        the backbone
      • isSat

        public boolean isSat()
        Returns whether the original formula of this backbone was satisfiable or not.
        Returns:
        whether the original formula of this backbone was satisfiable or not
      • getPositiveBackbone

        public SortedSet<Variable> getPositiveBackbone()
        Returns the positive variables of the backbone.
        Returns:
        the set of positive backbone variables
      • getNegativeBackbone

        public SortedSet<Variable> getNegativeBackbone()
        Returns the negative variables of the backbone.
        Returns:
        the set of negative backbone variables
      • getOptionalVariables

        public SortedSet<Variable> getOptionalVariables()
        Returns the variables of the formula that are optional, i.e. not in the positive or negative backbone.
        Returns:
        the set of non-backbone variables
      • getCompleteBackbone

        public SortedSet<Literal> getCompleteBackbone()
        Returns all literals of the backbone. Positive backbone variables have positive polarity, negative backbone variables have negative polarity.
        Returns:
        the set of both positive and negative backbone variables as literals
      • toFormula

        public Formula toFormula​(FormulaFactory f)
        Returns the positive and negative backbone as a conjunction of literals.
        Parameters:
        f - the formula factory needed for construction the backbone formula.
        Returns:
        the backbone formula
      • toMap

        public SortedMap<Variable,​Tristate> toMap()
        Returns the backbone as map from variables to tri-states. A positive variable is mapped to Tristate.TRUE, a negative variable to Tristate.FALSE and the optional variables to Tristate.UNDEF.
        Returns:
        the mapping of the backbone
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object