move game.cc from misc/ to twaalgos/

* spot/misc/game.cc, spot/misc/game.hh: Move...
* spot/twaalgos/game.cc, spot/twaalgos/game.hh: ... here.
* bin/ltlsynt.cc, python/spot/impl.i, spot/misc/Makefile.am,
spot/twaalgos/Makefile.am: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2020-12-09 16:47:18 +01:00
parent 459088b887
commit 05449a42d3
6 changed files with 12 additions and 15 deletions

View file

@ -1,6 +1,6 @@
## -*- coding: utf-8 -*-
## Copyright (C) 2008-2018 Laboratoire de Recherche et Développement
## de l'Epita (LRDE).
## Copyright (C) 2008-2018, 2020 Laboratoire de Recherche et
## Développement de l'Epita (LRDE).
## Copyright (C) 2003-2005 Laboratoire d'Informatique de Paris 6
## (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
## Pierre et Marie Curie.
@ -50,6 +50,7 @@ twaalgos_HEADERS = \
dualize.hh \
emptiness.hh \
emptiness_stats.hh \
game.hh \
genem.hh \
gfguarantee.hh \
gv04.hh \
@ -127,6 +128,7 @@ libtwaalgos_la_SOURCES = \
isdet.cc \
isunamb.cc \
isweakscc.cc \
game.cc \
langmap.cc \
lbtt.cc \
ltl2taa.cc \

1011
spot/twaalgos/game.cc Normal file

File diff suppressed because it is too large Load diff

107
spot/twaalgos/game.hh Normal file
View file

@ -0,0 +1,107 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2017-2020 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <algorithm>
#include <memory>
#include <ostream>
#include <unordered_map>
#include <vector>
#include <bddx.h>
#include <spot/twa/twagraph.hh>
#include <spot/twaalgos/parity.hh>
namespace spot
{
/// \brief Transform an automaton into a parity game by propagating
/// players
///
/// This propagate state players, assuming the initial state belong
/// to \a first_player, and alternating players on each transitions.
/// If an odd cycle is detected, a runtime_exception is raised.
///
/// If \a complete0 is set, ensure that states of player 0 are
/// complete.
SPOT_API
void alternate_players(spot::twa_graph_ptr& arena,
bool first_player = false,
bool complete0 = true);
// false -> env, true -> player
typedef std::vector<bool> region_t;
// state idx -> global edge number
typedef std::vector<unsigned> strategy_t;
/// \brief solve a parity-game
///
/// The arena is a deterministic max odd parity automaton with a
/// "state-player" property.
///
/// This computes the winning strategy and winning region of this
/// game for player 1 using Zielonka's recursive algorithm.
/// \cite zielonka.98.tcs
///
/// Also includes some inspiration from Oink.
/// \cite vandijk.18.tacas
///
/// Returns the player winning in the initial state, and sets
/// the state-winner and strategy named properties.
SPOT_API
bool solve_parity_game(const twa_graph_ptr& arena);
/// \brief Print a max odd parity game using PG-solver syntax
SPOT_API
void pg_print(std::ostream& os, const const_twa_graph_ptr& arena);
/// \brief Highlight the edges of a strategy on an automaton.
///
/// Pass a negative color to not display the corresponding strategy.
SPOT_API
twa_graph_ptr highlight_strategy(twa_graph_ptr& arena,
int player0_color = 5,
int player1_color = 4);
/// \brief Set the owner for all the states.
SPOT_API
void set_state_players(twa_graph_ptr arena, std::vector<bool> owners);
SPOT_API
void set_state_players(twa_graph_ptr arena, std::vector<bool>* owners);
/// \brief Set the owner of a state.
SPOT_API
void set_state_player(twa_graph_ptr arena, unsigned state, unsigned owner);
/// \brief Get the owner of all the state.
SPOT_API
const std::vector<bool>& get_state_players(const_twa_graph_ptr arena);
/// \brief Get the owner of a state.
SPOT_API
unsigned get_state_player(const_twa_graph_ptr arena, unsigned state);
/// \brief Solve a reachability game.
SPOT_API
bool solve_reachability_game(twa_graph_ptr game);
}