Giter VIP home page Giter VIP logo

gvgai-pddl's Introduction

License: GPL v3 Java CI with Maven Build Status

๐Ÿค– GVGAI-PDDL

Implementation of a planning-based agent in GVGAI. This project is being developed as part of my Bachelor's thesis.

The project makes use of the PDDL Solver from planning.domains. If you want to have more information about this solver and how you can use it in your own project, please check the following page.

This projects is being developed and partially funded under the framework of the Spanish MINECO R&D Projects TIN2015-71618-R and RTI2018-098460-B-I00.

๐Ÿ”“ Requirements

This project has the following dependencies:

  • git
  • OpenJDK 8
  • Maven
  • Python3
  • Python3 venv

To install them, run the following command:

$ sudo apt install git openjdk-8-jdk maven python3 python3-venv

NOTE: If you have more than one version of java installed in your device, you will have to select the openjdk-8-jdk version by running sudo update-alternatives --config java.

๐Ÿ”ง Installation

First clone this repository:

$ git clone https://github.com/Vol0kin/gvgai-pddl.git

After the repository has been cloned, change the working directory to the directory that contains the cloned files. To do that, run the following command:

$ cd gvgai-pddl

To install the required Python dependencies, you can create a virtual environment and install them in there. You can do this by running the following commands:

# Create virtual envirnoment
$ python3 -m venv env

# Activate virtual envirnment
$ source env/bin/activate

# Install dependencies
$ pip install -r requirements.txt

This way, you will be able to run the Python script without any kind of issue whenever the virtual environment is active. If you want to exit the virtual environment, run the following command:

$ deactivate

To create the executable JAR file, run either of these two commands:

# Create executable file and run the tests
$ mvn package

# Create executable file without running the tests
$ mvn package -DskipTests=true

Either of them will generate the following JAR file: target/GVGAI-PDDL-1.0.jar. The target/ directory also contains external dependencies. Without them, the JAR file can't be executed.

๐Ÿ’ป Usage

๐Ÿ“ Generation of template configuration files

The gen_config_file.py script allows the generation of template configuration files.

usage: gen_config_file.py [-h] -d DOMAIN -g GAME [-o OUTPUT] [--orientations]

Generate the game's configuration file.

optional arguments:
  -h, --help            show this help message and exit
  -d DOMAIN, --domain DOMAIN
                        Domain file.
  -g GAME, --game GAME  Game description file.
  -o OUTPUT, --output OUTPUT
                        Output file.
  --orientations        Use orientation predicates.

The game description files can be found in the examples/gridphysic/ directory. Their names follow the following pattern: gamename.txt.

๐Ÿƒ Running the system

To run the system, execute the following command:

$ java -jar target/GVGAI-PDDL-1.0.jar [ options ]

The detailed list of options can be found here:

Usage: GVGAI-PDDL [-dhsV] [--localhost] [-c=<configurationFile>] -g=<gameIdx>
                  -l=<levelIdx>
Launches a new GVGAI game played by a planning agent or by a human.
  -c, --config=<configurationFile>
                           YAML configuration file that will be used by the
                             agent.
  -d, --debug              Debug mode.
  -g, --game=<gameIdx>     Game to be played.
  -h, --help               Show this help message and exit.
  -l, --level=<levelIdx>   Level to be played.
      --localhost          Call planner running on localhost.
  -s, --save               Save runtime information (problems, plans and log).
  -V, --version            Print version information and exit.

The levelIdx parameter ranges from 0 to 4. To find out what the gameIdx of a given game is, please check this file.

๐Ÿ•น๏ธ Human player

If you want to play a level of a given game to mess with it and understand it better, just run the system with the following options:

$ java -jar target/GVGAI-PDDL-1.0.jar -g [gameIdx] -l [lvlIdx]

๐Ÿ‘พ Run system using configuration file

To run the system using the implemented planning agent, you must specify the path of a configuration file. To do so, run the system with the following options:

$ java -jar target/GVGAI-PDDL-1.0.jar -g [gameIdx] -l [lvlIdx] -c [configurationFile]

๐Ÿ› Debugging mode

The system also has a debugging mode, which can be very handy if you want to get more information during execution time. To enable it, run the system with the following options:

$ java -jar target/GVGAI-PDDL-1.0.jar -g [gameIdx] -l [lvlIdx] -c [configurationFile] -d

Note: In order to run the debugging mode, you have to use the implemented planning agent. Thus, you must specify a configuration file. Otherwise, the -d flag won't do anything.

๐Ÿ’พ Save runtime information

You can also save runtime information such as the generated problems, the response plans and a log file which contains information about everything that is going on in the system. To enable this option, run the system as follows:

$ java -jar target/GVGAI-PDDL-1.0.jar -g [gameIdx] -l [lvlIdx] -c [configurationFile] -s

Note: This option is only available if you are running the implemented planning agent. Thus, you must specify a configuration file. Otherwise, the -s flag won't do anything.

โ˜๏ธ Running the planner on localhost

Sometimes you might experience some issues while trying to run the system because the cloud solver is busy. To solve this problems and get faster execution times, consider running it on localhost. This is especially advisable if you are going to do some heavy testing. However, in order to run it you will need to install NodeJS beforehand. Please referr to the official web page to find the latests releases and the installation process.

After you have installed it, go to the solver's repository and clone it. Once you have cloned it, go to the directory where the source files are found and run the following commands:

# Install the project's dependencies
$ npm install .

# Run the server
$ node web.js

This will create a new server running on localhost:5000. By running the system with the --localhost option, the HTTP requests will be automatically sent to the server running on localhost.

๐Ÿ“š Source code documentation

The source code's documentation is available here. There you can find the generated JavaDoc for the whole project (including GVGAI's source files). However, if you are more interested in the documentation of this particular agent, you can check the controller package documentation.

๐ŸŽ“ Other documentation

In the following links you can find out more documentation about this project:

๐Ÿค Contributing

If you want to contribute to this project or think that some feature is broken/missing, please consider opening a PR. All contributions are welcome! ๐Ÿ˜„

gvgai-pddl's People

Contributors

dependabot[bot] avatar vol0kin avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gvgai-pddl's Issues

Add debug mode.

Having a debug mode can be very useful:

  • The user might understand better what the agent is doing.
  • When a discrepancy is found, the decision that the agent has made can be understood better.
  • When an important event happens, the user will be able to understand what is going to happen next.

Fix repeated objects.

When creating the problem file, some of the objects are written more than once. Some planners are quite strict in this sense as they don't allow repeated objects.

Create a basic agent that has predefined goals.

This implementation must meet the following requirements:

  • It has to use an agenda to store the goals.
  • It has to control whether a goal has been achieved or not.
  • It has to update the agenda once a goal has been achieved.

Allow users to pass command line arguments to the program.

Once the JAR is generated, passing arguments to it will be very handy since it will allow to modify run-time parameters (game, level, configuration file used by the agent, debug mode, etc.). Also, checking what values are passed will allow to discern whether the game will be played by an actual human or by the agent.

Join JSON files into a single data structure.

The game information is currently spread across multiple files. The main idea is to join all the information in a single file, which will contain a data structure that will be loaded once a new game begins.

Test more games.

Currently, only one game has been tested. At least, 3 games have to be tested:

  • Boulderdash.
  • Ice and Fire.
  • N/A.

Testing more games will give us a deeper insight on things that shoud be added to the data structures that we already have so that more games can be played by the agent.

Add option to call solver running on localhost.

In order not to saturate the cloud solver when some heavy testing has to be done, it could be a good idea to add an option which would allow to send the HTTP requests to a server running on localhost.

Automate the game information creation.

Currently, creating the data structure that represents the game information is tedious and inefficient. Thus, the creation of this data structure must be automated, so it doesn't have to be created manually.

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.