Problem #1, MOSEL Code
model ENCE723_PB1
uses "mmxprs"
!decision variables
declarations
x1 : mpvar !Decision variable
x2 : mpvar !Decision variable
g1 : linctr !Linear constraint
g2 : linctr !Linear constraint
end-declarations
!Constraints
g1:= x1 + x2 -1 <=0
g2:= -x2 <=0
x1 is_free
x2 is_free
!objective function
minimize(-x1)
writeln("x1= ",getsol(x1))
writeln("x2= ",getsol(x2))
writeln("dual1= ",getdual(g1))
writeln("dual2= ",getdual(g2))
end-model
!The duals will be -1, -1 (sign convention issue), to get values of 1,1 , try instead
!g1:= -x1 - x2 +1 >=0 , g2:= x2 >=0