12template<
typename ValueType>
14 return terminateNow([¤tValues](uint64_t
const& i) {
return currentValues[i]; }, guarantee);
17template<
typename ValueType>
22template<
typename ValueType>
27template<
typename ValueType>
30 : threshold(threshold), filter(filter), strict(strict) {
34template<
typename ValueType>
41 ValueType sum = storm::utility::zero<ValueType>();
42 for (
auto pos : filter) {
43 sum += valueGetter(pos);
46 return strict ? sum > this->threshold : sum >= this->threshold;
49template<
typename ValueType>
54template<
typename ValueType>
56 ValueType
const& threshold,
bool useMinimum)
59 STORM_LOG_THROW(!this->filter.
empty(), storm::exceptions::InvalidArgumentException,
"Empty Filter; Can not take extremum over empty set.");
63template<
typename ValueType>
70 ValueType extremum = valueGetter(cachedExtremumIndex);
71 if (useMinimum && (this->strict ? extremum <= this->threshold : extremum < this->threshold)) {
78 for (
auto pos : this->filter) {
79 extremum = std::min(valueGetter(pos), extremum);
80 if (extremum <= this->threshold) {
81 cachedExtremumIndex = pos;
86 for (
auto pos : this->filter) {
87 extremum = std::min(valueGetter(pos), extremum);
88 if (extremum < this->threshold) {
89 cachedExtremumIndex = pos;
95 for (
auto pos : this->filter) {
96 extremum = std::max(valueGetter(pos), extremum);
100 return this->strict ? extremum > this->threshold : extremum >= this->threshold;
103template<
typename ValueType>
108template<
typename ValueType>
110 ValueType
const& threshold,
bool useMinimum)
112 STORM_LOG_THROW(!this->filter.
empty(), storm::exceptions::InvalidArgumentException,
"Empty Filter; Can not take extremum over empty set.");
116template<
typename ValueType>
123 ValueType extremum = valueGetter(cachedExtremumIndex);
124 if (!useMinimum && (this->strict ? extremum >= this->threshold : extremum > this->threshold)) {
130 for (
auto pos : this->filter) {
131 extremum = std::min(valueGetter(pos), extremum);
135 for (
auto pos : this->filter) {
136 extremum = std::max(valueGetter(pos), extremum);
137 if (extremum >= this->threshold) {
138 cachedExtremumIndex = pos;
143 for (
auto pos : this->filter) {
144 extremum = std::max(valueGetter(pos), extremum);
145 if (extremum > this->threshold) {
146 cachedExtremumIndex = pos;
153 return this->strict ? extremum < this->threshold : extremum <= this->threshold;
156template<
typename ValueType>
virtual bool terminateNow(std::function< ValueType(uint64_t const &)> const &valueGetter, SolverGuarantee const &guarantee=SolverGuarantee::None) const override
virtual bool requiresGuarantee(SolverGuarantee const &guarantee) const override
Retrieves whether the termination criterion requires the given guarantee in order to decide terminati...
TerminateIfFilteredExtremumBelowThreshold(storm::storage::BitVector const &filter, bool strict, ValueType const &threshold, bool useMinimum)
bool terminateNow(std::function< ValueType(uint64_t const &)> const &valueGetter, SolverGuarantee const &guarantee=SolverGuarantee::None) const override
virtual bool requiresGuarantee(SolverGuarantee const &guarantee) const override
Retrieves whether the termination criterion requires the given guarantee in order to decide terminati...
uint64_t cachedExtremumIndex
TerminateIfFilteredExtremumExceedsThreshold(storm::storage::BitVector const &filter, bool strict, ValueType const &threshold, bool useMinimum)
bool terminateNow(std::function< ValueType(uint64_t const &)> const &valueGetter, SolverGuarantee const &guarantee=SolverGuarantee::None) const override
uint64_t cachedExtremumIndex
virtual bool requiresGuarantee(SolverGuarantee const &guarantee) const override
Retrieves whether the termination criterion requires the given guarantee in order to decide terminati...
virtual bool requiresGuarantee(SolverGuarantee const &guarantee) const override
Retrieves whether the termination criterion requires the given guarantee in order to decide terminati...
bool terminateNow(std::function< ValueType(uint64_t const &)> const &valueGetter, SolverGuarantee const &guarantee=SolverGuarantee::None) const override
TerminateIfFilteredSumExceedsThreshold(storm::storage::BitVector const &filter, ValueType const &threshold, bool strict)
virtual bool terminateNow(std::vector< ValueType > const ¤tValues, SolverGuarantee const &guarantee=SolverGuarantee::None) const
Retrieves whether the guarantee provided by the solver for the current result is sufficient to termin...
A bit vector that is internally represented as a vector of 64-bit values.
uint_fast64_t getNextSetIndex(uint_fast64_t startingIndex) const
Retrieves the index of the bit that is the next bit set to true in the bit vector.
bool empty() const
Retrieves whether no bits are set to true in this bit vector.
#define STORM_LOG_THROW(cond, exception, message)