{"id":31939342,"url":"https://github.com/aig-upf/sltp","last_synced_at":"2026-07-01T16:32:32.316Z","repository":{"id":111742365,"uuid":"173146479","full_name":"aig-upf/sltp","owner":"aig-upf","description":"The SLTP Generalized Planning Framework: Sample, Learn, Transform \u0026 Plan","archived":false,"fork":false,"pushed_at":"2020-11-03T15:51:26.000Z","size":8407,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-23T06:37:30.832Z","etag":null,"topics":["first-order-methods","generalized-planning","logic","planning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aig-upf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-02-28T16:25:34.000Z","updated_at":"2024-09-29T08:00:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"257be382-03ba-4305-bec7-919511604fc5","html_url":"https://github.com/aig-upf/sltp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/aig-upf/sltp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fsltp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fsltp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fsltp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fsltp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aig-upf","download_url":"https://codeload.github.com/aig-upf/sltp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fsltp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35015053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-01T02:00:05.325Z","response_time":130,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["first-order-methods","generalized-planning","logic","planning"],"created_at":"2025-10-14T08:25:52.559Z","updated_at":"2026-07-01T16:32:32.309Z","avatar_url":"https://github.com/aig-upf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n\n# The SLTP Generalized Planning Framework: Sample, Learn, Transform \u0026 Plan\n\n\n## Installation\n\nThe whole pipeline runs in *Python3* and relies on some dependencies; most notably:\n\n* The [FS planner](https://github.com/aig-upf/fs-private/) (actually, a simplified version of it).\n* Some MaxSat solver such as [OpenWBO](http://sat.inesc-id.pt/open-wbo/)\n* The [Tarski](https://github.com/aig-upf/tarski/) planning problem definition module.\n* CMake\n\n### Installing required packages\n\nIf running on Ubuntu, you will need to install CMake: \n    \n    sudo apt-get -y install cmake\n\n\n### Installing FS\n\nWe use the FS planner to fully expand state space samples. It is a bit of overkill, but might prove\nuseful down the road if we need to use compact FSTRIPS encodings. To install the planner, you need \nthe following packages (assuming Ubuntu):\n\n\n    sudo apt-get install -y --no-install-recommends \\\n         build-essential g++ python3 git scons libboost-all-dev\n\n\nNow checkout the `sltp-lite` branch (which contains a simplified version of the planner for our purposes)\nand run the build script:\n\n    git clone git@github.com:aig-upf/fs-private.git -b sltp-lite fs-planner\n    cd fs-planner\n    git submodule update --init\n    ./build.py -p\n\nOnce the build has finished, you'll need to create an environment variable named `$FS_PATH` to point\nto the installation location, e.g. adding this to your `.bashrc` file (change the path to your actual\nlocation):\n\n    export FS_PATH=\"${HOME}/projects/code/fs\"\n\n\n### Installing openWBO\nHere you should simply download and follow \n[OpenWBO](http://sat.inesc-id.pt/open-wbo/)'s installation instructions, and make sure that the resulting\n`open-wbo_static` binary is on your `$PATH`.\n\n### Installing the project code\n\nWe recommend installing the current project *in development mode*, and *on a fresh Python3 virtual \nenvironment*. This will help debugging and troubleshooting. Assuming that `virtualenv` is installed in you\nmachine, create a new environment for `sltp` by running (usually in some user directory outside the project tree):\n\n    mkdir -p ~/virtualenvs/sltp\n    virtualenv -p python3 ~/virtualenvs/sltp\n    \nYou should then be able to \"enter\" this virtualenv by running `source ~/virtualenvs/sltp/bin/activate`.\nOur setup script requires `pip \u003e= 18.1`. If `pip --version` shows that you have an older version, \nthen you should be able to upgrade it with `python -m pip install -U pip` \n\nFinally, to perform the installation (from inside the virtual environment) \nissue the following command on the root directory of the project:\n\n    pip install -e .\n\nThis should build and install all the required dependencies, including some the C++ feature generator\nmodule, which should be compiled and installed transparently.\n\n\n## Usage\n\nIndividual experiments are on the `experiments` folder, e.g. see `experiments/blocks.py` for an example.\nA file such as `blocks.py` contains different experiment configurations for learning in the blocks domain.\nWe invoke the pipeline with \u003cscript-name\u003e \u003cexperiment-name\u003e \u003cpipeline-steps-to-be-executed\u003e,\nwhere the last parameter is an optional  list of experiment step IDs (e.g.: 1 2 3). All steps are run if no IDs are specified.\nExample invocations:\n\n    # AAAI Experiment: BW with goal clear(x)\n    ./run.py blocks:aaai_clear_x_simple_hybrid  # Theory T_G\n    ./run.py blocks:aaai_clear_x_no_marking     # Theory T\n\n    # AAAI Experiment: BW with goal on(x,y)\n    ./run.py blocks:aaai_bw_on_x_y_completeness_opt  # Theory T_G\n    ./run.py blocks:aaai_bw_on_x_y_completeness_opt_no_marking     # Theory T\n\n    # AAAI Experiment: Gripper\n    ./run.py gripper:aaai_prob01  # Theory T_G\n    ./run.py gripper:aaai_prob01_no_marking     # Theory T\n\n    # ...\n\nThe experiment names are not as informative as could be.\nThe configuration of each experiment can be inspected by looking at the experiment file.\n\n## Using the SLTP Docker image \nWe can also run experiments from within the Docker image. Assuming you want to run experiment `p1` from the `Visitall`\ndomain, leaving all intermediate files and results in a `workspace` directory in the host machine: \n    \n    mkdir workspace\n    docker pull gfrancesm/sltp\n    docker run -it --mount src=`pwd`/workspace,target=/root/projects/workspace,type=bind \\\n        gfrancesm/sltp sltp gripper:aaai_prob01 --workspace /root/projects/workspace    \n\nYou can also run experiments that are not integrated within the standard SLTP command runner, just as you would run\nany normal script within a Docker image. Suppose you have _in the host machine_ a SLTP experiment script such as the one \nfound in the `examples` folder:\n    \n    /tmp/workspace$ ls\n    gripper.py\n\nYou can run that script _within the Docker container_ as follows:\n\n    /tmp/workspace$ docker pull gfrancesm/sltp\n    /tmp/workspace$ docker run -it --mount src=`pwd`,target=/root/projects/workspace,type=bind \\\n                       gfrancesm/sltp /root/projects/workspace/gripper.py aaai_prob01 --workspace /root/projects/workspace\n    \nwhere `aaai_prob01` is the experiment name configured in your `gripper.py` script.\n\n### Sampling\nThe SLTP pipeline uses a modified version of the FS planner (see installation instructions above)\nin order to sample the (reachable part of the) state spaces of given PDDL instances. The sampling\nsteps of the pipeline write a few files with a textual representation of the state space. To see\nan example, run e.g. from the `experiments` directory:\n\n    $ ./run.py gripper:aaai_prob01 1 2 \n    ================================================================================\n    (pid: 17590) STARTING STEP #1: Sampling of the state space\n    ================================================================================\n    ...\n    ================================================================================\n    (pid: 17606) STARTING STEP #2: Generation of the training sample\n    ================================================================================\n    ...\n    2020-02-23 20:21:18 INFO     Sample after resampling: roots: 2, states: 381, transitions: 812 (28 optimal), goals: 4, unsolvable: 0\n    2020-02-23 20:21:18 INFO     Resampled states logged at \"/home/frances/projects/code/sltp/workspace/2020022320.gripper.prob01_sample02.2000.cs-8/resampled.txt\"\n    2020-02-23 20:21:18 INFO     Printing transition matrix with 381 states and 812 transitions to '/home/frances/projects/code/sltp/workspace/2020022320.gripper.prob01_sample02.2000.cs-8/transition-matrix.dat'\n\nThe above command runs two different pipeline steps: one for calling `n` times the FS planner on `n`\ngiven problem instances; the second step, reads all outputs, and consolidates them into a single set\nof transition samples, assigning all states a unique ID, etc. The result of this consolidation is \noutput, in the example above, to file\n`/home/frances/projects/code/sltp/workspace/2020022320.gripper.prob01_sample02.2000.cs-8/resampled.txt`\nThe format of the file is relatively human-readable. Each state has an id such as #7, plus a number\nof symbols that denote different (possibly complementary) properties of the state. These can be:\n\n    \"*\": the state is a goal\n    \"^\": the state has been fully expanded\n    \"º\": the state is a dead-end\n    \"=\": the state is a root of one of the sampled instances\n    \"+\": the state lies on an optimal path to the goal of its instance\n\nThis sampling pipeline step also generates a second output file, in a somewhat more machine-readable\nfile, but also with less informatoin. In the example above, this file is \n`/home/frances/projects/code/sltp/workspace/2020022320.gripper.prob01_sample02.2000.cs-8/transition-matrix.dat` \nThis file contains one line per every expanded state, such as e.g.:\n\n    11 2 5 31\n\nThis line corresponds to state with id 11, and denotes that state 11 has children states 2, 5 and\n31. \n\n### Generating Features\nIn order to be able to build the C++ feature generator, run `cmake . \u0026\u0026 make` on directory\n`src/features`. As it stands now, this generator generates features up to a certain syntactic \ncomplexity bound and *based on a given set of transition samples* (i.e. sampled state space).\nIdeally, one could also want to generate features independently of any transitions or state spaces,\nbut at the moment the generator creates only features that are non-redundant based on the denotation\nover the whole set of sampled transitions, hence the requirement of having those transitions.\nTwo features are considered redundant if they have exactly the same denotation over all sampled\nstates.\n\nAs an example, the feature generation step for some set of Gripper can be run with  \n \n    $ ./run.py gripper:aaai_prob01  1 2 3\n    ================================================================================\n    (pid: 18828) STARTING STEP #1: Sampling of the state space\n    ================================================================================\n    ...\n    ...\n    ================================================================================\n    (pid: 18848) STARTING STEP #3: C++ feature generation module\n    ================================================================================\n    2020-02-23 20:54:08 INFO     Generating non-redundant concepts from sample set: roots: 2, states: 381, transitions: 812 (28 optimal), goals: 4, unsolvable: 0\n    2020-02-23 20:54:08 INFO     Invoking C++ feature generation module\n    ...\n    DL::Factory: #concepts-final=60\n    A total of 0 features were marked as goal-identifying\n    FEATURES: #features=7, #nullary=0, #boolean=2, #numerical=5, #distance=0, #conditional=0\n    ...\n    2020-02-23 20:54:08 INFO     Reading feature information from /home/frances/projects/code/sltp/workspace/2020022320.gripper.prob01_sample02.2000.cs-8/feature-info.io\n    ...\n    2020-02-23 20:54:08 INFO     Reading denotation matrix from /home/frances/projects/code/sltp/workspace/2020022320.gripper.prob01_sample02.2000.cs-8/feature-matrix.io\n\nThe above command runs 3 different steps; the first two generate the sample (see above section);\nthe third is the one that actually generates all non-redundant concepts and features.\nThe relevant output of this step is, in the example above, file \n`/home/frances/projects/code/sltp/workspace/2020022320.gripper.prob01_sample02.2000.cs-8/feature-matrix.io`\nThis file is the denotation matrix of the generated features. The value at row i, column j\nis the denotation of the j-th generated feature in state #i.\nFile `/home/frances/projects/code/sltp/workspace/2020022320.gripper.prob01_sample02.2000.cs-8/feature-info.io`\nalso contains the textual representation of each feature. \n\n\n\n### Software Requirements\nSLTP has been tested on Python 3.6+ / Ubuntu\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faig-upf%2Fsltp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faig-upf%2Fsltp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faig-upf%2Fsltp/lists"}