diff --git a/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp b/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp index af83589ae..71f29a0c0 100644 --- a/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp +++ b/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp @@ -674,6 +674,49 @@ namespace storm { template void performIterationStep(storm::storage::SparseMatrix const& A, std::vector const& b) { + if (!decisionValueBlocks) { + performIterationStepUpdateDecisionValue(A, b); + } else { + assert(decisionValue == getPrimaryBound()); + auto xIt = x.rbegin(); + auto yIt = y.rbegin(); + auto groupStartIt = A.getRowGroupIndices().rbegin(); + uint64_t groupEnd = *groupStartIt; + ++groupStartIt; + for (auto groupStartIte = A.getRowGroupIndices().rend(); groupStartIt != groupStartIte; groupEnd = *(groupStartIt++), ++xIt, ++yIt) { + // Perform the iteration for the first row in the group + uint64_t row = *groupStartIt; + ValueType xBest, yBest; + multiplyRow(row, A, b[row], xBest, yBest); + ++row; + // Only do more work if there are still rows in this row group + if (row != groupEnd) { + ValueType xi, yi; + ValueType bestValue = xBest + yBest * getPrimaryBound(); + for (;row < groupEnd; ++row) { + // Get the multiplication results + multiplyRow(row, A, b[row], xi, yi); + ValueType currentValue = xi + yi * getPrimaryBound(); + // Check if the current row is better then the previously found one + if (better(currentValue, bestValue)) { + xBest = std::move(xi); + yBest = std::move(yi); + bestValue = std::move(currentValue); + } else if (currentValue == bestValue && yBest > yi) { + // If the value for this row is not strictly better, it might still be equal and have a better y value + xBest = std::move(xi); + yBest = std::move(yi); + } + } + } + *xIt = std::move(xBest); + *yIt = std::move(yBest); + } + } + } + + template + void performIterationStepUpdateDecisionValue(storm::storage::SparseMatrix const& A, std::vector const& b) { auto xIt = x.rbegin(); auto yIt = y.rbegin(); auto groupStartIt = A.getRowGroupIndices().rbegin();