Browse Source

Fix extremal value computation

tempestpy_adaptions
Jip Spel 4 years ago
parent
commit
8d17a0362d
  1. 18
      src/storm-pars/modelchecker/region/SparseParameterLiftingModelChecker.cpp

18
src/storm-pars/modelchecker/region/SparseParameterLiftingModelChecker.cpp

@ -247,11 +247,8 @@ namespace storm {
storm::utility::Stopwatch boundsWatch(false); storm::utility::Stopwatch boundsWatch(false);
auto numberOfPLACallsBounds = 0; auto numberOfPLACallsBounds = 0;
ConstantType initBound; ConstantType initBound;
if (minimize) {
initBound = storm::utility::zero<ConstantType>(); initBound = storm::utility::zero<ConstantType>();
} else {
initBound = storm::utility::one<ConstantType>();
}
bool first = true;
if (useMonotonicity) { if (useMonotonicity) {
if (this->isUseBoundsSet()) { if (this->isUseBoundsSet()) {
numberOfPLACallsBounds++; numberOfPLACallsBounds++;
@ -273,18 +270,11 @@ namespace storm {
monotonicityWatch.stop(); monotonicityWatch.stop();
STORM_LOG_INFO(std::endl << "Total time for monotonicity checking: " << monotonicityWatch << "." << std::endl << std::endl); STORM_LOG_INFO(std::endl << "Total time for monotonicity checking: " << monotonicityWatch << "." << std::endl << std::endl);
if (minimize) {
regionQueue.emplace(region, order, monRes, initBound); regionQueue.emplace(region, order, monRes, initBound);
} else {
regionQueue.emplace(region, order, monRes, initBound);
}
} else {
if (minimize) {
regionQueue.emplace(region, nullptr, nullptr, initBound);
first = false;
} else { } else {
regionQueue.emplace(region, nullptr, nullptr, initBound); regionQueue.emplace(region, nullptr, nullptr, initBound);
} }
}
// The results // The results
boost::optional<ConstantType> value; boost::optional<ConstantType> value;
@ -309,7 +299,6 @@ namespace storm {
auto numberOfPLACalls = 0; auto numberOfPLACalls = 0;
auto numberOfOrderCopies = 0; auto numberOfOrderCopies = 0;
auto numberOfMonResCopies = 0; auto numberOfMonResCopies = 0;
bool first = true;
storm::utility::Stopwatch loopWatch(true); storm::utility::Stopwatch loopWatch(true);
if (!(useMonotonicity && regionQueue.top().localMonRes->getGlobalMonotonicityResult()->isDone() && regionQueue.top().localMonRes->getGlobalMonotonicityResult()->isAllMonotonicity())) { if (!(useMonotonicity && regionQueue.top().localMonRes->getGlobalMonotonicityResult()->isDone() && regionQueue.top().localMonRes->getGlobalMonotonicityResult()->isAllMonotonicity())) {
// Doing the extremal computation, only when we don't use monotonicity or there are possibly not monotone variables. // Doing the extremal computation, only when we don't use monotonicity or there are possibly not monotone variables.
@ -325,8 +314,9 @@ namespace storm {
std::vector<storm::storage::ParameterRegion<typename SparseModelType::ValueType>> newRegions; std::vector<storm::storage::ParameterRegion<typename SparseModelType::ValueType>> newRegions;
// Check whether this region needs further investigation based on the bound of the parent region // Check whether this region needs further investigation based on the bound of the parent region
bool investigateBounds = (minimize && currBound < value.get() - storm::utility::convertNumber<ConstantType>(precision))
bool investigateBounds = first || (minimize && currBound < value.get() - storm::utility::convertNumber<ConstantType>(precision))
|| (!minimize && currBound > value.get() + storm::utility::convertNumber<ConstantType>(precision)); || (!minimize && currBound > value.get() + storm::utility::convertNumber<ConstantType>(precision));
first = false;
if (investigateBounds) { if (investigateBounds) {
numberOfPLACalls++; numberOfPLACalls++;
auto bounds = getBound(env, currRegion, dir, localMonotonicityResult)->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector(); auto bounds = getBound(env, currRegion, dir, localMonotonicityResult)->template asExplicitQuantitativeCheckResult<ConstantType>().getValueVector();

Loading…
Cancel
Save