16#include "dlinear/libs/libgmp.h"
17#include "dlinear/solver/BoundIterator.h"
18#include "dlinear/solver/LpColBound.h"
19#include "dlinear/symbolic/literal.h"
20#include "dlinear/util/SortedVector.hpp"
133 void SetBounds(
const mpq_class& lb,
const mpq_class& ub);
241 [[nodiscard]]
const Bound& operator[](std::size_t idx)
const {
return bounds_[idx]; }
266 [[nodiscard]]
bool ViolatedNqBounds(
const mpq_class& lb,
const mpq_class& ub)
const;
281 [[nodiscard]]
bool IsLowerBound(
const mpq_class& value)
const;
289 [[nodiscard]]
bool IsUpperBound(
const mpq_class& value)
const;
326 [[nodiscard]] BoundIterator
GetActiveBound(
const mpq_class& lb,
const mpq_class& ub)
const;
337 [[nodiscard]] BoundIterator
GetActiveBounds(
const mpq_class& lb,
const mpq_class& ub)
const;
348using BoundVectorMap = std::map<Variable, BoundVector>;
349using BoundVectorVector = std::vector<BoundVector>;
351std::ostream& operator<<(std::ostream& os,
const BoundVector& bounds_vector);
352std::ostream& operator<<(std::ostream& os,
const BoundVectorMap& bounds_vector_map);
353std::ostream& operator<<(std::ostream& os,
const BoundVectorVector& bounds_vector_vector);
357#ifdef DLINEAR_INCLUDE_FMT
359#include "dlinear/util/logging.h"
363OSTREAM_FORMATTER(dlinear::BoundVectorMap)
364OSTREAM_FORMATTER(dlinear::BoundVectorVector)
Data structure to store the LP solver bounds in a sorted vector to determine the active lower and upp...
const mpq_class * active_upper_bound_
Active upper bound.
void SetUpperBound(const mpq_class &value)
Manually set the active upper bound to value.
BoundIterator GetActiveBounds() const
Return a BoundIterator containing a set of bounds enclosing the interval [active_lower_bound_,...
void SetLowerBound(const mpq_class &value)
Manually set the active lower bound to value.
int n_lower_bounds() const
Return the number of lower bounds in the vector, both strict and non-strict.
const mpq_class * active_lower_bound_
Active lower bound.
std::size_t n_lower_bounds_
Number of lower bounds, both strict and non-strict.
Bounds nq_bounds_
Non-equality bounds.
const mpq_class * GetActiveEqualityBound() const
Return the active equality bound.
BoundVector(const mpq_class &inf_l, const mpq_class &inf_u)
Construct a new BoundVector using inf_l as the the lower bound and inf_u as the upper bound.
const mpq_class & active_lower_bound() const
Get read-only access to the active_lower_bound of the BoundVector.
bool RemoveBound(const Bound &bound)
Remove bound from the vector if it is present.
Bounds::const_iterator LowerBoundEnd() const
Return an iterator over bounds_ after the last lower bound and to the first upper bound.
BoundIterator AddBound(const Bound &bound)
Add a new bound to the vector.
const mpq_class & active_upper_bound() const
Get read-only access to the active_upper_bound of the BoundVector.
LiteralSet GetActiveExplanation() const
Produce a LiteralSet containing all the active bounds that can be used as an explanation.
bool IsUpperBound(const mpq_class &value) const
Check if value represents an upper bound.
bool IsActiveEquality(const mpq_class &value) const
Check if value represents an equality bound.
bool IsBounded() const
Check if the vector has an upper bound and lower bound.
void Clear()
Clear the vector and reset the active bounds.
const mpq_class * inf_u_
Starting upper bound.
BoundIterator ViolatedBounds(const mpq_class &value, LpColBound lp_bound) const
Check if the combination of value and lp_bound violates any of the existing bounds.
bool IsLowerBound(const mpq_class &value) const
Check if value represents a lower bound.
std::pair< const mpq_class &, const mpq_class & > GetActiveBoundsValue() const
Return a pair containing the active lower and upper bound.
const Bounds & bounds() const
Get read-only access to the bounds vector of the BoundVector.
const Bounds & nq_bounds() const
Get read-only access to the non-equal-to bounds vector of the BoundVector.
const mpq_class * inf_l_
Starting lower bound.
int n_upper_bounds() const
Return the number of upper bounds in the vector, both strict and non-strict.
bool IsLowerBounded() const
Check if the vector has a lower bound greater than inf_l_.
Bounds bounds_
Equality and inequality bounds.
bool IsUpperBounded() const
Check if the vector has an upper bound lower than inf_u_.
const mpq_class & inf_u() const
Get read-only access to the positive infinity bound of the BoundVector.
bool ViolatedNqBounds() const
Check if the active bounds violate any of the existing non-equality bounds.
BoundIterator GetActiveBound() const
Return a BoundIterator containing a minimal set of bounds enclosing the interval [active_lower_bound_...
LiteralSet GetActiveEqExplanation() const
Produce a LiteralSet containing all the active bounds that can be used as an explanation,...
const mpq_class & inf_l() const
Get read-only access to the negative lower bound of the BoundVector.
void SetBounds(const mpq_class &lb, const mpq_class &ub)
Manually set the active bounds to lb and ub.
size_t size() const
Get read-only access to the size of the vector.
typename std::vector< Bound >::const_iterator const_iterator
Global namespace for the dlinear library.
LpColBound
Describe the bound of a linear program variable.
std::set< Literal > LiteralSet
A set of literals.
Tuple containing the value, bound type and theory literal associated with the bound.
A literal is a variable with an associated truth value, indicating whether it is true or false.