LydiaSyft
DfaGameSynthesizer.h
1 #ifndef DFA_GAME_SYNTHESIZER_H
2 #define DFA_GAME_SYNTHESIZER_H
3 
4 #include "Quantification.h"
5 #include "automata/SymbolicStateDfa.h"
6 #include "Synthesizer.h"
7 #include "Transducer.h"
8 
9 namespace Syft {
10 
11 
15  class DfaGameSynthesizer : public Synthesizer<SymbolicStateDfa> {
16  protected:
20  std::shared_ptr<VarMgr> var_mgr_;
32  std::vector<int> initial_vector_;
36  std::vector<CUDD::BDD> transition_vector_;
40  std::unique_ptr<Quantification> quantify_independent_variables_;
44  std::unique_ptr<Quantification> quantify_non_state_variables_;
45 
53  CUDD::BDD preimage(const CUDD::BDD &winning_states) const;
54 
62  CUDD::BDD project_into_states(const CUDD::BDD &winning_moves) const;
63 
70  bool includes_initial_state(const CUDD::BDD &winning_states) const;
71 
72  public:
73 
83  DfaGameSynthesizer(SymbolicStateDfa spec, Player starting_player, Player protagonist_player);
84 
85 
91  virtual SynthesisResult run()
92  const override = 0;
93 
94 
100  std::unique_ptr<Transducer> AbstractSingleStrategy(const SynthesisResult &result) const;
101 
102  private:
103  std::unique_ptr<Transducer> abstract_single_strategy(const CUDD::BDD &winning_moves,
104  const std::shared_ptr<VarMgr> &var_mgr,
105  const std::vector<int> &initial_vector,
106  const std::vector<CUDD::BDD> &transition_vector,
107  Player starting_player) const;
108 
109  std::unordered_map<int, CUDD::BDD>
110  synthesize_strategy(const CUDD::BDD &winning_moves, const std::shared_ptr<VarMgr> &var_mgr) const;
111  };
112 
113 }
114 
115 #endif // DFA_GAME_SYNTHESIZER_H
A synthesizer for a game whose arena is a symbolic-state DFA.
Definition: DfaGameSynthesizer.h:15
std::unique_ptr< Quantification > quantify_independent_variables_
Quantification on the variables that the protagonist player does not depend on.
Definition: DfaGameSynthesizer.h:40
bool includes_initial_state(const CUDD::BDD &winning_states) const
Check whether the initial state is a winning state.
Definition: DfaGameSynthesizer.cpp:65
Player starting_player_
The player that moves first each turn.
Definition: DfaGameSynthesizer.h:24
virtual SynthesisResult run() const override=0
Synthesis for the game.
std::unique_ptr< Quantification > quantify_non_state_variables_
Quantification on non-state variables.
Definition: DfaGameSynthesizer.h:44
DfaGameSynthesizer(SymbolicStateDfa spec, Player starting_player, Player protagonist_player)
Construct a synthesizer for a given DFA game.
Definition: DfaGameSynthesizer.cpp:6
std::unique_ptr< Transducer > AbstractSingleStrategy(const SynthesisResult &result) const
Abstract a winning strategy for the game.
Definition: DfaGameSynthesizer.cpp:128
std::shared_ptr< VarMgr > var_mgr_
Variable manager.
Definition: DfaGameSynthesizer.h:20
std::vector< CUDD::BDD > transition_vector_
The transition function of the game arena.
Definition: DfaGameSynthesizer.h:36
std::vector< int > initial_vector_
The initial state of the game arena.
Definition: DfaGameSynthesizer.h:32
Player protagonist_player_
The player for which we aim to find the winning strategy.
Definition: DfaGameSynthesizer.h:28
CUDD::BDD preimage(const CUDD::BDD &winning_states) const
Compute a set of winning moves.
Definition: DfaGameSynthesizer.cpp:50
CUDD::BDD project_into_states(const CUDD::BDD &winning_moves) const
Project a set of winning moves to a set of winning states.
Definition: DfaGameSynthesizer.cpp:60
A DFA with symbolic states and transitions.
Definition: SymbolicStateDfa.h:18
Abstract class for synthesizers.
Definition: Synthesizer.h:41
Definition: Synthesizer.h:16