Giter Club home page Giter Club logo

app-trapper's Introduction

PP-TRAPPER: Agent Planning Programs via Trap Reasoning

This is the PP-LPG solver for APP adapted to include dead-end (i.e., traps) reasoning:

Pre-requisites

Before running the solvers, make sure that:

  1. The following binary tools are available in tools/:
    • validate binary, from the VAL project.
    • trapper binary form the trapper-lapkt repo, presented at ICAPS16 paper Traps, Invariants, and Dead-Ends.
    • lpg preference-based planner binary. This is a modified version of the original LPG planner that leaves the final state of the solution plan in file endstate.txt and the solution plan is always written a file called soln (instead of using the domain name and .SOL extension).
  2. In any problem to solve, there must be a dummy empty file called emptyplan.tmp (its used is hard-coded in the solver).
    • Just create one doing: touch emptyplan.tmp.

Online solver

To compile the online solver, get into src/, update the paths in def.h if needed, and then run:

$ cd src/
$ make online

This will build the pp-online online solver and the various pp-<solver> offline solvers.

To run the online solvers, get into the problem folder and run:

$ /path/to/src/pp-online <obj_file> <init_file> <predicate_file> <action_file> <graph_file> <seed> <planner_type>

where <planner_type> could be one of the following:

  • lmcut_trap: uses trapper with LM-cut.
  • lmcut_no_trap: uses LM-cut without trapper.
  • dfs_trap: uses trapper with DFS+.
  • dfs_no_trap: uses DFS+ without trapper.
  • lpg: uses LPG without trapper

When using trap reasoning, the tool used to extract dead-ends/traps is trapper, available in the trapper-lapkt repo.

Running trapper as follows:

$ tools/trapper --domain domain.pddl --problem pfile-trap.pddl --search dfs+_trap --candidates a2 --goals 1 --plan soln.tmp

For example, this will run the online solver using on the complex example using the LPG planner with no traps (which will fail) and the DFS+ planner with trap reasoning (which will succeed):

$ cd examples/complex

$ ../../src/pp-online obj.pddl init.pddl predicates.pddl acts.pddl graph.txt 123 lpg

$ ../../src/pp-online obj.pddl init.pddl predicates.pddl acts.pddl graph.txt 123 dsf_trap

Offline solvers

To compile the offline solver, get into src/, update the paths in def.h if needed, and then run:

$ cd src/
$ make offline

This will build the varios pp-<solver> offline solvers:

  • pp-lpg: uses preference-based LPG without trapper. This is basically the original APP solver from the AIJ16 paper. Not integrated with trapper or LAPKT; so no reasoning on traps.
  • pp-dfs_no_trap: uses DFS+ from LAPKT but without trapper.
  • pp-dfs_trap: uses trapper with DFS+ from LAPKT.
  • pp-lmcut_no_trap: uses LM-cut from LAPKT but without trapper.
  • pp-lmcut_trap: uses trapper with LM-cut from LAPKT.

NOTE: when a local planning step is performed to "close" the policy, LPG is used, as it is a preference-based planner. However, LPG is not integrated with trapper, so those planning episodes do not use any dead-end reasoning. So, in all the above cases, LPG is used in some transitions.

To run the offline solvers, get into the problem folder and run:

$ cd /path/to/problem
$ /path/to/src/pp-<planner_type> <obj_file> <init_file> <predicate_file> <action_file> <graph_file> <seed>

For example, to run the LPG offline solver (as per AIJ16) on the complex example:

$ cd examples/complex
$ ../../src/pp-lpg obj.pddl init.pddl predicates.pddl acts.pddl graph.txt 123

app-trapper's People

Contributors

ssardina avatar lchrpa avatar

Watchers

James Cloos avatar  avatar

app-trapper's Issues

Not running with lpg option

System does not seem to run with lpg option:

[ssardina@Thinkpad-X1 example]$ ../src/pp-traps obj.pddl init.pddl predicates.pddl acts.pddl graph.txt 123 lpg
Checking plan: emptyplan.tmp
Plan executed successfully - checking goal
Plan valid
Final value: 0

Successful plans:
Value: 0
 emptyplan.tmp 


FAIL

Clean-up repo and do documentation

Would be nice to clean-up the repo and code a bit so that it can be distributed to others that want to use it and test experiments.

Basically we want a README that can be followed step-by-step, from setup to compile to run.

Understand Trapper-based solvers using LPG

Hi @lchrpa

With the examples you provided, I have done quite a lot of clean-up, both at source level and documentation.

I have left log run files *.log in each example.

One thing that I am still trying to remember is the role of LPG when we use use DFS+ or LMCUT. So, the paper says:

image

So it seems that even when we use offline with DFS+, the LPG planner is called and this is true as it prints things like this:

; Command line: /home/ssardina/git/soft/planning/app/app-trapper.git/tools/lpg -f pfile.pddl -o domain.pddl -n 1 -input_plan soln.tmp -seed 125 -same_objects  

However, I can see those LPG calls also in the online solvers when using DFS with and without traps.

And all this happens on both of our examples that do NOT have loops in the APP, they are both linear.

Do you know what is happening or what am I missing @lchrpa ?

; Command line: /home/ssardina/git/soft/planning/app/app-trapper.git/tools/lpg -f pfile.pddl -o domain.pddl -out soln
 Command line: /home/ssardina/git/soft/planning/app/app-trapper.git/tools/lpg -f pfile.pddl -o domain.pddl -n 1 -inp
ut_plan soln.tmp -seed 1234 -same_objects

char *x vs char (*x)[500] warning

This is not a problem, it is my misunderstanding of C and I am curious. ;-)

When I compile, say offline solver, I get many errors of this sort:

image

I want to understand what is happening here. My C is not great for sure. :-)

It is true the arguments to the function are char *:

image

So if I understand well, that means that fgoals is a pointer to (one) char. However, when it is called:

image

Now that future_goals is defined in the Node struct as:

char future_goals[MAX_CONN][MAX_STR_LEN]

I understand that an array of something in C, is just the address to the first element of the array.

But future_goals is not just an array of charof size 500 (MAX_STR_LEN): it is an array of an array of chars...

But the compiler seems to expect a `char (*)[500]’

Why it is not telling me that it should be char (*)[100][500] (since MAX_CONN = 100).

@lchrpa , I suspect this is trivial for you...

Error due to LPG option `-same_object`

Wehn I try the online solver:

[ssardina@Thinkpad-X1 example]$ ../src/pp-online obj.pddl init.pddl predicates.pddl acts.pddl graph.txt 123 lpg
Checking plan: emptyplan.tmp
Plan executed successfully - checking goal
Goal not satisfied
Plan invalid


Failed plans:
 emptyplan.tmp 
Running trapper as follows: /home/ssardina/git/soft/planning/app/app-trapper.git/tools/lpg -f pfile.pddl -o domain.pddl -out soln.tmp -n 1 -seed 1692901013 -cputime 60 -nobestfirst -inst_with_contraddicting_objects -same_object

 Unknown option: -same_object entered


LPG-td-1.0 SETTINGS:

This is because the commands in def.h have the -same_object when calling LPG. It is strange because they are in the original LPG indeed, but that does not seem to be recognized by the lpg binary!

What is happening here? If I delete that option from the commands, then it works!

Is this fix correct?

@lchrpa , we have this function:

image

and we call it like this:

image

I have replaced it with:

image

Agree? Why did it work well before?

Make online compile error

I can make the offline version, but online (see I have renamed main-traps.c to main-online.c in #1):

[ssardina@Thinkpad-X1 src]$ make online
gcc main-online.c -o pp-online -D__TOOLDIR__="\"`pwd | sed 's/src/tools/g'`\""
main-online.c: In function ‘create_domain_file’:
main-online.c:480:20: warning: too many arguments for format [-Wformat-extra-args]
  480 |       fprintf(out, ")\n", j); // the j is not used at all, no place in formatted string
      |                    ^~~~~
main-online.c: In function ‘run_planner’:
main-online.c:597:7: internal compiler error: in subspan, at input.h:68
  597 |       snprintf(tmp, MAX_STR_LEN, COMMAND_LPG_1SOL, seed);
      |       ^~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
make: *** [makefile:7: online] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.