spot 2.16
Loading...
Searching...
No Matches
game.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 <algorithm>
22#include <memory>
23#include <ostream>
24#include <unordered_map>
25#include <vector>
26#include <optional>
27
28#include <bddx.h>
29#include <spot/misc/optionmap.hh>
30#include <spot/twa/twagraph.hh>
31#include <spot/twaalgos/parity.hh>
32
33namespace spot
34{
37
48 SPOT_API
50 bool first_player = false,
51 bool complete0 = true);
52
53
54 // false -> env, true -> player
57 typedef std::vector<bool> region_t;
58 // state idx -> global edge number
61 typedef std::vector<unsigned> strategy_t;
62
63
105 SPOT_API
107 bool solve_globally = false);
108
123 SPOT_API
125
138 SPOT_API bool
140
141
156 SPOT_API
157 std::ostream& print_pg(std::ostream& os, const const_twa_graph_ptr& arena);
158
159 SPOT_DEPRECATED("use print_pg() instead")
160 SPOT_API
161 void pg_print(std::ostream& os, const const_twa_graph_ptr& arena);
163
168 SPOT_API
170 int player0_color = 5,
171 int player1_color = 4);
172
176 SPOT_API
177 void set_state_players(twa_graph_ptr& arena, const region_t& owners);
178 SPOT_API
181
184 SPOT_API
185 void set_state_player(twa_graph_ptr& arena, unsigned state, bool owner);
186
189 SPOT_API
190 bool get_state_player(const const_twa_graph_ptr& arena, unsigned state);
191
195 SPOT_API
197 SPOT_API
200
204 SPOT_API
206 SPOT_API
207 void set_strategy(twa_graph_ptr& arena, const strategy_t& strat);
208 SPOT_API
209 void set_strategy(twa_graph_ptr& arena, strategy_t&& strat);
211
214 SPOT_API
215 void set_synthesis_outputs(const twa_graph_ptr& arena, const bdd& outs);
216
219 SPOT_API
221
223 SPOT_API
224 std::vector<std::string>
226
230 SPOT_API
231 void set_state_winners(twa_graph_ptr& arena, const region_t& winners);
232 SPOT_API
233 void set_state_winners(twa_graph_ptr& arena, region_t&& winners);
235
238 SPOT_API
239 void set_state_winner(twa_graph_ptr& arena, unsigned state, bool winner);
240
243 SPOT_API
244 bool get_state_winner(const const_twa_graph_ptr& arena, unsigned state);
245
249 SPOT_API
251#ifndef SWIG
252 SPOT_API
254#endif
256}
Abstract class for states.
Definition twa.hh:49
const region_t & get_state_winners(const const_twa_graph_ptr &arena)
Get the winner of all states.
void set_state_winner(twa_graph_ptr &arena, unsigned state, bool winner)
Set the winner of a state.
bool get_state_winner(const const_twa_graph_ptr &arena, unsigned state)
Get the winner of a state.
std::vector< bool > region_t
Winning region: false = player 0 (env), true = player 1.
Definition game.hh:57
bool solve_parity_game(const twa_graph_ptr &arena, bool solve_globally=false)
Solve a parity game.
void pg_print(std::ostream &os, const const_twa_graph_ptr &arena)
Print a parity game using PG-solver syntax.
void set_strategy(twa_graph_ptr &arena, const strategy_t &strat)
Get or set the strategy.
std::vector< unsigned > strategy_t
Strategy: maps each state index to the chosen global edge number.
Definition game.hh:61
void set_state_winners(twa_graph_ptr &arena, const region_t &winners)
Set the winner for all the states.
bool solve_safety_game(const twa_graph_ptr &game)
Solve a safety game.
bdd get_synthesis_outputs(const const_twa_graph_ptr &arena)
Get all synthesis outputs as a conjunction.
bool solve_game(const twa_graph_ptr &arena)
Generic interface for game solving.
const strategy_t & get_strategy(const const_twa_graph_ptr &arena)
Get or set the strategy.
twa_graph_ptr highlight_strategy(twa_graph_ptr &arena, int player0_color=5, int player1_color=4)
Highlight the edges of a strategy on an automaton.
std::ostream & print_pg(std::ostream &os, const const_twa_graph_ptr &arena)
Print a parity game using PG-solver syntax.
const region_t & get_state_players(const const_twa_graph_ptr &arena)
Get the owner of all states.
void set_synthesis_outputs(const twa_graph_ptr &arena, const bdd &outs)
Set all synthesis outputs as a conjunction.
bool get_state_player(const const_twa_graph_ptr &arena, unsigned state)
Get the owner of a state.
void set_state_player(twa_graph_ptr &arena, unsigned state, bool owner)
Set the owner of a state.
void alternate_players(spot::twa_graph_ptr &arena, bool first_player=false, bool complete0=true)
Transform an automaton into a parity game by propagating players.
void set_state_players(twa_graph_ptr &arena, const region_t &owners)
Set the owner for all the states.
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:41
Definition automata.hh:26
std::vector< std::string > get_synthesis_output_aps(const const_twa_graph_ptr &arena)
Get the vector with the names of the output propositions.

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