TimQu
7 years ago
4 changed files with 128 additions and 5 deletions
-
9src/storm/environment/solver/TopologicalLinearEquationSolverEnvironment.cpp
-
2src/storm/settings/SettingsManager.cpp
-
67src/storm/settings/modules/TopologicalEquationSolverSettings.cpp
-
55src/storm/settings/modules/TopologicalEquationSolverSettings.h
@ -0,0 +1,67 @@ |
|||
#include "storm/settings/modules/TopologicalEquationSolverSettings.h"
|
|||
|
|||
|
|||
#include "storm/settings/modules/CoreSettings.h"
|
|||
|
|||
#include "storm/settings/SettingsManager.h"
|
|||
#include "storm/settings/SettingMemento.h"
|
|||
#include "storm/settings/Option.h"
|
|||
#include "storm/settings/OptionBuilder.h"
|
|||
#include "storm/settings/ArgumentBuilder.h"
|
|||
#include "storm/settings/Argument.h"
|
|||
#include "storm/solver/SolverSelectionOptions.h"
|
|||
|
|||
#include "storm/storage/dd/DdType.h"
|
|||
|
|||
#include "storm/utility/macros.h"
|
|||
#include "storm/exceptions/IllegalArgumentValueException.h"
|
|||
#include "storm/exceptions/InvalidOptionException.h"
|
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
const std::string TopologicalEquationSolverSettings::moduleName = "topological"; |
|||
const std::string TopologicalEquationSolverSettings::underlyingEquationSolverOptionName = "eqsolver"; |
|||
|
|||
TopologicalEquationSolverSettings::TopologicalEquationSolverSettings() : ModuleSettings(moduleName) { |
|||
std::vector<std::string> linearEquationSolver = {"gmm++", "native", "eigen", "elimination"}; |
|||
this->addOption(storm::settings::OptionBuilder(moduleName, underlyingEquationSolverOptionName, false, "Sets which solver is considered for solving the underlying equation systems.") |
|||
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the used solver.").addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(linearEquationSolver)).setDefaultValueString("gmm++").build()).build()); |
|||
} |
|||
|
|||
bool TopologicalEquationSolverSettings::isUnderlyingEquationSolverTypeSet() const { |
|||
return this->getOption(underlyingEquationSolverOptionName).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
bool TopologicalEquationSolverSettings::isUnderlyingEquationSolverTypeSetFromDefaultValue() const { |
|||
return !this->getOption(underlyingEquationSolverOptionName).getHasOptionBeenSet() || this->getOption(underlyingEquationSolverOptionName).getArgumentByName("name").wasSetFromDefaultValue(); |
|||
} |
|||
|
|||
storm::solver::EquationSolverType TopologicalEquationSolverSettings::getUnderlyingEquationSolverType() const { |
|||
std::string equationSolverName = this->getOption(underlyingEquationSolverOptionName).getArgumentByName("name").getValueAsString(); |
|||
if (equationSolverName == "gmm++") { |
|||
return storm::solver::EquationSolverType::Gmmxx; |
|||
} else if (equationSolverName == "native") { |
|||
return storm::solver::EquationSolverType::Native; |
|||
} else if (equationSolverName == "eigen") { |
|||
return storm::solver::EquationSolverType::Eigen; |
|||
} else if (equationSolverName == "elimination") { |
|||
return storm::solver::EquationSolverType::Elimination; |
|||
} |
|||
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Unknown underlying equation solver '" << equationSolverName << "'."); |
|||
} |
|||
|
|||
bool TopologicalEquationSolverSettings::check() const { |
|||
if (this->isUnderlyingEquationSolverTypeSet() && getUnderlyingEquationSolverType() == storm::solver::EquationSolverType::Topological) { |
|||
STORM_LOG_WARN("Underlying solver type of the topological solver can not be the topological solver."); |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
} // namespace modules
|
|||
} // namespace settings
|
|||
} // namespace storm
|
|||
|
|||
|
@ -0,0 +1,55 @@ |
|||
#pragma once |
|||
|
|||
#include "storm/settings/modules/ModuleSettings.h" |
|||
|
|||
#include "storm/solver/SolverSelectionOptions.h" |
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
/*! |
|||
* This class represents the settings for the native equation solver. |
|||
*/ |
|||
class TopologicalEquationSolverSettings : public ModuleSettings { |
|||
public: |
|||
|
|||
/*! |
|||
* Creates a new set of native equation solver settings. |
|||
*/ |
|||
TopologicalEquationSolverSettings(); |
|||
|
|||
/*! |
|||
* Retrieves whether the underlying equation solver type has been set. |
|||
* |
|||
* @return True iff the linear equation system technique has been set. |
|||
*/ |
|||
bool isUnderlyingEquationSolverTypeSet() const; |
|||
|
|||
/*! |
|||
* Retrieves whether the underlying equation solver type is set from its default value. |
|||
* |
|||
* @return True iff it was set from its default value. |
|||
*/ |
|||
bool isUnderlyingEquationSolverTypeSetFromDefaultValue() const; |
|||
|
|||
/*! |
|||
* Retrieves the method that is to be used for solving systems of linear equations. |
|||
* |
|||
* @return The method to use. |
|||
*/ |
|||
storm::solver::EquationSolverType getUnderlyingEquationSolverType() const; |
|||
|
|||
bool check() const override; |
|||
|
|||
// The name of the module. |
|||
static const std::string moduleName; |
|||
|
|||
private: |
|||
// Define the string names of the options as constants. |
|||
static const std::string underlyingEquationSolverOptionName; |
|||
}; |
|||
|
|||
} // namespace modules |
|||
} // namespace settings |
|||
} // namespace storm |
Write
Preview
Loading…
Cancel
Save
Reference in new issue