- java.lang.Object
-
- org.logicng.backbones.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
- Positive backbone variables: Variables that occur positive in each model of the formula
- Negative backbone variables: Variables that occur negative in each model of the formula
- Optional variables: Variables that are neither in the positive nor in the negative backbone. Therefore these variables can be assigned to true or false.
- Since:
- 1.5.0
- Version:
- 2.3.1
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)SortedSet<Literal>getCompleteBackbone()Returns all literals of the backbone.SortedSet<Variable>getNegativeBackbone()Returns the negative variables of the backbone.SortedSet<Variable>getOptionalVariables()Returns the variables of the formula that are optional, i.e.SortedSet<Variable>getPositiveBackbone()Returns the positive variables of the backbone.inthashCode()booleanisSat()Returns whether the original formula of this backbone was satisfiable or not.static BackbonesatBackbone(SortedSet<Variable> positiveBackbone, SortedSet<Variable> negativeBackbone, SortedSet<Variable> optionalVariables)Returns a new backbone for a satisfiable formula.FormulatoFormula(FormulaFactory f)Returns the positive and negative backbone as a conjunction of literals.SortedMap<Variable,Tristate>toMap()Returns the backbone as map from variables to tri-states.StringtoString()static BackboneunsatBackbone()Returns a new empty backbone for an unsatisfiable formula.
-
-
-
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 variablesnegativeBackbone- negative backbone variablesoptionalVariables- 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 toTristate.TRUE, a negative variable toTristate.FALSEand the optional variables toTristate.UNDEF.- Returns:
- the mapping of the backbone
-
-