AI-Planning/pddl

Update `MonotoneOp` to allow only flattening but not idempotency

marcofavorito opened this issue · 0 comments

Is your feature request related to a problem? Please describe.

The MonotoneOp metaclass was employed for simple simplifications for and and or logical operators, which both simplify the arguments by exploiting the idempotency property (i.e. arg OP arg \equiv arg), and it also flattens the binary operator if its operands are binary operators of the same type.

PR #92 introduced several binary operators which do not satisfy the idempotency property (i.e. arg OP arg \equiv arg), but their implementation would benefit if MonotoneOp can be configured so to not apply the idempotency simplification if not needed.

Describe the solution you'd like
add a class attribute idempotency: bool, which by default is False, and change the behaviour of MonotoneOp depending on what is the value of idempotency. We should change the name for a generic binary operation metaclass, e.g. BinaryOpMetaclass. By doing so, we can still gain from the usefulness of flattening.

See: https://github.com/AI-Planning/pddl/pull/92/files#r1359940653