# Unexpected result

I am just trying out cvx for the first time but the results does not seem to make sense. I ran the follwing simple linear program:

cvx_begin
variable g1
variable g2
variable l1
dual variables dualx
minimize (10g1 + 20g2 - 50*l1)
subject to
0 <= g1 <= 500
0 <= g2 <= 500
0 <= l1 <= 25
l1 - g1 - g2 == 0:dualx
cvx_end

I am expecting dualx to be 10, but cvx computes it to be -10. Using linprog and lp_solve as shown below for the dual problem to this linear program yields 10 for dualx. Why do the results differ or is there something i am doing incorrectly?

f = [-10 -20 50]
a = [-1 -1 1]
b = [0]
e = [0]
vlb = [0 0 0]
vub = [500 500 25]
[obj, x, dualx1] = lp_solve(f,a,b,e,vlb,vub)

f1 = [500 500 25 0]
A1 = [-1 0 0 1; 0 -1 0 1; 0 0 -1 -1]
b1 = [10 10 -50]
lb1 = [0 0 0 -inf]
ub1 = [inf inf inf inf]
dualx2 = linprog(f1,A1,b1,[],[],lb1,ub1)

Anyone have any insight into the result above? Or if I should seek help from a different forum?

Actually, the sign of a Lagrange multiplier (dual variable) for an equality constraint depends on convention. The fact that lp_solve returns the negative of what CVX does really isnâ€™t a problem, as long as both solvers are consistent in their approach. For inequalities, the sign does matter however.