ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
Solidifier.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6#include "reusex/reconstruction/CellComplex.hpp"
7
8#include <functional>
9#include <memory>
10#include <optional>
11#include <set>
12#include <string>
13#include <unordered_map>
14#include <utility>
15#include <vector>
16
17namespace reusex::geometry {
18
36
38const char *to_string(SolveStatus status);
39
49
52SolverChoice parse_solver_choice(const std::string &s);
53
58 double time_limit_seconds = 120.0;
59
61 double alpha = 0.04;
62
64 double mip_gap = -1.0;
65
72 bool sectioned = true;
73
77 size_t sectioned_threshold = 2000;
78
81};
82
86 int section = -1;
87 size_t cells = 0;
88 size_t variables = 0;
89 size_t constraints = 0;
90 double seconds = 0.0;
92 bool used_highs_fallback = false;
93};
94
102 public:
105
106 Solidifier() = delete;
107 explicit Solidifier(std::shared_ptr<const CellComplex> cc,
110
111 // Delete copy (contains unique_ptr to incomplete type)
112 Solidifier(const Solidifier &) = delete;
113 Solidifier &operator=(const Solidifier &) = delete;
114
115 // Delete move (simpler, could be implemented if needed)
116 Solidifier(Solidifier &&) = delete;
118
124 std::optional<std::pair<std::unordered_map<Cd, int>,
125 std::unordered_map<Cd, std::set<int>>>>
127
135
142 const std::vector<SectionSolveStats> &section_stats() const;
143
149 std::pair<Eigen::MatrixXd, Eigen::MatrixXi>
150 toMesh(std::function<bool(const Cd)> filter);
151
152 protected:
153 // Internal accessor for implementations in separate compilation units
154 std::shared_ptr<const CellComplex> get_cell_complex() const;
155
156 private:
157 class Impl;
158 std::unique_ptr<Impl> pimpl_;
159};
160
161} // namespace reusex::geometry
boost::graph_traits< Graph >::vertex_descriptor Vertex
Solidifier(Solidifier &&)=delete
SolveStatus last_solve_status() const
Status of the most recent solve() call.
std::pair< Eigen::MatrixXd, Eigen::MatrixXi > toMesh(std::function< bool(const Cd)> filter)
Convert solved cell complex to mesh.
Solidifier & operator=(Solidifier &&)=delete
Solidifier(const Solidifier &)=delete
std::shared_ptr< const CellComplex > get_cell_complex() const
Solidifier(std::shared_ptr< const CellComplex > cc, SolidifierOptions options=SolidifierOptions{})
std::optional< std::pair< std::unordered_map< Cd, int >, std::unordered_map< Cd, std::set< int > > > > solve()
Solve the MIP problem for room segmentation.
Solidifier & operator=(const Solidifier &)=delete
const std::vector< SectionSolveStats > & section_stats() const
Per-section solve diagnostics from the most recent solve().
std::string_view to_string(ComponentType type)
SolverChoice
Which MIP backend the Solidifier should use for each (sub)problem.
SolveStatus
Backend-agnostic classification of the last MIP solve outcome.
SolverChoice parse_solver_choice(const std::string &s)
Parse a –solver CLI string ("auto"/"cuopt"/"highs") into a SolverChoice.
void error(fmt::format_string< Args... > format, Args &&...args)
Definition logging.hpp:100
Per-section solve diagnostics (issue #226).
int section
Section (storey) index.
size_t variables
MIP variables created.
size_t cells
Cells in this section's subproblem.
bool used_highs_fallback
True if HiGHS retried after primary.
size_t constraints
MIP constraints created.
double seconds
Wall-clock solve time.
double time_limit_seconds
Wall-clock time limit for the MIP solve, in seconds.
double alpha
Weight on the wall/complexity term of the objective (was hardcoded).
bool sectioned
Solve the MIP per horizontal section (storey) instead of monolithically, when the arrangement has mor...
SolverChoice solver
Solver backend selection + fallback policy (issue #226).
double mip_gap
Relative MIP gap tolerance. Negative => use the solver default.
size_t sectioned_threshold
Only take the sectioned path when the monolithic problem would have at least this many cells.