40 using namespace gtsam;
90 CHECK(gnc.getFactors().equals(fg));
92 CHECK(gnc.getParams().equals(gncParams));
98 CHECK(gnc.equals(gnc2));
142 CHECK(fg.equals(gnc.getFactors()));
231 CHECK(gnc.checkMuConvergence(
mu));
241 CHECK(!gnc.checkMuConvergence(
mu));
260 double prev_cost = 1.0;
263 CHECK(!gnc.checkCostConvergence(cost, prev_cost));
271 double prev_cost = 1.0;
274 CHECK(gnc.checkCostConvergence(cost, prev_cost));
293 Vector weights = Vector::Ones(fg.size());
294 CHECK(!gnc.checkWeightsConvergence(weights));
303 Vector weights = Vector::Ones(fg.size());
305 CHECK(gnc.checkWeightsConvergence(weights));
314 Vector weights = Vector::Ones(fg.size());
316 CHECK(!gnc.checkWeightsConvergence(weights));
326 Vector weights = Vector::Ones(fg.size());
328 CHECK(gnc.checkWeightsConvergence(weights));
347 CHECK(gnc.checkCostConvergence(1.0, 1.0));
348 CHECK(!gnc.checkCostConvergence(1.0, 2.0));
361 Vector weights_expected = Vector::Zero(4);
362 weights_expected[0] = 1.0;
363 weights_expected[1] = 1.0;
364 weights_expected[2] = 1.0;
365 weights_expected[3] =
std::pow(1.0 / (50.0 + 1.0), 2);
378 weights_expected[3] =
std::pow(
mu * barcSq / (50.0 +
mu * barcSq), 2);
383 weights_actual = gnc2.calculateWeights(
initial,
mu);
396 Vector weights_expected = Vector::Zero(4);
397 weights_expected[0] = 1.0;
398 weights_expected[1] = 1.0;
399 weights_expected[2] = 1.0;
400 weights_expected[3] = 0;
432 Vector weights_expected = Vector::Zero(1);
433 weights_expected[0] = 1.0;
449 Vector weights_expected = Vector::Zero(1);
450 weights_expected[0] = 0.0;
465 Vector weights_expected = Vector::Zero(1);
466 weights_expected[0] = 0.5;
493 Vector weights = Vector::Ones(1);
524 Values actual = gnc.optimize();
558 Values gnc_result = gnc.optimize();
571 knownInliers.push_back(0);
572 knownInliers.push_back(1);
573 knownInliers.push_back(2);
584 Values gnc_result = gnc.optimize();
588 Vector finalWeights = gnc.getWeights();
601 Values gnc_result = gnc.optimize();
605 Vector finalWeights = gnc.getWeights();
621 Values gnc_result = gnc.optimize();
625 Vector finalWeights = gnc.getWeights();
648 knownInliers.push_back(0);
649 knownInliers.push_back(1);
650 knownInliers.push_back(2);
659 CHECK(
assert_equal(4.605170185988091 * Vector::Ones(fg.size()), gnc.getInlierCostThresholds(), 1
e-3));
679 gnc.getInlierCostThresholds(), 1
e-3));
695 knownInliers.push_back(0);
696 knownInliers.push_back(1);
697 knownInliers.push_back(2);
706 Values gnc_result = gnc.optimize();
710 Vector finalWeights = gnc.getWeights();
714 CHECK(
assert_equal(2.0 * Vector::Ones(fg.size()), gnc.getInlierCostThresholds(), 1
e-3));
724 Values gnc_result = gnc.optimize();
728 Vector finalWeights = gnc.getWeights();
732 CHECK(
assert_equal(2.0 * Vector::Ones(fg.size()), gnc.getInlierCostThresholds(), 1
e-3));
769 Values actual = gnc.optimize();
787 knownInliers.push_back(0);
788 knownInliers.push_back(1);
789 knownInliers.push_back(2);
792 knownOutliers.push_back(3);
802 Values gnc_result = gnc.optimize();
806 Vector finalWeights = gnc.getWeights();
816 knownInliers.push_back(2);
817 knownInliers.push_back(0);
820 knownOutliers.push_back(3);
830 Values gnc_result = gnc.optimize();
834 Vector finalWeights = gnc.getWeights();
844 knownOutliers.push_back(3);
853 Values gnc_result = gnc.optimize();
857 Vector finalWeights = gnc.getWeights();
877 Vector weights = 0.5 * Vector::Ones(fg.size());
881 gnc.setInlierCostThresholds(1.0);
882 Values gnc_result = gnc.optimize();
886 Vector finalWeights = gnc.getWeights();
897 Vector weights = Vector::Zero(fg.size());
904 gnc.setInlierCostThresholds(1.0);
905 Values gnc_result = gnc.optimize();
909 Vector finalWeights = gnc.getWeights();
919 knownInliers.push_back(2);
920 knownInliers.push_back(0);
923 knownOutliers.push_back(3);
929 Vector weights = 0.5 * Vector::Ones(fg.size());
933 gnc.setInlierCostThresholds(1.0);
934 Values gnc_result = gnc.optimize();
938 Vector finalWeights = gnc.getWeights();