13template<
typename ValueType>
15 return terminateNow([¤tValues](uint64_t
const& i) {
return currentValues[i]; }, guarantee);
18template<
typename ValueType>
23template<
typename ValueType>
28template<
typename ValueType>
31 : threshold(threshold), filter(filter), strict(strict) {
35template<
typename ValueType>
42 ValueType sum = storm::utility::zero<ValueType>();
43 for (
auto pos : filter) {
44 sum += valueGetter(pos);
47 return strict ? sum > this->threshold : sum >= this->threshold;
50template<
typename ValueType>
55template<
typename ValueType>
57 ValueType
const& threshold,
bool useMinimum)
60 STORM_LOG_THROW(!this->filter.
empty(), storm::exceptions::InvalidArgumentException,
"Empty Filter; Can not take extremum over empty set.");
64template<
typename ValueType>
71 ValueType extremum = valueGetter(cachedExtremumIndex);
72 if (useMinimum && (this->strict ? extremum <= this->threshold : extremum < this->threshold)) {
79 for (
auto pos : this->filter) {
80 extremum = std::min(valueGetter(pos), extremum);
81 if (extremum <= this->threshold) {
82 cachedExtremumIndex = pos;
87 for (
auto pos : this->filter) {
88 extremum = std::min(valueGetter(pos), extremum);
89 if (extremum < this->threshold) {
90 cachedExtremumIndex = pos;
96 for (
auto pos : this->filter) {
97 extremum = std::max(valueGetter(pos), extremum);
101 return this->strict ? extremum > this->threshold : extremum >= this->threshold;
104template<
typename ValueType>
109template<
typename ValueType>
111 ValueType
const& threshold,
bool useMinimum)
113 STORM_LOG_THROW(!this->filter.
empty(), storm::exceptions::InvalidArgumentException,
"Empty Filter; Can not take extremum over empty set.");
117template<
typename ValueType>
124 ValueType extremum = valueGetter(cachedExtremumIndex);
125 if (!useMinimum && (this->strict ? extremum >= this->threshold : extremum > this->threshold)) {
131 for (
auto pos : this->filter) {
132 extremum = std::min(valueGetter(pos), extremum);
136 for (
auto pos : this->filter) {
137 extremum = std::max(valueGetter(pos), extremum);
138 if (extremum >= this->threshold) {
139 cachedExtremumIndex = pos;
144 for (
auto pos : this->filter) {
145 extremum = std::max(valueGetter(pos), extremum);
146 if (extremum > this->threshold) {
147 cachedExtremumIndex = pos;
154 return this->strict ? extremum < this->threshold : extremum <= this->threshold;
157template<
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.
uint64_t getNextSetIndex(uint64_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)