Beispiel #1
0
        public void Test()
        {
            Solver solver = new Solver(-1000, 1000);
            FltVar i0     = new FltVar(solver, 0, 10);
            FltVar i1     = new FltVar(solver, 10, 20);
            FltVar i2     = new FltVar(solver, 20, 30);
            FltVar s      = new FltVar(solver, 30, 60);

            FltVarList    list = new FltVarList(solver, new FltVar[] { i0, i1, i2 });
            FltVarListSum sum  = list.Sum();

            solver.Add(sum);
            solver.Propagate();

            Assert.AreEqual(s.Domain, sum.Var0.Domain);
        }
Beispiel #2
0
        public void Test()
        {
            Solver     solver = new Solver(-1000, 1000);
            FltVar     a      = new FltVar(solver, -10, -5, "a");
            FltVar     b      = new FltVar(solver, -1, 1, "b");
            FltVar     c      = new FltVar(solver, 5, 10, "c");
            FltVarList list   = new FltVarList(solver, new FltVar[] { a, b, c });

            IntVar          index  = new IntVar(solver);
            FltVarListIndex cons   = list.At(index);
            FltVar          result = cons.Var0;

            solver.Add(cons);
            solver.Propagate();

            result.Intersect(-8, 8);
            result.Difference(-2, 6);
            cons.Index.Difference(1);
        }