13template<storm::dd::DdType DdType,
typename ValueType>
18template<storm::dd::DdType DdType,
typename ValueType>
21 std::set<storm::expressions::Variable>
const& columnMetaVariables,
22 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& rowColumnMetaVariablePairs)
27template<storm::dd::DdType DdType,
typename ValueType>
30 std::set<storm::expressions::Variable>
const& columnMetaVariables,
31 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& rowColumnMetaVariablePairs)
36template<storm::dd::DdType DdType,
typename ValueType>
44 diagonal &= this->getAllRows();
45 diagonal = diagonal.
swapVariables(this->oldNewMetaVariablePairs);
57 uint64_t iterations = 0;
63 matrix *= inverseLoopProbabilities;
65 solution *= inverseLoopProbabilities;
68 matrix = diagonal.
ite(ddManager.template getAddZero<ValueType>(), matrix);
71 solution += (matrix * solution.
swapVariables(newRowColumnMetaVariablePairs)).sumAbstract(newColumnVariables);
78 STORM_LOG_TRACE(
"Completed iteration " << iterations <<
" of elimination process.");
81 STORM_LOG_INFO(
"Elimination completed in " << iterations <<
" iterations.");
86template<storm::dd::DdType DdType,
typename ValueType>
91template<storm::dd::DdType DdType,
typename ValueType>
94 std::set<storm::expressions::Variable>
const& columnMetaVariables,
95 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& rowColumnMetaVariablePairs) {
99 for (
auto const& metaVariablePair : this->rowColumnMetaVariablePairs) {
100 auto rowVariable = metaVariablePair.first;
104 std::vector<storm::expressions::Variable> newMetaVariables;
107 uint64_t counter = 0;
108 std::string newMetaVariableName =
"tmp_" + metaVariable.
getName();
109 while (ddManager.
hasMetaVariable(newMetaVariableName + std::to_string(counter))) {
113 newMetaVariables = ddManager.
cloneVariable(metaVariablePair.first, newMetaVariableName + std::to_string(counter), 3);
115 newRowVariables.insert(newMetaVariables[0]);
116 newColumnVariables.insert(newMetaVariables[1]);
117 helperVariables.insert(newMetaVariables[2]);
119 newRowColumnMetaVariablePairs.emplace_back(newMetaVariables[0], newMetaVariables[1]);
120 columnHelperMetaVariablePairs.emplace_back(newMetaVariables[1], newMetaVariables[2]);
122 rowRowMetaVariablePairs.emplace_back(metaVariablePair.first, newMetaVariables[0]);
123 columnColumnMetaVariablePairs.emplace_back(metaVariablePair.second, newMetaVariables[1]);
125 oldToNewMapping.emplace_back(std::move(newMetaVariables));
128 oldNewMetaVariablePairs = rowRowMetaVariablePairs;
129 for (
auto const& entry : columnColumnMetaVariablePairs) {
130 oldNewMetaVariablePairs.emplace_back(entry.first, entry.second);
133 shiftMetaVariablePairs = newRowColumnMetaVariablePairs;
134 for (
auto const& entry : columnHelperMetaVariablePairs) {
135 shiftMetaVariablePairs.emplace_back(entry.first, entry.second);
139template<storm::dd::DdType DdType,
typename ValueType>
142 std::set<storm::expressions::Variable>
const& columnMetaVariables,
143 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& rowColumnMetaVariablePairs) {
148 this->createInternalData(this->getAllRows(), this->rowMetaVariables, this->columnMetaVariables, this->rowColumnMetaVariablePairs);
151template<storm::dd::DdType DdType,
typename ValueType>
154 return std::make_unique<SymbolicEliminationLinearEquationSolver<DdType, ValueType>>();
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.
bool isZero() const
Retrieves whether this ADD represents the constant zero function.
Add< LibraryType, ValueType > multiplyMatrix(Add< LibraryType, ValueType > const &otherMatrix, std::set< storm::expressions::Variable > const &summationMetaVariables) const
Multiplies the current ADD (representing a matrix) with the given matrix by summing over the given me...
Add< LibraryType, ValueType > permuteVariables(std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &metaVariablePairs) const
Permutes the given pairs of meta variables in the ADD.
Bdd< LibraryType > swapVariables(std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &metaVariablePairs) const
Swaps the given pairs of meta variables in the BDD.
Bdd< LibraryType > ite(Bdd< LibraryType > const &thenBdd, Bdd< LibraryType > const &elseBdd) const
Performs an if-then-else with the given operands, i.e.
DdManager< LibraryType > & getDdManager() const
Retrieves the manager that is responsible for this DD.
storm::expressions::Variable getMetaVariable(std::string const &variableName) const
Retrieves the given meta variable by name.
bool hasMetaVariable(std::string const &variableName) const
Retrieves whether the given meta variable name is already in use.
std::vector< storm::expressions::Variable > cloneVariable(storm::expressions::Variable const &variable, std::string const &newVariableName, boost::optional< uint64_t > const &numberOfLayers=boost::none)
Clones the given meta variable and optionally changes the number of layers of the variable.
virtual std::unique_ptr< storm::solver::SymbolicLinearEquationSolver< DdType, ValueType > > create(Environment const &env) const override
virtual void setData(storm::dd::Bdd< DdType > const &allRows, 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) override
virtual LinearEquationSolverProblemFormat getEquationProblemFormat(Environment const &env) const override
Retrieves the format in which this solver expects to solve equations.
SymbolicEliminationLinearEquationSolver()
Constructs a symbolic linear equation solver.
virtual storm::dd::Add< DdType, ValueType > solveEquations(Environment const &env, storm::dd::Add< DdType, ValueType > const &x, storm::dd::Add< DdType, ValueType > const &b) const override
Solves the equation system A*x = b.
storm::dd::Bdd< DdType > allRows
An interface that represents an abstract symbolic linear equation solver.
virtual void setData(storm::dd::Bdd< DdType > const &allRows, 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 > columnMetaVariables
std::set< storm::expressions::Variable > rowMetaVariables
std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > rowColumnMetaVariablePairs
void setMatrix(storm::dd::Add< DdType, ValueType > const &newA)
#define STORM_LOG_INFO(message)
#define STORM_LOG_TRACE(message)
LinearEquationSolverProblemFormat
storm::dd::Bdd< Type > getRowColumnDiagonal(storm::dd::DdManager< Type > const &ddManager, std::vector< std::pair< storm::expressions::Variable, storm::expressions::Variable > > const &rowColumnMetaVariablePairs)