16template<storm::dd::DdType Type,
typename ValueType>
39template<storm::dd::DdType Type,
typename ValueType>
46 "Switching game method to Value iteration since the selected method is not supported by this solver.");
53 uint_fast64_t iterations = 0;
54 bool converged =
false;
58 if (basePlayer1Strategy) {
64 boost::optional<storm::dd::Add<Type, ValueType>> previousPlayer2Values;
66 if (basePlayer2Strategy && player2Goal == storm::OptimizationDirection::Maximize) {
71 previousPlayer2Values = (
player2Strategy.get().
template toAdd<ValueType>() *
72 (this->
A.multiplyMatrix(x.
swapVariables(this->rowColumnMetaVariablePairs), this->columnMetaVariables) + b))
76 previousPlayer2Values =
A.getDdManager().template getAddZero<ValueType>();
87 if (player2Goal == storm::OptimizationDirection::Maximize) {
94 previousPlayer2Values = newValues;
109 if (player1Goal == storm::OptimizationDirection::Maximize) {
139 }
while (!converged && iterations < maxIter);
140 STORM_LOG_INFO(
"Numerically solving the game took " << iterations <<
" iterations.");
145template<storm::dd::DdType Type,
typename ValueType>
150template<storm::dd::DdType Type,
typename ValueType>
155template<storm::dd::DdType Type,
typename ValueType>
161template<storm::dd::DdType Type,
typename ValueType>
163 STORM_LOG_THROW(
player1Strategy, storm::exceptions::IllegalFunctionCallException,
"Cannot retrieve player 1 strategy because none was generated.");
167template<storm::dd::DdType Type,
typename ValueType>
169 STORM_LOG_THROW(
player2Strategy, storm::exceptions::IllegalFunctionCallException,
"Cannot retrieve player 2 strategy because none was generated.");
173template<storm::dd::DdType Type,
typename ValueType>
176 storm::dd::Bdd<Type> const& illegalPlayer2Mask, std::set<storm::expressions::Variable>
const& rowMetaVariables,
177 std::set<storm::expressions::Variable>
const& columnMetaVariables,
178 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& rowColumnMetaVariablePairs,
179 std::set<storm::expressions::Variable>
const& player1Variables, std::set<storm::expressions::Variable>
const& player2Variables)
const {
180 return std::unique_ptr<storm::solver::SymbolicGameSolver<Type, ValueType>>(
182 rowColumnMetaVariablePairs, player1Variables, player2Variables));
SolverEnvironment & solver()
storm::RationalNumber const & getPrecision() const
uint64_t const & getMaximalNumberOfIterations() const
bool const & getRelativeTerminationCriterion() const
storm::solver::GameMethod const & getMethod() const
GameSolverEnvironment & game()
Add< LibraryType, ValueType > swapVariables(std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &metaVariablePairs) const
Swaps the given pairs of meta variables in the ADD.
Bdd< LibraryType > greater(Add< LibraryType, ValueType > const &other) const
Retrieves the function that maps all evaluations to one whose function value in the first ADD are gre...
Add< LibraryType, ValueType > maxAbstract(std::set< storm::expressions::Variable > const &metaVariables) const
Max-abstracts from the given meta variables.
Bdd< LibraryType > minAbstractRepresentative(std::set< storm::expressions::Variable > const &metaVariables) const
Similar to minAbstract, but does not abstract from the variables but rather picks a valuation of each...
Add< LibraryType, ValueType > minAbstract(std::set< storm::expressions::Variable > const &metaVariables) const
Min-abstracts from the given meta variables.
bool equalModuloPrecision(Add< LibraryType, ValueType > const &other, ValueType const &precision, bool relative=true) const
Checks whether the current and the given ADD represent the same function modulo some given precision.
Bdd< LibraryType > maxAbstractRepresentative(std::set< storm::expressions::Variable > const &metaVariables) const
Similar to maxAbstract, but does not abstract from the variables but rather picks a valuation of each...
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
An interface that represents an abstract symbolic game solver.
bool generatePlayer1Strategy
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
storm::dd::Bdd< Type > allRows
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.
void setGeneratePlayer1Strategy(bool value)
void setGeneratePlayersStrategies(bool value)
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
void setGeneratePlayer2Strategy(bool value)
std::set< storm::expressions::Variable > columnMetaVariables
std::set< storm::expressions::Variable > player2Variables
bool generatePlayer2Strategy
std::set< storm::expressions::Variable > player1Variables
#define STORM_LOG_INFO(message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
TargetType convertNumber(SourceType const &number)