fix tests
parent
4fc2387a63
commit
3ecc232c0a
|
@ -21,8 +21,8 @@
|
||||||
#include <gtsam/base/Testable.h>
|
#include <gtsam/base/Testable.h>
|
||||||
#include <gtsam/base/TestableAssertions.h>
|
#include <gtsam/base/TestableAssertions.h>
|
||||||
#include <gtsam/discrete/DiscreteConditional.h>
|
#include <gtsam/discrete/DiscreteConditional.h>
|
||||||
#include <gtsam/discrete/TableDistribution.h>
|
|
||||||
#include <gtsam/discrete/DiscreteValues.h>
|
#include <gtsam/discrete/DiscreteValues.h>
|
||||||
|
#include <gtsam/discrete/TableDistribution.h>
|
||||||
#include <gtsam/hybrid/HybridBayesNet.h>
|
#include <gtsam/hybrid/HybridBayesNet.h>
|
||||||
#include <gtsam/hybrid/HybridGaussianConditional.h>
|
#include <gtsam/hybrid/HybridGaussianConditional.h>
|
||||||
#include <gtsam/hybrid/HybridGaussianFactor.h>
|
#include <gtsam/hybrid/HybridGaussianFactor.h>
|
||||||
|
@ -145,8 +145,8 @@ TEST(HybridGaussianFactorGraph, TwoStateModel) {
|
||||||
// Importance sampling run with 100k samples gives 50.051/49.949
|
// Importance sampling run with 100k samples gives 50.051/49.949
|
||||||
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
||||||
TableDistribution expected(m1, "50 50");
|
TableDistribution expected(m1, "50 50");
|
||||||
EXPECT(assert_equal(expected,
|
EXPECT(
|
||||||
*(bn->at(2)->asDiscrete<TableDistribution>())));
|
assert_equal(expected, *(bn->at(2)->asDiscrete<TableDistribution>())));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -163,8 +163,8 @@ TEST(HybridGaussianFactorGraph, TwoStateModel) {
|
||||||
// Values taken from an importance sampling run with 100k samples:
|
// Values taken from an importance sampling run with 100k samples:
|
||||||
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
||||||
TableDistribution expected(m1, "44.3854 55.6146");
|
TableDistribution expected(m1, "44.3854 55.6146");
|
||||||
EXPECT(assert_equal(
|
EXPECT(assert_equal(expected, *(bn->at(2)->asDiscrete<TableDistribution>()),
|
||||||
expected, *(bn->at(2)->asDiscrete<TableDistribution>()), 0.02));
|
0.02));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +253,7 @@ TEST(HybridGaussianFactorGraph, TwoStateModel2) {
|
||||||
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
||||||
TableDistribution expected(m1, "48.3158 51.6842");
|
TableDistribution expected(m1, "48.3158 51.6842");
|
||||||
EXPECT(assert_equal(
|
EXPECT(assert_equal(
|
||||||
expected, *(eliminated->at(2)->asDiscrete<TableDistribution>()),
|
expected, *(eliminated->at(2)->asDiscrete<TableDistribution>()), 0.02));
|
||||||
0.02));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -269,8 +268,8 @@ TEST(HybridGaussianFactorGraph, TwoStateModel2) {
|
||||||
// Values taken from an importance sampling run with 100k samples:
|
// Values taken from an importance sampling run with 100k samples:
|
||||||
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
||||||
TableDistribution expected(m1, "55.396 44.604");
|
TableDistribution expected(m1, "55.396 44.604");
|
||||||
EXPECT(assert_equal(
|
EXPECT(assert_equal(expected, *(bn->at(2)->asDiscrete<TableDistribution>()),
|
||||||
expected, *(bn->at(2)->asDiscrete<TableDistribution>()), 0.02));
|
0.02));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,8 +346,8 @@ TEST(HybridGaussianFactorGraph, TwoStateModel3) {
|
||||||
// Values taken from an importance sampling run with 100k samples:
|
// Values taken from an importance sampling run with 100k samples:
|
||||||
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
||||||
TableDistribution expected(m1, "51.7762 48.2238");
|
TableDistribution expected(m1, "51.7762 48.2238");
|
||||||
EXPECT(assert_equal(
|
EXPECT(assert_equal(expected, *(bn->at(2)->asDiscrete<TableDistribution>()),
|
||||||
expected, *(bn->at(2)->asDiscrete<TableDistribution>()), 0.02));
|
0.02));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -363,8 +362,8 @@ TEST(HybridGaussianFactorGraph, TwoStateModel3) {
|
||||||
// Values taken from an importance sampling run with 100k samples:
|
// Values taken from an importance sampling run with 100k samples:
|
||||||
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
||||||
TableDistribution expected(m1, "49.0762 50.9238");
|
TableDistribution expected(m1, "49.0762 50.9238");
|
||||||
EXPECT(assert_equal(
|
EXPECT(assert_equal(expected, *(bn->at(2)->asDiscrete<TableDistribution>()),
|
||||||
expected, *(bn->at(2)->asDiscrete<TableDistribution>()), 0.05));
|
0.05));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,8 +389,8 @@ TEST(HybridGaussianFactorGraph, TwoStateModel4) {
|
||||||
// Values taken from an importance sampling run with 100k samples:
|
// Values taken from an importance sampling run with 100k samples:
|
||||||
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
// approximateDiscreteMarginal(hbn, hybridMotionModel, given);
|
||||||
TableDistribution expected(m1, "8.91527 91.0847");
|
TableDistribution expected(m1, "8.91527 91.0847");
|
||||||
EXPECT(assert_equal(
|
EXPECT(assert_equal(expected, *(bn->at(2)->asDiscrete<TableDistribution>()),
|
||||||
expected, *(bn->at(2)->asDiscrete<TableDistribution>()), 0.01));
|
0.01));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
@ -496,7 +495,7 @@ TEST(HybridGaussianFactorGraph, DifferentMeans) {
|
||||||
VectorValues{{X(0), Vector1(0.0)}, {X(1), Vector1(0.25)}},
|
VectorValues{{X(0), Vector1(0.0)}, {X(1), Vector1(0.25)}},
|
||||||
DiscreteValues{{M(1), 1}});
|
DiscreteValues{{M(1), 1}});
|
||||||
|
|
||||||
// EXPECT(assert_equal(expected, actual));
|
EXPECT(assert_equal(expected, actual));
|
||||||
|
|
||||||
{
|
{
|
||||||
DiscreteValues dv{{M(1), 0}};
|
DiscreteValues dv{{M(1), 0}};
|
||||||
|
@ -546,8 +545,8 @@ TEST(HybridGaussianFactorGraph, DifferentCovariances) {
|
||||||
DiscreteValues dv0{{M(1), 0}};
|
DiscreteValues dv0{{M(1), 0}};
|
||||||
DiscreteValues dv1{{M(1), 1}};
|
DiscreteValues dv1{{M(1), 1}};
|
||||||
|
|
||||||
DiscreteConditional expected_m1(m1, "0.5/0.5");
|
TableDistribution expected_m1(m1, "0.5 0.5");
|
||||||
DiscreteConditional actual_m1 = *(hbn->at(2)->asDiscrete());
|
TableDistribution actual_m1 = *(hbn->at(2)->asDiscrete<TableDistribution>());
|
||||||
|
|
||||||
EXPECT(assert_equal(expected_m1, actual_m1));
|
EXPECT(assert_equal(expected_m1, actual_m1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1063,8 +1063,8 @@ TEST(HybridNonlinearFactorGraph, DifferentCovariances) {
|
||||||
DiscreteValues dv0{{M(1), 0}};
|
DiscreteValues dv0{{M(1), 0}};
|
||||||
DiscreteValues dv1{{M(1), 1}};
|
DiscreteValues dv1{{M(1), 1}};
|
||||||
|
|
||||||
DiscreteConditional expected_m1(m1, "0.5/0.5");
|
TableDistribution expected_m1(m1, "0.5 0.5");
|
||||||
DiscreteConditional actual_m1 = *(hbn->at(2)->asDiscrete());
|
TableDistribution actual_m1 = *(hbn->at(2)->asDiscrete<TableDistribution>());
|
||||||
|
|
||||||
EXPECT(assert_equal(expected_m1, actual_m1));
|
EXPECT(assert_equal(expected_m1, actual_m1));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue