From 1766bc385e7ef27afef48be4f3958396529f2340 Mon Sep 17 00:00:00 2001 From: Tim Quatmann Date: Wed, 6 May 2020 10:10:16 +0200 Subject: [PATCH] POMDP Approximation: Use relative gap --- .../modelchecker/ApproximatePOMDPModelchecker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/storm-pomdp/modelchecker/ApproximatePOMDPModelchecker.cpp b/src/storm-pomdp/modelchecker/ApproximatePOMDPModelchecker.cpp index 77d76f47b..55b252225 100644 --- a/src/storm-pomdp/modelchecker/ApproximatePOMDPModelchecker.cpp +++ b/src/storm-pomdp/modelchecker/ApproximatePOMDPModelchecker.cpp @@ -536,6 +536,8 @@ namespace storm { bool restoreAllActions = false; bool checkRewireForAllActions = false; ValueType gap = storm::utility::abs(overApproximation->getUpperValueBoundAtCurrentState() - overApproximation->getLowerValueBoundAtCurrentState()); + // Get the relative gap + gap = gap * storm::utility::convertNumber(2) / (storm::utility::abs(overApproximation->getLowerValueBoundAtCurrentState()) + storm::utility::abs(overApproximation->getUpperValueBoundAtCurrentState())); if (!hasOldBehavior) { // Case 1 // If we explore this state and if it has no old behavior, it is clear that an "old" optimal scheduler can be extended to a scheduler that reaches this state @@ -723,7 +725,10 @@ namespace storm { underApproximation->setCurrentStateIsTruncated(); } else if (!stateAlreadyExplored) { // Check whether we want to explore the state now! - if (storm::utility::abs(underApproximation->getUpperValueBoundAtCurrentState() - underApproximation->getLowerValueBoundAtCurrentState()) < heuristicParameters.gapThreshold) { + ValueType gap = storm::utility::abs(underApproximation->getUpperValueBoundAtCurrentState() - underApproximation->getLowerValueBoundAtCurrentState()); + // Get the relative gap + gap = gap * storm::utility::convertNumber(2) / (storm::utility::abs(underApproximation->getLowerValueBoundAtCurrentState()) + storm::utility::abs(underApproximation->getUpperValueBoundAtCurrentState())); + if (gap < heuristicParameters.gapThreshold) { stopExploration = true; underApproximation->setCurrentStateIsTruncated(); } else if (underApproximation->getCurrentNumberOfMdpStates() >= heuristicParameters.sizeThreshold) {