TimQu
10 years ago
10 changed files with 198 additions and 55 deletions
-
48src/modelchecker/reachability/SparseDtmcRegionModelChecker.cpp
-
5src/modelchecker/reachability/SparseDtmcRegionModelChecker.h
-
2src/parser/MappedFile.h
-
5src/settings/SettingsManager.cpp
-
8src/settings/SettingsManager.h
-
50src/settings/modules/RegionSettings.cpp
-
64src/settings/modules/RegionSettings.h
-
13src/utility/cli.h
-
40src/utility/regions.cpp
-
10src/utility/regions.h
@ -0,0 +1,50 @@ |
|||||
|
#include "src/settings/modules/RegionSettings.h"
|
||||
|
|
||||
|
#include "src/settings/SettingsManager.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
const std::string RegionSettings::moduleName = "region"; |
||||
|
const std::string RegionSettings::regionfileOptionName = "regionfile"; |
||||
|
const std::string RegionSettings::regionsOptionName = "regions"; |
||||
|
|
||||
|
RegionSettings::RegionSettings(storm::settings::SettingsManager& settingsManager) : ModuleSettings(settingsManager, moduleName) { |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, regionfileOptionName, true, "Specifies the regions via a file. Format: 0.3<=p<=0.4,0.2<=q<=0.5; 0.6<=p<=0.7,0.8<=q<=0.9") |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The file from which to read the regions.").build()).build()); |
||||
|
this->addOption(storm::settings::OptionBuilder(moduleName, regionsOptionName, true, "Specifies the regions via command line. Format: '0.3<=p<=0.4,0.2<=q<=0.5; 0.6<=p<=0.7,0.8<=q<=0.9'") |
||||
|
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("regions", "The considered regions.").build()).build()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
bool RegionSettings::isRegionFileSet() const{ |
||||
|
return this->getOption(regionfileOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
std::string RegionSettings::getRegionFilePath() const{ |
||||
|
return this->getOption(regionfileOptionName).getArgumentByName("filename").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
bool RegionSettings::isRegionsSet() const{ |
||||
|
return this->getOption(regionsOptionName).getHasOptionBeenSet(); |
||||
|
} |
||||
|
|
||||
|
std::string RegionSettings::getRegionsFromCmdLine() const{ |
||||
|
return this->getOption(regionsOptionName).getArgumentByName("regions").getValueAsString(); |
||||
|
} |
||||
|
|
||||
|
bool RegionSettings::check() const{ |
||||
|
if(isRegionsSet() && isRegionFileSet()){ |
||||
|
STORM_LOG_ERROR("Regions specified twice: via command line AND via file."); |
||||
|
return false; |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} // namespace modules
|
||||
|
} // namespace settings
|
||||
|
} // namespace storm
|
@ -0,0 +1,64 @@ |
|||||
|
#ifndef STORM_SETTINGS_MODULES_REGIONSETTINGS_H_ |
||||
|
#define STORM_SETTINGS_MODULES_REGIONSETTINGS_H_ |
||||
|
|
||||
|
#include "src/settings/modules/ModuleSettings.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace settings { |
||||
|
namespace modules { |
||||
|
|
||||
|
/*! |
||||
|
* This class represents the settings for parametric region model checking. |
||||
|
*/ |
||||
|
class RegionSettings : public ModuleSettings { |
||||
|
public: |
||||
|
/** |
||||
|
* A type for saving the Solving Strategy. |
||||
|
* |
||||
|
*/ |
||||
|
//enum class SolvingStrategy { ... }; |
||||
|
|
||||
|
/*! |
||||
|
* Creates a new set of parametric region model checking settings that is managed by the given manager. |
||||
|
* |
||||
|
* @param settingsManager The responsible manager. |
||||
|
*/ |
||||
|
RegionSettings(storm::settings::SettingsManager& settingsManager); |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the regions are specified in a file. |
||||
|
* @return True iff the regions are specified in a file. |
||||
|
*/ |
||||
|
bool isRegionFileSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Returns the file in which the regions are specified. |
||||
|
*/ |
||||
|
std::string getRegionFilePath() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves whether the regions are specified as cmd line parameter |
||||
|
* @return True iff the regions are specified as cmd line parameter |
||||
|
*/ |
||||
|
bool isRegionsSet() const; |
||||
|
|
||||
|
/*! |
||||
|
* Returns the regions that are specified as cmd line parameter |
||||
|
*/ |
||||
|
std::string getRegionsFromCmdLine() const; |
||||
|
|
||||
|
|
||||
|
bool check() const override; |
||||
|
|
||||
|
const static std::string moduleName; |
||||
|
|
||||
|
private: |
||||
|
const static std::string regionfileOptionName; |
||||
|
const static std::string regionsOptionName; |
||||
|
}; |
||||
|
|
||||
|
} // namespace modules |
||||
|
} // namespace settings |
||||
|
} // namespace storm |
||||
|
|
||||
|
#endif /* STORM_SETTINGS_MODULES_REGIONSETTINGS_H_ */ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue