20 #ifndef OPM_TRACK_ORDERING_TSP_HPP 21 #define OPM_TRACK_ORDERING_TSP_HPP 28 #include <initializer_list> 30 #include <type_traits> 86 [[nodiscard]] constexpr
bool isValid() const noexcept
88 auto&& [ij, k, z, dir, z_scale] = *
this;
90 []<
typename... Ts>(Ts&&...) {
91 static_assert((std::same_as<
double, std::decay_t<Ts>> && ...),
92 "TrackCostWeights must only contain double members.");
93 }(ij, k, z, dir, z_scale);
95 const auto all_nonneg = std::ranges::
96 all_of(std::initializer_list {ij, k, z, dir, z_scale},
97 [](
const auto w) {
return w >= 0.0; });
107 && std::ranges::any_of(std::initializer_list {ij, k, z, dir},
108 [](
const auto w) {
return w > 0.0; });
134 std::vector<std::size_t>
135 order(std::span<const Connection> connections)
const;
145 std::vector<std::size_t>
146 order(std::span<const Connection> connections,
147 const TrackCostWeights& weights)
const;
156 struct CandidateStart
161 std::int_least64_t ijdist2 {};
173 std::size_t index {};
179 auto operator<=>(
const CandidateStart&)
const =
default;
192 std::size_t numStartPoints_{1};
200 std::vector<CandidateStart>
201 determineStartPoints(std::span<const Connection> connections)
const;
206 #endif // OPM_TRACK_ORDERING_TSP_HPP double w_k
Weight for logical K-index step distance.
Definition: TrackOrderingTSP.hpp:51
TrackOrderingTSP & numberOfStartPoints(std::size_t numStarts)
Set number of start points from which to explore path creation.
Definition: TrackOrderingTSP.cpp:298
TrackOrderingTSP(int headI, int headJ)
Construct with the well-head logical cartesian indices.
Definition: TrackOrderingTSP.cpp:292
double w_ij
Weight for horizontal logical-grid distance in the I/J plane.
Definition: TrackOrderingTSP.hpp:48
double w_dir
Weight for direction-misalignment penalty between successive connections and their step vector...
Definition: TrackOrderingTSP.hpp:58
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
std::vector< std::size_t > order(std::span< const Connection > connections) const
Return the permutation that puts connections in TRACK order, using default-constructed TrackCostWeigh...
Definition: TrackOrderingTSP.cpp:309
double w_z
Weight for geometric depth difference.
Definition: TrackOrderingTSP.hpp:54
constexpr bool isValid() const noexcept
Check if the weights are valid for use in the edge-cost function.
Definition: TrackOrderingTSP.hpp:86
double z_to_ij_scale
Scale factor that maps depth differences into the I/J distance metric used by the direction penalty t...
Definition: TrackOrderingTSP.hpp:77
Cost weights controlling the TRACK edge-cost function.
Definition: TrackOrderingTSP.hpp:45
Multi-start nearest-neighbour + 2-opt TSP heuristic for TRACK ordering of well connections.
Definition: TrackOrderingTSP.hpp:41