12 #ifndef INCLUDE_MOLASSEMBLER_DG_EXPLICIT_BOUNDS_GRAPH_H
13 #define INCLUDE_MOLASSEMBLER_DG_EXPLICIT_BOUNDS_GRAPH_H
17 #include "boost/graph/adjacency_list.hpp"
25 namespace Molassembler {
31 namespace outcome = OUTCOME_V2_NAMESPACE;
36 namespace DistanceGeometry {
39 class DistanceBoundsMatrix;
63 using EdgeWeightProperty = boost::property<boost::edge_weight_t, double>;
64 using GraphType = boost::adjacency_list<
71 using VertexDescriptor = GraphType::vertex_descriptor;
72 using EdgeDescriptor = GraphType::edge_descriptor;
74 using BoundsMatrix = Eigen::MatrixXd;
94 const BoundsMatrix& bounds
107 const std::vector<VertexDescriptor>& predecessors,
108 const std::vector<double>& distances
115 [[gnu::const]]
static inline bool isLeft(
const VertexDescriptor i) noexcept {
119 [[gnu::const]]
static inline bool sameSide(
const VertexDescriptor i,
const VertexDescriptor j) noexcept {
120 return i % 2 == j % 2;
127 [[gnu::const]]
static inline VertexDescriptor
left(
const VertexDescriptor a) noexcept {
135 [[gnu::const]]
static inline VertexDescriptor
right(
const VertexDescriptor a) noexcept {
164 double lowerBound(VertexDescriptor a, VertexDescriptor b)
const;
170 double upperBound(VertexDescriptor a, VertexDescriptor b)
const;
197 const GraphType&
graph()
const;
212 void updateOrAddEdge_(
218 void updateGraphWithFixedDistance_(
static VertexDescriptor right(const VertexDescriptor a) noexcept
Get the right subgraph vertex descriptor corresponding to an outer index.
Definition: ExplicitBoundsGraph.h:135
outcome::result< Eigen::MatrixXd > makeDistanceMatrix(Random::Engine &engine) noexcept
Generate a distance matrix.
outcome::result< Eigen::MatrixXd > makeDistanceBounds() const noexcept
Make smooth distance bounds.
Definition: DistanceBoundsMatrix.h:28
Drives a PRNG.
Definition: Prng.h:24
static bool sameSide(const VertexDescriptor i, const VertexDescriptor j) noexcept
Explain contradictions between distance bounds on a path.
Definition: ExplicitBoundsGraph.h:119
std::array< Utils::ElementType, 2 > heaviestAtoms_
Stores the two heaviest element types.
Definition: ExplicitBoundsGraph.h:210
static bool isLeft(const VertexDescriptor i) noexcept
Check whether a vertex is part of the left subgraph.
Definition: ExplicitBoundsGraph.h:115
ExplicitBoundsGraph(const PrivateGraph &inner, const DistanceBoundsMatrix &bounds)
Construct from distance bounds matrix.
Data struct for storing a numeric interval.
Library internal graph class wrapping BGL types.
Definition: PrivateGraph.h:24
void addBound(VertexDescriptor a, VertexDescriptor b, const ValueBounds &bound)
Adds a bound between outer vertex indices to the graph.
static void explainContradictionPaths(VertexDescriptor a, VertexDescriptor b, const std::vector< VertexDescriptor > &predecessors, const std::vector< double > &distances)
Explain contradictions between distance bounds on a path.
Data class for bounded values.
Definition: ValueBounds.h:23
double maximalImplicitLowerBound(VertexDescriptor i) const
Returns the length of the maximal implicit lower bound outgoing from a left vertex.
double lowerBound(VertexDescriptor a, VertexDescriptor b) const
Fetches the lower bound between outer vertex indices from the graph.
BGL wrapper to help with distance bounds smoothing.
Definition: ExplicitBoundsGraph.h:59
double upperBound(VertexDescriptor a, VertexDescriptor b) const
Fetches the upper bound between outer vertex indices from the graph.
static VertexDescriptor left(const VertexDescriptor a) noexcept
Get the left subgraph vertex descriptor corresponding to an outer index.
Definition: ExplicitBoundsGraph.h:127
Partiality
Limit triangle inequality bounds smoothing to a subset of all atoms.
Definition: Conformers.h:44
const GraphType & graph() const
Nonmodifiable access to underlying graph.