I'm developing a Python framework that's used to compose logic formulas. For example, if I request mutual exclusion between a
and b
, the output would be the Boolean formula:
"(a --> ¬b)^(b --> ¬a)"
In addition, I want to use some formulas as building blocks for building different types of formulas, such as formulas in Linear Temporal Logic (which is a superset of Boolean logic).
The question is twofold:
- Do I define one base class (e.g.
BooleanFormula
) and then:- add methods for generating specific formulas (e.g.
gen_mutex_formula(a, b)
) ? - or define more classes (e.g.
MutExFormula
) that inherit from the fundamental class (BooleanFormula
in my example) and generate the formulas in their constructors?
- add methods for generating specific formulas (e.g.
-
When I want to create the new types of formulas, do I inherit from the classes in (1) and mask/override their methods or do I use multiple inheritance. Example of the latter:
class LTLMutExFormula(LTLFormula, MutExFormula)
What are the criteria and heuristics I should be considering as I'm designing the framework?
PS. Here's what I've been doing so far: link to module on Github
Aucun commentaire:
Enregistrer un commentaire