Esempio n. 1
0
 public override void Post()
 {
     // Always store the demon in the constraint to avoid it being reclaimed
     // by the GC.
     demon_ = new SetMaxDemon(x_);
     x_.WhenBound(demon_);
 }
Esempio n. 2
0
 public void Demon() {
   Solver solver = new Solver("DemonTest");
   IntVar x = solver.MakeIntVar(new int[] {2, 4, -1, 6, 11, 10}, "x");
   NetDemon demon = new SetMaxDemon(x);
   Assert.Equal(11, x.Max());
   demon.Run(solver);
   Assert.Equal(10, x.Max());
 }
Esempio n. 3
0
    static void DemonTest()
    {
        Solver   solver = new Solver("DemonTest");
        IntVar   x      = solver.MakeIntVar(new int[] { 2, 4, -1, 6, 11, 10 }, "x");
        NetDemon demon  = new SetMaxDemon(x);

        CheckLongEq(x.Max(), 11, "Bad test setup");
        demon.Run(solver);
        CheckLongEq(x.Max(), 10, "The demon did not run.");
    }
Esempio n. 4
0
 public override void Post() {
   // Always store the demon in the constraint to avoid it being reclaimed
   // by the GC.
   demon_ = new SetMaxDemon(x_);
   x_.WhenBound(demon_);
 }
Esempio n. 5
0
 static void DemonTest() {
   Solver solver = new Solver("DemonTest");
   IntVar x = solver.MakeIntVar(new int[] {2, 4, -1, 6, 11, 10}, "x");
   NetDemon demon = new SetMaxDemon(x);
   CheckLongEq(x.Max(), 11, "Bad test setup");
   demon.Run(solver);
   CheckLongEq(x.Max(), 10, "The demon did not run.");
 }