public void ConstraintConstructor() {
        Solver solver = new Solver("Solver");
        IntVar x = solver.MakeIntVar(3, 7, "x");
        Assert.Equal("x(3..7)", x.ToString());

        // Unary operator
        Constraint c0 = (x == 5);
        Assert.Equal("(x(3..7) == 5)", c0.ToString());
        IntExpr e1 = -c0;
        Assert.Equal("-(Watch<x == 5>(0 .. 1))", e1.ToString());
        IntExpr e2 = c0.Abs();
        Assert.Equal("Watch<x == 5>(0 .. 1)", e2.ToString());
        IntExpr e3 = c0.Square();
        Assert.Equal("IntSquare(Watch<x == 5>(0 .. 1))", e3.ToString());

        // Relational operator with a scalar
        Constraint c1 = x == 5;
        Assert.Equal("(x(3..7) == 5)", c1.ToString());
        Constraint c2 = x >= 5;
        Assert.Equal("(x(3..7) >= 5)", c2.ToString());
        Constraint c3 = x > 5;
        Assert.Equal("(x(3..7) >= 6)", c3.ToString());
        Constraint c4 = x <= 5;
        Assert.Equal("(x(3..7) <= 5)", c4.ToString());
        Constraint c5 = x < 5;
        Assert.Equal("(x(3..7) <= 4)", c5.ToString());
        Constraint c6 = x != 5;
        Assert.Equal("(x(3..7) != 5)", c6.ToString());
        Constraint c7 = x == 2;
        Assert.Equal("FalseConstraint()", c7.ToString());
      }
      public void ConstraintAndIntVar() {
        Solver solver = new Solver("Solver");
        IntVar x = solver.MakeIntVar(3, 13, "x");
        Assert.Equal(3, x.Min());
        Assert.Equal(13, x.Max());

        Constraint c1 = x == 7;
        Assert.Equal("(x(3..13) == 7)", c1.ToString());

        IntVar y = solver.MakeIntVar(5, 17, "y");
        Assert.Equal(5, y.Min());
        Assert.Equal(17, y.Max());

        // Arithmetic operator with IntVar
        IntExpr e3a = c1 + y;
        Assert.Equal("(Watch<x == 7>(0 .. 1) + y(5..17))", e3a.ToString());
        IntExpr e3b = y + c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) + y(5..17))", e3b.ToString());

        IntExpr e3c = c1 - y;
        Assert.Equal("(Watch<x == 7>(0 .. 1) - y(5..17))", e3c.ToString());
        IntExpr e3d = y - c1;
        Assert.Equal("(y(5..17) - Watch<x == 7>(0 .. 1))", e3d.ToString());

        IntExpr e3e = c1 * y;
        Assert.Equal("(Watch<x == 7>(0 .. 1) * y(5..17))", e3e.ToString());
        IntExpr e3f = y * c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) * y(5..17))", e3f.ToString());

        // Relational operator with an IntVar
        Constraint c9a = c1 == y;
        Assert.Equal("Watch<x == 7>(0 .. 1) == y(5..17)", c9a.ToString());
        Constraint c9b = y == c1;
        Assert.Equal("y(5..17) == Watch<x == 7>(0 .. 1)", c9b.ToString());

        Constraint c9c = c1 != y;
        Assert.Equal("Watch<x == 7>(0 .. 1) != y(5..17)", c9c.ToString());
        Constraint c9d = y != c1;
        Assert.Equal("y(5..17) != Watch<x == 7>(0 .. 1)", c9d.ToString());

        Constraint c9e = c1 >= y;
        Assert.Equal("y(5..17) <= Watch<x == 7>(0 .. 1)", c9e.ToString());
        Constraint c9f = y >= c1;
        Assert.Equal("Watch<x == 7>(0 .. 1) <= y(5..17)", c9f.ToString());

        Constraint c9g = c1 > y;
        Assert.Equal("y(5..17) < Watch<x == 7>(0 .. 1)", c9g.ToString());
        Constraint c9h = y > c1;
        Assert.Equal("Watch<x == 7>(0 .. 1) < y(5..17)", c9h.ToString());

        Constraint c9i = c1 <= y;
        Assert.Equal("Watch<x == 7>(0 .. 1) <= y(5..17)", c9i.ToString());
        Constraint c9j = y <= c1;
        Assert.Equal("y(5..17) <= Watch<x == 7>(0 .. 1)", c9j.ToString());

        Constraint c9k = c1 < y;
        Assert.Equal("Watch<x == 7>(0 .. 1) < y(5..17)", c9k.ToString());
        Constraint c9l = y < c1;
        Assert.Equal("y(5..17) < Watch<x == 7>(0 .. 1)", c9l.ToString());
      }
      public void ConstraintAndScalar() {
        Solver solver = new Solver("Solver");
        IntVar x = solver.MakeIntVar(3, 13, "x");
        Assert.Equal(3, x.Min());
        Assert.Equal(13, x.Max());

        Constraint c1 = (x == 7);
        Assert.Equal("(x(3..13) == 7)", c1.ToString());

        // Arithmetic operator with a scalar
        IntExpr e2a = c1 + 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) + 1)", e2a.ToString());
        IntExpr e2b = 1 + c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) + 1)", e2b.ToString());

        IntExpr e2c = c1 - 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) + -1)", e2c.ToString());
        IntExpr e2d = 1 - c1;
        Assert.Equal("Not(Watch<x == 7>(0 .. 1))", e2d.ToString());

        IntExpr e2e = c1 * 2;
        Assert.Equal("(Watch<x == 7>(0 .. 1) * 2)", e2e.ToString());
        IntExpr e2f = 2 * c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) * 2)", e2f.ToString());

        IntExpr e2g = c1 / 4;
        Assert.Equal("(Watch<x == 7>(0 .. 1) div 4)", e2g.ToString());

        // Relational operator with a scalar
        Constraint c8a = c1 == 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) == 1)", c8a.ToString());
        Constraint c8b = 1 == c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) == 1)", c8b.ToString());

        Constraint c8c = c1 != 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) != 1)", c8c.ToString());
        Constraint c8d = 1 != c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) != 1)", c8d.ToString());

        Constraint c8e = c1 >= 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) >= 1)", c8e.ToString());
        Constraint c8f = 1 >= c1;
        Assert.Equal("TrueConstraint()", c8f.ToString());

        Constraint c8g = c1 > 1;
        Assert.Equal("FalseConstraint()", c8g.ToString());
        Constraint c8h = 1 > c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) <= 0)", c8h.ToString());

        Constraint c8i = c1 <= 1;
        Assert.Equal("TrueConstraint()", c8i.ToString());
        Constraint c8j = 1 <= c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) >= 1)", c8j.ToString());

        Constraint c8k = c1 < 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) <= 0)", c8k.ToString());
        Constraint c8l = 1 < c1;
        Assert.Equal("FalseConstraint()", c8l.ToString());
      }
      public void GreaterIntExprAndIntVar() {
        Solver solver = new Solver("Solver");
        IntVar x = solver.MakeIntVar(3, 13, "x");
        Assert.Equal(3, x.Min());
        Assert.Equal(13, x.Max());

        IntVar y = solver.MakeIntVar(5, 17, "y");
        Assert.Equal(5, y.Min());
        Assert.Equal(17, y.Max());

        // Arithmetic operator with IntVar
        IntExpr e3a = (x >= 7) + y;
        Assert.Equal("(Watch<x >= 7>(0 .. 1) + y(5..17))", e3a.ToString());
        IntExpr e3b = y + (x >= 7);
        Assert.Equal("(Watch<x >= 7>(0 .. 1) + y(5..17))", e3b.ToString());

        IntExpr e3c = (x >= 7) - y;
        Assert.Equal("(Watch<x >= 7>(0 .. 1) - y(5..17))", e3c.ToString());
        IntExpr e3d = y - (x >= 7);
        Assert.Equal("(y(5..17) - Watch<x >= 7>(0 .. 1))", e3d.ToString());

        IntExpr e3e = (x >= 7) * y;
        Assert.Equal("(Watch<x >= 7>(0 .. 1) * y(5..17))", e3e.ToString());
        IntExpr e3f = y * (x >= 7);
        Assert.Equal("(Watch<x >= 7>(0 .. 1) * y(5..17))", e3f.ToString());

        // Relational operator with an IntVar
        Constraint c9a = (x >= 7) == y;
        Assert.Equal("Watch<x >= 7>(0 .. 1) == y(5..17)", c9a.ToString());
        Constraint c9b = y == (x >= 7);
        Assert.Equal("y(5..17) == Watch<x >= 7>(0 .. 1)", c9b.ToString());

        Constraint c9c = (x >= 7) != y;
        Assert.Equal("Watch<x >= 7>(0 .. 1) != y(5..17)", c9c.ToString());
        Constraint c9d = y != (x >= 7);
        Assert.Equal("y(5..17) != Watch<x >= 7>(0 .. 1)", c9d.ToString());

        Constraint c9e = (x >= 7) >= y;
        Assert.Equal("y(5..17) <= Watch<x >= 7>(0 .. 1)", c9e.ToString());
        Constraint c9f = y >= (x >= 7);
        Assert.Equal("Watch<x >= 7>(0 .. 1) <= y(5..17)", c9f.ToString());

        Constraint c9g = (x >= 7) > y;
        Assert.Equal("y(5..17) < Watch<x >= 7>(0 .. 1)", c9g.ToString());
        Constraint c9h = y > (x >= 7);
        Assert.Equal("Watch<x >= 7>(0 .. 1) < y(5..17)", c9h.ToString());

        Constraint c9i = (x >= 7) <= y;
        Assert.Equal("Watch<x >= 7>(0 .. 1) <= y(5..17)", c9i.ToString());
        Constraint c9j = y <= (x >= 7);
        Assert.Equal("y(5..17) <= Watch<x >= 7>(0 .. 1)", c9j.ToString());

        Constraint c9k = (x >= 7) < y;
        Assert.Equal("Watch<x >= 7>(0 .. 1) < y(5..17)", c9k.ToString());
        Constraint c9l = y < (x >= 7);
        Assert.Equal("y(5..17) < Watch<x >= 7>(0 .. 1)", c9l.ToString());
      }
      public void IntExprAndScalar() {
        Solver solver = new Solver("Solver");
        IntVar x = solver.MakeIntVar(3, 13, "x");
        Assert.Equal(3, x.Min());
        Assert.Equal(13, x.Max());

        // Arithmetic operator with a scalar
        IntExpr e2a = (x == 7) + 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) + 1)", e2a.ToString());
        IntExpr e2b = 1 + (x == 7);
        Assert.Equal("(Watch<x == 7>(0 .. 1) + 1)", e2b.ToString());

        IntExpr e2c = (x == 7) - 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) + -1)", e2c.ToString());
        IntExpr e2d = 1 - (x == 7);
        Assert.Equal("Not(Watch<x == 7>(0 .. 1))", e2d.ToString());

        IntExpr e2e = (x == 7) * 2;
        Assert.Equal("(Watch<x == 7>(0 .. 1) * 2)", e2e.ToString());
        IntExpr e2f = 2 * (x == 7);
        Assert.Equal("(Watch<x == 7>(0 .. 1) * 2)", e2f.ToString());

        IntExpr e2g = (x == 7) / 4;
        Assert.Equal("(Watch<x == 7>(0 .. 1) div 4)", e2g.ToString());

        // Relational operator with a scalar
        Constraint c8a = (x == 7) == 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) == 1)", c8a.ToString());
        Constraint c8b = 1 == (x == 7);
        Assert.Equal("(Watch<x == 7>(0 .. 1) == 1)", c8b.ToString());

        Constraint c8c = (x == 7) != 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) != 1)", c8c.ToString());
        Constraint c8d = 1 != (x == 7);
        Assert.Equal("(Watch<x == 7>(0 .. 1) != 1)", c8d.ToString());

        Constraint c8e = (x == 7) >= 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) >= 1)", c8e.ToString());
        Constraint c8f = 1 >= (x == 7);
        Assert.Equal("TrueConstraint()", c8f.ToString());

        Constraint c8g = (x == 7) > 1;
        Assert.Equal("FalseConstraint()", c8g.ToString());
        Constraint c8h = 1 > (x == 7);
        Assert.Equal("(Watch<x == 7>(0 .. 1) <= 0)", c8h.ToString());

        Constraint c8i = (x == 7) <= 1;
        Assert.Equal("TrueConstraint()", c8i.ToString());
        Constraint c8j = 1 <= (x == 7);
        Assert.Equal("(Watch<x == 7>(0 .. 1) >= 1)", c8j.ToString());

        Constraint c8k = (x == 7) < 1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) <= 0)", c8k.ToString());
        Constraint c8l = 1 < (x == 7);
        Assert.Equal("FalseConstraint()", c8l.ToString());
      }
      public void ConstraintAndIntExpr() {
        Solver solver = new Solver("Solver");
        IntVar x = solver.MakeIntVar(3, 13, "x");
        Assert.Equal(3, x.Min());
        Assert.Equal(13, x.Max());
        Constraint c1 = x == 7;
        Assert.Equal("(x(3..13) == 7)", c1.ToString());

        IntVar y = solver.MakeIntVar(5, 17, "y");
        Assert.Equal(5, y.Min());
        Assert.Equal(17, y.Max());

        // Arithmetic operator with an IntExpr
        IntExpr e11a = c1 + (y == 11);
        Assert.Equal("(Watch<x == 7>(0 .. 1) + Watch<y == 11>(0 .. 1))", e11a.ToString());
        IntExpr e11b = (y == 11) + c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) + Watch<y == 11>(0 .. 1))", e11b.ToString());
        IntExpr e11c = c1 - (y == 11);
        Assert.Equal("(Watch<x == 7>(0 .. 1) - Watch<y == 11>(0 .. 1))", e11c.ToString());
        IntExpr e11d = (y == 11) - c1;
        Assert.Equal("(Watch<y == 11>(0 .. 1) - Watch<x == 7>(0 .. 1))", e11d.ToString());
        IntExpr e11e = c1 * (y == 11);
        Assert.Equal("(Watch<x == 7>(0 .. 1) * Watch<y == 11>(0 .. 1))", e11e.ToString());
        IntExpr e11f = (y == 11) * c1;
        Assert.Equal("(Watch<x == 7>(0 .. 1) * Watch<y == 11>(0 .. 1))", e11f.ToString());

        // Relational operator with an IntExpr
        Constraint c12a = c1 == (y == 11);
        Assert.Equal("Watch<x == 7>(0 .. 1) == Watch<y == 11>(0 .. 1)", c12a.ToString());
        Constraint c12b = (y == 11) == c1;
        Assert.Equal("Watch<y == 11>(0 .. 1) == Watch<x == 7>(0 .. 1)", c12b.ToString());
        Constraint c12c = c1 != (y == 11);
        Assert.Equal("Watch<x == 7>(0 .. 1) != Watch<y == 11>(0 .. 1)", c12c.ToString());
        Constraint c12d = (y == 11) != c1;
        Assert.Equal("Watch<y == 11>(0 .. 1) != Watch<x == 7>(0 .. 1)", c12d.ToString());
        Constraint c12e = c1 >= (y == 11);
        Assert.Equal("Watch<y == 11>(0 .. 1) <= Watch<x == 7>(0 .. 1)", c12e.ToString());
        Constraint c12f = (y == 11) >= c1;
        Assert.Equal("Watch<x == 7>(0 .. 1) <= Watch<y == 11>(0 .. 1)", c12f.ToString());
        Constraint c12g = c1 > (y == 11);
        Assert.Equal("Watch<y == 11>(0 .. 1) < Watch<x == 7>(0 .. 1)", c12g.ToString());
        Constraint c12h = (y == 11) > c1;
        Assert.Equal("Watch<x == 7>(0 .. 1) < Watch<y == 11>(0 .. 1)", c12h.ToString());
        Constraint c12i = c1 <= (y == 11);
        Assert.Equal("Watch<x == 7>(0 .. 1) <= Watch<y == 11>(0 .. 1)", c12i.ToString());
        Constraint c12j = (y == 11) <= c1;
        Assert.Equal("Watch<y == 11>(0 .. 1) <= Watch<x == 7>(0 .. 1)", c12j.ToString());
        Constraint c12k = c1 < (y == 11);
        Assert.Equal("Watch<x == 7>(0 .. 1) < Watch<y == 11>(0 .. 1)", c12k.ToString());
        Constraint c12l = (y == 11) < c1;
        Assert.Equal("Watch<y == 11>(0 .. 1) < Watch<x == 7>(0 .. 1)", c12l.ToString());
      }
      public void GreaterIntExprConstructor() {
        Solver solver = new Solver("Solver");
        IntVar x = solver.MakeIntVar(3, 13, "x");
        Assert.Equal(3, x.Min());
        Assert.Equal(13, x.Max());

        // Unary Operator
        IntExpr e1 = -(x >= 7);
        Assert.Equal("-(Watch<x >= 7>(0 .. 1))", e1.ToString());
        IntExpr e2 = (x >= 7).Abs();
        Assert.Equal("Watch<x >= 7>(0 .. 1)", e2.ToString());
        IntExpr e3 = (x >= 7).Square();
        Assert.Equal("IntSquare(Watch<x >= 7>(0 .. 1))", e3.ToString());
      }
示例#8
0
文件: testcp.cs 项目: njb0401/JobShop
    static void ConstraintWithExprTest()
    {
        Console.WriteLine("TestConstraintWithExpr");
        Solver     solver = new Solver("test");
        IntVar     x      = solver.MakeIntVar(0, 10, "x");
        IntVar     y      = solver.MakeIntVar(0, 10, "y");
        Constraint c1     = x == 2;
        Constraint c2     = y == 3;
        IntExpr    e2a    = c1 + 1;

        Console.WriteLine(e2a.ToString());
        IntExpr e2b = 1 + c1;

        Console.WriteLine(e2b.ToString());
        IntExpr e2c = c1 - 1;

        Console.WriteLine(e2c.ToString());
        IntExpr e2d = 1 - c1;

        Console.WriteLine(e2d.ToString());
        IntExpr e2e = c1 * 2;

        Console.WriteLine(e2e.ToString());
        IntExpr e2f = 2 * c1;

        Console.WriteLine(e2f.ToString());
        IntExpr e3a = c1 + y;

        Console.WriteLine(e3a.ToString());
        IntExpr e3b = y + c1;

        Console.WriteLine(e3b.ToString());
        IntExpr e3c = c1 - y;

        Console.WriteLine(e3c.ToString());
        IntExpr e3d = y - c1;

        Console.WriteLine(e3d.ToString());
        IntExpr e3e = c1 * y;

        Console.WriteLine(e3e.ToString());
        IntExpr e3f = y * c1;

        Console.WriteLine(e3f.ToString());
        IntExpr e4 = -c1;

        Console.WriteLine(e4.ToString());
        IntExpr e5 = c1 / 4;

        Console.WriteLine(e5.ToString());
        IntExpr e6 = c1.Abs();

        Console.WriteLine(e6.ToString());
        IntExpr e7 = c1.Square();

        Console.WriteLine(e7.ToString());
        Constraint c8a = c1 == 1;

        Console.WriteLine(c8a.ToString());
        Constraint c8b = 1 == c1;

        Console.WriteLine(c8b.ToString());
        Constraint c8c = c1 != 1;

        Console.WriteLine(c8c.ToString());
        Constraint c8d = 1 != c1;

        Console.WriteLine(c8d.ToString());
        Constraint c8e = c1 >= 1;

        Console.WriteLine(c8e.ToString());
        Constraint c8f = 1 >= c1;

        Console.WriteLine(c8f.ToString());
        Constraint c8g = c1 > 1;

        Console.WriteLine(c8g.ToString());
        Constraint c8h = 1 > c1;

        Console.WriteLine(c8h.ToString());
        Constraint c8i = c1 <= 1;

        Console.WriteLine(c8i.ToString());
        Constraint c8j = 1 <= c1;

        Console.WriteLine(c8j.ToString());
        Constraint c8k = c1 < 1;

        Console.WriteLine(c8k.ToString());
        Constraint c8l = 1 < c1;

        Console.WriteLine(c8l.ToString());
        Constraint c9a = c1 == y;

        Console.WriteLine(c9a.ToString());
        Constraint c9b = y == c1;

        Console.WriteLine(c9b.ToString());
        Constraint c9c = c1 != y;

        Console.WriteLine(c9c.ToString());
        Constraint c9d = y != c1;

        Console.WriteLine(c9d.ToString());
        Constraint c9e = c1 >= y;

        Console.WriteLine(c9e.ToString());
        Constraint c9f = y >= c1;

        Console.WriteLine(c9f.ToString());
        Constraint c9g = c1 > y;

        Console.WriteLine(c9g.ToString());
        Constraint c9h = y > c1;

        Console.WriteLine(c9h.ToString());
        Constraint c9i = c1 <= y;

        Console.WriteLine(c9i.ToString());
        Constraint c9j = y <= c1;

        Console.WriteLine(c9j.ToString());
        Constraint c9k = c1 < y;

        Console.WriteLine(c9k.ToString());
        Constraint c9l = y < c1;

        Console.WriteLine(c9l.ToString());
        Constraint c10a = c1 == c2;

        Console.WriteLine(c10a.ToString());
        Constraint c10c = c1 != c2;

        Console.WriteLine(c10c.ToString());
        Constraint c10e = c1 >= c2;

        Console.WriteLine(c10e.ToString());
        Constraint c10g = c1 > c2;

        Console.WriteLine(c10g.ToString());
        Constraint c10i = c1 <= c2;

        Console.WriteLine(c10i.ToString());
        Constraint c10k = c1 < c2;

        Console.WriteLine(c10k.ToString());
        IntExpr e11a = c1 + (y == 2);

        Console.WriteLine(e11a.ToString());
        IntExpr e11b = (y == 2) + c1;

        Console.WriteLine(e11b.ToString());
        IntExpr e11c = c1 - (y == 2);

        Console.WriteLine(e11c.ToString());
        IntExpr e11d = (y == 2) - c1;

        Console.WriteLine(e11d.ToString());
        IntExpr e11e = c1 * (y == 2);

        Console.WriteLine(e11e.ToString());
        IntExpr e11f = (y == 2) * c1;

        Console.WriteLine(e11f.ToString());
        Constraint c12a = c1 == (y == 2);

        Console.WriteLine(c12a.ToString());
        Constraint c12b = (y == 2) == c1;

        Console.WriteLine(c12b.ToString());
        Constraint c12c = c1 != (y == 2);

        Console.WriteLine(c12c.ToString());
        Constraint c12d = (y == 2) != c1;

        Console.WriteLine(c12d.ToString());
        Constraint c12e = c1 >= (y == 2);

        Console.WriteLine(c12e.ToString());
        Constraint c12f = (y == 2) >= c1;

        Console.WriteLine(c12f.ToString());
        Constraint c12g = c1 > (y == 2);

        Console.WriteLine(c12g.ToString());
        Constraint c12h = (y == 2) > c1;

        Console.WriteLine(c12h.ToString());
        Constraint c12i = c1 <= (y == 2);

        Console.WriteLine(c12i.ToString());
        Constraint c12j = (y == 2) <= c1;

        Console.WriteLine(c12j.ToString());
        Constraint c12k = c1 < (y == 2);

        Console.WriteLine(c12k.ToString());
        Constraint c12l = (y == 2) < c1;

        Console.WriteLine(c12l.ToString());
    }
示例#9
0
文件: testcp.cs 项目: njb0401/JobShop
    static void BaseEqualityWithExprTest()
    {
        Console.WriteLine("TestBaseEqualityWithExpr");
        Solver  solver = new Solver("test");
        IntVar  x      = solver.MakeIntVar(0, 10, "x");
        IntVar  y      = solver.MakeIntVar(0, 10, "y");
        IntExpr e2a    = (x >= 1) + 1;

        Console.WriteLine(e2a.ToString());
        IntExpr e2b = 1 + (x >= 1);

        Console.WriteLine(e2b.ToString());
        IntExpr e2c = (x >= 1) - 1;

        Console.WriteLine(e2c.ToString());
        IntExpr e2d = 1 - (x >= 1);

        Console.WriteLine(e2d.ToString());
        IntExpr e2e = (x >= 1) * 2;

        Console.WriteLine(e2e.ToString());
        IntExpr e2f = 2 * (x >= 1);

        Console.WriteLine(e2f.ToString());
        IntExpr e3a = (x >= 1) + y;

        Console.WriteLine(e3a.ToString());
        IntExpr e3b = y + (x >= 1);

        Console.WriteLine(e3b.ToString());
        IntExpr e3c = (x >= 1) - y;

        Console.WriteLine(e3c.ToString());
        IntExpr e3d = y - (x >= 1);

        Console.WriteLine(e3d.ToString());
        IntExpr e3e = (x >= 1) * y;

        Console.WriteLine(e3e.ToString());
        IntExpr e3f = y * (x >= 1);

        Console.WriteLine(e3f.ToString());
        IntExpr e4 = -(x >= 1);

        Console.WriteLine(e4.ToString());
        IntExpr e5 = (x >= 1) / 4;

        Console.WriteLine(e5.ToString());
        IntExpr e6 = (x >= 1).Abs();

        Console.WriteLine(e6.ToString());
        IntExpr e7 = (x >= 1).Square();

        Console.WriteLine(e7.ToString());
        Constraint c8a = (x >= 1) >= 1;

        Console.WriteLine(c8a.ToString());
        Constraint c8b = 1 >= (x >= 1);

        Console.WriteLine(c8b.ToString());
        Constraint c8c = (x >= 1) != 1;

        Console.WriteLine(c8c.ToString());
        Constraint c8d = 1 != (x >= 1);

        Console.WriteLine(c8d.ToString());
        Constraint c8e = (x >= 1) >= 1;

        Console.WriteLine(c8e.ToString());
        Constraint c8f = 1 >= (x >= 1);

        Console.WriteLine(c8f.ToString());
        Constraint c8g = (x >= 1) > 1;

        Console.WriteLine(c8g.ToString());
        Constraint c8h = 1 > (x >= 1);

        Console.WriteLine(c8h.ToString());
        Constraint c8i = (x >= 1) <= 1;

        Console.WriteLine(c8i.ToString());
        Constraint c8j = 1 <= (x >= 1);

        Console.WriteLine(c8j.ToString());
        Constraint c8k = (x >= 1) < 1;

        Console.WriteLine(c8k.ToString());
        Constraint c8l = 1 < (x >= 1);

        Console.WriteLine(c8l.ToString());
        Constraint c9a = (x >= 1) >= y;

        Console.WriteLine(c9a.ToString());
        Constraint c9b = y >= (x >= 1);

        Console.WriteLine(c9b.ToString());
        Constraint c9c = (x >= 1) != y;

        Console.WriteLine(c9c.ToString());
        Constraint c9d = y != (x >= 1);

        Console.WriteLine(c9d.ToString());
        Constraint c9e = (x >= 1) >= y;

        Console.WriteLine(c9e.ToString());
        Constraint c9f = y >= (x >= 1);

        Console.WriteLine(c9f.ToString());
        Constraint c9g = (x >= 1) > y;

        Console.WriteLine(c9g.ToString());
        Constraint c9h = y > (x >= 1);

        Console.WriteLine(c9h.ToString());
        Constraint c9i = (x >= 1) <= y;

        Console.WriteLine(c9i.ToString());
        Constraint c9j = y <= (x >= 1);

        Console.WriteLine(c9j.ToString());
        Constraint c9k = (x >= 1) < y;

        Console.WriteLine(c9k.ToString());
        Constraint c9l = y < (x >= 1);

        Console.WriteLine(c9l.ToString());
        Constraint c10a = (x >= 1) >= (y >= 2);

        Console.WriteLine(c10a.ToString());
        Constraint c10c = (x >= 1) != (y >= 2);

        Console.WriteLine(c10c.ToString());
        Constraint c10e = (x >= 1) >= (y >= 2);

        Console.WriteLine(c10e.ToString());
        Constraint c10g = (x >= 1) > (y >= 2);

        Console.WriteLine(c10g.ToString());
        Constraint c10i = (x >= 1) <= (y >= 2);

        Console.WriteLine(c10i.ToString());
        Constraint c10k = (x >= 1) < (y >= 2);

        Console.WriteLine(c10k.ToString());
    }