11template<storm::dd::DdType DdType,
typename ValueType>
16template<storm::dd::DdType DdType,
typename ValueType>
19 std::set<storm::expressions::Variable>
const& columnMetaVariables,
20 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& rowColumnMetaVariablePairs)
25template<storm::dd::DdType DdType,
typename ValueType>
28 std::set<storm::expressions::Variable>
const& columnMetaVariables,
29 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& rowColumnMetaVariablePairs)
34template<storm::dd::DdType DdType,
typename ValueType>
42 diagonal &= this->getAllRows();
43 diagonal = diagonal.
swapVariables(this->oldNewMetaVariablePairs);
55 uint64_t iterations = 0;
61 matrix *= inverseLoopProbabilities;
63 solution *= inverseLoopProbabilities;
66 matrix = diagonal.
ite(ddManager.template getAddZero<ValueType>(), matrix);
69 solution += (matrix * solution.
swapVariables(newRowColumnMetaVariablePairs)).sumAbstract(newColumnVariables);
76 STORM_LOG_TRACE(
"Completed iteration " << iterations <<
" of elimination process.");
79 STORM_LOG_INFO(
"Elimination completed in " << iterations <<
" iterations.");
84template<storm::dd::DdType DdType,
typename ValueType>
89template<storm::dd::DdType DdType,
typename ValueType>
92 std::set<storm::expressions::Variable>
const& columnMetaVariables,
93 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& rowColumnMetaVariablePairs) {
97 for (
auto const& metaVariablePair : this->rowColumnMetaVariablePairs) {
98 auto rowVariable = metaVariablePair.first;
102 std::vector<storm::expressions::Variable> newMetaVariables;
105 uint64_t counter = 0;
106 std::string newMetaVariableName =
"tmp_" + metaVariable.
getName();
107 while (ddManager.
hasMetaVariable(newMetaVariableName + std::to_string(counter))) {
111 newMetaVariables = ddManager.
cloneVariable(metaVariablePair.first, newMetaVariableName + std::to_string(counter), 3);
113 newRowVariables.insert(newMetaVariables[0]);
114 newColumnVariables.insert(newMetaVariables[1]);
115 helperVariables.insert(newMetaVariables[2]);
117 newRowColumnMetaVariablePairs.emplace_back(newMetaVariables[0], newMetaVariables[1]);
118 columnHelperMetaVariablePairs.emplace_back(newMetaVariables[1], newMetaVariables[2]);
120 rowRowMetaVariablePairs.emplace_back(metaVariablePair.first, newMetaVariables[0]);
121 columnColumnMetaVariablePairs.emplace_back(metaVariablePair.second, newMetaVariables[1]);
123 oldToNewMapping.emplace_back(std::move(newMetaVariables));
126 oldNewMetaVariablePairs = rowRowMetaVariablePairs;
127 for (
auto const& entry : columnColumnMetaVariablePairs) {
128 oldNewMetaVariablePairs.emplace_back(entry.first, entry.second);
131 shiftMetaVariablePairs = newRowColumnMetaVariablePairs;
132 for (
auto const& entry : columnHelperMetaVariablePairs) {
133 shiftMetaVariablePairs.emplace_back(entry.first, entry.second);
137template<storm::dd::DdType DdType,
typename ValueType>
140 std::set<storm::expressions::Variable>
const& columnMetaVariables,
141 std::vector<std::pair<storm::expressions::Variable, storm::expressions::Variable>>
const& rowColumnMetaVariablePairs) {
146 this->createInternalData(this->getAllRows(), this->rowMetaVariables, this->columnMetaVariables, this->rowColumnMetaVariablePairs);
149template<storm::dd::DdType DdType,
typename ValueType>
152 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)