MCPcopy Create free account
hub / github.com/LiangliangNan/PolyFit / optimize

Method optimize

code/method/face_selection.cpp:38–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37
38void FaceSelection::optimize(HypothesisGenerator* generator,
39 LinearProgramSolver::SolverName solver_name,
40 double data_fitting,
41 double model_coverage,
42 double model_complexity)
43 {
44 if (pset_ == nullptr || model_ == nullptr)
45 return;
46
47 facet_attrib_supporting_vertex_group_.bind_if_defined(model_, Method::facet_attrib_supporting_vertex_group);
48 if (!facet_attrib_supporting_vertex_group_.is_bound()) {
49 Logger::err("-") << "attribute " << Method::facet_attrib_supporting_vertex_group << " doesn't exist" << std::endl;
50 return;
51 }
52 facet_attrib_supporting_point_num_.bind_if_defined(model_, Method::facet_attrib_supporting_point_num);
53 if (!facet_attrib_supporting_point_num_.is_bound()) {
54 Logger::err("-") << "attribute " << Method::facet_attrib_supporting_point_num << " doesn't exist" << std::endl;
55 return;
56 }
57 facet_attrib_facet_area_.bind_if_defined(model_, Method::facet_attrib_facet_area);
58 if (!facet_attrib_facet_area_.is_bound()) {
59 Logger::err("-") << "attribute " << Method::facet_attrib_facet_area << " doesn't exist" << std::endl;
60 return;
61 }
62 facet_attrib_covered_area_.bind_if_defined(model_, Method::facet_attrib_covered_area);
63 if (!facet_attrib_covered_area_.is_bound()) {
64 Logger::err("-") << "attribute " << Method::facet_attrib_covered_area << " doesn't exist" << std::endl;
65 return;
66 }
67
68 auto adjacency = generator->extract_adjacency(model_);
69
70 edge_source_planes_.bind_if_defined(model_, "EdgeSourcePlanes");
71 vertex_source_planes_.bind_if_defined(model_, "VertexSourcePlanes");
72 facet_attrib_supporting_plane_.bind_if_defined(model_, "FacetSupportingPlane");
73
74 //////////////////////////////////////////////////////////////////////////
75
76 double total_points = double(pset_->points().size());
77 std::size_t idx = 0;
78 MapFacetAttribute<std::size_t> facet_indices(model_);
79 FOR_EACH_FACET(Map, model_, it) {
80 Map::Facet* f = it;
81 facet_indices[f] = idx;
82 ++idx;
83 }
84
85 //-------------------------------------
86
87 StopWatch w;
88 Logger::out("-") << "face selection..." << std::endl;
89
90 //-------------------------------------
91
92 // binary variables:
93 // x[0] ... x[num_faces - 1] : binary labels of all the input faces
94 // x[num_faces] ... x[num_faces + num_edges] : binary labels of all the intersecting edges (remain or not)
95 // x[num_faces + num_edges] ... x[num_faces + num_edges + num_edges] : binary labels of corner edges (sharp edge of not)

Callers 5

mainFunction · 0.95
optimizationMethod · 0.45
mainFunction · 0.45
reconstructFunction · 0.45
_solve_GUROBIMethod · 0.45

Calls 15

extract_adjacencyMethod · 0.80
bboxMethod · 0.80
create_objectiveMethod · 0.80
add_coefficientMethod · 0.80
create_n_variablesMethod · 0.80
set_variable_typeMethod · 0.80
set_boundsMethod · 0.80
create_constraintMethod · 0.80
set_boundMethod · 0.80
elapsedMethod · 0.80
erase_facetMethod · 0.80
FOR_EACH_EDGEFunction · 0.70

Tested by

no test coverage detected