New Types in UP #508
-
Hi! I'm interested in adding specific types to UP and then take care of them in the solver side. The usual case of PDDL-with-a-small-language-extension. For example, adding rationals, complex numbers or sets. What is the canonical way of doing such a thing, if possible? Thanks, Joan |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hi @JoanEspasa , Rationals are supported at UP level (we use Adding something else, like complex numbers, isn't really covered and can't be done in an "easy" way; if not by explicitly adding the support. We will consider what needs to be done in order to support a general use-case like yours. |
Beta Was this translation helpful? Give feedback.
-
Thanks @Framba-Luca , it's good to know that it's not supported out-of-the-box as I suspected. To give you a further example, consider a logistics-style domain where trucks are required to deliver raw materials between locations. Materials are loaded into trucks one big "pack" at a time, but all materials in a truck are unloaded at the same time, as they are dump-trucks. These problems get very naturally modelled as sets. My ideal scenario would be to add sets for example as a type for any Python API user, allow them to use them to construct problems and then translate them away via a Compiler. As I have no knowledge of UP internals, I'm wondering what is the amount of effort you expect such feature would entail, or if it is even viable with the current design. |
Beta Was this translation helpful? Give feedback.
At glance I would say you have to create a new FNode that contains the new type, then specify how the new FNode interacts with other types on every operand (in the unified_planning/model/walkers/type_checker.py), add checks around the code that the type is not the new one (where it can't be) and, in every walker, specify how it should behave on the new expression.
So, yes, adding complex numbers (for example) is not trivial and requires knowledge about how every walker should behave. Some might be trivial and might not even need a new function (the default one works), but others require effort and testing.
Adding sets would be like #44, which I am not certain what would be needed in order…