internal void AssertArith(int vid, ArithExpr variable) { // Get the bounds on the row Rational lower, upper; _model.GetBounds(vid, out lower, out upper); // Case of equality if (lower == upper) { // Create the equality term Expr eqConst = GetNumeral(lower, variable.Sort); BoolExpr constraint = _context.MkEq(eqConst, variable); // Assert the constraint _optSolver.Assert(constraint); } else { // If upper bound is finite assert the upper bound constraint if (lower.IsFinite) { // Create the lower Bound constraint ArithExpr lowerTerm = GetNumeral(lower, variable.Sort); BoolExpr constraint = _context.MkLe(lowerTerm, variable); // Assert the constraint _optSolver.Assert(constraint); } // If lower bound is finite assert the lower bound constraint if (upper.IsFinite) { // Create the upper bound constraint ArithExpr upperTerm = GetNumeral(upper, variable.Sort); BoolExpr constraint = _context.MkGe(upperTerm, variable); // Assert the constraint _optSolver.Assert(constraint); } } }