Giter Club home page Giter Club logo

pyhop's Introduction

PyHOP, version 2.0

A Hierarchical Ordered Planner for Python

Introduction

PyHOP is a simple hierarchical task network (HTN) planner written in Python. It works in both Python 2.7 and 3.2.

PyHOP was easy to implement (less than 150 lines of code), and if you understand the basic ideas of HTN planning (this presentation contains a quick summary), PyHOP should be easy to understand.

PyHOP's planning algorithm is like the one in SHOP, but with several differences that should make it easier to integrate it with ordinary computer programs:

  • PyHOP represents states of the world using ordinary variable bindings, not logical propositions. A state is just a Python object that contains the variable bindings. For example, you might write s.loc['v'] = 'd' to say that vehicle v is at location d in state s.

  • To write HTN operators and methods for PyHOP, you don't need to learn a specialized planning language. Instead, you write them as ordinary Python functions. The current state (e.g., s in the above example) is passed to them as an argument.

Installation

$ git clone https://github.com/oubiwann/pyhop.git
$ cd pyhop
$ sudo python setup.py install

Examples

The code comes with several examples. These can be run in the following manner:

$ git clone https://github.com/oubiwann/pyhop.git
$ cd pyhop
$ python examples/simple_travel.py
$ python examples/blocks_world/run1.py
$ python examples/blocks_world/run2.py

Changes from Version 1

With versison 2.0, the following change were made:

  • code has now been converted to a Python package, complete with setup.py file
  • slight changes to the API have been made (the planner function pyhop has been ranamed to plan)
  • slight changes to some of the helper functions have been made (added another parameter to help generalize)
  • examples have been moved into their own directory

License


Copyright 2013 Dana S. Nau - http://www.cs.umd.edu/~nau

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


pyhop's People

Contributors

dananau avatar oubiwann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pyhop's Issues

Evaluate with cost

Is there a way where we can provide the cost for each primitive action, and the planner gets the plan with the least cost?
Thanks

Bug in blocks moveb_m

I believe this line:

b1 = helpers.find_if( lambda x: status(x,state,goal,'table') == 'waiting', helpers.all(state))

should be this one to prevent infinite recursion when a block is waiting but already on the table:

b1 = helpers.find_if( lambda x: status(x,state,goal,'table') == 'waiting' and state.pos[x] != 'table', helpers.all(state))

You can trigger the bug in the current code by reversing the order of key iteration in find_if.

Printing typo in search_methods/8

It should read

print('*task[1:]: {},{},{}.'.format(*task[1:]))

in search_methods; that is, insert a "," between the three "{}" and a "." after the last "{}".

-- EJ.

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.