spot  2.16
synthesis.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) by the Spot authors, see the AUTHORS file for details.
3 //
4 // This file is part of Spot, a model checking library.
5 //
6 // Spot is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // Spot is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 #pragma once
20 
21 #include <spot/twa/twagraph.hh>
22 #include <spot/twaalgos/game.hh>
23 #include <spot/twaalgos/relabel.hh>
24 #include <bddx.h>
25 
26 namespace spot
27 {
28 
31  struct SPOT_API synthesis_info
32  {
34  enum class algo
35  {
36  DET_SPLIT = 0,
37  SPLIT_DET,
38  DPA_SPLIT,
39  LAR,
40  LAR_OLD,
41  ACD,
42  };
43 
45  enum class splittype
46  {
47  AUTO = 0, // Uses a heuristic to choose
48  EXPL, // Explicit enumerations of inputs
49  SEMISYM, // Works on one bdd per env state
50  FULLYSYM // Works on a fully symbolic version of the automaton
51  };
52 
60  struct bench_var
61  {
63  unsigned sub_specs = 0;
65  double total_time = 0.0;
67  double sum_trans_time = 0.0;
69  double sum_split_time = 0.0;
71  double sum_paritize_time = 0.0;
73  double sum_solve_time = 0.0;
75  double sum_strat2aut_time = 0.0;
77  double sum_simplify_strat_time = 0.0;
79  double aig_time = 0.0;
81  unsigned max_trans_states = 0;
83  unsigned max_trans_edges = 0;
85  unsigned max_trans_colors = 0;
87  unsigned max_trans_ap = 0;
89  unsigned max_game_states = 0;
91  unsigned max_game_colors = 0;
93  unsigned max_strat_states = 0;
95  unsigned max_strat_edges = 0;
97  unsigned sum_strat_states = 0;
99  unsigned sum_strat_edges = 0;
101  unsigned max_simpl_strat_states = 0;
103  unsigned max_simpl_strat_edges = 0;
105  unsigned sum_simpl_strat_states = 0;
107  unsigned sum_simpl_strat_edges = 0;
109  unsigned aig_latches = 0;
111  unsigned aig_gates = 0;
113  bool realizable = false;
114  };
115 
117  : force_sbacc{false},
118  s{algo::LAR},
119  minimize_lvl{2},
120  sp{splittype::AUTO},
121  bv{},
122  verbose_stream{nullptr},
123  moore{false},
124  dict(make_bdd_dict())
125  {
126  }
127 
128  bool force_sbacc;
129  algo s;
132  std::optional<bench_var> bv;
133  std::ostream* verbose_stream;
135  bool moore;
137  };
138 
141 
173  SPOT_API twa_graph_ptr
175  const bdd& output_bdd, bool complete_env = true,
177  = synthesis_info::splittype::AUTO,
178  bool moore = false);
179 
183  SPOT_API twa_graph_ptr
184  split_2step(const const_twa_graph_ptr& aut, bool complete_env = true,
186  = synthesis_info::splittype::AUTO,
187  bool moore = false);
188 
194  SPOT_API twa_graph_ptr
196  synthesis_info& gi);
197 
198 
207  SPOT_API twa_graph_ptr
209 
212  SPOT_API std::ostream&
213  operator<<(std::ostream& os, synthesis_info::algo s);
214 
217  SPOT_API std::ostream &
218  operator<<(std::ostream &os, const synthesis_info &gi);
219 
220 
232  SPOT_API twa_graph_ptr
234  const std::vector<std::string>& all_outs,
235  synthesis_info& gi,
236  const std::vector<std::string>* unobs = nullptr);
237 
248  SPOT_API twa_graph_ptr
250  const std::vector<std::string>& all_outs,
251  const std::vector<std::string>* unobs = nullptr);
252 
261  SPOT_API twa_graph_ptr
263  SPOT_API twa_graph_ptr
265  SPOT_API twa_graph_ptr
267  SPOT_API twa_graph_ptr
269  SPOT_API twa_graph_ptr
271  SPOT_API twa_graph_ptr
274 
278  struct SPOT_API mealy_like
279  {
282  {
283  UNREALIZABLE,
284  UNKNOWN,
285  REALIZABLE_REGULAR,
286  // strat is DTGBA and a glob_cond
287  REALIZABLE_DTGBA
288  };
289 
292  bdd glob_cond;
293  };
294 
308  SPOT_API std::pair<std::vector<formula>, std::vector<std::set<formula>>>
309  split_independent_formulas(formula f, const std::vector<std::string>& outs);
310 
311  SPOT_API std::pair<std::vector<formula>, std::vector<std::set<formula>>>
312  split_independent_formulas(const std::string& f,
313  const std::vector<std::string>& outs);
315 
331  SPOT_API mealy_like
333  const std::vector<std::string>& output_aps,
334  synthesis_info& gi, bool want_strategy = false);
335 
341  SPOT_API bool
343 
346  struct SPOT_API game_relabeling_map
347  {
350  };
351 
364  SPOT_API game_relabeling_map
366  bool relabel_env,
367  bool relabel_play,
368  bool split_env = false,
369  bool split_play = false,
370  unsigned max_letter = -1u,
371  unsigned max_letter_mult = -1u);
372 
377  SPOT_API void
379  game_relabeling_map& rel_maps);
380 
381 }
Main class for temporal logic formula.
Definition: formula.hh:847
Manage a map of options.
Definition: optionmap.hh:34
bool solve_game(const twa_graph_ptr &arena)
Generic interface for game solving.
twa_graph_ptr solved_game_to_split_mealy(twa_graph_ptr arena, synthesis_info &gi)
creates a mealy machine from a solved game arena taking into account the options given in gi....
twa_graph_ptr solved_game_to_separated_mealy(twa_graph_ptr arena, synthesis_info &gi)
creates a mealy machine from a solved game arena taking into account the options given in gi....
twa_graph_ptr unsplit_2step(const const_twa_graph_ptr &aut)
the inverse of split_2step
twa_graph_ptr split_2step(const const_twa_graph_ptr &aut, const bdd &output_bdd, bool complete_env=true, synthesis_info::splittype sp=synthesis_info::splittype::AUTO, bool moore=false)
make each transition a 2-step transition, transforming the graph into an alternating arena
game_relabeling_map partitioned_game_relabel_here(twa_graph_ptr &arena, bool relabel_env, bool relabel_play, bool split_env=false, bool split_play=false, unsigned max_letter=-1u, unsigned max_letter_mult=-1u)
Tries to relabel a SPLIT game arena using fresh propositions. Can be applied to env or player dependi...
mealy_like try_create_direct_strategy(formula f, const std::vector< std::string > &output_aps, synthesis_info &gi, bool want_strategy=false)
Creates a strategy for the formula given by calling all intermediate steps.
twa_graph_ptr solved_game_to_mealy(twa_graph_ptr arena, synthesis_info &gi)
creates a mealy machine from a solved game arena taking into account the options given in gi....
std::pair< std::vector< formula >, std::vector< std::set< formula > > > split_independent_formulas(formula f, const std::vector< std::string > &outs)
Seeks to decompose a formula into independently synthetizable sub-parts. The conjunction of all sub-p...
void relabel_game_here(twa_graph_ptr &arena, game_relabeling_map &rel_maps)
Undoes a relabeling done by partitioned_game_relabel_here. A dedicated function is necessary in order...
twa_graph_ptr ltl_to_game(formula f, const std::vector< std::string > &all_outs, synthesis_info &gi, const std::vector< std::string > *unobs=nullptr)
Creates a game from a specification and a set of output propositions.
bdd_dict_ptr make_bdd_dict()
Create a new, empty bdd_dict wrapped in a shared pointer.
Definition: bdddict.hh:308
std::shared_ptr< bdd_dict > bdd_dict_ptr
Shared pointer to a bdd_dict.
Definition: bdddict.hh:304
std::shared_ptr< twa_graph > twa_graph_ptr
Shared pointer to a mutable twa_graph.
Definition: fwd.hh:44
std::shared_ptr< const twa_graph > const_twa_graph_ptr
Shared pointer to a const twa_graph.
Definition: fwd.hh:38
Definition: automata.hh:26
std::ostream & operator<<(std::ostream &os, const mc_algorithm &ma)
Print an mc_algorithm value to a stream.
Definition: mc.hh:74
std::map< formula, formula > relabeling_map
Map associating new (key) formula names to old (value) ones.
Definition: relabel.hh:31
Pair of relabeling maps for environment and player edges in a synthesis game.
Definition: synthesis.hh:347
relabeling_map env_map
Map for environment edges.
Definition: synthesis.hh:348
relabeling_map player_map
Map for player edges.
Definition: synthesis.hh:349
A struct that represents different types of mealy like objects.
Definition: synthesis.hh:279
bdd glob_cond
Global condition for DTGBA strategies.
Definition: synthesis.hh:292
realizability_code success
Realizability result.
Definition: synthesis.hh:290
realizability_code
Realizability result codes.
Definition: synthesis.hh:282
Benchmarking variables tracking timing and counts for each step of synthesis.
Definition: synthesis.hh:61
Benchmarking data and options for synthesis.
Definition: synthesis.hh:32
splittype
Splitting strategy for 2-step games.
Definition: synthesis.hh:46
option_map opt
Additional options.
Definition: synthesis.hh:134
splittype sp
Splitting strategy.
Definition: synthesis.hh:131
bdd_dict_ptr dict
BDD dictionary.
Definition: synthesis.hh:136
bool force_sbacc
Force state-based acceptance.
Definition: synthesis.hh:128
algo
Algorithm selection for synthesis.
Definition: synthesis.hh:35
std::ostream * verbose_stream
Verbose output stream.
Definition: synthesis.hh:133
int minimize_lvl
Minimization level.
Definition: synthesis.hh:130
std::optional< bench_var > bv
Benchmarking data.
Definition: synthesis.hh:132
algo s
Selected algorithm.
Definition: synthesis.hh:129
bool moore
Use Moore (output-first) semantics instead of Mealy.
Definition: synthesis.hh:135

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.1