Skip to main content

Automata Learning Algorithm for Stochastic Hybrid Automata

Project description

L*_sha: L*-Based Algorithm for Stochastic Hybrid Automata Learning

This repository contains the implementation of L*_sha, an algorithm to learn Stochastic Hybrid Automata from collected system traces. The algorithm is not tied to a specific domain, although it has been successfully exploited to infer a model of human behavior in human-robot interaction scenarios building upon the work presented in:

The algorithm builds upon L*, whose main elements are:

  • a Teacher that stores the collected traces and answers queries based on currently accumulated knowledge
  • a Learner that progressively refines the hypothesis automaton by asking queries to the Teacher

The teacher relies on samples of the System Under Learning (SUL) (i.e., it does not possess exact knowledge). To generate traces for the specific use case of human-robot interaction, we exploit either Uppaal with manually drafted SHA to be learned or the deployment framework to simulate the robotic application in a virtual environment and collect the simulation traces.

Authors:

Name E-mail address
Lestingi Livia livia.lestingi@polimi.it

Learned SHA

Learned SHA for the thermostat case study can be found here.

Learned SHA for the human-robot interaction case study can be found here.

Configuration File Setup

The main L*_sha script requires as input parameter the path to a configuration file, whose template can be found within the ./resources/config/ folder.

Make sure to set each property to match your environment, specifically:

  • N_min is the minimum number of observations for each trace to stop perfoming the refinement query (i.e., a value greater than 10 is advised);
  • CASE_STUDY is the chosen SUL (either THERMO or HRI);
  • CS_VERSION is the experiment you want to perform for the chosen SUL;
  • RESAMPLE_STRATEGY is the chosen approach to generate new SUL traces (either UPPAAL or SIM).

If the chosen resample strategy is UPPAAL:

  • UPPAAL_PATH is the path to Uppaal command line utility;
  • UPPAAL_SCRIPT_PATH is the path to verify.sh;
  • UPPAAL_MODEL_PATH is the path to the Uppaal model template (e.g., hri-w_ref.xml);
  • UPPAAL_QUERY_PATH is the path to the Uppal query template (e.g., thermostat.q);
  • UPPAAL_OUT_PATH is the path where you want the generated traces to be stored.

If the chosen resample strategy is SIM:

  • SIM_LOGS_PATH is the path to available SUL traces.

Note: The algorithm has been tested on Uppaal v.4.1.24 on Mac OS X. Should you run into any issue while testing with a different configuration please report to livia.lestingi@polimi.it.

Python Dependencies

Install the required dependencies:

pip install -r $LSHA_REPO_PATH/requirements.txt

Add the L*_SHA repo path to your Pytho path (fixes ModuleNotFoundError while trying to execute from command line):

export PYTHONPATH="${PYTHONPATH}:$LSHA_REPO_PATH"

Run the main script specifying the path to your configuration file:

python3 $LSHA_REPO_PATH/it/polimi/hri_learn/learn_model.py $CONFIG_FILE_PATH

Copyright © 2021 Livia Lestingi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lsha-0.1.8.tar.gz (144.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lsha-0.1.8-py3-none-any.whl (188.4 kB view details)

Uploaded Python 3

File details

Details for the file lsha-0.1.8.tar.gz.

File metadata

  • Download URL: lsha-0.1.8.tar.gz
  • Upload date:
  • Size: 144.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for lsha-0.1.8.tar.gz
Algorithm Hash digest
SHA256 8d5ae70a9fa50ff9e4c96e4eef11b65f280c51c5f933fd69be8ef0c9f8cd763f
MD5 11f713bf51af02bd3bf99a2d208b2882
BLAKE2b-256 be25ac83f9589468da1d3af2acb2331806ba74dc77fd7a32a9ae6da666b34b1f

See more details on using hashes here.

File details

Details for the file lsha-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: lsha-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 188.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for lsha-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b5557af79a855c9a1beef17d2d1a4045a2da12ccba4b20222815e99e38fcaa61
MD5 afd4615701d26b554aa023c49508a317
BLAKE2b-256 4af0d0325709b5d4c853b44ccadd293440e0721f5324df23f7da51c05fea5856

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page