Module src.olaaaf.formula.nullaryFormula.constraint.propositionalVariable
Representation of a Propositional Variable in CPC.
Classes
- class PropositionalVariable (name: str, fmName: str = None)
- 
Abstract Constraint class, representing a Constraint in PCMLC. Attributes- children:- None
- The children of the current node. Since a cosntraint doesn't have any, it's None.
 Expand source codeclass PropositionalVariable(Constraint): def __init__(self, name: str, fmName: str = None): self.name = name # Declare if name if(fmName is not None): FormulaManager.declare(fmName, self) def getVariables(self): ''' Not applicable here ''' raise NotImplementedError("getVariables cannot be use here, the Formula contains a PropositionalVariable") def getAdherence(self, var : Variable = None): ''' Not applicable here ''' raise NotImplementedError("getAdherence cannot be use here, the Formula contains a PropositionalVariable") def _getAdherenceNeg(self, var : Variable = None): ''' Not applicable here ''' raise NotImplementedError("_getAdherenceNeg cannot be use here, the Formula contains a PropositionalVariable") def __str__(self): return self.name def toLatex(self): return self.name def toLessOrEqConstraint(self): ''' Not applicable here ''' raise NotImplementedError("toLessOrEqConstraint cannot be use here, the Formula contains a PropositionalVariable") def toPCMLC(self, varDict) -> Formula: ''' Method used to transform a `olaaaf.formula.formula.Formula` into a new one, in the PCMLC formalism. Parameters ---------- varDict : dictionnary Dictionnary used to tell which variable should be replaced by which. Returns ------- `olaaaf.formula.formula.Formula` A `olaaaf.formula.formula.Formula` in the PCMLC formalism. ''' LC = LinearConstraint("") LC.variables = {varDict[self]: Fraction(-1)} LC.operator = ConstraintOperator.LEQ LC.bound = Fraction(-1) return LC def _toPCMLCNeg(self, varDict) -> Formula: ''' Method used to transform a `olaaaf.formula.formula.Formula` into a new one, in the PCMLC formalism. Parameters ---------- varDict : dictionnary Dictionnary used to tell which variable should be replaced by which. Returns ------- `olaaaf.formula.formula.Formula` A `olaaaf.formula.formula.Formula` in the PCMLC formalism. ''' LC = LinearConstraint("") LC.variables = {varDict[self]: Fraction(1)} LC.operator = ConstraintOperator.LEQ LC.bound = Fraction(0) return LC def clone(self) -> PropositionalVariable: """ Method returning a clone of the current Formula. Returns ------- `olaaaf.formula.formula.Formula` Clone of the current `olaaaf.formula.formula.Formula`. """ clonedPv = PropositionalVariable("") clonedPv.name = self.name.copy() return clonedPv def __eq__(self, o) -> bool: #BRAVO if o.__class__ != self.__class__: return False else: return o.name == self.name def __hash__(self): return hash(str(self))Ancestors- Constraint
- NullaryFormula
- Formula
- abc.ABC
 Methods- def getAdherence(self, var: Variable = None)
- 
Not applicable here 
- def getVariables(self)
- 
Not applicable here 
- def toLessOrEqConstraint(self)
- 
Not applicable here 
 Inherited members