{"id":20613156,"url":"https://github.com/sherwinshen/learning_ota_by_testing","last_synced_at":"2026-04-16T20:34:19.414Z","repository":{"id":69843200,"uuid":"259027778","full_name":"sherwinshen/learning_OTA_by_testing","owner":"sherwinshen","description":"🔨 A prototype tool on learning DOTAs by testing.","archived":false,"fork":false,"pushed_at":"2021-03-29T13:41:22.000Z","size":3459,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-09T06:12:25.976Z","etag":null,"topics":["active-learning","pac-learning","timed-automata"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sherwinshen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-26T12:42:55.000Z","updated_at":"2024-12-23T07:04:54.000Z","dependencies_parsed_at":"2023-06-01T04:00:32.469Z","dependency_job_id":null,"html_url":"https://github.com/sherwinshen/learning_OTA_by_testing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sherwinshen/learning_OTA_by_testing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sherwinshen%2Flearning_OTA_by_testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sherwinshen%2Flearning_OTA_by_testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sherwinshen%2Flearning_OTA_by_testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sherwinshen%2Flearning_OTA_by_testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sherwinshen","download_url":"https://codeload.github.com/sherwinshen/learning_OTA_by_testing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sherwinshen%2Flearning_OTA_by_testing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31903925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["active-learning","pac-learning","timed-automata"],"created_at":"2024-11-16T11:08:59.810Z","updated_at":"2026-04-16T20:34:19.408Z","avatar_url":"https://github.com/sherwinshen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PAC Learning of DOTAs\n\nLast updated: 2020.05.22  —— new version: [pac_learn_DOTAs](https://github.com/MrEnvision/pac_learn_DOTAs)\n\n## Overview\n\nThis tool is dedicated to learning deterministic one-clock timed automata (DOTAs) which is a subclass of timed automata with only one clock. In contrast to the white-box learning tool given in [OTALearning](https://github.com/Leslieaj/OTALearning), we focus on the challenge of PAC learning of timed automata, which is a black box system. This tool for learning DOTAs under more realistic assumptions within the framework of PAC learning. Membership queries and equivalence queries are realized via testing. In addition, to speed up the learning process, we make several improvements to the basic PAC algorithm. This includes a special sampling method, the use of a comparator to reduce the number of equivalence queries, and the use of counterexample minimization. We provide two kinds of teachers for learning, smart teacher and normal teacher. The main difference is that the normal learner now needs to *guess* the reset information on transitions discovered in the observation table. Due to these guesses, the normal learning algorithm features exponential complexity in the size of the learned automata.\n\n## Installation\n\nThe project was developed using Python3, and you only need to download the project, but there are a few prerequisites before running：\n\n- Python3.7.* (or high)\n- graphviz (used for drawing)\n\n## Usage\n\nIf you have prepared files `model.json` and `precondition.json` in path `Automata/TCP`, you can directly run: \n\n- smart teacher setting:\n\n```shell\n$python3 learnOTA_smart.py Automata/TCP\n```\n\n- normal teacher setting:\n\n```shell\n$python3 learnOTA_normal.py Automata/TCP\n```\n\n1. `learnOTA_smart.py` is the main file of the program.\n2. `model.json` is a JSON file about the structure of the model. Although this is a black box learning tool, in the prototype stage, users can provide model structure files to model DOTAs  to be learned.\n3. `precondition.json` is a JSON file that records information about the model that the user knows  in advance, as well as user-defined parameters.\n\n**For example:**\n\n1. model.json \n\n```json\n{\n    \"states\": [\"1\", \"2\"],\n    \"inputs\": [\"a\", \"b\", \"c\"],\n    \"trans\": {\n        \"0\": [\"1\", \"a\", \"[3,9)\", \"r\", \"2\"],\n        \"1\": [\"1\", \"b\", \"[1,5]\", \"r\", \"2\"],\n        \"2\": [\"1\", \"c\", \"[0,3)\", \"n\", \"1\"],\n        \"3\": [\"2\", \"a\", \"(5,+)\", \"n\", \"1\"],\n        \"4\": [\"2\", \"b\", \"(7,8]\", \"n\", \"1\"],\n        \"5\": [\"2\", \"c\", \"(4,+)\", \"r\", \"1\"]\n    },\n    \"initState\": \"1\",\n    \"acceptStates\": [\"2\"]\n}\n```\n\n*Explanation:*\n\n- \"states\": the set of the name of locations;\n- \"inputs\": the input alphabet;\n- \"trans\": the set of transitions in the form `id : [name of the source location, input action, guards, reset, name of the target location];`\n  - \"+\" in a guard means INFTY;\n  - \"r\" means resetting the clock, \"n\" otherwise\n- \"initState\": the name of initial location;\n- \"acceptStates\": the set of the name of accepting locations.\n\n2. precondition.json\n\n```json\n{\n  \"inputs\": [\"a\", \"b\", \"c\"],\n  \"upperGuard\": 10,\n  \"stateNum\": 3,\n  \"epsilon\": 0.005,\n  \"delta\": 0.005\n}\n```\n\n*Explanation:*\n\n- “inputs”:  the set of input operations that the user knows;\n- \"upperGuard\" and \"stateNum\": the maximum constant appearing in the clock constraints and the number of model states estimated by the user based on experience;\n- “epsilon”: the error parameter;\n- \"delta\": the confidence parameter.\n\n\u003e ⚠️⚠️⚠️ During use, you must ensure that the naming is correct and the content follows the prescribed format.\n\n## Output\n\n### 1. Smart teacher setting:\n\nIf we learn the target DOTA successfully, the final COTA will be drawn and displayed as a PDF file. Additionally, we will count the total learning time, the number of tests, the number of equivalence query, and the number of membership query, etc. All results will be stored in a folder named `results` and a file named `result.json`.\n\n### 2. Normal teacher setting:\n\nIf we learn the target DOTA successfully, we will count the total learning time, total number of tables explored, the number of equivalence query, and the number of membership query, etc.  Additionally, we will store the model information in file  `result.json`.\n\n## License\n\nSee [MIT LICENSE](./LICENSE) file.\n\n## Contact\n\nPlease let me know if you have any questions 👉 [EnvisionShen@gmail.com](mailto:EnvisionShen@gmail.com)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsherwinshen%2Flearning_ota_by_testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsherwinshen%2Flearning_ota_by_testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsherwinshen%2Flearning_ota_by_testing/lists"}