From 116bd58b226ded90daf89cdcd7f472a289a46d6a Mon Sep 17 00:00:00 2001
From: TimQu <tim.quatmann@cs.rwth-aachen.de>
Date: Tue, 2 Jan 2018 17:22:30 +0100
Subject: [PATCH] log improvements + minor bugfixes for qvi

---
 src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp b/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp
index 3f214176e..dfda44387 100644
--- a/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp
+++ b/src/storm/solver/IterativeMinMaxLinearEquationSolver.cpp
@@ -257,6 +257,7 @@ namespace storm {
                 if (!this->hasUniqueSolution()) {
                     requirements.requireNoEndComponents();
                 }
+                requirements.requireBounds();
             } else {
                 STORM_LOG_THROW(false, storm::exceptions::InvalidEnvironmentException, "Unsupported technique for iterative MinMax linear equation solver.");
             }
@@ -686,6 +687,7 @@ namespace storm {
             // If minimizing, the primary bound is the lower bound; if maximizing, the primary bound is the upper bound.
             ValueType& primaryBound = minimize(dir) ? currentLowerBound : currentUpperBound;
             bool& hasPrimaryBound = minimize(dir) ? hasCurrentLowerBound : hasCurrentUpperBound;
+            STORM_LOG_INFO_COND(!hasPrimaryBound, "Initial bound on the result is " << primaryBound);
             
             // Proceed with the iterations as long as the method did not converge or reach the maximum number of iterations.
             SolverStatus status = SolverStatus::InProgress;
@@ -733,7 +735,7 @@ namespace storm {
                             ValueType bestValue = yTmp.front();
                             for (uint64_t choice = 1; choice < xTmp.size(); ++choice) {
                                 ValueType const& value = yTmp[choice];
-                                if (betterEqual(value, bestValue) && (value != bestValue || better(xTmp[choice], xTmp[bestChoice]))) {
+                                if (value >= bestValue && (value != bestValue || better(xTmp[choice], xTmp[bestChoice]))) {
                                     bestValue = std::move(value);
                                     bestChoice = choice;
                                 }
@@ -749,7 +751,7 @@ namespace storm {
                                 if (deltaY > storm::utility::zero<ValueType>()) {
                                    ValueType newDecisionValue = (xTmp[choice] - *xIt) / deltaY;
                                     if (!hasDecisionValue || better(newDecisionValue, decisionValue)) {
-             //                           std::cout << "Updating decision value to " << newDecisionValue << ", where deltaX = " << xTmp[choice] << " - " << *xIt << " = " << (xTmp[choice] - *xIt) << " and deltaY= " << *yIt << " - " << yTmp[choice] << " = " << deltaY << "." << std::endl;
+                                   //     std::cout << "Updating decision value in Iteration " << iterations << " to " << newDecisionValue << ", where deltaX = " << xTmp[choice] << " - " << *xIt << " = " << (xTmp[choice] - *xIt) << " and deltaY= " << *yIt << " - " << yTmp[choice] << " = " << deltaY << "." << std::endl;
                                         decisionValue = std::move(newDecisionValue);
                                         hasDecisionValue = true;
                                     }