public ClLinearInequality(ClLinearExpression cle1, Cl.Operator op, ClLinearExpression cle2, ClStrength strength, double weight = 1.0)
            : base(cle2.Clone(), strength, weight)
            /* throws ExClInternalError */
        {
            const double EPSILON = 1e-8;

            switch (op)
            {
            case Cl.Operator.GreaterThanOrEqualTo:
                SetupGreaterThanOrEqualTo(cle1);
                break;

            case Cl.Operator.GreaterThan:
                SetupGreaterThanOrEqualTo(cle1);
                ExpressionField.IncrementConstant(-EPSILON);
                break;

            case Cl.Operator.LessThanOrEqualTo:
                SetupLessThanOrEqualTo(cle1);
                break;

            case Cl.Operator.LessThan:
                SetupLessThanOrEqualTo(cle1);
                ExpressionField.IncrementConstant(-EPSILON);
                break;

            default:
                // invalid operator
                throw new CassowaryInternalException("Invalid operator in ClLinearInequality constructor");
            }
        }
Esempio n. 2
0
 public TestSuccessEntry(string constraint, string[] terms, Cl.Operator @operator)
 {
     this.Constraint    = constraint;
     this.ExpectedTerms = terms;
     this.Operator      = @operator;
 }
 public ClLinearInequality(ClLinearExpression cle, Cl.Operator op, ClAbstractVariable clv)
     : this(cle, op, clv, ClStrength.Required)
     /* throws ExClInternalError */
 {
 }
 public ClLinearInequality(ClLinearExpression cle, Cl.Operator op, ClAbstractVariable clv, ClStrength strength, double weight = 1.0)
     : this(cle, op, new ClLinearExpression(clv), strength, weight)
     /* throws ExClInternalError */
 {
 }
 public ClLinearInequality(ClLinearExpression cle1, Cl.Operator op, ClLinearExpression cle2)
     : this(cle1, op, cle2, ClStrength.Required)
     /* throws ExClInternalError */
 {
 }
 public ClLinearInequality(ClAbstractVariable clv, Cl.Operator op, double val)
     : this(clv, op, val, ClStrength.Required)
     /* throws ExClInternalError */
 {
 }
 public ClLinearInequality(ClAbstractVariable clv1, Cl.Operator op, ClAbstractVariable clv2)
     : this(clv1, op, clv2, ClStrength.Required)
     /* throws ExClInternalError */
 {
 }