planimation / backend

Planimation Backend
GNU General Public License v3.0
1 stars 21 forks source link

Action Costs supported? #19

Closed nirlipo closed 1 month ago

nirlipo commented 5 years ago

I was trying to planimate this problem:

but I get an incorrect visualization:

image

Is this error a result of using PDDL action costs syntax? If that's the case, we could just ignore action costs effects and functions in the problem and domain files, and think later about how to visualize action costs.

If I run the same domain removing action costs from the problem, I get the correct visualization:

image

Best,

nirlipo commented 4 years ago

Documentation on how to use costs in PDDL 

In terms of information about the use of costs in PDDL see below:

Find visualitzation toolkits / examples relevant to visualization of costs (temporal) / resources (time-series) AI visualization 

I haven't found anything interesting to be honest. So far, this is the existing simple visualization of a temporal plan:  image

You can access this by going to editor.planning.domains -> plugins -> install timeline viewer. http://editor.planning.domains/#read_session=qZxJB4b2Ht 

This simply takes the plan file actions, and place them below using the initial time(first number) and their duration number within square brackets [].   

There's some literature of tools visualizing temporal planning but I can't find anything that applies just to costs/numeric planning.

Types of semantics visualization that can get attached to costs

      Below I discuss few possible visualizations of costs and visual semantics that can be attached to them.

No semantic 

Distances 

Foreach predicate/function defined in the initial state, we can associate it witha drawing e.g. A line, an image, etc. and allow to:  

PDDLexamples:

Resources 

Draw a reservoir, and allow to define: max, min, and units. Then we can assign the cost or function/predicate to a specific reservoir. We have to see where in the UI we can add this image

PDDLExample:

Note that in these two examples, capacity and fuel are expressed through predicates instead of functions, as it assumes no use of numeric variables, just action costs.This leads to the encoding of boolean predicates representing numbers, where the initial state expresses basic arithmetic such as sum, greater, smaller, etc. Think how can you associate these predicates into a visualization like the above. It may need a special function, similar to what we have for associating a set of predicates into a grid: https://planimation.github.io/documentation/ap_guide/#25-functions

Stock and Flows

Loopy is a nice visualization tool for systems thinking. We can take it as an inspiration to visualize flows and stocks, which are similar to reservoirs.

Explore some avilable demos provided by loopy and how it visualizes concepts

image

This type of semantics can be very helpful for some numeric fluents problems and lead to temporal planning visualizations.

JamieYuu commented 3 years ago

Currently, on the branch feature/19-action-cost, the program can handle the PDDL files mentioned above. However, it only hardcoding the keywords "traverse-cost" and "total-cost" (for example, https://github.com/planimation/backend/blob/feature/19-action-cost/server/app/vfg/parser/Plan_generator.py#L126). The parser functions in the backend needs to be updated to handling complex PDDL syntax, maybe using some third-party libraries is a better option. Due to this reason, this branch is not merged into the develop branch yet. We found some potential libraries: https://pypi.org/project/pddlpy/ https://github.com/garydoranjr/pyddl

I also updated the predicate list generator function: https://github.com/planimation/backend/blob/125d6b020d8efc0bacc55f831781827921ed9b16/server/app/vfg/parser/Domain_parser.py#L34.

chillray commented 3 months ago

Currently, on the branch feature/19-action-cost, the program can handle the PDDL files mentioned above. However, it only hardcoding the keywords "traverse-cost" and "total-cost" (for example, https://github.com/planimation/backend/blob/feature/19-action-cost/server/app/vfg/parser/Plan_generator.py#L126). The parser functions in the backend needs to be updated to handling complex PDDL syntax, maybe using some third-party libraries is a better option. Due to this reason, this branch is not merged into the develop branch yet. We found some potential libraries: https://pypi.org/project/pddlpy/ https://github.com/garydoranjr/pyddl

I also updated the predicate list generator function:

https://github.com/planimation/backend/blob/125d6b020d8efc0bacc55f831781827921ed9b16/server/app/vfg/parser/Domain_parser.py#L34 .

Regarding the flexibility issue, our solution on the branch feature/19-action-cost-v2 allows users to specify the action cost keyword in the animation profile themselves. The backend will handle action costs based on the cost_keyword specified by the user.

However, we don't think this is the perfect solution, as it only supports one action cost_keyword. What if there are two separated action costs for Truck1 and Truck2?