Plan Tool

Introduction:

PlanTool is a tool for efficient application and research in planning area, which integrating various popular planners. For now there are a GUI for planning application and a planning package with a lot of planners.

Source Code:

Schedule:

  1. First discussion <2017-05-12 五>
    • Read the source code, and wrap the main function.
    MemberTask
    Wenfeng FengSAT2006, HSP
    Enle LiuLAMA
    Ruipeng LiHTN(C++ version)
    Xin LuoJSHOP2
    Erhu RongFF
    Yuncong LiCSP
    Min TangTLplan
    Hao FuRandward
    Han TianSGPlan
    • Ting Zhang and Qiping continue to wrap the functions of IPP and Graphplan.
  2. Second discussion <2017-05-19 Fri>
    • Write Documentation for wrapper planners
    • Consider new interface for input file
    • Possible future usage of plantool

Steps of wrapping a planner

Environment requirement

  1. Linux 16.04 LTS

    Easy to use and configure environment, assuming apt as package manager

  2. bison flex

    Required by makefile

    sudo apt-get install bison flex
  3. swig

    Required by wrapping

    sudo apt-get install swig
  4. make gcc python
    sudo apt install make gcc python-dev

After installing the necessary tools(Here is a general method)

Since errors are unavoidable, please add problems to the problems section below. Welcome to edit this document, add your thoughts on how we build and your vision on plantool (future section).

  • Some reference

    SWIG and Python the solution provided here is simple, but problems could occur when files grow bigger SWIG basis A general idea of swig

  • Adding planner swig interface file
    touch PLANNER.i
        

    Here PLANER.i is an interface file for swig to parse. Write what you want to wrap in this file. An example for wrapping main() is given below

    Adding functions for wrapping

    At present, only main() wrapped

    // PLANNER.i
    %module PLANNER
    
    %include <argcargv.i>
    
    %{
    #include "PLANNER.h" // The header where functions are declared
    %}
    
    %apply (int ARGC, char **ARGV) { (int argc, char *argv[]) }
    
    int oldmain( int argc, char *argv[] ); // The function we want to wrap
        
  • Editing PLANNER.h(where swig interface wrap) and PLANNER.c(where the main() are defined)
    • Adding oldmain() declaration in PLANNER.h
      // Somewhere in PLANNER.h
      /**********************************************************/
      /* SWIG Wrapping*/
      int oldmain( int argc, char * argv[] );
              
    • Rename main() in PLANNER.c to oldmain() and add a main()
      // PLANNER.c (Generally where main is located)
      int oldmain( int argc, char * argv[] ) {
         //  original main()
         //  ...
      }
      int main(int argc, char *argv[]) {
         return oldmain(argc, argv);
      }
              
  • Modifying makefile(other solutions are provided by the reference links above, if there are successful usage or other solution, please add to this file)

    First edit makefile(slightly complicated)

    • Adding gcc -fPIC flag
    -fPIC
        
    • Adding INC_PYTHON to compile PLANNER_wrap.c (PLANNER_wrap.c would include headers from this path)
    INC_PYTHON = -I/usr/include/python2.7
        

    this directory may vary bewteen machines, so find yours and add -I/the/path/to/python2.x

    • Adding dynamic shared objects
    _PLANNER.so: $(OBJECTS) $(PDDL_PARSER_OBJ) PLANNER_wrap.o
    gcc -shared -o $@ $^
    
    PLANNER_wrap.o: PLANNER_wrap.c
    $(CC) -c $(INC_PYTHON) -fPIC $^
    
    PLANNER.py PLANNER_wrap.c: PLANNER.i
    swig -python PLANNER.i
        
    • Notes that:
      1. so(shared object) gernerally needs all object files compiled from source(.c)
      2. Should use “tab”
      3. $@ and $^ are special symbols what do the makefile symbols mean
      4. -fPIC would be required to be added as gcc flag to compile c in order to be used as shared objects
      5. This is usually a generally method, in practice it might vary. For example makefile using implict rules. In this case the classic error would be suggesting to recompile with -fPIC
  • Use python import

    This is rather easy part

    import PLANNER
    # Using planner functions
        
  • If there were any problems during wrapping, please do the honor to add to the below section

Example on wrapping ff-v2.3

Note: this may be an easy one, you can try to call most of the functions defined in ff.h , if you want to call more functions in main.c , the easy one is by adding its declaration to ff.h, add function to ff.i(swig interface file), recompile with makefile just change replace string: PLANNER => ff

Problems section

Note:(It is better to include a screenshot of bug reporting in directory called BUG_PIC in the same directory)

  1. CSP: DIR = code/Deterministic/CSP/gp_csp_ver1.1.2/ Successfully compile, but on importing in python errors occur undefined symbol: yywrap
    • Error cause:

    When the scanner receives an end-of-file indication from YY_INPUT, it then checks the yywrap() function. If yywrap() returns false (zero), then it is assumed that the function has gone ahead and set up yyin to point to another input file, and scanning continues. If it returns true (non-zero), then the scanner terminates, returning 0 to its caller. Note that in either case, the start condition remains unchanged; it does not revert to INITIAL. If you do not supply your own version of yywrap(), then you must either use %option noyywrap (in which case the scanner behaves as though yywrap() returned 1), or you must link with -lfl to obtain the default version of the routine, which always returns 1.

    • Solution:

    Add a -lfl flag while linking the dynamic library like this:

    gcc -shared ... -o ... -lfl
    # '...' means objects you need for this instruction 
        

Future section

Please spill out your ideas

  1. To be added …

Documentation

References

STAPLAN: http://www.cs.rochester.edu/users/faculty/kautz/satplan/index.htm

Blackbox: https://www.cs.rochester.edu/u/kautz/satplan/blackbox/

IPP: https://user.enterpriselab.ch/~takoehle/publications/ipp/ipp.html

HSP: http://planet.hud.ac.uk/repository/heuristic.html

FF: http://fai.cs.uni-saarland.de/hoffmann/ff.html

MIPS-XXL: http://sjabbar.com/mips-xxl-planner

MIPS-BDD: http://www.tzi.de/~edelkamp/mips/mips-bdd.html

AltAlt: http://rakaposhi.eas.asu.edu/altweb/altalt.html

SHOP: https://www.cs.umd.edu/projects/shop/

PYHOP: https://bitbucket.org/dananau/pyhop

LPG: http://lpg.unibs.it/lpg/

TLPLAN: http://www.cs.toronto.edu/tlplan/ http://planiart.usherbrooke.ca/tlplan/

CPT: http://www.cril.univ-artois.fr/~vidal/cpt.html

LAMA: https://github.com/rock-planning/planning-lama

SGPLAN: http://wah.cse.cuhk.edu.hk/wah/programs/SGPlan/

Graphplan: https://www.cs.cmu.edu/~avrim/graphplan.html

UCPOP: http://aiweb.cs.washington.edu/ai/ucpop.html

GP-CSP: http://rakaposhi.eas.asu.edu/gp-csp.html

NOLIN: http://www.aiai.ed.ac.uk/project/nonlin/

O-PLAN: http://www.aiai.ed.ac.uk/project/oplan/

UMCP: http://www.cs.umd.edu/projects/plus/umcp/