Giter Club home page Giter Club logo

mapf-instance-generator's Introduction

The MAPF Instance Generator is a tool for generating instances of the Multi-Agent Path Finding (MAPF) problem in the lightweight MAPF instance format. It is designed to help students and researchers create custom MAPF instances for testing and benchmarking purposes.

instance examples

Installation

Requires Conda to be installed.

To install download this repository and run conda env create --file reqs.yml from the main folder. This will create a new environment called "gen" and install all required packages. Please remember to activate the correct environment using conda activate gen to be able to use the generator.

Usage

Help message

usage: python gen.py (empty | maze | random -c [0-100] | room -w WIDTH | warehouse -w WIDTH) -s SIZE -a AGENTS [-d DISTANCE] [-dir DIRECTORY] [-dur MINDUR MAXDUR] [-m] [-suf SUFFIX] [-t TIMEOUT] [-v] [-h] [-q]


positional arguments:
  {empty, maze, random, room, warehouse, *.jpg, *.png, *.lp}
                                                 type of instance to be generated, path to image to be converted or path to instance to be loaded
optional arguments:
  -h,                 --help                     show this help message and exit
  -a AGENTS,          --agents AGENTS            number of agents
  -acyc,              --acyclicity               checks acyclicity
                      --allSPs                   generates all shortest paths instead of one
  -c [0-100],         --cover [0-100]            percentage of vertices covered (default=75)
  -d DISTANCE,        --distance DISTANCE        min. manhatten distance from start to goal
  -dir DIRECTORY      --directory DIRECTORY      sets directory
  -dur MINDUR MAXDUR, --durations MINDUR MAXDUR  generates instances with durations
  -m,                 --makespan                 searches for minimal makespan
  -q,                 --quiet                    turns on quiet mode
  -sp,                --shortest_paths           searches for shortest paths
  -suf SUFFIX,        --suffix SUFFIX            appends suffix to filename
  -t,                 --timeout                  sets a timeout in seconds
  -v,                 --visualize                convert to and visualize with asprilo
  -w WIDTH,           --width WIDTH              width of rooms / shelves (default=5)

required arguments for all instance types:
  -s X-SIZE Y-SIZE,   --size X-SIZE Y-SIZE       size of instance

Examples

Generation

Empty

python gen.py empty -s 10 10 -a 5 -dur 1 5 generates an empty 10x10 instance with 5 agents and random durations between 1 and 5 of the edges.

Maze

python gen.py maze -s 10 10 -a 5 -dir "mazes" generates a 10x10 maze instance with 5 agents and saves it in the directory "mazes".

Random

python gen.py random -s 10 10 -a 5 -c 55 generates a 10x10 random instance with 5 agents where 55% of the space is covered by nodes resulting in 45% being random obstacles.

Room

python gen.py room -s 10 10 -a 5 -w 5 generates a 10x10 room instance with 5 agents where every room has a size of 5x5 nodes.

Change instance

python gen.py instance.lp -a 12 changes the number of agents of an instance to 12.

Convert image to instance

python gen.py image.jpg -s 10 10 converts an image to a 10x10 instance.

Meta Information

Makespan

The -m option saves the minimal makespan in a seperate meta file.

Shortest Paths

The -sp option saves the shortest path in a seperate file.

Acyclicity

The -acyc option checks if the instance is solvable without any of the agents performing cycles. If so the fact acyclic. is added to the meta file.

Timeout

-t 600 sets a 10 minutes timeout for the generation.

Quiet

Use -q to have no status output at all

Visualization

To automatically visualize the instance at the end of the process use the -v option.

To visualize the instances at a later time use the asprilo visualizer with the converter: mif_to_asprilo.lp like this: clingo instance.lp mif_to_asprilo.lp | viz


Literature

mapf-instance-generator's People

Contributors

j-behrens avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

mapf-instance-generator's Issues

Implement different versions of agent distribution

Image

  • Cross Sides (CS): all agents start on one side and traverse to the other side
  • Swap Sides (SS): half the agents start on one side and the other half start on the other side, targets are randomly selected in the side opposite of their sources
  • Inside Out (IO): agents start near the center of the grid and are assigned targets near the outer edges of the grid
  • Outside In (OI): agents start near the outer edges of the grid and are assigned targets near the center of the grid
  • Tight to Tight (TT): agents start together and are assigned targets that are as close as possible elsewhere on the grid
  • Tight to Wide (TW): agents start close together and are assigned targets that are spread out in the same general area of the grid

Arguments that lead to long runtime

Hi, I cannot get it to run:

At uni:

 > ll ./gen.py 
-rwxr--r-- 1 torsten csstaff 4027 Aug 12 13:21 ./gen.py

 > ./gen.py random -c 10 -s 20 -a 5

doesn't terminate

The same for
python3 ./gen.py random -c 10 -s 20 -a 5

--size with 2 args

change argparser and encodings to allow for non-quadratic instance shapes

meta information: acyclicity

For the DL work, it would be good to know whether there are acyclic solutions:

#edge ((A,U),(A,V)) : move(A,U,V,_), agent(A).

Let python take care of random stuff

Write own configuration files to fix non random choices like for: (didn't work well)
Let python take care of random stuff like for:

  • room: choosing if a wall has a door or not and where the door is placed

  • random: choosing vertices

  • agents: choosing position of starts and goals

Also:

  • Implement the python part into the .lp files instead

image to instance

gen IMAGE_PATH -s SIZE

converts image to instance of given size

Examples:

Image Instance
Image Image
Image Image
Image Image

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.