Browse Source

Fixed issue in qpower

tempestpy_adaptions
TimQu 7 years ago
parent
commit
7eab8589bd
  1. 6
      src/storm/solver/NativeLinearEquationSolver.cpp

6
src/storm/solver/NativeLinearEquationSolver.cpp

@ -606,7 +606,7 @@ namespace storm {
bool terminate = false; bool terminate = false;
uint64_t minIndex(0), maxIndex(0); uint64_t minIndex(0), maxIndex(0);
ValueType minValueBound, maxValueBound; ValueType minValueBound, maxValueBound;
bool hasMinValueBound, hasMaxValueBound;
bool hasMinValueBound(false), hasMaxValueBound(false);
// Prepare initial bounds for the solution (if given) // Prepare initial bounds for the solution (if given)
if (this->hasLowerBound()) { if (this->hasLowerBound()) {
minValueBound = this->getLowerBound(true); minValueBound = this->getLowerBound(true);
@ -688,9 +688,11 @@ namespace storm {
} }
if (!hasMinValueBound || minValueBoundCandidate > minValueBound) { if (!hasMinValueBound || minValueBoundCandidate > minValueBound) {
minValueBound = minValueBoundCandidate; minValueBound = minValueBoundCandidate;
hasMinValueBound = true;
} }
if (!hasMaxValueBound || maxValueBoundCandidate < maxValueBound) { if (!hasMaxValueBound || maxValueBoundCandidate < maxValueBound) {
maxValueBound = maxValueBoundCandidate; maxValueBound = maxValueBoundCandidate;
hasMaxValueBound = true;
} }
absoluteError = stayProb * (maxValueBound - minValueBound); absoluteError = stayProb * (maxValueBound - minValueBound);
if (absoluteError <= maxAllowedError) { if (absoluteError <= maxAllowedError) {
@ -724,6 +726,7 @@ namespace storm {
} }
// Finally set up the solution vector // Finally set up the solution vector
ValueType meanBound = (maxValueBound + minValueBound) / storm::utility::convertNumber<ValueType>(2.0); ValueType meanBound = (maxValueBound + minValueBound) / storm::utility::convertNumber<ValueType>(2.0);
storm::utility::vector::applyPointwise(*stepBoundedX, *stepBoundedStayProbs, x, [&meanBound] (ValueType const& v, ValueType const& p) { return v + p * meanBound; }); storm::utility::vector::applyPointwise(*stepBoundedX, *stepBoundedStayProbs, x, [&meanBound] (ValueType const& v, ValueType const& p) { return v + p * meanBound; });
@ -733,6 +736,7 @@ namespace storm {
} }
this->logIterations(converged, terminate, iterations); this->logIterations(converged, terminate, iterations);
STORM_LOG_WARN_COND(hasMinValueBound && hasMaxValueBound, "Could not compute lower or upper bound within the given number of iterations.");
STORM_LOG_INFO("Quick Power Iteration terminated with lower value bound " << minValueBound << " and upper value bound " << maxValueBound << "."); STORM_LOG_INFO("Quick Power Iteration terminated with lower value bound " << minValueBound << " and upper value bound " << maxValueBound << ".");
return converged; return converged;

Loading…
Cancel
Save