Browse Source

fixing treatment of zero-states in game solver causing problems in policy iteration and non-unique solutions

tempestpy_adaptions
dehnert 6 years ago
parent
commit
21aabc5b05
  1. 7
      src/storm/solver/StandardGameSolver.cpp

7
src/storm/solver/StandardGameSolver.cpp

@ -159,14 +159,16 @@ namespace storm {
targetStates = storm::utility::vector::filterGreaterZero(subB);
zeroStates = ~storm::utility::graph::performProbGreater0(submatrix.transpose(), storm::storage::BitVector(targetStates.size(), true), targetStates);
}
bool asEquationSystem = false;
if (this->linearEquationSolverFactory->getEquationProblemFormat(environmentOfSolver) == LinearEquationSolverProblemFormat::EquationSystem) {
submatrix.convertToEquationSystem();
asEquationSystem = true;
}
if (!this->hasUniqueSolution()) {
for (auto state : zeroStates) {
for (auto& element : submatrix.getRow(state)) {
if (element.getColumn() == state) {
element.setValue(storm::utility::one<ValueType>());
element.setValue(asEquationSystem ? storm::utility::one<ValueType>() : storm::utility::zero<ValueType>());
} else {
element.setValue(storm::utility::zero<ValueType>());
}
@ -177,7 +179,6 @@ namespace storm {
auto submatrixSolver = linearEquationSolverFactory->create(environmentOfSolver, std::move(submatrix));
if (this->lowerBound) {
submatrixSolver->setLowerBound(this->lowerBound.get());
}
if (this->upperBound) {
submatrixSolver->setUpperBound(this->upperBound.get());
@ -211,7 +212,7 @@ namespace storm {
for (auto state : zeroStates) {
for (auto& element : submatrix.getRow(state)) {
if (element.getColumn() == state) {
element.setValue(storm::utility::one<ValueType>());
element.setValue(asEquationSystem ? storm::utility::one<ValueType>() : storm::utility::zero<ValueType>());
} else {
element.setValue(storm::utility::zero<ValueType>());
}

Loading…
Cancel
Save