Package: lsha
L*_sha: L*-Based Algorithm for Stochastic Hybrid Automata LearningThis 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:Formal Modeling and Verification of Multi-Robot Interactive Scenarios in Service SettingsA Deployment Framework for Formally Verified Human-Robot InteractionsA Model-driven Approach for the Formal Analysis of Human-Robot Interaction ScenariosFormal Verification of Human-Robot Interaction in Healthcare ScenariosStatistical Model Checking of Human-Robot Interaction ScenariosThe algorithm builds uponL*, whose main elements are:aTeacherthat stores the collected traces and answers queries based on currently accumulated knowledgeaLearnerthat progressively refines the hypothesis automaton by asking queries to the TeacherThe teacher relies onsamplesof 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 eitherUppaalwith manually drafted SHA to be learned or thedeployment frameworkto simulate the robotic application in a virtual environment and collect the simulation traces.Authors:NameE-mail addressLestingi Livialivia.lestingi@polimi.itLearned SHALearned SHA for thethermostatcase study can be foundhere.Learned SHA for thehuman-robot interactioncase study can be foundhere.Configuration File SetupThemain L*_sha scriptrequires 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_minis the minimum number of observations for each trace to stop perfoming the refinement query (i.e., a value greater than 10 is advised);CASE_STUDYis the chosen SUL (either THERMO or HRI);CS_VERSIONis the experiment you want to perform for the chosen SUL;RESAMPLE_STRATEGYis the chosen approach to generate new SUL traces (either UPPAAL or SIM).If the chosen resample strategy is UPPAAL:UPPAAL_PATHis the path to Uppaalcommand line utility;UPPAAL_SCRIPT_PATHis the path toverify.sh;UPPAAL_MODEL_PATHis the path to the Uppaal model template (e.g.,hri-w_ref.xml);UPPAAL_QUERY_PATHis the path to the Uppal query template (e.g.,thermostat.q);UPPAAL_OUT_PATHis the path where you want the generated traces to be stored.If the chosen resample strategy is SIM:SIM_LOGS_PATHis the path to available SUL traces.Note: The algorithm has been tested on Uppaalv.4.1.24on Mac OS X. Should you run into any issue while testing with a different configuration please report tolivia.lestingi@polimi.it.Python DependenciesInstall the required dependencies:pip install -r $LSHA_REPO_PATH/requirements.txtAdd 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_PATHCopyright © 2021 Livia Lestingi