Git Product home page Git Product logo

kstar's Introduction

Welcome to the page of K* planner -- a state of the art Top-k planner integrating the K* algorithm into Fast Downward.

This can be run locally, in a docker container, or as a service.

Running locally

Building

## Suggested build for 64bit

./build.py release64

Usage

# ./fast-downward.py --build release64 <domain_file> <problem_file> --search "kstar(heuristic,k=<number-of-plans>)"

./fast-downward.py --build release64 examples/gripper/domain.pddl examples/gripper/prob01.pddl --search "kstar(blind(),k=100)"

Running commands with Docker

You can run the Docker image locally by sharing your current folder and using a bash shell inside the container like this:

docker run --rm -it -v $(pwd):/work rofrano/kstar bash

Usage in Docker

/usr/bin/python3 /workspace/kstar/fast-downward.py --build release64 <domain_file> <problem_file> --search "kstar(heuristic,k=<number-of-plans>)"

For example (using files from git repo):

/usr/bin/python3 /workspace/kstar/fast-downward.py --build release64 examples/gripper/domain.pddl examples/gripper/prob01.pddl --search "kstar(blind(),k=100)"

Running as a Service

Run the service locally via:

docker run -d -p 4501:4501 \
    --env server__hostname=`hostname`:4501 \
    --name <YOUR_CONTAINER_NAME> rofrano/kstar

A couple of notes:

  • This will make the service available on your local machine on port 4501. See the Docker User Guide for manipulating port mappings and binding to specific interfaces.
  • <YOUR_CONTAINER_NAME> can be any name like kstar or planner. It allows you to more easily manipulated it with commands like docker stop kstar, docker start kstar, and docker rm kstar
  • The --env options are only necessary for the swagger UI available at (http://localhost:4501/api-docs) to properly bind to your physical host name and port instead of the container name. If you do not plan to use the swagger UI, you can safely skip it.

Usage as a service

There is now a REST API service so that the planner can be called remotely. The REST API was intentionally kept consistent with the ctpelok77/ibmresearchaiplanningsolver API even though it only containes the kstar planner. It should allow easily swapping this planner out for the more robust version.

You can use the planner service with curl using the following commands:

url=http://localhost:4501/planners/topk/kstar-topk

domain=`sed 's/;/\n;/g' <DOMAIN-FILE> | sed '/^;/d' | tr -d '\n'`

problem=`sed 's/;/\n;/g' <PROBLEM-FILE> | sed '/^;/d' | tr -d '\n'`

body="{\"domain\": \"$domain\", \"problem\": \"$problem\", \"numplans\":<NUMBER-OF-PLANS>}"

basebody=`echo $body`

curl -d "$basebody" -H "Content-Type: application/json" "$url"

Where <DOMAIN-FILE> is your domain.pddl and <PROBLEM-FILE> is your problem.pddl and <NUMBER-OF-PLANS> is a positive integer that represents the number of plans you want to generate.

The response will be a json structure with all of the plans. Using the gripper example you would get something like this:

{
    "plans": [
        {
            "cost": 11,
            "actions": [
                "pick ball2 rooma left",
                "pick ball1 rooma right",
                "move rooma roomb",
                "drop ball1 roomb right",
                "drop ball2 roomb left",
                "move roomb rooma",
                "pick ball3 rooma left",
                "pick ball4 rooma right",
                "move rooma roomb",
                "drop ball3 roomb left",
                "drop ball4 roomb right"
            ]
        }
    ]
}

Citation

Michael Katz, Shirin Sohrabi, Octavian Udrea and Dominik Winterer
A Novel Iterative Approach to Top-k Planning [pdf] [bib]
In ICAPS 2018

Contact

For questions and comments please get in touch with Michael Katz ([email protected]).

kstar's People

Contributors

ctpelok77 avatar florianpommerening avatar jendrikseipp avatar karpase avatar maltehelmert avatar roeger avatar rofrano avatar rpgoldman avatar salome-eriksson avatar theonering avatar thomaskeller79 avatar

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.