Giter VIP home page Giter VIP logo

twtl's Introduction

Overview

Time Window Temporal Logic (TWTL) is a bounded temporal logic used to specify rich properties[1]. Relaxed versions of TWTL formulae are also considered in the sense of extending the deadlines of time windows. An automata based approach is proposed to solve synthesis, verification and learning problems. The key ingredient is a construction algorithm of annotated Deterministic Finite State Automata (DFA) from TWTL properties. See [1] for more details.

PyTWTL is a Python 2.7 implementation of the algorithms proposed in [1] based on LOMAP [2], ANTLRv3 [3] and networkx [4] libraries. PyTWTL implementation is released under the GPLv3 license. The library can be used to:

  • construct DFAs and annotated DFAs from TWTL formulae;
  • monitor the satisfaction of a TWTL formula;
  • monitor the satisfaction of an arbitrary relaxation of a TWTL formula;
  • compute the temporal relaxation of a trace with respect to a TWTL formula;
  • compute a satisfying control policy with respect to a TWTL formula;
  • compute a minimally relaxed control policy with respect to a TWTL formula;
  • verify if all traces of a system satisfy some relaxed version of a TWTL formula;
  • learn the parameters of a TWTL formula, i.e. the deadlines.

The parsing of TWTL formulae is performed using ANTLRv3 framework. The package provides grammar files which may be used to generate lexers and parsers for other programming languages such as Java, C/C++, Ruby. To support Python 2.7, we used version 3.1.3 of ANTLRv3 and the corresponding Python runtime ANTLR library, which we included in our distribution for convenience.

Citation

If you use TWTL or PyTWTL, then please consider citing the reference paper:

Cristian-Ioan Vasile, Derya Aksaray, and Calin Belta. "Time Window Temporal Logic". Theoretical Computer Science, 691(Supplement C):27โ€“54, August 2017. doi:10.1016/j.tcs.2017.07.012, [bib]

Download

Download

Requirements

The package is written for python 2.7. The following python packages are required:
  • NumPy
  • NetworkX (<=1.11)
  • ParallelPython
  • matplotlib
  • setuptools
  • ANTLRv3 python runtime
You can install the packages using:
pip install networkx==1.11, numpy, matplotlib, pp, antlr-python-runtime, setuptools

How to Use

See examples_tcs.py for examples of the algorithms and the PyTWTL API. An ANT build file build.xml is provided to generate the lexer and parser from the ANTLR3 grammar files.

License & Copying

Copyright (C) 2015-2018  Cristian Ioan Vasile <cvasile@;mit.edu>
Hybrid and Networked Systems (HyNeSs) Group, BU Robotics Lab, Boston University

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 3 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, see <http://www.gnu.org/licenses/>.

A copy of the GNU General Public License is included in the source folder in a file called 'gpl.txt'.

TWTL uses the ANTLR (version 3.1.3) third party Java library to generate the lexers and parsers. It is included for convenience in the 'lib' folder of the distribution source tree. The library can be downloaded from https://github.com/antlr/website-antlr3/tree/gh-pages/download. See the file names 'license.txt' for copyright notices and license information of packages used in PyTWTL.

References

[1] Cristian Ioan Vasile, Derya Aksaray, and Calin Belta. "Time Window Temporal Logic". Theoretical Computer Science, 691(Supplement C):27โ€“54, August 2017. doi:10.1016/j.tcs.2017.07.012.

[2] Alphan Ulusoy, Stephen L. Smith, Xu Chu Ding, Calin Belta, and Daniela Rus. "Optimality and robustness in multi-robot path planning with temporal logic constraints." The International Journal of Robotics Research 32, no. 8 (2013): 889-911.

[3] Terence Parr. "The Definitive ANTLR Reference: Building Domain-Specific Languages." Pragmatic Bookshelf, 2007. ISBN 978-0978739256.

[4] Aric A. Hagberg, Daniel A. Schult, and Pieter J. Swart. "Exploring network structure, dynamics, and function using NetworkX." 2008.

twtl's People

Contributors

wasserfeder avatar

Stargazers

Prashant Vaidyanathan avatar

Watchers

James Cloos avatar  avatar  avatar  avatar Disha Kamale avatar

twtl's Issues

NameError in twtl.py

When I run twtl.py on branch feature/port_antlr4, I get the following error:

Traceback (most recent call last):
  File "examples_tcs.py", line 137, in <module>
    case1_synthesis(phi, '../data/ts_synthesis.yaml')
  File "examples_tcs.py", line 43, in case1_synthesis
    _, dfa_0, dfa_inf, bdd = twtl.translate(formula, kind='both', norm=True)
  File "/home/disha/Lehigh/twtl_antlr4/twtl/twtl/twtl.py", line 259, in translate
    ast = TWTLAbstractSyntaxTreeExtractor().visit(t)
NameError: global name 't' is not defined

Error with dfa in twtl code

When I run the twtl code with the new lomap, I get an error where relabel_nodes doesnt seem to have the right structure, but it is correct with respect to networkx=1.11 documentation. Any ideas?

File "twtl/twtl/dfa.py", line 324, in relabel_dfa
ret.g = nx.relabel_nodes(dfa.g, mapping, copy=True)
TypeError: relabel_nodes() got an unexpected keyword argument 'copy'

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.