File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
polygon_coverage_solvers/include/polygon_coverage_solvers/impl Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -343,7 +343,8 @@ GraphBase<NodeProperty, EdgeProperty>::getAdjacencyMatrix() const {
343343 }
344344 sort (sorted_cost.begin (), sorted_cost.end ());
345345 const double equality = 0.000001 ; // Min. considered cost difference.
346- auto min_diff = sorted_cost.back ();
346+ const double min_diff_desired = 1.1 ; // To distinguish integer value costs.
347+ auto min_diff = min_diff_desired;
347348 if (sorted_cost.back () == 0.0 ) {
348349 ROS_ERROR (" Adjacency matrix invalid. Greatest cost is 0.0." );
349350 min_diff = std::numeric_limits<double >::max ();
@@ -353,13 +354,11 @@ GraphBase<NodeProperty, EdgeProperty>::getAdjacencyMatrix() const {
353354 if (diff > equality && diff < min_diff) min_diff = diff;
354355 }
355356
356- // Only scale with min_diff if this does not blow up the cost.
357+ // Only scale with min_diff if this does not overflow the cost.
357358 // Maximum expected cost is number of clusters times max. cost per cluster.
358359 // TODO(rikba): Find a tighter upper bound.
359360 double total_cost_upper_bound = sorted_cost.back () * graph_.size ();
360- // Add 0.1 to make sure that min_diff * max_scale > 1.0 to avoid rounding
361- // errors.
362- double max_scale = 1.1 / min_diff;
361+ double max_scale = min_diff_desired / min_diff;
363362 double min_scale =
364363 std::numeric_limits<int >::max () / (total_cost_upper_bound + 1.0 );
365364 double scale = 1.0 ;
You can’t perform that action at this time.
0 commit comments