public static LinearConstraint MakeConstraint(LinearExpr /*!*/ le0, LinearExpr /*!*/ le1, LinearConstraint.ConstraintRelation rel, BigNum constantOffset) /* throws ArithmeticException */ { Contract.Requires(le0 != null); Contract.Requires(le1 != null); le1.Negate(); le0.Add(le1); le0.AddConstant(constantOffset); return(le0.ToConstraint(rel)); }
public LinearConstraint ToConstraint(LinearConstraint.ConstraintRelation rel) /* throws ArithmeticException */ { LinearConstraint constraint = new LinearConstraint(rel); for (Term t = terms; t != null; t = t.next) { constraint.SetCoefficient(t.var, t.coeff.ToRational); } BigNum rhs = -constant; constraint.rhs = rhs.ToRational; return(constraint); }