Browse Source

fixed a few bugs

tempestpy_adaptions
dehnert 8 years ago
parent
commit
a2e29893f2
  1. 13
      src/storm/modelchecker/prctl/helper/HybridMdpPrctlHelper.cpp
  2. 1
      src/storm/modelchecker/prctl/helper/SparseDtmcPrctlHelper.cpp
  3. 2
      src/storm/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp
  4. 4
      src/storm/modelchecker/prctl/helper/SymbolicDtmcPrctlHelper.cpp
  5. 1
      src/storm/modelchecker/results/HybridQuantitativeCheckResult.cpp
  6. 14
      src/storm/solver/SymbolicMinMaxLinearEquationSolver.cpp

13
src/storm/modelchecker/prctl/helper/HybridMdpPrctlHelper.cpp

@ -243,16 +243,21 @@ namespace storm {
// Then compute the state reward vector to use in the computation.
storm::dd::Add<DdType, ValueType> subvector = rewardModel.getTotalRewardVector(maybeStatesAdd, submatrix, model.getColumnVariables());
if (!rewardModel.hasStateActionRewards() && !rewardModel.hasTransitionRewards()) {
// If the reward model neither has state-action nor transition rewards, we need to multiply
// it with the legal nondetermism encodings in each state.
subvector *= transitionMatrixBdd.existsAbstract(model.getColumnVariables()).template toAdd<ValueType>();
}
// Since we are cutting away target and infinity states, we need to account for this by giving
// choices the value infinity that have some successor contained in the infinity states.
storm::dd::Bdd<DdType> choicesWithInfinitySuccessor = (maybeStates && transitionMatrixBdd && infinityStates.swapVariables(model.getRowColumnMetaVariablePairs())).existsAbstract(model.getColumnVariables());
subvector = choicesWithInfinitySuccessor.ite(model.getManager().template getInfinity<ValueType>(), subvector);
// Before cutting the non-maybe columns, we need to compute the sizes of the row groups.
storm::dd::Add<DdType, uint_fast64_t> stateActionAdd = (submatrix.notZero().existsAbstract(model.getColumnVariables()) || subvector.notZero()).template toAdd<uint_fast64_t>();
storm::dd::Add<DdType, uint_fast64_t> stateActionAdd = submatrix.notZero().existsAbstract(model.getColumnVariables()).template toAdd<uint_fast64_t>();
std::vector<uint_fast64_t> rowGroupSizes = stateActionAdd.sumAbstract(model.getNondeterminismVariables()).toVector(odd);
// Finally cut away all columns targeting non-maybe states.
submatrix *= maybeStatesAdd.swapVariables(model.getRowColumnMetaVariablePairs());
@ -261,7 +266,7 @@ namespace storm {
// Translate the symbolic matrix/vector to their explicit representations.
std::pair<storm::storage::SparseMatrix<ValueType>, std::vector<ValueType>> explicitRepresentation = submatrix.toMatrixVector(subvector, std::move(rowGroupSizes), model.getNondeterminismVariables(), odd, odd);
// Now solve the resulting equation system.
std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>> solver = linearEquationSolverFactory.create(std::move(explicitRepresentation.first));
solver->solveEquations(dir, x, explicitRepresentation.second);

1
src/storm/modelchecker/prctl/helper/SparseDtmcPrctlHelper.cpp

@ -88,7 +88,6 @@ namespace storm {
storm::utility::vector::selectVectorValues(x, maybeStates, resultHint.get());
}
// Prepare the right-hand side of the equation system. For entry i this corresponds to
// the accumulated probability of going from state i to some 'yes' state.
std::vector<ValueType> b = transitionMatrix.getConstrainedRowSumVector(maybeStates, statesWithProbability1);

2
src/storm/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp

@ -330,7 +330,7 @@ namespace storm {
}
}
}
// Create vector for results for maybe states.
std::vector<ValueType> x(maybeStates.getNumberOfSetBits(), storm::utility::zero<ValueType>());

4
src/storm/modelchecker/prctl/helper/SymbolicDtmcPrctlHelper.cpp

@ -166,13 +166,13 @@ namespace storm {
storm::dd::Add<DdType, ValueType> submatrix = transitionMatrix * maybeStatesAdd;
// Then compute the state reward vector to use in the computation.
storm::dd::Add<DdType, ValueType> subvector = rewardModel.getTotalRewardVector(submatrix, model.getColumnVariables());
storm::dd::Add<DdType, ValueType> subvector = rewardModel.getTotalRewardVector(maybeStatesAdd, submatrix, model.getColumnVariables());
// Finally cut away all columns targeting non-maybe states and convert the matrix into the matrix needed
// for solving the equation system (i.e. compute (I-A)).
submatrix *= maybeStatesAdd.swapVariables(model.getRowColumnMetaVariablePairs());
submatrix = (model.getRowColumnIdentity() * maybeStatesAdd) - submatrix;
// Solve the equation system.
std::unique_ptr<storm::solver::SymbolicLinearEquationSolver<DdType, ValueType>> solver = linearEquationSolverFactory.create(submatrix, maybeStates, model.getRowVariables(), model.getColumnVariables(), model.getRowColumnMetaVariablePairs());
storm::dd::Add<DdType, ValueType> result = solver->solveEquations(model.getManager().getConstant(0.0), subvector);

1
src/storm/modelchecker/results/HybridQuantitativeCheckResult.cpp

@ -106,6 +106,7 @@ namespace storm {
if (!this->symbolicStates.isZero()) {
if (this->symbolicValues.isZero()) {
out << "0";
first = false;
} else {
for (auto valuationValuePair : this->symbolicValues) {
if (!first) {

14
src/storm/solver/SymbolicMinMaxLinearEquationSolver.cpp

@ -54,15 +54,15 @@ namespace storm {
xCopy = tmp;
if (converged) {
STORM_LOG_TRACE("Iterative solver converged in " << iterations << " iterations.");
} else {
STORM_LOG_WARN("Iterative solver did not converge in " << iterations << " iterstions.");
}
++iterations;
}
if (converged) {
STORM_LOG_TRACE("Iterative solver converged in " << iterations << " iterations.");
} else {
STORM_LOG_WARN("Iterative solver did not converge in " << iterations << " iterstions.");
}
return xCopy;
}

Loading…
Cancel
Save