Giter VIP home page Giter VIP logo

lomap's Introduction

LTL Optimal Multi-Agent Planner (LOMAP)

LTL Optimal Multi-Agent Planner (LOMAP) is a python package for automatic planning of optimal paths for multi-agent systems. See the directory 'examples' (either in the source archive or in the installation directory) for examples.

Copyright (C) 2012-2015, Alphan Ulusoy ([email protected])

Copyright (C) 2013-2020, Cristian-Ioan Vasile ([email protected], [email protected])

Installation Instructions

Linux (Ubuntu)

  1. Clone the lomap repository
  • Navigate to desired location
  • Run the following line in shell:
git clone https://github.com/wasserfeder/lomap.git
  1. Install Spot using Debian Packages (https://spot.lrde.epita.fr/install.html)
  • Run the following lines in shell:

    wget -q -O - https://www.lrde.epita.fr/repo/debian.gpg | sudo apt-key add -
    sudo sh -c "echo 'deb http://www.lrde.epita.fr/repo/debian/ stable/' >> /etc/apt/sources.list"
    sudo apt update
    sudo apt install spot libspot-dev spot-doc
    sudo apt install python3-spot # For python3 support
  1. Install necessary dependencies:
  • Run the following lines in shell:

    sudo apt install python-pip
    pip install six
    pip install matplotlib
    pip install numpy
    sudo apt install python-tk
    pip install networkx==1.11
    pip install pyyaml
    pip install pp # Optional
    apt install cmake
  • Note: Ensure that Python 2.7 is installed.

  • Note: If Python3, install matplotlib==2.2.3 in order to maintain compatibility with network 1.11

  • Note: If Python3, there is not easy way to install pp package.

  1. Download and unpack ltl2dstar
  • Download from: https://www.ltl2dstar.de/

  • Unpack ltl2dstar

  • Navigate to the ltl2dstar folder

  • Run the following lines in shell:

    mkdir build
    cd build/
    cmake -DCMAKE_BUILD_TYPE=Release ../src
    make
  • Optionally add the binary to folder in PATH

    • For example:

      mkdir ~/bin
      cp ltl2dstar ~/bin/
      echo 'export PATH="$PATH:$HOME/bin"' >> ~/.bashrc
  1. Set $PYTHONPATH to include the location of the lomap library:
  • Run the following line in shell:

    export PYTHONPATH="${PYTHONPATH}:/path/to/lomap"
  • Optionally make this setting persistent:

    echo 'export PYTHONPATH="${PYTHONPATH}:/path/to/lomap"' >> ~/.bashrc
  1. Test if the setup worked properly:
  • Navigate to /lomap/lomap/tests
  • Run any of the Python test files
    • Ex. python test_automata.py

Common Issues:

  1.    ImportError: No module named lomap.classes
  • Problem: The lomap library is not in the path variable PYTHONPATH
  • Possible Solution: Manually add lomap to your Python directory
    cd <lomap_directory>
    export PYTHONPATH="$PYTHONPATH:$PWD"
  1.    File "/usr/bin/pip", line 9, in <module>
       from pip import main
       ImportError: cannot import name main
  • Problem: Wrong version of pip (are using Python 3 pip)
  • Solution: Run commands with pip2
  1. AttributeError: 'Graph' object has no attribute 'nodes_iter' (or other graph issues)
  • Problem: Wrong version of networkx installed
  • Solution: Uninstall networkx and install networkx1.11 (see above)

Todo List:

  • Port to networkx 2.x
  • Add support for Python 3.x
  • Remove old Ts/Markov file format system, use yaml
  • Revise developer instructions, add more tests
  • Create more testing examples with instructions (docs)
  • Improve visualization
  • Add support for DFSCAs
  • Implement dfsa and dfsca minimization
  • Integrate logic minimization
  • Add Buchi/Rabin games
  • Sync with twtl, reactive-ltl, lvrmod, pvrp, gdtl-firm
  • Integrate GDTL and predicate system
  • Add more examples
  • Add RH/MPC framework
  • General clean-up of code
  • Test for functions and continuous integration system
  • BDDs for guards

Copyright and Warranty Information

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

A copy of the GNU General Public License is included in this distribution, in a file called 'license.txt'.

lomap's People

Contributors

wasserfeder avatar elenikary avatar sreyav avatar braraki avatar

Stargazers

Wu avatar Gustavo A. Cardona avatar  avatar Kumar Manas avatar Tardis avatar  avatar Disha Kamale avatar Joseph avatar Yiting He avatar  avatar Qi Shuhao avatar Yuanfan Xu avatar William Bell avatar  avatar Erfan Aasi avatar Tom Stuckey avatar Charlie avatar Akash Kumar Singh avatar Athanasios Kougionis avatar  avatar  avatar Ramon Fraga Pereira avatar TianDaiying avatar Mohammad Hussein Tavakoli Bina  avatar Felix Naser avatar Guang avatar

Watchers

 avatar James Cloos avatar  avatar  avatar  avatar Disha Kamale avatar

lomap's Issues

TypeError: 'NoneType' object is not iterable

I ve been trying to run the test_wfse.py file and I have been getting a lot of errors which are referencing the wfse.py and wfse_product.py files. I was able to fix the ones referencing the wfse.py file and now I have to been facing the ones referring to the product function. This one error I am getting now refers to line 49 from wfse_product.py:

                                                   **for wfse_out in wfse.next_state(init_wfse, init_prop):**

As I was investigating the error, I looked up where the function next_state() is defined and I found it in the fsa.py file. This function returns None for the given inputs and therefore it cannot iterate with the for loop (?). Also I noticed from the comments in file fsa.py that None is returned in the cases of "blocking automata". Does that mean that the wfse created as is now is returning a blocking automaton?
This is the error that I am getting from running the test_wfse.py file:

Traceback (most recent call last):
File "/Users/eleni/Documents/lomap-features-p23/lomap/tests/test_wfse.py", line 93, in
product_model = product_function(ts, wfse, fsa)
File "/usr/local/lib/python3.7/site-packages/lomap/algorithms/wfse_product.py", line 49, in product_function
for wfse_out in wfse.next_state(init_wfse, init_prop):
TypeError: 'NoneType' object is not iterable

Not compatible with Python3

I made lomap compatible with python 3. It wasn't too bad, there was just one tricky step.

  1. use '2to3' (comes with python) to convert lomap scripts to python3.
    /path-to-lomap/lomap$ 2to3 -w -n .
    Note: -w means that 2to3 writes the changes to the files (instead of just printing to terminal) and -n means do not create backup files.
  2. The package 'pp' is not python3 compatible. You can get around this by installing pp-1.6.4.4 from https://www.parallelpython.com/content/view/18/32/ and running sudo pip install . in the folder (maybe pip3?) and then adding the path to pp to your PYTHONPATH variable. (see https://github.com/Kamnitsask/deepmedic/issues/58 for more info)

Error while running example.

I get the following error while running the example. Is it due to any version compatibility ? Thanks.

Traceback (most recent call last):
File "ijrr2013.py", line 226, in
main()
File "ijrr2013.py", line 79, in main
prefix_length, prefixes, suffix_cycle_cost, suffix_cycles = lomap.robust_multi_agent_optimal_run(ts_tuple, rhos, formula, opt_prop)
File "/home/asus/.local/lib/python2.7/site-packages/lomap/algorithms/robust_multi_agent_optimal_run.py", line 67, in robust_multi_agent_optimal_run
team_ts = ts_times_ts(ts_tuple)
File "/home/asus/.local/lib/python2.7/site-packages/lomap/algorithms/product.py", line 171, in ts_times_ts
product_ts.g.add_node(init_state, {'prop':init_prop, 'label':"%s\n%s" % (init_state,list(init_prop))})
TypeError: add_node() takes exactly 2 arguments (3 given)

Error on installation

Hi, i did follow your installation instructions, but still got an Exception: ('lomap.classes.automata', "Problem running ltl2tgba: '[Errno 2] No such file or directory: 'ltl2tgba''")
can you help me?

fsa_times_fsa does not work with MultiGraphs

there are two calls to fsa.g[u][v]['guard'] and fsa.g[u][v]['input'] --- in the case of a MultiGraph, these must be fsa.g[u][v][key]['guard'] etc, where 'key' is an extra index that MultiGraphs have. I've implemented this in my branch.

markov_times_fsa product does not work

seems as though the Fsa class is missing a function:

File "/home/brandon/packages/lomap/lomap/algorithms/product.py", line 819, in markov_times_fsa
    for act_init_fsa in fsa.next_states_of_fsa(init_fsa, init_prop):
AttributeError: 'Fsa' object has no attribute 'next_states_of_fsa'

Can't save transition system

I have a script to generate a transition system. Cristi has access to it in another repo. But dumper has issues saving the TS. I assume there is an issue with the formatting in the graph somehow.

import lomap as lm
from RandomizedCaTLExperiments import generateRandomGridTS_seed

b = generateRandomGridTS_seed('test_ts',[5,5],0.1,['A','B','C'],[0.1,0.2,0.7],[1,2],seed=1)
b.save('test_b.yaml')

If I change model.py to include this definition

    def save(self, filename):
        '''Save the model to file in YAML format.'''
        Dumper.ignore_aliases = lambda *args : True
        with open(filename, 'w') as fout:
            dump(self, fout, Dumper=Dumper)

then I can use save without any issues.

Hrere is the long error message I obtain:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kevin/iitchs/catl_planning/RandomizedCaTLExperiments.py", line 116, in generateRandomGridTS_seed
    tsModel.save(tsname)
  File "/home/kevin/iitchs/catl_planning/lomap/lomap/classes/model.py", line 114, in save
    dump(self, fout, Dumper=Dumper)
  File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 202, in dump
    return dump_all([data], stream, Dumper=Dumper, **kwds)
  File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 190, in dump_all
    dumper.represent(data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 28, in represent
    node = self.represent_data(data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/kevin/iitchs/catl_planning/lomap/lomap/classes/__init__.py", line 39, in model_representer
    'edges' : map(list, model.g.edges(data=True))
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 123, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 223, in represent_dict
    return self.represent_mapping(u'tag:yaml.org,2002:map', data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 123, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 215, in represent_list
    return self.represent_sequence(u'tag:yaml.org,2002:seq', data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 101, in represent_sequence
    node_item = self.represent_data(item)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 215, in represent_list
    return self.represent_sequence(u'tag:yaml.org,2002:seq', data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 101, in represent_sequence
    node_item = self.represent_data(item)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 223, in represent_dict
    return self.represent_mapping(u'tag:yaml.org,2002:map', data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 123, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 61, in represent_data
    node = self.yaml_multi_representers[data_type](self, data)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 437, in represent_object
    return self.represent_sequence(tag+function_name, args)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 101, in represent_sequence
    node_item = self.represent_data(item)
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 41, in represent_data
    if self.ignore_aliases(data):
  File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 142, in ignore_aliases
    if data in [None, ()]:
TypeError: data type not understood

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.