clear all;
close all;
clc

cvx_begin
variables x1 x2;
minimize (-x1-0.64*x2)
50*x1+31*x2<=250;
-3*x1+2*x2<=4;
x1>=0;
x2>=0;
cvx_end

%%
% The dual

cvx_begin
variables u1 u2;
maximize (250*u1+4*u2)
50*u1-3*u2<=-1;
31*u1+2*u2<=-0.64;
u1<=0;
u2<=0;
cvx_end

%%
% The primal and dual together

cvx_begin
variables x1 x2;
dual variables u1 u2;
minimize (-x1-0.64*x2)
u1: 50*x1+31*x2<=250;
u2: -3*x1+2*x2<=4;
x1>=0;
x2>=0;
cvx_end
