@@ -40,16 +40,16 @@ function vexity(c::LessThanConstraint)
4040end
4141
4242function _add_constraint! (context:: Context{T} , lt:: LessThanConstraint ) where {T}
43- f = conic_form! (context, lt. rhs - lt. lhs )
43+ f = conic_form! (context, lt. lhs - lt. rhs )
4444 if f isa AbstractVector
4545 # a trivial constraint without variables like `5 <= 0`
46- if ! all (f .>= - CONSTANT_CONSTRAINT_TOL[])
46+ if ! all (f .<= CONSTANT_CONSTRAINT_TOL[])
4747 @warn " Constant constraint is violated"
4848 context. detected_infeasible_during_formulation[] = true
4949 end
5050 return
5151 end
52- set = MOI. Nonnegatives (MOI. output_dimension (f))
52+ set = MOI. Nonpositives (MOI. output_dimension (f))
5353 context. constr_to_moi_inds[lt] = MOI_add_constraint (context. model, f, set)
5454 return
5555end
@@ -61,10 +61,6 @@ Base.:<=(lhs::AbstractExpr, rhs::Value) = <=(lhs, constant(rhs))
6161Base.:<= (lhs:: Value , rhs:: AbstractExpr ) = <= (constant (lhs), rhs)
6262
6363function populate_dual! (model:: MOI.ModelLike , c:: LessThanConstraint , indices)
64- # FIXME (odow): this dual is the 'wrong' sign, because Convex implements
65- # rhs - lhs in Nonnegatives for a LessThanConstraint, instead of
66- # lhs - rhs in Nonpositives.
67- # Should we fix this?
6864 ret = MOI. get (model, MOI. ConstraintDual (), indices)
6965 c. dual = output (reshape (ret, c. size))
7066 return
0 commit comments