Plan Tool


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:


  1. First discussion <2017-05-12 五>
    • Read the source code, and wrap the main function.
    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
    • 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 $(OBJECTS) $(PDDL_PARSER_OBJ) PLANNER_wrap.o
    gcc -shared -o $@ $^
    PLANNER_wrap.o: PLANNER_wrap.c
    $(CC) -c $(INC_PYTHON) -fPIC $^ 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 …