Browse Source

reuse scheduler from previous epoch as initial hint

tempestpy_adaptions
TimQu 7 years ago
parent
commit
b788c1b403
  1. 7
      src/storm/modelchecker/multiobjective/pcaa/SparseMdpRewardBoundedPcaaWeightVectorChecker.cpp
  2. 4
      src/storm/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp

7
src/storm/modelchecker/multiobjective/pcaa/SparseMdpRewardBoundedPcaaWeightVectorChecker.cpp

@ -97,6 +97,8 @@ namespace storm {
// Check whether the linear equation solver needs to be updated // Check whether the linear equation solver needs to be updated
auto const& choices = cachedData.minMaxSolver->getSchedulerChoices(); auto const& choices = cachedData.minMaxSolver->getSchedulerChoices();
if (cachedData.schedulerChoices != choices) { if (cachedData.schedulerChoices != choices) {
std::vector<uint64_t> choicesTmp = choices;
cachedData.minMaxSolver->setInitialScheduler(std::move(choicesTmp));
swAux2.start(); swAux2.start();
++numSchedChanges; ++numSchedChanges;
cachedData.schedulerChoices = choices; cachedData.schedulerChoices = choices;
@ -204,8 +206,9 @@ namespace storm {
cachedData.minMaxSolver->setRequirementsChecked(true); cachedData.minMaxSolver->setRequirementsChecked(true);
cachedData.minMaxSolver->setOptimizationDirection(storm::solver::OptimizationDirection::Maximize); cachedData.minMaxSolver->setOptimizationDirection(storm::solver::OptimizationDirection::Maximize);
// Set the scheduler choices to invalid choice indices so that an update of the linEqSolver is enforced
cachedData.schedulerChoices.assign(epochModel.epochMatrix.getRowGroupCount(), std::numeric_limits<uint64_t>::max());
// Clear the scheduler choices so that an update of the linEqSolver is enforced
cachedData.schedulerChoices.clear();
cachedData.schedulerChoices.reserve(epochModel.epochMatrix.getRowGroupCount());
// Update data for linear equation solving // Update data for linear equation solving
cachedData.bLinEq.resize(epochModel.epochMatrix.getRowGroupCount()); cachedData.bLinEq.resize(epochModel.epochMatrix.getRowGroupCount());

4
src/storm/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp

@ -92,6 +92,7 @@ namespace storm {
minMaxSolver = minMaxLinearEquationSolverFactory.create(epochModel.epochMatrix); minMaxSolver = minMaxLinearEquationSolverFactory.create(epochModel.epochMatrix);
minMaxSolver->setOptimizationDirection(dir); minMaxSolver->setOptimizationDirection(dir);
minMaxSolver->setCachingEnabled(true); minMaxSolver->setCachingEnabled(true);
minMaxSolver->setTrackScheduler(true);
minMaxSolver->setLowerBound(storm::utility::zero<ValueType>()); minMaxSolver->setLowerBound(storm::utility::zero<ValueType>());
minMaxSolver->setUpperBound(storm::utility::one<ValueType>()); minMaxSolver->setUpperBound(storm::utility::one<ValueType>());
auto req = minMaxSolver->getRequirements(storm::solver::EquationSystemType::StochasticShortestPath, dir); auto req = minMaxSolver->getRequirements(storm::solver::EquationSystemType::StochasticShortestPath, dir);
@ -99,6 +100,9 @@ namespace storm {
req.clearBounds(); req.clearBounds();
STORM_LOG_THROW(req.empty(), storm::exceptions::UncheckedRequirementException, "A solver requirement is not satisfied."); STORM_LOG_THROW(req.empty(), storm::exceptions::UncheckedRequirementException, "A solver requirement is not satisfied.");
minMaxSolver->setRequirementsChecked(); minMaxSolver->setRequirementsChecked();
} else {
auto choicesTmp = minMaxSolver->getSchedulerChoices();
minMaxSolver->setInitialScheduler(std::move(choicesTmp));
} }
// Prepare the right hand side of the equation system // Prepare the right hand side of the equation system

Loading…
Cancel
Save