top of page

HARP
Hierarchical Adaptive oRdered Planner

 

Some Background...

 

Answer Set Programming

 

External Atoms Extension, DLVHEX

 

Action Atoms, ActHEX

 

Brief Description:

 

HARP is the result of my bachelor thesis research. 

The goal of this work is to provide a pilot real-time application of ASP; in order to achieve this result, ASP paradigm is combined to the Hierarchical Task Network (HTN) formalism. This lead to the creation of a HTN planner framework where specifications can be written in a declarative language.

HARP can be used to plan offline and online; if planning online, HARP needs some user-defined methods which will be executed as the result of the planning process.

HARP is able to interleave both declarative and imperative code; the possibility of introducing imperative code allows to retrieve information from an external application or an external source of knowledge and to issue and execute tasks to accomplish. Combining ASP and HTN brings very interesting results, such as the possibility to adapt the planning procedure in runtime, for example by manipulating the maximum plan size, so to calibrate reaction times dynamically. 

HARP has been tested in a real-time strategy game, Starcraft. An artificial player that is able to control game bots by reasoning on information that changes over the time, dynamically providing goals and set of task to execute, has been developed.

 

The framework lets the user to concentrate on the design of his AI module, without taking into account how to manage the connection between the planner and the application, due to the HARP plug-in architecture. The framework can be reused by just changing the application specific classes, there is no need to adapt the planner itself. HARP capabilities have been shown providing an example of a simple AI task for the Starcraft game, which illustrated how the framework can be tailored and combined with user defined code and how the interaction between the planner and the application at hand works. Moreover, since HARP receives feedback from the application, every time a plan is executed, it is possible to tune the planning procedure basing on what the application requirements are: short plans are generated in critical situations, whereas long term plans are created in case of positive response.

 

A simple AI test

 

The HARP online planning methodology has been tested within the Starcraft video game. Using the BWAPI API, in fact, it is possible to inject code into the game and build a bot player. The developed Starcraft AI is based on the result of the planning procedure: the bots will receive messages through the network form HARP and according to the messages, an action is executed into the game. When a plan is needed, the external atoms retrieves all the relevant information from the game, which is then stored in the HARP environment. Once that the data has been collected, the planning procedure starts. In this phase, the ASP code is reasoning on the game information and will end with a plan (if possible). The plan is then uploaded to the HARP environment and then sent to the Starcraft AI, which will execute the set of tasks constituting the plan at hand. Among the generated plans, the best one is selected, based on the cost of each possible task. The Starcraft AI communicate the result of the plan back to the HARP Environment. If the plan fails, the plan length is reduced for the next requested planning. This behavior is fundamental: the more a plan fails, the more the HARP environment adjusts the maximum plan size. In a simple implementation, the plan is just reduced in size, but more complex adaptive behaviors may be based on statistics data and prevision. 

 

 

Features:

  • Online and Offline planning

  • Declarative-based planner

  • Declarative HTN encoding

  • Use ASP for real-time domains

  • Dynamic plan length

  • Tested in Starcraft via network messages (BWAPI)

 

Role: Programmer

Technology: C++, Answer Set Programming

University/Company: Universita' della Calabria

 

If you want to know more on my thesis and this project:

 

->thesis brief

 

->thesis

 

 

bottom of page