Browse Source

using multiplier in PLA

tempestpy_adaptions
TimQu 7 years ago
parent
commit
02d2cf07b6
  1. 20
      src/storm-pars/modelchecker/region/SparseDtmcParameterLiftingModelChecker.cpp

20
src/storm-pars/modelchecker/region/SparseDtmcParameterLiftingModelChecker.cpp

@ -10,7 +10,8 @@
#include "storm/modelchecker/prctl/helper/BaierUpperRewardBoundsComputer.h" #include "storm/modelchecker/prctl/helper/BaierUpperRewardBoundsComputer.h"
#include "storm/models/sparse/Dtmc.h" #include "storm/models/sparse/Dtmc.h"
#include "storm/models/sparse/StandardRewardModel.h" #include "storm/models/sparse/StandardRewardModel.h"
#include "storm/solver/StandardMinMaxLinearEquationSolver.h"
#include "storm/solver/MinMaxLinearEquationSolver.h"
#include "storm/solver/Multiplier.h"
#include "storm/utility/vector.h" #include "storm/utility/vector.h"
#include "storm/utility/graph.h" #include "storm/utility/graph.h"
#include "storm/utility/NumberTraits.h" #include "storm/utility/NumberTraits.h"
@ -249,6 +250,12 @@ namespace storm {
parameterLifter->specifyRegion(region, dirForParameters); parameterLifter->specifyRegion(region, dirForParameters);
if (stepBound) {
assert(*stepBound > 0);
x = std::vector<ConstantType>(maybeStates.getNumberOfSetBits(), storm::utility::zero<ConstantType>());
auto multiplier = storm::solver::MultiplierFactory<ConstantType>().create();
multiplier->repeatedMultiply(env, dirForParameters, x, &parameterLifter->getVector(), *stepBound);
} else {
auto solver = solverFactory->create(env, parameterLifter->getMatrix()); auto solver = solverFactory->create(env, parameterLifter->getMatrix());
solver->setHasUniqueSolution(); solver->setHasUniqueSolution();
if (lowerResultBound) solver->setLowerBound(lowerResultBound.get()); if (lowerResultBound) solver->setLowerBound(lowerResultBound.get());
@ -269,9 +276,9 @@ namespace storm {
solver->setUpperBound(baier.computeUpperBound()); solver->setUpperBound(baier.computeUpperBound());
} }
} }
if (!stepBound) solver->setTrackScheduler(true);
if (storm::solver::minimize(dirForParameters) && minSchedChoices && !stepBound) solver->setInitialScheduler(std::move(minSchedChoices.get()));
if (storm::solver::maximize(dirForParameters) && maxSchedChoices && !stepBound) solver->setInitialScheduler(std::move(maxSchedChoices.get()));
solver->setTrackScheduler(true);
if (storm::solver::minimize(dirForParameters) && minSchedChoices) solver->setInitialScheduler(std::move(minSchedChoices.get()));
if (storm::solver::maximize(dirForParameters) && maxSchedChoices) solver->setInitialScheduler(std::move(maxSchedChoices.get()));
if (this->currentCheckTask->isBoundSet() && solver->hasInitialScheduler()) { if (this->currentCheckTask->isBoundSet() && solver->hasInitialScheduler()) {
// If we reach this point, we know that after applying the hint, the x-values can only become larger (if we maximize) or smaller (if we minimize). // If we reach this point, we know that after applying the hint, the x-values can only become larger (if we maximize) or smaller (if we minimize).
std::unique_ptr<storm::solver::TerminationCondition<ConstantType>> termCond; std::unique_ptr<storm::solver::TerminationCondition<ConstantType>> termCond;
@ -287,11 +294,6 @@ namespace storm {
} }
// Invoke the solver // Invoke the solver
if (stepBound) {
assert(*stepBound > 0);
x = std::vector<ConstantType>(maybeStates.getNumberOfSetBits(), storm::utility::zero<ConstantType>());
solver->repeatedMultiply(env, dirForParameters, x, &parameterLifter->getVector(), *stepBound);
} else {
x.resize(maybeStates.getNumberOfSetBits(), storm::utility::zero<ConstantType>()); x.resize(maybeStates.getNumberOfSetBits(), storm::utility::zero<ConstantType>());
solver->solveEquations(env, dirForParameters, x, parameterLifter->getVector()); solver->solveEquations(env, dirForParameters, x, parameterLifter->getVector());
if(storm::solver::minimize(dirForParameters)) { if(storm::solver::minimize(dirForParameters)) {

Loading…
Cancel
Save