Browse Source

AbstractEquationSolver: Added more convenient getters for the most appropriate lower/upper bound of a given variable

tempestpy_adaptions
Tim Quatmann 4 years ago
parent
commit
e59918668e
No known key found for this signature in database GPG Key ID: 6EDE19592731EEC3
  1. 30
      src/storm/solver/AbstractEquationSolver.cpp
  2. 14
      src/storm/solver/AbstractEquationSolver.h

30
src/storm/solver/AbstractEquationSolver.cpp

@ -126,6 +126,21 @@ namespace storm {
return lowerBound.get();
}
template<typename ValueType>
ValueType const& AbstractEquationSolver<ValueType>::getLowerBound(uint64_t const& index) const {
if (lowerBounds) {
STORM_LOG_ASSERT(index < lowerBounds->size(), "Invalid row index " << index << " for vector of size " << lowerBounds->size());
if (lowerBound) {
return std::max(lowerBound.get(), lowerBounds.get()[index]);
} else {
return lowerBounds.get()[index];
}
} else {
STORM_LOG_ASSERT(lowerBound, "Lower bound requested but was not specified before.");
return lowerBound.get();
}
}
template<typename ValueType>
ValueType AbstractEquationSolver<ValueType>::getLowerBound(bool convertLocalBounds) const {
if (lowerBound) {
@ -142,6 +157,21 @@ namespace storm {
return upperBound.get();
}
template<typename ValueType>
ValueType const& AbstractEquationSolver<ValueType>::getUpperBound(uint64_t const& index) const {
if (upperBounds) {
STORM_LOG_ASSERT(index < upperBounds->size(), "Invalid row index " << index << " for vector of size " << upperBounds->size());
if (upperBound) {
return std::min(upperBound.get(), upperBounds.get()[index]);
} else {
return upperBounds.get()[index];
}
} else {
STORM_LOG_ASSERT(upperBound, "Upper bound requested but was not specified before.");
return upperBound.get();
}
}
template<typename ValueType>
ValueType AbstractEquationSolver<ValueType>::getUpperBound(bool convertLocalBounds) const {
if (upperBound) {

14
src/storm/solver/AbstractEquationSolver.h

@ -100,6 +100,13 @@ namespace storm {
*/
ValueType const& getLowerBound() const;
/*!
* Retrieves the lower bound for the variable with the given index (if there is any lower bound).
* @pre some lower bound (local or global) has been specified
* @return the largest lower bound known for the given row
*/
ValueType const& getLowerBound(uint64_t const& index) const;
/*!
* Retrieves the lower bound (if there is any).
* If the given flag is true and if there are only local bounds,
@ -112,6 +119,13 @@ namespace storm {
*/
ValueType const& getUpperBound() const;
/*!
* Retrieves the upper bound for the variable with the given index (if there is any upper bound).
* @pre some upper bound (local or global) has been specified
* @return the smallest upper bound known for the given row
*/
ValueType const& getUpperBound(uint64_t const& index) const;
/*!
* Retrieves the upper bound (if there is any).
* If the given flag is true and if there are only local bounds,

Loading…
Cancel
Save