Tim Quatmann
5 years ago
6 changed files with 159 additions and 1 deletions
-
2src/storm/environment/SubEnvironment.cpp
-
94src/storm/environment/solver/LongRunAverageSolverEnvironment.cpp
-
49src/storm/environment/solver/LongRunAverageSolverEnvironment.h
-
9src/storm/environment/solver/SolverEnvironment.cpp
-
4src/storm/environment/solver/SolverEnvironment.h
-
2src/storm/solver/SolverSelectionOptions.h
@ -0,0 +1,94 @@ |
|||||
|
#include "storm/environment/solver/LongRunAverageSolverEnvironment.h"
|
||||
|
|
||||
|
#include "storm/settings/SettingsManager.h"
|
||||
|
#include "storm/settings/modules/LongRunAverageSolverSettings.h"
|
||||
|
#include "storm/utility/constants.h"
|
||||
|
#include "storm/utility/macros.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
|
||||
|
LongRunAverageSolverEnvironment::LongRunAverageSolverEnvironment() { |
||||
|
auto const& lraSettings = storm::settings::getModule<storm::settings::modules::LongRunAverageSolverSettings>(); |
||||
|
detMethod = lraSettings.getDetLraMethod(); |
||||
|
detMethodSetFromDefault = lraSettings.isDetLraMethodSetFromDefaultValue(); |
||||
|
nondetMethod = lraSettings.getNondetLraMethod(); |
||||
|
nondetMethodSetFromDefault = lraSettings.isNondetLraMethodSetFromDefaultValue(); |
||||
|
precision = storm::utility::convertNumber<storm::RationalNumber>(lraSettings.getPrecision()); |
||||
|
relative = lraSettings.isRelativePrecision(); |
||||
|
if (lraSettings.isMaximalIterationCountSet()) { |
||||
|
maxIters = lraSettings.getMaximalIterationCount(); |
||||
|
} |
||||
|
aperiodicFactor = lraSettings.getAperiodicFactor(); |
||||
|
} |
||||
|
|
||||
|
LongRunAverageSolverEnvironment::~LongRunAverageSolverEnvironment() { |
||||
|
// Intentionally left empty
|
||||
|
} |
||||
|
|
||||
|
storm::solver::LraMethod const& LongRunAverageSolverEnvironment::getDetLraMethod() const { |
||||
|
return detMethod; |
||||
|
} |
||||
|
|
||||
|
bool const& LongRunAverageSolverEnvironment::isDetLraMethodSetFromDefault() const { |
||||
|
return detMethodSetFromDefault; |
||||
|
} |
||||
|
|
||||
|
void LongRunAverageSolverEnvironment::setDetLraMethod(storm::solver::LraMethod value, bool isSetFromDefault) { |
||||
|
detMethod = value; |
||||
|
detMethodSetFromDefault = isSetFromDefault; |
||||
|
} |
||||
|
|
||||
|
storm::solver::LraMethod const& LongRunAverageSolverEnvironment::getNondetLraMethod() const { |
||||
|
return nondetMethod; |
||||
|
} |
||||
|
|
||||
|
bool const& LongRunAverageSolverEnvironment::isNondetLraMethodSetFromDefault() const { |
||||
|
return nondetMethodSetFromDefault; |
||||
|
} |
||||
|
|
||||
|
void LongRunAverageSolverEnvironment::setNondetLraMethod(storm::solver::LraMethod value, bool isSetFromDefault) { |
||||
|
nondetMethod = value; |
||||
|
nondetMethodSetFromDefault = isSetFromDefault; |
||||
|
} |
||||
|
|
||||
|
storm::RationalNumber const& LongRunAverageSolverEnvironment::getPrecision() const { |
||||
|
return precision; |
||||
|
} |
||||
|
|
||||
|
void LongRunAverageSolverEnvironment::setPrecision(storm::RationalNumber value) { |
||||
|
precision = value; |
||||
|
} |
||||
|
|
||||
|
bool const& LongRunAverageSolverEnvironment::getRelativeTerminationCriterion() const { |
||||
|
return relative; |
||||
|
} |
||||
|
|
||||
|
void LongRunAverageSolverEnvironment::setRelativeTerminationCriterion(bool value) { |
||||
|
relative = value; |
||||
|
} |
||||
|
|
||||
|
bool LongRunAverageSolverEnvironment::isMaximalIterationCountSet() const { |
||||
|
return maxIters.is_initialized(); |
||||
|
} |
||||
|
|
||||
|
uint64_t LongRunAverageSolverEnvironment::getMaximalIterationCount() const { |
||||
|
return maxIters.get(); |
||||
|
} |
||||
|
|
||||
|
void LongRunAverageSolverEnvironment::setMaximalIterationCount(uint64_t value) { |
||||
|
maxIters = value; |
||||
|
} |
||||
|
|
||||
|
void LongRunAverageSolverEnvironment::unsetMaximalIterationCount() { |
||||
|
maxIters = boost::none; |
||||
|
} |
||||
|
|
||||
|
storm::RationalNumber const& LongRunAverageSolverEnvironment::getAperiodicFactor() const { |
||||
|
return aperiodicFactor; |
||||
|
} |
||||
|
|
||||
|
void LongRunAverageSolverEnvironment::setAperiodicFactor(storm::RationalNumber value) { |
||||
|
aperiodicFactor = value; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "storm/environment/solver/SolverEnvironment.h" |
||||
|
#include "storm/solver/SolverSelectionOptions.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
|
||||
|
class LongRunAverageSolverEnvironment { |
||||
|
public: |
||||
|
|
||||
|
LongRunAverageSolverEnvironment(); |
||||
|
~LongRunAverageSolverEnvironment(); |
||||
|
|
||||
|
storm::solver::LraMethod const& getDetLraMethod() const; |
||||
|
bool const& isDetLraMethodSetFromDefault() const; |
||||
|
void setDetLraMethod(storm::solver::LraMethod value, bool isSetFromDefault = false); |
||||
|
|
||||
|
storm::solver::LraMethod const& getNondetLraMethod() const; |
||||
|
bool const& isNondetLraMethodSetFromDefault() const; |
||||
|
void setNondetLraMethod(storm::solver::LraMethod value, bool isSetFromDefault = false); |
||||
|
|
||||
|
storm::RationalNumber const& getPrecision() const; |
||||
|
void setPrecision(storm::RationalNumber value); |
||||
|
bool const& getRelativeTerminationCriterion() const; |
||||
|
void setRelativeTerminationCriterion(bool value); |
||||
|
|
||||
|
bool isMaximalIterationCountSet() const; |
||||
|
uint64_t getMaximalIterationCount() const; |
||||
|
void setMaximalIterationCount(uint64_t value); |
||||
|
void unsetMaximalIterationCount(); |
||||
|
|
||||
|
storm::RationalNumber const& getAperiodicFactor() const; |
||||
|
void setAperiodicFactor(storm::RationalNumber value); |
||||
|
|
||||
|
private: |
||||
|
storm::solver::LraMethod detMethod; |
||||
|
bool detMethodSetFromDefault; |
||||
|
|
||||
|
storm::solver::LraMethod nondetMethod; |
||||
|
bool nondetMethodSetFromDefault; |
||||
|
|
||||
|
storm::RationalNumber precision; |
||||
|
bool relative; |
||||
|
boost::optional<uint64_t> maxIters; |
||||
|
|
||||
|
storm::RationalNumber aperiodicFactor; |
||||
|
}; |
||||
|
} |
||||
|
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue