AI-Planning / cloud-solver

Repository that lets you run an automated planner as a service on heroku.
26 stars 7 forks source link

Return all of the ground actions possible instead of failing for just one #2

Open guanghuhappysf128 opened 4 years ago

guanghuhappysf128 commented 4 years ago

When I use solver API, the following case happens. I didn't have any action named reach-goal. Here is the return json:

{
    "status": "ok",
    "result": {
        "parse_status": "ok",
        "length": 7,
        "plan": [
            "(move a1 b1)",
            "(move b1 b2)",
            "(move b2 b3)",
            "(move b3 a3)",
            "(move a3 a4)",
            "(move a4 a5)",
            "(reach-goal)"
        ],
        "error": "'reach-goal'",
        "output": "\n\ntask contains conditional effects. turning off state domination.\n\n --- OK.\n Match tree built with 19 nodes.\n\nPDDL problem description loaded: \n\tDomain: PACMAN_MID\n\tProblem: PACMAN-LEVEL-1\n\t#Actions: 19\n\t#Fluents: 20\nLandmarks found: 1\nStarting search with IW (time budget is 60 secs)...\nrel_plan size: 6\n#RP_fluents 10\nCaption\n{#goals, #UNnachieved,  #Achieved} -> IW(max_w)\n\n{1/1/0}:IW(1) -> [2][3][4][5][6][7][8]rel_plan size: 0\n#RP_fluents 0Plan found with cost: 7\nTotal time: -1.07288e-09\nNodes generated during search: 42\nNodes expanded during search: 34\nIW search completed\n",
        "type": "simple",
        "planPath": "/tmp/solver_planning_domains_tmp_4CKg1JPQfz3GC/plan",
        "logPath": "/tmp/solver_planning_domains_tmp_4CKg1JPQfz3GC/log"
    }
}

Could you please help me out on figure out how could this happened?

guanghuhappysf128 commented 4 years ago

Here is the link for the domain and problem file. Got the same result when use online editor: http://editor.planning.domains/#edit_session=jVYVlhdoeRirKvL

haz commented 4 years ago

Fascinating...

@nirlipo would the planner be adding a final step to reach the goal given that it's a non-standard one (negations and disjunctions).

@guanghuhappysf128 Keep in mind that you should only share read-only links from the editor (otherwise anyone with the link can start making edits!)

haz commented 4 years ago

Btw, the error status there is due to us not being able to extract the grounded action schema for display -- not an error in trying to find a plan. This is why a plan shows, but in the online editor you don't have the full action descriptions for each step.

nirlipo commented 4 years ago

This is a technique used in preprocessing by FF-parser to handle disjunctive goal formulas, adding $n$ dummy actions reach-goal, whose preconditions is each of the n clauses in the disjunction.

For this domain with goal formula

(:goal
        (and 
                    (not (isFood a5)) 
                    (not (isCapsule b1))
                    (or 
                               (not (isGhost a4)) 
                               (not (isGhost b4))
                     )
             )
)

we get:

Action (REACH-GOAL)
    Pre(a) = {(NOT-ISFOOD A5), (NOT-ISCAPSULE B1), (NOT-ISGHOST B4)}
    Add(a) = {}
    Del(a) = {}
    Conditional Effects:
        cond_eff 1:
        Pre(cond_eff) = {}
        Add(cond_eff) = {GOAL-REACHED}
        Del(cond_eff) = {}
Cost = 1
Action (REACH-GOAL)
    Pre(a) = {(NOT-ISFOOD A5), (NOT-ISCAPSULE B1), (NOT-ISGHOST A4)}
    Add(a) = {}
    Del(a) = {}
    Conditional Effects:
        cond_eff 1:
        Pre(cond_eff) = {}
        Add(cond_eff) = {GOAL-REACHED}
        Del(cond_eff) = {}

and the goal of the problem is set to GOAL-REACHED.

haz commented 4 years ago

So it was the disjunction in the end. The data-structures ok with multiple actions using the same name? Wild...

nirlipo commented 4 years ago

Better to be safe :) We map each action to a unique ID, just in case the parser generates groundings that PDDL wouldn't allow, like naming conventions.

nirlipo commented 4 years ago

This example in LAPKT is useful, as it gets pddl files and prints the output of FF-parser.

haz commented 4 years ago

Beauty.

So @guanghuhappysf128 , I hope this makes it clear where/why things were breaking for you. I'm going to rename the issue title to address the fact that the solution parser could be a little more robust in what it extracts (so it should show the full actions for those it manages to extract, rather than failing outright). Thanks for reporting!