psy-taliro


Namepsy-taliro JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummarySearch-based test generation framework
upload_time2024-03-21 22:55:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # $\Psi$-TaLiRo

An extensible Python toolbox for search-based test generation for cyber-physical
systems. This work is based of the MATLAB toolbox S-TaLiRo, which is available
[here](https://sites.google.com/a/asu.edu/s-taliro/s-taliro).

## Models

$\Psi$-TaLiRo represents the cyber-physical system under test as a model.
Conceptually, a model is a function that maps a set of system inputs to a
timed series of states called a _Trace_. $\Psi$-TaLiRo provides two ways to
construct a model: the __Blackbox__ and __Ode__ models. The __Blackbox__ model
makes no assumptions about the underlying system it represents. The __Ode__
model expects the underlying model to be represented using ordinary
differential equations.

## Specifications

$\Psi$-TaLiRo tests are system requirements expressed in metric temporal logic
(MTL). Evaluation of the system requirement depends on a _monitor_, and
$\Psi$-TaLiRo supports several options. All specific implementations are
available in the `staliro.specifications` module. To use a specification, you
will need to ensure that the monitor library is installed. Additional
information is available in the table below:

| Monitor            | Installation           | Link                                             |
| ------------------ | ---------------------- | ------------------------------------------------ |
| RTAMT              | `pip install rtamt`    | [homepage](https://github.com/nickovic/rtamt)    |
| TLTK (*Linux only) | `pip install tltk_mtl` | [homepage](https://bitbucket.org/versyslab/tltk) |
| Py-TaLiRo          | `pip install pytaliro` | [homepage](https://gitlab.com/sbtg/py-taliro)    |

## Optimizers

$\Psi$-TaLiRo generates inputs for the system under test by using an optimizer.
The optimizers provided by the toolbox are the __UniformRandom__ and
__DualAnnealing__ optimizers in the `staliro.optimizers` module.

For other optimizer options, see the [PartX](https://gitlab.com/bose1/part-x)
repository. There you will find additional implementations that give extra
guarantees about the system input space.

## Type hints

This toolbox provides [PEP484](https://peps.python.org/pep-0484) type hints
to help ensure correct usage. To use the type hints, you will need to install
one of the several type hint checkers available for python. A non-exhaustive
list is:

- [MyPy](https://mypy.readthedocs.io)
- [Pyright](https://github.com/microsoft/pyright)
- [Pyre](https://github.com/facebook/pyre-check)
- [Pytype](https://github.com/google/pytype)

The easiest way to get started is to install
[VSCode](https://code.visualstudio.com) with the
[python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
which includes the _pyright_ type checker.

## Installation

To install this toolbox, run the command `pip install psy_taliro`. To avoid
installing python packages globally, you can use a virtual environment to
keep the packages in a project-specific directory. Some of the tools for
managing virtual environments are:

- [Pipenv](https://pipenv.pypa.io)
- [Poetry](https://python-poetry.org)
- [Venv](https://docs.python.org/3/library/venv.html)

(Anaconda)[https://www.anaconda.com] can also be used to create separate python
environments, and may be easier to set up on some systems.

## Example

```python
from math import pi

from staliro import models, optimizers, specifications
from staliro.options import Options
from staliro.staliro import staliro


@models.blackbox()
def aircraft_model(X, T, U):
    """Blackbox model that represents the dynamics of an aircraft.

    Arguments:
        X: The static (initial) inputs to the system. A four-element vector of
           the form [roll, pitch, yaw, thrust].
        T: Interpolation times for the input signals
        U: Interpolated values of the time-varying input signals

    Returns:
        trace: A set of timed state values representing the altitude of the
               aircraft over time
    """
    ...


optimizer = optimizers.UniformRandom()
requirement = "[] (alt > 0.0)"  # Requirement that the aircraft does not crash
specification = specifications.RTAMTDense(requirements, {"alt": 0})  # The altitude value is in the first column of the aircraft trace states
options = Options(
    runs=10,  # 10 independent optimization attempts
    iterations=100,  # Generate 100 samples per optimization attempt
    interval=(0.0, 2.0),  # Simulation interval is from 0 to 2 seconds
    static_parameters=[
        (-pi / 4, pi / 4),  # Roll
        (-pi / 4, pi / 4),  # Pitch
        (-pi / 4, pi / 4),  # Yaw
        (0, 100),           # Thrust
    ]
)

result = staliro(aircraft_model, specification, optimizer, options)
```

## Documentation

For additional details about the toolbox components, or example scripts, refer
to the [documentation site](https://sbtg.gitlab.io/psy-taliro).

## Citing this project

If you use this toolbox in your research, include this citation in your
bibliography

```bibtex
@misc{psy-taliro,
  doi = {10.48550/ARXIV.2106.02200},
  url = {https://arxiv.org/abs/2106.02200},
  author = {Thibeault, Quinn and Anderson, Jacob and Chandratre, Aniruddh and Pedrielli, Giulia and Fainekos, Georgios},
  keywords = {Software Engineering (cs.SE), Systems and Control (eess.SY), FOS: Computer and information sciences, FOS: Computer and information sciences, FOS: Electrical engineering, electronic engineering, information engineering, FOS: Electrical engineering, electronic engineering, information engineering},
  title = {PSY-TaLiRo: A Python Toolbox for Search-Based Test Generation for Cyber-Physical Systems},
  publisher = {arXiv},
  year = {2021},
  copyright = {arXiv.org perpetual, non-exclusive license}
}
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "psy-taliro",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Quinn Thibeault <quinn.thibeault@asu.com>",
    "download_url": "https://files.pythonhosted.org/packages/9c/af/048f0aed2c51cdd3169951d84a84bbe37cb44fd936970a17b3171834cf81/psy_taliro-1.0.0.tar.gz",
    "platform": null,
    "description": "# $\\Psi$-TaLiRo\n\nAn extensible Python toolbox for search-based test generation for cyber-physical\nsystems. This work is based of the MATLAB toolbox S-TaLiRo, which is available\n[here](https://sites.google.com/a/asu.edu/s-taliro/s-taliro).\n\n## Models\n\n$\\Psi$-TaLiRo represents the cyber-physical system under test as a model.\nConceptually, a model is a function that maps a set of system inputs to a\ntimed series of states called a _Trace_. $\\Psi$-TaLiRo provides two ways to\nconstruct a model: the __Blackbox__ and __Ode__ models. The __Blackbox__ model\nmakes no assumptions about the underlying system it represents. The __Ode__\nmodel expects the underlying model to be represented using ordinary\ndifferential equations.\n\n## Specifications\n\n$\\Psi$-TaLiRo tests are system requirements expressed in metric temporal logic\n(MTL). Evaluation of the system requirement depends on a _monitor_, and\n$\\Psi$-TaLiRo supports several options. All specific implementations are\navailable in the `staliro.specifications` module. To use a specification, you\nwill need to ensure that the monitor library is installed. Additional\ninformation is available in the table below:\n\n| Monitor            | Installation           | Link                                             |\n| ------------------ | ---------------------- | ------------------------------------------------ |\n| RTAMT              | `pip install rtamt`    | [homepage](https://github.com/nickovic/rtamt)    |\n| TLTK (*Linux only) | `pip install tltk_mtl` | [homepage](https://bitbucket.org/versyslab/tltk) |\n| Py-TaLiRo          | `pip install pytaliro` | [homepage](https://gitlab.com/sbtg/py-taliro)    |\n\n## Optimizers\n\n$\\Psi$-TaLiRo generates inputs for the system under test by using an optimizer.\nThe optimizers provided by the toolbox are the __UniformRandom__ and\n__DualAnnealing__ optimizers in the `staliro.optimizers` module.\n\nFor other optimizer options, see the [PartX](https://gitlab.com/bose1/part-x)\nrepository. There you will find additional implementations that give extra\nguarantees about the system input space.\n\n## Type hints\n\nThis toolbox provides [PEP484](https://peps.python.org/pep-0484) type hints\nto help ensure correct usage. To use the type hints, you will need to install\none of the several type hint checkers available for python. A non-exhaustive\nlist is:\n\n- [MyPy](https://mypy.readthedocs.io)\n- [Pyright](https://github.com/microsoft/pyright)\n- [Pyre](https://github.com/facebook/pyre-check)\n- [Pytype](https://github.com/google/pytype)\n\nThe easiest way to get started is to install\n[VSCode](https://code.visualstudio.com) with the\n[python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)\nwhich includes the _pyright_ type checker.\n\n## Installation\n\nTo install this toolbox, run the command `pip install psy_taliro`. To avoid\ninstalling python packages globally, you can use a virtual environment to\nkeep the packages in a project-specific directory. Some of the tools for\nmanaging virtual environments are:\n\n- [Pipenv](https://pipenv.pypa.io)\n- [Poetry](https://python-poetry.org)\n- [Venv](https://docs.python.org/3/library/venv.html)\n\n(Anaconda)[https://www.anaconda.com] can also be used to create separate python\nenvironments, and may be easier to set up on some systems.\n\n## Example\n\n```python\nfrom math import pi\n\nfrom staliro import models, optimizers, specifications\nfrom staliro.options import Options\nfrom staliro.staliro import staliro\n\n\n@models.blackbox()\ndef aircraft_model(X, T, U):\n    \"\"\"Blackbox model that represents the dynamics of an aircraft.\n\n    Arguments:\n        X: The static (initial) inputs to the system. A four-element vector of\n           the form [roll, pitch, yaw, thrust].\n        T: Interpolation times for the input signals\n        U: Interpolated values of the time-varying input signals\n\n    Returns:\n        trace: A set of timed state values representing the altitude of the\n               aircraft over time\n    \"\"\"\n    ...\n\n\noptimizer = optimizers.UniformRandom()\nrequirement = \"[] (alt > 0.0)\"  # Requirement that the aircraft does not crash\nspecification = specifications.RTAMTDense(requirements, {\"alt\": 0})  # The altitude value is in the first column of the aircraft trace states\noptions = Options(\n    runs=10,  # 10 independent optimization attempts\n    iterations=100,  # Generate 100 samples per optimization attempt\n    interval=(0.0, 2.0),  # Simulation interval is from 0 to 2 seconds\n    static_parameters=[\n        (-pi / 4, pi / 4),  # Roll\n        (-pi / 4, pi / 4),  # Pitch\n        (-pi / 4, pi / 4),  # Yaw\n        (0, 100),           # Thrust\n    ]\n)\n\nresult = staliro(aircraft_model, specification, optimizer, options)\n```\n\n## Documentation\n\nFor additional details about the toolbox components, or example scripts, refer\nto the [documentation site](https://sbtg.gitlab.io/psy-taliro).\n\n## Citing this project\n\nIf you use this toolbox in your research, include this citation in your\nbibliography\n\n```bibtex\n@misc{psy-taliro,\n  doi = {10.48550/ARXIV.2106.02200},\n  url = {https://arxiv.org/abs/2106.02200},\n  author = {Thibeault, Quinn and Anderson, Jacob and Chandratre, Aniruddh and Pedrielli, Giulia and Fainekos, Georgios},\n  keywords = {Software Engineering (cs.SE), Systems and Control (eess.SY), FOS: Computer and information sciences, FOS: Computer and information sciences, FOS: Electrical engineering, electronic engineering, information engineering, FOS: Electrical engineering, electronic engineering, information engineering},\n  title = {PSY-TaLiRo: A Python Toolbox for Search-Based Test Generation for Cyber-Physical Systems},\n  publisher = {arXiv},\n  year = {2021},\n  copyright = {arXiv.org perpetual, non-exclusive license}\n}\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Search-based test generation framework",
    "version": "1.0.0",
    "project_urls": {
        "Documentation": "https://github.com/cpslab-asu/psy-taliro#readme",
        "Issues": "https://github.com/cpslab-asu/psy-taliro/issues",
        "Source": "https://github.com/cpslab-asu/psy-taliro"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4e728ad844ec95eaab80a99dacc64a4dafd1082d7156a56cc26ba4f5020c7934",
                "md5": "03f5de6c080a151e130dbafe37a25c61",
                "sha256": "a6e1d8bd963056dfb4079bea2ddda5ee55d9559e23d8a4f34227c8ad0bd2c173"
            },
            "downloads": -1,
            "filename": "psy_taliro-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "03f5de6c080a151e130dbafe37a25c61",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 29538,
            "upload_time": "2024-03-21T22:55:13",
            "upload_time_iso_8601": "2024-03-21T22:55:13.426722Z",
            "url": "https://files.pythonhosted.org/packages/4e/72/8ad844ec95eaab80a99dacc64a4dafd1082d7156a56cc26ba4f5020c7934/psy_taliro-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9caf048f0aed2c51cdd3169951d84a84bbe37cb44fd936970a17b3171834cf81",
                "md5": "1c905fa23a87f6ffa99bc3c765155dff",
                "sha256": "56d567a68e2a81ccb3d4149ac4cfb6d9c6341cfdc0627de42e344945eed9f442"
            },
            "downloads": -1,
            "filename": "psy_taliro-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1c905fa23a87f6ffa99bc3c765155dff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 26957,
            "upload_time": "2024-03-21T22:55:14",
            "upload_time_iso_8601": "2024-03-21T22:55:14.781572Z",
            "url": "https://files.pythonhosted.org/packages/9c/af/048f0aed2c51cdd3169951d84a84bbe37cb44fd936970a17b3171834cf81/psy_taliro-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-21 22:55:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cpslab-asu",
    "github_project": "psy-taliro#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "psy-taliro"
}
        
Elapsed time: 0.20613s