locked
calculation precision (Migrated from community.research.microsoft.com) RRS feed

  • Question

  • amchiclet posted on 03-04-2010 1:56 PM

    I have the following code.

                Variable<bool> x = Variable.Bernoulli(0.5);
                Variable<bool> y = Variable.Bernoulli(0.5);

                Variable<bool> xt = (x == true);
                Variable<bool> xf = (x == false);
                Variable<bool> yt = (y == true);
                Variable<bool> yf = (y == false);

                Variable<bool> tt = (xt & yt);
                Variable<bool> ff = (xf & yf);

    When I use this constraint:

                Variable.ConstrainEqualRandom(tt, Bernoulli.FromLogOdds(Math.Log(2.0)));

    I get: x = Bernoulli(0.6), y = Bernoulli(0.6)

    However, when I use this constraint:

                Variable.ConstrainEqualRandom(tt & !ff, Bernoulli.FromLogOdds(Math.Log(2.0)));

    I get: x = Bernoulli(0.6115), y = Bernoulli(0.6115)

    I thought both constraints should yield equivalent results. Is anything happening differently in the background?

    Friday, June 3, 2011 5:36 PM

Answers

All replies