From 170105c261f2eab1586f3923da627a6315f2cbe8 Mon Sep 17 00:00:00 2001 From: TimQu Date: Wed, 5 Apr 2017 16:13:36 +0200 Subject: [PATCH] Fixed "division by zero" error that occurred when considering a CTMC with state rewards but without action rewards --- src/storm/generator/PrismNextStateGenerator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/storm/generator/PrismNextStateGenerator.cpp b/src/storm/generator/PrismNextStateGenerator.cpp index e15db2629..62eeae361 100644 --- a/src/storm/generator/PrismNextStateGenerator.cpp +++ b/src/storm/generator/PrismNextStateGenerator.cpp @@ -22,7 +22,7 @@ namespace storm { } template - PrismNextStateGenerator::PrismNextStateGenerator(storm::prism::Program const& program, NextStateGeneratorOptions const& options, bool) : NextStateGenerator(program.getManager(), options), program(program), rewardModels() { + PrismNextStateGenerator::PrismNextStateGenerator(storm::prism::Program const& program, NextStateGeneratorOptions const& options, bool) : NextStateGenerator(program.getManager(), options), program(program), rewardModels(), hasStateActionRewards(false) { STORM_LOG_TRACE("Creating next-state generator for PRISM program: " << program); STORM_LOG_THROW(!this->program.specifiesSystemComposition(), storm::exceptions::WrongFormatException, "The explicit next-state generator currently does not support custom system compositions."); @@ -262,7 +262,9 @@ namespace storm { } } - globalChoice.addReward(stateActionRewardValue / totalExitRate); + if (hasStateActionRewards) { + globalChoice.addReward(stateActionRewardValue / totalExitRate); + } } // Move the newly fused choice in place.