8 changed files with 147 additions and 0 deletions
-
2src/storm/environment/SubEnvironment.cpp
-
33src/storm/environment/solver/MultiplierEnvironment.cpp
-
23src/storm/environment/solver/MultiplierEnvironment.h
-
9src/storm/environment/solver/SolverEnvironment.cpp
-
4src/storm/environment/solver/SolverEnvironment.h
-
2src/storm/settings/SettingsManager.cpp
-
40src/storm/settings/modules/MultiplierSettings.cpp
-
34src/storm/settings/modules/MultiplierSettings.h
@ -0,0 +1,33 @@ |
|||||
|
#include "storm/environment/solver/MultiplierEnvironment.h"
|
||||
|
|
||||
|
#include "storm/settings/SettingsManager.h"
|
||||
|
#include "storm/settings/modules/MultiplierSettings.h"
|
||||
|
#include "storm/utility/constants.h"
|
||||
|
#include "storm/utility/macros.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
|
||||
|
MultiplierEnvironment::MultiplierEnvironment() { |
||||
|
auto const& multiplierSettings = storm::settings::getModule<storm::settings::modules::MultiplierSettings>(); |
||||
|
type = multiplierSettings.getMultiplierType(); |
||||
|
typeSetFromDefault = multiplierSettings.isMultiplierTypeSetFromDefaultValue(); |
||||
|
} |
||||
|
|
||||
|
MultiplierEnvironment::~MultiplierEnvironment() { |
||||
|
// Intentionally left empty
|
||||
|
} |
||||
|
|
||||
|
storm::solver::MultiplierType const& MultiplierEnvironment::getType() const { |
||||
|
return type; |
||||
|
} |
||||
|
|
||||
|
bool const& MultiplierEnvironment::isTypeSetFromDefault() const { |
||||
|
return typeSetFromDefault; |
||||
|
} |
||||
|
|
||||
|
void MultiplierEnvironment::setType(storm::solver::MultiplierType value, bool isSetFromDefault) { |
||||
|
type = value; |
||||
|
typeSetFromDefault = isSetFromDefault; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "storm/environment/solver/SolverEnvironment.h" |
||||
|
#include "storm/solver/SolverSelectionOptions.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
|
||||
|
class MultiplierEnvironment { |
||||
|
public: |
||||
|
|
||||
|
MultiplierEnvironment(); |
||||
|
~MultiplierEnvironment(); |
||||
|
|
||||
|
storm::solver::MultiplierType const& getType() const; |
||||
|
bool const& isTypeSetFromDefault() const; |
||||
|
void setType(storm::solver::MultiplierType value, bool isSetFromDefault = false); |
||||
|
|
||||
|
private: |
||||
|
storm::solver::MultiplierType type; |
||||
|
bool typeSetFromDefault; |
||||
|
}; |
||||
|
} |
||||
|
|
@ -0,0 +1,40 @@ |
|||||
|
#include "storm/settings/modules/MultiplierSettings.h"
|
||||
|
|
||||
|
#include "storm/settings/Option.h"
|
||||
|
#include "storm/settings/ArgumentBuilder.h"
|
||||
|
#include "storm/settings/OptionBuilder.h"
|
||||
|
|
||||
|
#include "storm/utility/macros.h"
|
||||
|
#include "storm/exceptions/IllegalArgumentValueException.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
const std::string MultiplierSettings::moduleName = "multiplier"; |
||||
|
const std::string MultiplierSettings::multiplierTypeOptionName = "type"; |
||||
|
|
||||
|
MultiplierSettings::MultiplierSettings() : ModuleSettings(moduleName) { |
||||
|
std::vector<std::string> multiplierTypes = {"native", "gmmxx"}; |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, multiplierTypeOptionName, true, "Sets which type of multiplier is preferred.") |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of a multiplier.").addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(multiplierTypes)).setDefaultValueString("gmmxx").build()).build()); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
storm::solver::MultiplierType MultiplierSettings::getMultiplierType() const { |
||||
|
std::string type = this->getOption(multiplierTypeOptionName).getArgumentByName("name").getValueAsString(); |
||||
|
if (type == "native") { |
||||
|
return storm::solver::MultiplierType::Native; |
||||
|
} else if (type == "gmmxx") { |
||||
|
return storm::solver::MultiplierType::Gmmxx; |
||||
|
} |
||||
|
|
||||
|
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Unknown multiplier type '" << type << "'."); |
||||
|
} |
||||
|
|
||||
|
bool MultiplierSettings::isMultiplierTypeSetFromDefaultValue() const { |
||||
|
return !this->getOption(multiplierTypeOptionName).getArgumentByName("name").getHasBeenSet() || this->getOption(multiplierTypeOptionName).getArgumentByName("name").wasSetFromDefaultValue(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "storm-config.h" |
||||
|
#include "storm/settings/modules/ModuleSettings.h" |
||||
|
|
||||
|
#include "storm/solver/SolverSelectionOptions.h" |
||||
|
#include "storm/solver/MultiplicationStyle.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
/*! |
||||
|
* This class represents the multiplier settings. |
||||
|
*/ |
||||
|
class MultiplierSettings : public ModuleSettings { |
||||
|
public: |
||||
|
|
||||
|
MultiplierSettings(); |
||||
|
|
||||
|
storm::solver::MultiplierType getMultiplierType() const; |
||||
|
|
||||
|
bool isMultiplierTypeSetFromDefaultValue() const; |
||||
|
|
||||
|
// The name of the module. |
||||
|
static const std::string moduleName; |
||||
|
|
||||
|
private: |
||||
|
static const std::string multiplierTypeOptionName; |
||||
|
}; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue