Example #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_);
 }
 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());
 }
Example #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.");
    }
Example #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_);
 }
Example #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.");
 }