Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ where `<clone-dir>` is the directory where you cloned the `PyTeLo` repository.

Install *Gurobi* with *gurobipy* for python3.


Run
---

Expand All @@ -59,6 +58,17 @@ BibTeX:
}
```

Install as Package
---
After running `antlr4` above, from one directory level above `pytelo/`

```bash
pip install pytelo/
```

This will let other packages import pytelo functions without including pytelo in their directory structure or referencing the associated files by location.


**NOTE:** At the moment the implementation only supports python2 and python3. However, you
can generate lexers, parsers, listners, and visitors for other target languages,
such as Java (default), C++, C#, Go, JavaScript, and Swift.
Expand Down
4 changes: 0 additions & 4 deletions mtl/__init__.py

This file was deleted.

26 changes: 26 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from setuptools import find_packages, setup
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move towards the newer packaging methodology using a pyproject.toml file, pip as frontend and setuptools as backend.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked to Jaime about this, and he says that you could do that, but it's probably not necessary for a project of this size.


DISTNAME = "PyTeLo"

DESCRIPTION = "A Flexible and Efficient Temporal Logic Tool for Python"

INSTALL_REQUIRES = ["antlr4-python3-runtime==4.13.0",
"scipy",
"gurobipy"]

setup(
name=DISTNAME,
author="ERL Lehigh",
version="0.1.0",
description=DESCRIPTION,
url="https://github.com/erl-lehigh/PyTeLo",
python_requires=">=3.6, <3.11",
package_dir={"": "src"},
packages=find_packages("src"),
include_package_data=True,
install_requires=INSTALL_REQUIRES,
# extras_require=EXTRAS_REQUIRES,
)

# to install:
# pip install .
5 changes: 5 additions & 0 deletions src/pytelo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .stl import STLFormula, Trace, TraceBatch
from .mtl import MTLFormula


__version__ = "0.1.0"
5 changes: 5 additions & 0 deletions src/pytelo/mtl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .mtlLexer import mtlLexer
from .mtlParser import mtlParser
from .mtl import MTLAbstractSyntaxTreeExtractor
from .mtl import Operation, MTLFormula
from .mtl import to_ast
File renamed without changes.
6 changes: 3 additions & 3 deletions mtl/mtl.py → src/pytelo/mtl/mtl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from antlr4 import InputStream, CommonTokenStream

from mtlLexer import mtlLexer
from mtlParser import mtlParser
from mtlVisitor import mtlVisitor
from .mtlLexer import mtlLexer
from .mtlParser import mtlParser
from .mtlVisitor import mtlVisitor


class Operation(object):
Expand Down
4 changes: 2 additions & 2 deletions mtl/mtl2milp.py → src/pytelo/mtl/mtl2milp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import gurobipy as grb

from mtl import Operation, MTLFormula
from .mtl import Operation, MTLFormula


class mtl2milp(object):
Expand Down Expand Up @@ -146,4 +146,4 @@ def until(self, formula, z, t):
+ sum(z_children_left[:t+a+k+1]))

self.model.addConstr(z >= z_conj)
self.model.addConstr(z <= sum(z_aux))
self.model.addConstr(z <= sum(z_aux))
File renamed without changes.
5 changes: 5 additions & 0 deletions src/pytelo/stl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .stlLexer import stlLexer
from .stlParser import stlParser
from .stl import STLAbstractSyntaxTreeExtractor
from .stl import Operation, RelOperation, STLFormula, Trace, TraceBatch
from .stl import to_ast
4 changes: 2 additions & 2 deletions stl/agm.py → src/pytelo/stl/agm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import numpy as np
from antlr4 import InputStream, CommonTokenStream

from stlLexer import stlLexer
from stlParser import stlParser
from .stlLexer import stlLexer
from .stlParser import stlParser

from stl import Operation, RelOperation, STLAbstractSyntaxTreeExtractor, Trace

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions stl/stl.py → src/pytelo/stl/stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from scipy.interpolate import interp1d
from antlr4 import InputStream, CommonTokenStream

from stlLexer import stlLexer
from stlParser import stlParser
from stlVisitor import stlVisitor
from .stlLexer import stlLexer
from .stlParser import stlParser
from .stlVisitor import stlVisitor


class Operation(object):
Expand Down
3 changes: 1 addition & 2 deletions stl/stl2milp.py → src/pytelo/stl/stl2milp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import gurobipy as grb

from stl import Operation, RelOperation, STLFormula
from .stl import Operation, RelOperation, STLFormula


class stl2milp(object):
Expand Down Expand Up @@ -86,7 +86,6 @@ def add_state(self, state, t):
name='{}_{}'.format(state, t)
v = self.model.addVar(vtype=vtype, lb=low, ub=high, name=name)
self.variables[state][t] = v
print 'Added state:', state, 'time:', t
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should delete this print statement.

self.model.update()
return self.variables[state][t]

Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions stl/__init__.py

This file was deleted.