16template<storm::OptimizationDirection Dir,
typename ValueType>
44 bool better(ValueType
const& value)
const;
50 template<
typename ExtendedType>
51 requires(std::is_same_v<ExtendedType, storm::utility::ExtendedValueType<ValueType>> &&
52 !std::is_same_v<storm::utility::ExtendedValueType<ValueType>, ValueType>)
53 bool better(ExtendedType
const& value)
const {
55 return value < extremalValue;
58 return value > extremalValue;
121 template<
typename ExtendedType>
122 requires(std::is_same_v<ExtendedType, storm::utility::ExtendedValueType<ValueType>> &&
123 !std::is_same_v<storm::utility::ExtendedValueType<ValueType>, ValueType>)
124 bool operator&=(ExtendedType
const& value) {
126 extremalValue = value;
139 static bool const StoresPlainValues = std::is_same_v<storm::utility::ExtendedValueType<ValueType>, ValueType>;
140 static_assert(!StoresPlainValues || std::numeric_limits<ValueType>::has_infinity,
"NumberTraits claims an infinity that numeric_limits cannot provide.");
144 if constexpr (StoresPlainValues) {
147 return std::numeric_limits<ValueType>::infinity();
150 return -std::numeric_limits<ValueType>::infinity();
157 return storm::utility::ExtendedValueType<ValueType>::negativeInfinity();
165template<
typename ValueType>
167template<
typename ValueType>
Stores and manages an extremal (maximal or minimal) value.
bool operator&=(Extremum const &other)
Updates the stored value, if the given extremal value is better.
bool operator&=(ValueType const &value)
Updates the stored value, if the given value is better.
bool operator&=(ValueType &&value)
Updates the stored value, if the given value is better.
ValueType const & operator*() const
std::optional< ValueType > getOptionalValue() const
bool better(ValueType const &value) const
bool operator&=(Extremum &&other)
Updates the stored value, if the given extremal value is better.
Extremum(Extremum &&)=default
Extremum(ValueType &&value)
Extremum & operator=(ValueType const &value)
Sets the extremum to the given value.
storm::utility::ExtendedValueType< ValueType > const & getExtendedValue() const
Extremum(Extremum const &)=default
Extremum & operator=(ValueType &&value)
Sets the extremum to the given value.
Extremum(ValueType const &value)
void reset()
Forgets the extremal value so that this represents the extremum over an empty set.
Extremum & operator=(Extremum &&)=default
bool better(ExtendedType const &value) const
Extremum & operator=(Extremum const &)=default
bool constexpr maximize(OptimizationDirection d)
bool constexpr minimize(OptimizationDirection d)
Extremum< storm::OptimizationDirection::Maximize, ValueType > Maximum
Extremum< storm::OptimizationDirection::Minimize, ValueType > Minimum
std::conditional_t< storm::NumberTraits< ValueType >::HasInfinity, ValueType, ExtendedNumber< ValueType > > ExtendedValueType
The type to use for values that may be infinite.