pucrs-automated-planning / pddl-parser

:snake: Classical Planning in Python
GNU General Public License v3.0
84 stars 23 forks source link

One-line action printing by default, but with command-line 'verbose' format option #9

Closed bcorfman closed 3 years ago

bcorfman commented 3 years ago

This is a feature to print Actions as one-line by default, but with the command-line option to turn on the prior printing method with its preconditions and effects. If you still like the verbose format as a default, then it's easy enough to switch around the default. Note that I introduced some additional command-line parsing in planner.py to support this (including some help features), but I didn't use any libraries like optparse or argparse since you indicated you were trying not to use anything but pure Python. Merry Christmas!

Maumagnaguagno commented 3 years ago

I will accept the idea, as I already had to do this one yesterday while checking the airport actions, but respectfully decline your code. A verbose option should only affect the planner output, not the parser and action in my opinion. I also like to keep options after domain and problem arguments, I guess most planners work this way.

meneguzzi commented 3 years ago

Deciding how to interpret verbosity levels is always complicated, because very quickly we get a combinatorial explosion as to the number of ways we can do things (this can often be done with some sort of internal/optional configuration file), but then, feature creep can make us have an overly complex logging framework. As far as I'm concerned, the critical things in the verbosity options would be to have one option for the parser/planner to run completely silently (in case one wants to embed it somewhere else), and the others are up for debate.

What do you think of that @Maumagnaguagno ?

meneguzzi commented 3 years ago

Anyway, I also think that the options about verbosity do not belong to the action class, otherwise we'd be violating encapsulation here. If we want to go in this way of customization, I think a visitor pattern for pretty printing is the best way to go. I can discuss further if you are interested, and we can open an issue just for that.

Maumagnaguagno commented 3 years ago

We are already in feature creep, this repository was supposed to be a propositional PDDL parser, with the planner being just an example. I think the current verbose/only signature plans option is enough. This planner does no static analysis/smart grounding/state compression to solve any complex domain, logging would make it even slower, and adding such features would conflict with its goal. One can easily embed it replicating the main within their own Python program without the plan prints or do a system call and redirect output.

My goal here is to improve the extensibility of the parser, probably replacing the unsupported :feature print with a method call that can later be modified through inheritance, give me a few days to see how to better approach this solution.