Browse Source

handled case where no threshold for the number of iterations is provided

tempestpy_adaptions
TimQu 7 years ago
parent
commit
e1047e787f
  1. 10
      src/storm/environment/solver/EigenSolverEnvironment.cpp
  2. 6
      src/storm/environment/solver/GameSolverEnvironment.cpp
  3. 6
      src/storm/environment/solver/GmmxxSolverEnvironment.cpp
  4. 6
      src/storm/environment/solver/MinMaxSolverEnvironment.cpp
  5. 6
      src/storm/environment/solver/NativeSolverEnvironment.cpp
  6. 5
      src/storm/solver/EigenLinearEquationSolver.cpp
  7. 6
      src/storm/solver/GmmxxLinearEquationSolver.cpp

10
src/storm/environment/solver/EigenSolverEnvironment.cpp

@ -14,7 +14,11 @@ namespace storm {
methodSetFromDefault = eigenSettings.isLinearEquationSystemMethodSetFromDefault(); methodSetFromDefault = eigenSettings.isLinearEquationSystemMethodSetFromDefault();
preconditioner = eigenSettings.getPreconditioningMethod(); preconditioner = eigenSettings.getPreconditioningMethod();
restartThreshold = eigenSettings.getRestartIterationCount(); restartThreshold = eigenSettings.getRestartIterationCount();
maxIterationCount = eigenSettings.getMaximalIterationCount();
if (eigenSettings.isMaximalIterationCountSet()) {
maxIterationCount = eigenSettings.getMaximalIterationCount();
} else {
maxIterationCount = std::numeric_limits<uint_fast64_t>::max();
}
precision = storm::utility::convertNumber<storm::RationalNumber>(eigenSettings.getPrecision()); precision = storm::utility::convertNumber<storm::RationalNumber>(eigenSettings.getPrecision());
} }
@ -44,11 +48,11 @@ namespace storm {
} }
uint64_t const& EigenSolverEnvironment::getRestartThreshold() const { uint64_t const& EigenSolverEnvironment::getRestartThreshold() const {
return maxIterationCount;
return restartThreshold;
} }
void EigenSolverEnvironment::setRestartThreshold(uint64_t value) { void EigenSolverEnvironment::setRestartThreshold(uint64_t value) {
maxIterationCount = value;
restartThreshold = value;
} }
uint64_t const& EigenSolverEnvironment::getMaximalNumberOfIterations() const { uint64_t const& EigenSolverEnvironment::getMaximalNumberOfIterations() const {

6
src/storm/environment/solver/GameSolverEnvironment.cpp

@ -12,7 +12,11 @@ namespace storm {
gameMethod = gameSettings.getGameSolvingMethod(); gameMethod = gameSettings.getGameSolvingMethod();
methodSetFromDefault = gameSettings.isGameSolvingMethodSetFromDefaultValue(); methodSetFromDefault = gameSettings.isGameSolvingMethodSetFromDefaultValue();
maxIterationCount = gameSettings.getMaximalIterationCount();
if (gameSettings.isMaximalIterationCountSet()) {
maxIterationCount = gameSettings.getMaximalIterationCount();
} else {
maxIterationCount = std::numeric_limits<uint_fast64_t>::max();
}
precision = storm::utility::convertNumber<storm::RationalNumber>(gameSettings.getPrecision()); precision = storm::utility::convertNumber<storm::RationalNumber>(gameSettings.getPrecision());
considerRelativeTerminationCriterion = gameSettings.getConvergenceCriterion() == storm::settings::modules::GameSolverSettings::ConvergenceCriterion::Relative; considerRelativeTerminationCriterion = gameSettings.getConvergenceCriterion() == storm::settings::modules::GameSolverSettings::ConvergenceCriterion::Relative;
STORM_LOG_ASSERT(considerRelativeTerminationCriterion || gameSettings.getConvergenceCriterion() == storm::settings::modules::GameSolverSettings::ConvergenceCriterion::Absolute, "Unknown convergence criterion"); STORM_LOG_ASSERT(considerRelativeTerminationCriterion || gameSettings.getConvergenceCriterion() == storm::settings::modules::GameSolverSettings::ConvergenceCriterion::Absolute, "Unknown convergence criterion");

6
src/storm/environment/solver/GmmxxSolverEnvironment.cpp

@ -13,7 +13,11 @@ namespace storm {
method = gmmxxSettings.getLinearEquationSystemMethod(); method = gmmxxSettings.getLinearEquationSystemMethod();
preconditioner = gmmxxSettings.getPreconditioningMethod(); preconditioner = gmmxxSettings.getPreconditioningMethod();
restartThreshold = gmmxxSettings.getRestartIterationCount(); restartThreshold = gmmxxSettings.getRestartIterationCount();
maxIterationCount = gmmxxSettings.getMaximalIterationCount();
if (gmmxxSettings.isMaximalIterationCountSet()) {
maxIterationCount = gmmxxSettings.getMaximalIterationCount();
} else {
maxIterationCount = std::numeric_limits<uint_fast64_t>::max();
}
precision = storm::utility::convertNumber<storm::RationalNumber>(gmmxxSettings.getPrecision()); precision = storm::utility::convertNumber<storm::RationalNumber>(gmmxxSettings.getPrecision());
} }

6
src/storm/environment/solver/MinMaxSolverEnvironment.cpp

@ -12,7 +12,11 @@ namespace storm {
minMaxMethod = minMaxSettings.getMinMaxEquationSolvingMethod(); minMaxMethod = minMaxSettings.getMinMaxEquationSolvingMethod();
methodSetFromDefault = minMaxSettings.isMinMaxEquationSolvingMethodSetFromDefaultValue(); methodSetFromDefault = minMaxSettings.isMinMaxEquationSolvingMethodSetFromDefaultValue();
maxIterationCount = minMaxSettings.getMaximalIterationCount();
if (minMaxSettings.isMaximalIterationCountSet()) {
maxIterationCount = minMaxSettings.getMaximalIterationCount();
} else {
maxIterationCount = std::numeric_limits<uint_fast64_t>::max();
}
precision = storm::utility::convertNumber<storm::RationalNumber>(minMaxSettings.getPrecision()); precision = storm::utility::convertNumber<storm::RationalNumber>(minMaxSettings.getPrecision());
considerRelativeTerminationCriterion = minMaxSettings.getConvergenceCriterion() == storm::settings::modules::MinMaxEquationSolverSettings::ConvergenceCriterion::Relative; considerRelativeTerminationCriterion = minMaxSettings.getConvergenceCriterion() == storm::settings::modules::MinMaxEquationSolverSettings::ConvergenceCriterion::Relative;
STORM_LOG_ASSERT(considerRelativeTerminationCriterion || minMaxSettings.getConvergenceCriterion() == storm::settings::modules::MinMaxEquationSolverSettings::ConvergenceCriterion::Absolute, "Unknown convergence criterion"); STORM_LOG_ASSERT(considerRelativeTerminationCriterion || minMaxSettings.getConvergenceCriterion() == storm::settings::modules::MinMaxEquationSolverSettings::ConvergenceCriterion::Absolute, "Unknown convergence criterion");

6
src/storm/environment/solver/NativeSolverEnvironment.cpp

@ -12,7 +12,11 @@ namespace storm {
method = nativeSettings.getLinearEquationSystemMethod(); method = nativeSettings.getLinearEquationSystemMethod();
methodSetFromDefault = nativeSettings.isLinearEquationSystemTechniqueSetFromDefaultValue(); methodSetFromDefault = nativeSettings.isLinearEquationSystemTechniqueSetFromDefaultValue();
maxIterationCount = nativeSettings.getMaximalIterationCount();
if (nativeSettings.isMaximalIterationCountSet()) {
maxIterationCount = nativeSettings.getMaximalIterationCount();
} else {
maxIterationCount = std::numeric_limits<uint_fast64_t>::max();
}
precision = storm::utility::convertNumber<storm::RationalNumber>(nativeSettings.getPrecision()); precision = storm::utility::convertNumber<storm::RationalNumber>(nativeSettings.getPrecision());
considerRelativeTerminationCriterion = nativeSettings.getConvergenceCriterion() == storm::settings::modules::NativeEquationSolverSettings::ConvergenceCriterion::Relative; considerRelativeTerminationCriterion = nativeSettings.getConvergenceCriterion() == storm::settings::modules::NativeEquationSolverSettings::ConvergenceCriterion::Relative;
STORM_LOG_ASSERT(considerRelativeTerminationCriterion || nativeSettings.getConvergenceCriterion() == storm::settings::modules::NativeEquationSolverSettings::ConvergenceCriterion::Absolute, "Unknown convergence criterion"); STORM_LOG_ASSERT(considerRelativeTerminationCriterion || nativeSettings.getConvergenceCriterion() == storm::settings::modules::NativeEquationSolverSettings::ConvergenceCriterion::Absolute, "Unknown convergence criterion");

5
src/storm/solver/EigenLinearEquationSolver.cpp

@ -116,7 +116,10 @@ namespace storm {
} else { } else {
bool converged = false; bool converged = false;
uint64_t numberOfIterations = 0; uint64_t numberOfIterations = 0;
uint64_t maxIter = env.solver().eigen().getMaximalNumberOfIterations();
StormEigen::Index maxIter = std::numeric_limits<StormEigen::Index>::max();
if (env.solver().eigen().getMaximalNumberOfIterations() < static_cast<uint64_t>(maxIter)) {
maxIter = env.solver().eigen().getMaximalNumberOfIterations();
}
uint64_t restartThreshold = env.solver().eigen().getRestartThreshold(); uint64_t restartThreshold = env.solver().eigen().getRestartThreshold();
ValueType precision = storm::utility::convertNumber<ValueType>(env.solver().eigen().getPrecision()); ValueType precision = storm::utility::convertNumber<ValueType>(env.solver().eigen().getPrecision());
EigenLinearEquationSolverPreconditioner preconditioner = env.solver().eigen().getPreconditioner(); EigenLinearEquationSolverPreconditioner preconditioner = env.solver().eigen().getPreconditioner();

6
src/storm/solver/GmmxxLinearEquationSolver.cpp

@ -65,7 +65,11 @@ namespace storm {
} }
// Prepare an iteration object that determines the accuracy and the maximum number of iterations. // Prepare an iteration object that determines the accuracy and the maximum number of iterations.
gmm::iteration iter(storm::utility::convertNumber<ValueType>(env.solver().gmmxx().getPrecision()), 0, env.solver().gmmxx().getMaximalNumberOfIterations());
gmm::size_type maxIter = std::numeric_limits<gmm::size_type>::max();
if (env.solver().gmmxx().getMaximalNumberOfIterations() < static_cast<uint64_t>(maxIter)) {
maxIter = env.solver().gmmxx().getMaximalNumberOfIterations();
}
gmm::iteration iter(storm::utility::convertNumber<ValueType>(env.solver().gmmxx().getPrecision()), 0, maxIter);
// Invoke gmm with the corresponding settings // Invoke gmm with the corresponding settings
if (method == GmmxxLinearEquationSolverMethod::Bicgstab) { if (method == GmmxxLinearEquationSolverMethod::Bicgstab) {
Loading…
Cancel
Save