spot 2.15.1
Loading...
Searching...
No Matches
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-specifications 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/controller 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
228 SPOT_API twa_graph_ptr
230 const std::vector<std::string>& all_outs,
231 synthesis_info& gi,
232 const std::vector<std::string>* unobs = nullptr);
233 SPOT_API twa_graph_ptr
235 const std::vector<std::string>& all_outs,
236 const std::vector<std::string>* unobs = nullptr);
238
247 SPOT_API twa_graph_ptr
248 solved_game_to_mealy(twa_graph_ptr arena, synthesis_info& gi);
249 SPOT_API twa_graph_ptr
250 solved_game_to_mealy(twa_graph_ptr arena);
251 SPOT_API twa_graph_ptr
253 SPOT_API twa_graph_ptr
254 solved_game_to_separated_mealy(twa_graph_ptr arena);
255 SPOT_API twa_graph_ptr
257 SPOT_API twa_graph_ptr
258 solved_game_to_split_mealy(twa_graph_ptr arena);
260
264 struct SPOT_API mealy_like
265 {
266 enum class realizability_code
267 {
268 UNREALIZABLE,
269 UNKNOWN,
270 REALIZABLE_REGULAR,
271 // strat is DTGBA and a glob_cond
272 REALIZABLE_DTGBA
273 };
274
275 realizability_code success;
276 twa_graph_ptr mealy_like;
277 bdd glob_cond;
278 };
279
293 SPOT_API std::pair<std::vector<formula>, std::vector<std::set<formula>>>
294 split_independent_formulas(formula f, const std::vector<std::string>& outs);
295
296 SPOT_API std::pair<std::vector<formula>, std::vector<std::set<formula>>>
297 split_independent_formulas(const std::string& f,
298 const std::vector<std::string>& outs);
300
315 SPOT_API mealy_like
317 const std::vector<std::string>& output_aps,
318 synthesis_info& gi, bool want_strategy = false);
319
325 SPOT_API bool
326 solve_game(twa_graph_ptr arena, synthesis_info& gi);
327
328 struct SPOT_API game_relabeling_map
329 {
330 relabeling_map env_map;
331 relabeling_map player_map;
332 };
333
346 SPOT_API game_relabeling_map
347 partitioned_game_relabel_here(twa_graph_ptr& arena,
348 bool relabel_env,
349 bool relabel_play,
350 bool split_env = false,
351 bool split_play = false,
352 unsigned max_letter = -1u,
353 unsigned max_letter_mult = -1u);
354
359 SPOT_API void
360 relabel_game_here(twa_graph_ptr& arena,
361 game_relabeling_map& rel_maps);
362
363}
Main class for temporal logic formula.
Definition formula.hh:850
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...
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...
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.
Definition automata.hh:26
Definition synthesis.hh:329
A struct that represents different types of mealy like objects.
Definition synthesis.hh:265
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.8