spot 2.13
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
26namespace spot
27{
28
31 struct SPOT_API synthesis_info
32 {
33 enum class algo
34 {
35 DET_SPLIT = 0,
36 SPLIT_DET,
37 DPA_SPLIT,
38 LAR,
39 LAR_OLD,
40 ACD,
41 };
42
43 enum class splittype
44 {
45 AUTO = 0, // Uses a heuristic to choose
46 EXPL, // Explicit enumerations of inputs
47 SEMISYM, // Works on one bdd per env state
48 FULLYSYM // Works on a fully symbolic version of the automaton
49 };
50
51 // These statistics are recorded by various steps of the synthesis
52 // process.
53 struct bench_var
54 {
55 // Number of sub-spefications resulting from the decomposition.
56 // Updated by ltlsynt.
57 unsigned sub_specs = 0;
58 // Total time needed for the synthesis. Computed by ltlsynt.
59 double total_time = 0.0;
60 // Time needed to transform the LTL formula(s) into automata, summed
61 // over all subspecs. The type of automaton constructed depends on
62 // the "algo" parameter.
63 double sum_trans_time = 0.0;
64 // Time needed to split the automata into separate
65 // environment/controler steps. Summed over all subspecs.
66 // Splitting may occur before or after paritization depending on
67 // the "algo" parameter.
68 double sum_split_time = 0.0;
69 // Time needed to convert the automaton to deterministic parity
70 // automata. Summed over all subspecs. Paritization may occur
71 // before or after splitting depending on the "algo" parameter.
72 double sum_paritize_time = 0.0;
73 // Time needed to solve the game. Summed over all subspecs.
74 double sum_solve_time = 0.0;
75 // Time needed to convert the winning strategy into an
76 // automaton. Summed over all subspecs.
77 double sum_strat2aut_time = 0.0;
78 // Time needed to simplify the winning strategy. Summed over
79 // all subspecs.
80 double sum_simplify_strat_time = 0.0;
81 // Time needed to encode all the strategies into one AIG.
82 double aig_time = 0.0;
83 // Size of the automaton resulting from the main translation.
84 // If multiple subspecifications are used, only the largest
85 // (states,edges,colors,aps) triplet is kept.
86 unsigned max_trans_states = 0;
87 unsigned max_trans_edges = 0;
88 unsigned max_trans_colors = 0;
89 unsigned max_trans_ap = 0;
90 // Size of the game that should be solved. If multiple
91 // subspecifications are used, only the maximum states and
92 // colors are kept (those are compared independently).
93 unsigned max_game_states = 0;
94 unsigned max_game_colors = 0;
95 // Size of the strategy extracted from the game. If multiple
96 // subspecifications are used, only the maximum pair (states,
97 // edges) is kept.
98 unsigned max_strat_states = 0;
99 unsigned max_strat_edges = 0;
100 // Size of the strategy extracted from the game, summed over all
101 // subspecifications.
102 unsigned sum_strat_states = 0;
103 unsigned sum_strat_edges = 0;
104 // Size of the strategy after simplification game. If multiple
105 // subspecifications are used, only the maximum pair (states,
106 // edges) is kept.
107 unsigned max_simpl_strat_states = 0;
108 unsigned max_simpl_strat_edges = 0;
109 // Size of the strategy after simplification, summed over all
110 // subspecifications.
111 unsigned sum_simpl_strat_states = 0;
112 unsigned sum_simpl_strat_edges = 0;
113 // Size of the AIG
114 unsigned aig_latches = 0;
115 unsigned aig_gates = 0;
116 // Whether the (global) specification is realizable. Updated by
117 // ltlsynt.
118 bool realizable = false;
119 };
120
122 : force_sbacc{false},
123 s{algo::LAR},
124 minimize_lvl{2},
125 sp{splittype::AUTO},
126 bv{},
127 verbose_stream{nullptr},
128 dict(make_bdd_dict())
129 {
130 }
131
132 bool force_sbacc;
133 algo s;
134 int minimize_lvl;
135 splittype sp;
136 std::optional<bench_var> bv;
137 std::ostream* verbose_stream;
138 option_map opt;
139 bdd_dict_ptr dict;
140 };
141
144
172 SPOT_API twa_graph_ptr
173 split_2step(const const_twa_graph_ptr& aut,
174 const bdd& output_bdd, bool complete_env = true,
175 synthesis_info::splittype sp
176 = synthesis_info::splittype::AUTO);
177
181 SPOT_API twa_graph_ptr
182 split_2step(const const_twa_graph_ptr& aut, bool complete_env = true,
183 synthesis_info::splittype sp
184 = synthesis_info::splittype::AUTO);
185
191 SPOT_API twa_graph_ptr
192 split_2step(const const_twa_graph_ptr& aut,
193 synthesis_info& gi);
194
195
204 SPOT_API twa_graph_ptr
205 unsplit_2step(const const_twa_graph_ptr& aut);
206
209 SPOT_API std::ostream&
210 operator<<(std::ostream& os, synthesis_info::algo s);
211
214 SPOT_API std::ostream &
215 operator<<(std::ostream &os, const synthesis_info &gi);
216
217
229 SPOT_API twa_graph_ptr
231 const std::vector<std::string>& all_outs,
232 synthesis_info& gi);
233 SPOT_API twa_graph_ptr
235 const std::vector<std::string>& all_outs);
236 SPOT_API twa_graph_ptr
237 ltl_to_game(const std::string& f,
238 const std::vector<std::string>& all_outs,
239 synthesis_info& gi);
240 SPOT_API twa_graph_ptr
241 ltl_to_game(const std::string& f,
242 const std::vector<std::string>& all_outs);
244
253 SPOT_API twa_graph_ptr
254 solved_game_to_mealy(twa_graph_ptr arena, synthesis_info& gi);
255 SPOT_API twa_graph_ptr
256 solved_game_to_mealy(twa_graph_ptr arena);
257 SPOT_API twa_graph_ptr
259 SPOT_API twa_graph_ptr
260 solved_game_to_separated_mealy(twa_graph_ptr arena);
261 SPOT_API twa_graph_ptr
263 SPOT_API twa_graph_ptr
264 solved_game_to_split_mealy(twa_graph_ptr arena);
266
270 struct SPOT_API mealy_like
271 {
272 enum class realizability_code
273 {
274 UNREALIZABLE,
275 UNKNOWN,
276 REALIZABLE_REGULAR,
277 // strat is DTGBA and a glob_cond
278 REALIZABLE_DTGBA
279 };
280
281 realizability_code success;
282 twa_graph_ptr mealy_like;
283 bdd glob_cond;
284 };
285
299 SPOT_API std::pair<std::vector<formula>, std::vector<std::set<formula>>>
300 split_independent_formulas(formula f, const std::vector<std::string>& outs);
301
302 SPOT_API std::pair<std::vector<formula>, std::vector<std::set<formula>>>
303 split_independent_formulas(const std::string& f,
304 const std::vector<std::string>& outs);
306
321 SPOT_API mealy_like
323 const std::vector<std::string>& output_aps,
324 synthesis_info& gi, bool want_strategy = false);
325
331 SPOT_API bool
332 solve_game(twa_graph_ptr arena, synthesis_info& gi);
333
334 struct SPOT_API game_relabeling_map
335 {
336 relabeling_map env_map;
337 relabeling_map player_map;
338 };
339
352 SPOT_API game_relabeling_map
353 partitioned_game_relabel_here(twa_graph_ptr& arena,
354 bool relabel_env,
355 bool relabel_play,
356 bool split_env = false,
357 bool split_play = false,
358 unsigned max_letter = -1u,
359 unsigned max_letter_mult = -1u);
360
365 SPOT_API void
366 relabel_game_here(twa_graph_ptr& arena,
367 game_relabeling_map& rel_maps);
368
369}
Main class for temporal logic formula.
Definition: formula.hh:760
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....
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...
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)
make each transition a 2-step transition, transforming the graph into an alternating arena
twa_graph_ptr unsplit_2step(const const_twa_graph_ptr &aut)
the inverse of split_2step
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...
twa_graph_ptr ltl_to_game(const formula &f, const std::vector< std::string > &all_outs, synthesis_info &gi)
Creates a game from a specification and a set of output propositions.
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....
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...
Definition: automata.hh:26
Definition: synthesis.hh:335
A struct that represents different types of mealy like objects.
Definition: synthesis.hh:271
Definition: synthesis.hh:54
Benchmarking data and options for synthesis.
Definition: synthesis.hh:32

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.4