@@ -555,7 +555,7 @@ TEST(GaussianMixtureFactor, TwoStateModel2) {
555
555
using namespace test_two_state_estimation ;
556
556
557
557
double mu0 = 1.0 , mu1 = 3.0 ;
558
- double sigma0 = 6.0 , sigma1 = 4 .0 ;
558
+ double sigma0 = 0.5 , sigma1 = 2 .0 ;
559
559
auto hybridMotionModel = CreateHybridMotionModel (mu0, mu1, sigma0, sigma1);
560
560
561
561
// Start with no measurement on x1, only on x0
@@ -605,7 +605,7 @@ TEST(GaussianMixtureFactor, TwoStateModel2) {
605
605
// Now we add a measurement z1 on x1
606
606
HybridBayesNet hbn = CreateBayesNet (hybridMotionModel, true );
607
607
608
- double z1 = 2.2 ;
608
+ double z1 = 4.0 ; // favors m==1
609
609
given.insert (Z (1 ), Vector1 (z1));
610
610
611
611
HybridGaussianFactorGraph gfg = hbn.toFactorGraph (given);
@@ -636,7 +636,24 @@ TEST(GaussianMixtureFactor, TwoStateModel2) {
636
636
// Since we have a measurement on z2, we get a definite result
637
637
// Values taken from an importance sampling run with 50k samples:
638
638
// approximateDiscreteMarginal(hbn, proposalNet, given);
639
- DiscreteConditional expected (m1, " 0.446345/0.553655" );
639
+ DiscreteConditional expected (m1, " 0.481793/0.518207" );
640
+ EXPECT (assert_equal (expected, *(bn->at (2 )->asDiscrete ()), 0.01 ));
641
+ }
642
+
643
+ {
644
+ // Add a different measurement z1 on that favors m==0
645
+ HybridBayesNet hbn = CreateBayesNet (hybridMotionModel, true );
646
+
647
+ double z1 = 1.1 ;
648
+ given.insert_or_assign (Z (1 ), Vector1 (z1));
649
+
650
+ HybridGaussianFactorGraph gfg = hbn.toFactorGraph (given);
651
+ HybridBayesNet::shared_ptr bn = gfg.eliminateSequential ();
652
+
653
+ // Since we have a measurement on z2, we get a definite result
654
+ // Values taken from an importance sampling run with 50k samples:
655
+ // approximateDiscreteMarginal(hbn, proposalNet, given);
656
+ DiscreteConditional expected (m1, " 0.554485/0.445515" );
640
657
EXPECT (assert_equal (expected, *(bn->at (2 )->asDiscrete ()), 0.01 ));
641
658
}
642
659
}
0 commit comments