#pragma once #include #include "storm/solver/SolverGuarantee.h" #include "storm/storage/BitVector.h" namespace storm { namespace solver { template class TerminationCondition { public: /*! * Retrieves whether the guarantee provided by the solver for the current result is sufficient to terminate. */ virtual bool terminateNow(std::vector const& currentValues, SolverGuarantee const& guarantee = SolverGuarantee::None) const = 0; }; template class NoTerminationCondition : public TerminationCondition { public: virtual bool terminateNow(std::vector const& currentValues, SolverGuarantee const& guarantee = SolverGuarantee::None) const override; }; template class TerminateIfFilteredSumExceedsThreshold : public TerminationCondition { public: TerminateIfFilteredSumExceedsThreshold(storm::storage::BitVector const& filter, ValueType const& threshold, bool strict); bool terminateNow(std::vector const& currentValues, SolverGuarantee const& guarantee = SolverGuarantee::None) const; protected: ValueType threshold; storm::storage::BitVector filter; bool strict; }; template class TerminateIfFilteredExtremumExceedsThreshold : public TerminateIfFilteredSumExceedsThreshold{ public: TerminateIfFilteredExtremumExceedsThreshold(storm::storage::BitVector const& filter, bool strict, ValueType const& threshold, bool useMinimum); bool terminateNow(std::vector const& currentValue, SolverGuarantee const& guarantee = SolverGuarantee::None) const; protected: bool useMinimum; }; template class TerminateIfFilteredExtremumBelowThreshold : public TerminateIfFilteredSumExceedsThreshold{ public: TerminateIfFilteredExtremumBelowThreshold(storm::storage::BitVector const& filter, bool strict, ValueType const& threshold, bool useMinimum); bool terminateNow(std::vector const& currentValue, SolverGuarantee const& guarantee = SolverGuarantee::None) const; protected: bool useMinimum; }; } }