Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SymbolicGameSolver.h
Go to the documentation of this file.
1#pragma once
2
3#include <set>
4#include <vector>
5
7
11
12namespace storm {
13
14class Environment;
15
16namespace solver {
17
21template<storm::dd::DdType Type, typename ValueType = double>
23 public:
39 storm::dd::Bdd<Type> const& illegalPlayer2Mask, std::set<storm::expressions::Variable> const& rowMetaVariables,
40 std::set<storm::expressions::Variable> const& columnMetaVariables,
41 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> const& rowColumnMetaVariablePairs,
42 std::set<storm::expressions::Variable> const& player1Variables, std::set<storm::expressions::Variable> const& player2Variables);
43
44 virtual ~SymbolicGameSolver() = default;
45
62 boost::optional<storm::dd::Bdd<Type>> const& basePlayer1Strategy = boost::none,
63 boost::optional<storm::dd::Bdd<Type>> const& basePlayer2Strategy = boost::none);
64
65 // Setters that enable the generation of the players' strategies.
66 void setGeneratePlayer1Strategy(bool value);
67 void setGeneratePlayer2Strategy(bool value);
68 void setGeneratePlayersStrategies(bool value);
69
70 // Getters to retrieve the players' strategies. Only legal if they were generated.
73
74 protected:
75 // The matrix defining the coefficients of the linear equation system.
77
78 // A BDD characterizing all rows of the equation system.
80
81 // An ADD that can be used to compensate for the illegal choices of player 1.
83
84 // An ADD that can be used to compensate for the illegal choices of player 2.
86
87 // The row variables.
88 std::set<storm::expressions::Variable> rowMetaVariables;
89
90 // The column variables.
91 std::set<storm::expressions::Variable> columnMetaVariables;
92
93 // The pairs of meta variables used for renaming.
94 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> rowColumnMetaVariablePairs;
95
96 // The player 1 variables.
97 std::set<storm::expressions::Variable> player1Variables;
98
99 // The player 2 variables.
100 std::set<storm::expressions::Variable> player2Variables;
101
102 // A flag indicating whether a player 1 is to be generated.
104
105 // A player 1 strategy if one was generated.
106 boost::optional<storm::dd::Bdd<Type>> player1Strategy;
107
108 // A flag indicating whether a player 2 is to be generated.
110
111 // A player 1 strategy if one was generated.
112 boost::optional<storm::dd::Bdd<Type>> player2Strategy;
113};
114
115template<storm::dd::DdType Type, typename ValueType>
117 public:
118 virtual ~SymbolicGameSolverFactory() = default;
119
120 virtual std::unique_ptr<storm::solver::SymbolicGameSolver<Type, ValueType>> create(
121 storm::dd::Add<Type, ValueType> const& A, storm::dd::Bdd<Type> const& allRows, storm::dd::Bdd<Type> const& illegalPlayer1Mask,
122 storm::dd::Bdd<Type> const& illegalPlayer2Mask, std::set<storm::expressions::Variable> const& rowMetaVariables,
123 std::set<storm::expressions::Variable> const& columnMetaVariables,
124 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>> const& rowColumnMetaVariablePairs,
125 std::set<storm::expressions::Variable> const& player1Variables, std::set<storm::expressions::Variable> const& player2Variables) const;
126};
127
128} // namespace solver
129} // namespace storm
virtual std::unique_ptr< storm::solver::SymbolicGameSolver< Type, ValueType > > create(storm::dd::Add< Type, ValueType > const &A, storm::dd::Bdd< Type > const &allRows, storm::dd::Bdd< Type > const &illegalPlayer1Mask, storm::dd::Bdd< Type > const &illegalPlayer2Mask, std::set< storm::expressions::Variable > const &rowMetaVariables, std::set< storm::expressions::Variable > const &columnMetaVariables, std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &rowColumnMetaVariablePairs, std::set< storm::expressions::Variable > const &player1Variables, std::set< storm::expressions::Variable > const &player2Variables) const
virtual ~SymbolicGameSolver()=default
storm::dd::Add< Type, ValueType > illegalPlayer2Mask
storm::dd::Bdd< Type > const & getPlayer1Strategy() const
boost::optional< storm::dd::Bdd< Type > > player2Strategy
SymbolicGameSolver(storm::dd::Add< Type, ValueType > const &A, storm::dd::Bdd< Type > const &allRows, storm::dd::Bdd< Type > const &illegalPlayer1Mask, storm::dd::Bdd< Type > const &illegalPlayer2Mask, std::set< storm::expressions::Variable > const &rowMetaVariables, std::set< storm::expressions::Variable > const &columnMetaVariables, std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &rowColumnMetaVariablePairs, std::set< storm::expressions::Variable > const &player1Variables, std::set< storm::expressions::Variable > const &player2Variables)
Constructs a symbolic game solver with the given meta variable sets and pairs.
storm::dd::Add< Type, ValueType > illegalPlayer1Mask
std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > rowColumnMetaVariablePairs
virtual storm::dd::Add< Type, ValueType > solveGame(Environment const &env, OptimizationDirection player1Goal, OptimizationDirection player2Goal, storm::dd::Add< Type, ValueType > const &x, storm::dd::Add< Type, ValueType > const &b, boost::optional< storm::dd::Bdd< Type > > const &basePlayer1Strategy=boost::none, boost::optional< storm::dd::Bdd< Type > > const &basePlayer2Strategy=boost::none)
Solves the equation system defined by the game matrix.
storm::dd::Add< Type, ValueType > A
boost::optional< storm::dd::Bdd< Type > > player1Strategy
storm::dd::Bdd< Type > const & getPlayer2Strategy() const
std::set< storm::expressions::Variable > rowMetaVariables
std::set< storm::expressions::Variable > columnMetaVariables
std::set< storm::expressions::Variable > player2Variables
std::set< storm::expressions::Variable > player1Variables