LydiaSyft
gr1.hpp
1 //
2 // Created by marcofavorito on 22/01/24.
3 //
4 
5 #ifndef LYDIASYFT_CLI_GR1_H
6 #define LYDIASYFT_CLI_GR1_H
7 
8 #include <CLI/CLI.hpp>
9 #include "synthesizer/GR1LTLfSynthesizer.h"
10 #include "Utils.h"
11 
12 
13 namespace Syft {
14 
15  class GR1Runner : public BaseRunner {
16  private:
17  const std::string path_to_slugs_;
18  const std::string gr1_file_;
19  const std::optional<std::string> env_safety_file_;
20  const std::optional<std::string> agent_safety_file_;
21 
22  const whitemech::lydia::ltlf_ptr agent_safety_;
23  const whitemech::lydia::ltlf_ptr env_safety_;
24 
25  Syft::SymbolicStateDfa do_dfa_construction_with_message_(const whitemech::lydia::LTLfFormula &formula,
26  const std::shared_ptr<VarMgr> &var_mgr,
27  const std::string &msg) const;
28 
29  void do_gr1_synthesis_(const SymbolicStateDfa &dfa, const SymbolicStateDfa &dfa1,
30  const SymbolicStateDfa &dfa2) const;
31 
32  void handle_gr1_synthesis_result_(const GR1LTLfSynthesizer &synthesizer,
33  const SynthesisResult &result) const;
34 
35 
36  public:
37  GR1Runner(const std::shared_ptr<whitemech::lydia::parsers::ltlf::LTLfDriver> &driver,
38  const std::string &formula_file, const std::string &path_to_syfco, const std::string &path_to_slugs,
39  const std::string &gr1_file, const std::optional<std::string> &env_safety_file,
40  const std::optional<std::string> &agent_safety_file,
41  bool print_strategy, bool print_times) : BaseRunner(driver, formula_file, path_to_syfco,
42  print_strategy, print_times),
43  path_to_slugs_(path_to_slugs), gr1_file_(gr1_file),
44  env_safety_file_(env_safety_file),
45  agent_safety_file_(agent_safety_file),
46  agent_safety_(parse_formula(driver_,
47  read_assumption_file_if_file_specified(
48  agent_safety_file_))),
49  env_safety_(parse_formula(driver_,
50  read_assumption_file_if_file_specified(
51  env_safety_file_))) {}
52 
53  void run() const;
54  };
55 
56 }
57 
58 
59 #endif //LYDIASYFT_CLI_GR1_H
Base class for running a synthesis algorithm.
Definition: base.hpp:75
A single-strategy-synthesizer for an LTLf formula given as a symbolic-state DFA, considering environm...
Definition: GR1LTLfSynthesizer.h:24
Definition: gr1.hpp:15
A DFA with symbolic states and transitions.
Definition: SymbolicStateDfa.h:18
Definition: Synthesizer.h:16