Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
FeasibilitySynthesisTask.h
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
6#include "storm/logic/Bound.h"
9
10namespace storm::pars {
11enum class FeasibilityMethod { PLA, SCP, GD };
12
14 public:
18 FeasibilitySynthesisTask(std::shared_ptr<storm::logic::Formula const> const& formula) : formula(formula) {}
19
20 void setBound(storm::logic::Bound const& bound) {
21 this->bound = bound;
22 }
23
28 return bound.value();
29 }
30
34 bool isBoundSet() const {
35 return static_cast<bool>(bound);
36 }
37
39 return *formula;
40 }
41
42 void setMaximalAllowedGap(storm::RationalNumber const& maxGap) {
43 this->maxGap = maxGap;
44 }
48 std::optional<storm::RationalNumber> getMaximalAllowedGap() const {
49 return maxGap;
50 }
51
52 void setMaximalAllowedGapIsRelative(bool newValue) {
53 gapIsRelative = newValue;
54 }
55
56 bool isMaxGapRelative() const {
57 return gapIsRelative;
58 }
59
61 this->region = region;
62 }
63
64 bool isRegionSet() const {
65 return region != std::nullopt;
66 }
67
69 return region.value();
70 }
71
73 this->optimizationDirection = dir;
74 }
75
77 STORM_LOG_ASSERT(isBoundSet() || optimizationDirection != std::nullopt, "Bound or direction should be set");
78 STORM_LOG_ASSERT(!isBoundSet() || optimizationDirection == std::nullopt, "Bound or direction should not be both set");
79
80 if (optimizationDirection) {
81 return optimizationDirection.value();
82 } else {
83 return getBound().isLowerBound() ? storm::solver::OptimizationDirection::Maximize : storm::solver::OptimizationDirection::Minimize;
84 }
85 }
86
87 private:
89 std::shared_ptr<storm::logic::Formula const> formula;
91 std::optional<storm::logic::Bound> bound = std::nullopt;
93 std::optional<storm::storage::ParameterRegion<storm::RationalFunction>> region = std::nullopt;
96 std::optional<storm::RationalNumber> maxGap = std::nullopt;
98 bool gapIsRelative = true;
100 std::optional<storm::solver::OptimizationDirection> optimizationDirection = std::nullopt;
101};
102
103} // namespace storm::pars
void setOptimizationDirection(storm::solver::OptimizationDirection const &dir)
storm::logic::Bound const & getBound() const
Retrieves the bound (if set).
storm::storage::ParameterRegion< storm::RationalFunction > const & getRegion() const
storm::solver::OptimizationDirection getOptimizationDirection() const
bool isBoundSet() const
Retrieves whether there is a bound with which the values for the states will be compared.
std::optional< storm::RationalNumber > getMaximalAllowedGap() const
void setMaximalAllowedGap(storm::RationalNumber const &maxGap)
void setBound(storm::logic::Bound const &bound)
storm::logic::Formula const & getFormula() const
void setRegion(storm::storage::ParameterRegion< storm::RationalFunction > const &region)
FeasibilitySynthesisTask(std::shared_ptr< storm::logic::Formula const > const &formula)
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
bool isLowerBound() const
Definition Bound.h:29