Example #1
0
        public void UndefinedFloatVarEquationHasNoEffectTest()
        {
            var p    = new Problem("test");
            var dom  = new FloatDomain("signed unit", -1, 1);
            var prop = (Proposition)"prop";
            var x    = new FloatVariable("x", dom, prop, p);
            var y    = (FloatVariable)dom.Instantiate("y");

            p.Assert(Not(prop));
            p.Assert(x == y);

            for (int i = 0; i < 100; i++)
            {
                var s = p.Solve();
                Assert.IsFalse(x.IsDefinedInInternal(s));
                Assert.IsTrue(y.IsDefinedInInternal(s));
                Assert.IsFalse(ReferenceEquals(x.Representative, y.Representative));
            }
        }
Example #2
0
        public void UndefinedFloatVarTest()
        {
            var p    = new Problem("test");
            var dom  = new FloatDomain("signed unit", -1, 1);
            var prop = (Proposition)"prop";
            var x    = new FloatVariable("x", dom, prop, p);

            p.Assert(Not(prop));
            Solution s = null;

            for (int i = 0; i < 100; i++)
            {
                s = p.Solve();
                Console.WriteLine(s.Model);
                Assert.IsFalse(s[prop]);
                Assert.IsFalse(x.IsDefinedInInternal(s));
            }
            Console.WriteLine(x.Value(s));
        }
Example #3
0
 public override bool IsDefinedIn(Solution s)
 {
     return(s[this] && Result.IsDefinedInInternal(s) && lhs.IsDefinedInInternal(s) && rhs.IsDefinedInInternal(s));
 }