Browse Source

Better progress info

tempestpy_adaptions
TimQu 7 years ago
parent
commit
016fedd58e
  1. 11
      src/storm/modelchecker/multiobjective/pcaa/SparseMdpRewardBoundedPcaaWeightVectorChecker.cpp
  2. 7
      src/storm/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp
  3. 32
      src/storm/solver/AbstractEquationSolver.cpp
  4. 13
      src/storm/solver/AbstractEquationSolver.h
  5. 84
      src/storm/utility/ProgressMeasurement.cpp
  6. 107
      src/storm/utility/ProgressMeasurement.h

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

@ -5,6 +5,7 @@
#include "storm/models/sparse/StandardRewardModel.h"
#include "storm/utility/macros.h"
#include "storm/utility/vector.h"
#include "storm/utility/ProgressMeasurement.h"
#include "storm/logic/Formulas.h"
#include "storm/solver/MinMaxLinearEquationSolver.h"
#include "storm/solver/LinearEquationSolver.h"
@ -39,9 +40,8 @@ namespace storm {
template <class SparseMdpModelType>
void SparseMdpRewardBoundedPcaaWeightVectorChecker<SparseMdpModelType>::check(std::vector<ValueType> const& weightVector) {
STORM_LOG_DEBUG("Analyzing weight vector " << storm::utility::vector::toString(weightVector));
++numChecks;
STORM_LOG_INFO("Analyzing weight vector #" << numChecks << ": " << storm::utility::vector::toString(weightVector));
// In case we want to export the cdf, we will collect the corresponding data
std::vector<std::vector<ValueType>> cdfData;
@ -61,7 +61,10 @@ namespace storm {
STORM_PRINT_AND_LOG("Objective/Dimension/Epoch count is: " << this->objectives.size() << "/" << rewardUnfolding.getEpochManager().getDimensionCount() << "/" << epochOrder.size() << "." << std::endl);
}
storm::utility::ProgressMeasurement progress("epochs");
progress.setMaxCount(epochOrder.size());
progress.startNewMeasurement(0);
uint64_t numCheckedEpochs = 0;
for (auto const& epoch : epochOrder) {
computeEpochSolution(epoch, weightVector, cachedData, precision);
if (storm::settings::getModule<storm::settings::modules::IOSettings>().isExportCdfSet() && !rewardUnfolding.getEpochManager().hasBottomDimension(epoch)) {
@ -76,6 +79,8 @@ namespace storm {
cdfEntry.insert(cdfEntry.end(), solutionIt, solution.end());
cdfData.push_back(std::move(cdfEntry));
}
++numCheckedEpochs;
progress.updateProgress(numCheckedEpochs);
}
if (storm::settings::getModule<storm::settings::modules::IOSettings>().isExportCdfSet()) {

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

@ -29,6 +29,7 @@
#include "storm/settings/modules/CoreSettings.h"
#include "storm/utility/Stopwatch.h"
#include "storm/utility/ProgressMeasurement.h"
#include "storm/exceptions/InvalidStateException.h"
#include "storm/exceptions/InvalidPropertyException.h"
@ -99,6 +100,10 @@ namespace storm {
if (storm::settings::getModule<storm::settings::modules::GeneralSettings>().isSoundSet()) {
precision = precision / storm::utility::convertNumber<ValueType>(epochCount);
}
storm::utility::ProgressMeasurement progress("epochs");
progress.setMaxCount(epochOrder.size());
progress.startNewMeasurement(0);
uint64_t numCheckedEpochs = 0;
for (auto const& epoch : epochOrder) {
swBuild.start();
auto& epochModel = rewardUnfolding.setCurrentEpoch(epoch);
@ -196,6 +201,8 @@ namespace storm {
rewardUnfolding.setSolutionForCurrentEpoch(storm::utility::vector::filterVector(x, epochModel.epochInStates));
}
swCheck.stop();
++numCheckedEpochs;
progress.updateProgress(numCheckedEpochs);
}
std::map<storm::storage::sparse::state_type, ValueType> result;

32
src/storm/solver/AbstractEquationSolver.cpp

HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Set-Cookie: i_like_gitea=8161792de8b729f1; Path=/; HttpOnly; SameSite=Lax Set-Cookie: _csrf=AmdT6qqmCU81NPV0kHXmCIx5-Ho6MTczNjUzOTQ1MjY3MDM4MjQ2Nw; Path=/; Expires=Sat, 11 Jan 2025 20:04:12 GMT; HttpOnly; SameSite=Lax Set-Cookie: macaron_flash=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax X-Frame-Options: SAMEORIGIN Date: Fri, 10 Jan 2025 20:04:14 GMT Transfer-Encoding: chunked 91d0 sp/tempest - tempest - Gitea: Git with a cup of tea
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
@ -16,9 +16,9 @@ namespace storm {
template<typename ValueType>
AbstractEquationSolver<ValueType>::AbstractEquationSolver() {
auto const& generalSettings = storm::settings::getModule<storm::settings::modules::GeneralSettings>();
showProgressFlag = generalSettings.isVerboseSet();
showProgressDelay = generalSettings.getShowProgressDelay();
if (storm::settings::getModule<storm::settings::modules::GeneralSettings>().isVerboseSet()) {
this->progressMeasurement = storm::utility::ProgressMeasurement("iterations");
}
}
template<typename ValueType>
@ -203,35 +203,29 @@ namespace storm {
template<typename ValueType>
bool AbstractEquationSolver<ValueType>::isShowProgressSet() const {
return showProgressFlag;
return this->progressMeasurement.is_initialized();
}
template<typename ValueType>
uint64_t AbstractEquationSolver<ValueType>::getShowProgressDelay() const {
return showProgressDelay;
STORM_LOG_ASSERT(this->isShowProgressSet(), "Tried to get the progress message delay but progress is not shown.");
return this->progressMeasurement->getShowProgressDelay();
}
template<typename ValueType>
void AbstractEquationSolver<ValueType>::startMeasureProgress(uint64_t startingIteration) const {
timeOfStart = std::chrono::high_resolution_clock::now();
timeOfLastMessage = timeOfStart;
iterationOfLastMessage = startingIteration;
if (this->isShowProgressSet()) {
this->progressMeasurement->startNewMeasurement(startingIteration);
}
}
template<typename ValueType>
void AbstractEquationSolver<ValueType>::showProgressIterative(uint64_t iteration, boost::optional<uint64_t> const& bound) const {
if (this->isShowProgressSet()) {
auto now = std::chrono::high_resolution_clock::now();
auto durationSinceLastMessage = static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(now - timeOfLastMessage).count());
if (durationSinceLastMessage >= this->getShowProgressDelay()) {
uint64_t numberOfIterationsSinceLastMessage = iteration - iterationOfLastMessage;
STORM_LOG_INFO("Completed " << iteration << " iterations "
<< (bound ? "(out of " + std::to_string(bound.get()) + ") " : "")
<< "in " << std::chrono::duration_cast<std::chrono::seconds>(now - timeOfStart).count() << "s (currently " << (static_cast<double>(numberOfIterationsSinceLastMessage) / durationSinceLastMessage) << " per second)."
);
timeOfLastMessage = std::chrono::high_resolution_clock::now();
iterationOfLastMessage = iteration;
if (bound) {
this->progressMeasurement->setMaxCount(bound.get());
}
this->progressMeasurement->updateProgress(iteration);
dehnert 913aa83dbc Removed ltl2dstar. 10 years ago
..
3rdparty Removed ltl2dstar. 10 years ago
cmake Merge branch 'master' into cuda_integration 10 years ago
BUILD.txt Updated build instructions with list of tested compilers and some new dependencies, but it still looks partially outdated. 10 years ago
GUIDELINES-Doxygen.example.h Added temporary Find* files for CMake 13 years ago
GUIDELINES.txt Renaming MRMC to STORM, see #42 12 years ago
Google C++ Style Guide.pdf Updated styleguides 13 years ago
Google C++ Testing Framework.pdf Updated styleguides 13 years ago
0