From 488479b5a73a5bc06695c32b8b9afe54c2c46b27 Mon Sep 17 00:00:00 2001 From: TimQu Date: Fri, 8 Sep 2017 12:11:53 +0200 Subject: [PATCH] better objectiveRewardFilter --- .../MultiDimensionalRewardUnfolding.cpp | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/storm/modelchecker/multiobjective/rewardbounded/MultiDimensionalRewardUnfolding.cpp b/src/storm/modelchecker/multiobjective/rewardbounded/MultiDimensionalRewardUnfolding.cpp index d6fc54c38..03aaf9dba 100644 --- a/src/storm/modelchecker/multiobjective/rewardbounded/MultiDimensionalRewardUnfolding.cpp +++ b/src/storm/modelchecker/multiobjective/rewardbounded/MultiDimensionalRewardUnfolding.cpp @@ -216,7 +216,14 @@ namespace storm { } swSetEpoch.start(); - epochModel.objectiveRewardFilter = std::vector(objectives.size(), storm::storage::BitVector(epochModel.objectiveRewards.front().size(), true)); + swAux1.start(); + epochModel.objectiveRewardFilter.clear(); + for (auto const& objRewards : epochModel.objectiveRewards) { + epochModel.objectiveRewardFilter.push_back(storm::utility::vector::filterZero(objRewards)); + epochModel.objectiveRewardFilter.back().complement(); + } + swAux1.stop(); + epochModel.stepSolutions.resize(epochModel.stepChoices.getNumberOfSetBits()); auto stepSolIt = epochModel.stepSolutions.begin(); for (auto const& reducedChoice : epochModel.stepChoices) { @@ -228,9 +235,14 @@ namespace storm { // Find out whether objective reward is earned for the current choice // Objective reward is not earned if there is a subObjective that is still relevant but the corresponding reward bound is passed after taking the choice swAux1.start(); - for (uint64_t dim = 0; dim < dimensionCount; ++dim) { - if (isBottomDimension(successorEpoch, dim) && memoryState.get(dim)) { - epochModel.objectiveRewardFilter[subObjectives[dim].second].set(reducedChoice, false); + for (uint64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) { + if (epochModel.objectiveRewardFilter[objIndex].get(reducedChoice)) { + for (auto const& dim : objectiveDimensions[objIndex]) { + if (isBottomDimension(successorEpoch, dim) && memoryState.get(dim)) { + epochModel.objectiveRewardFilter[objIndex].set(reducedChoice, false); + break; + } + } } } swAux1.stop();