clc;
clear;


n=1388;
m=5072;

c=load('c');
indices=load('indices');
triplets=load('G');
G = sparse(triplets(:,1), triplets(:,2), triplets(:,3), m, n);

addpath(genpath('/scratch.1/mingg13/ming_project/YALMIP/yalmip'));
addpath('/scratch.1/mingg13/ming_project/Mosek/mosek/7/toolbox/r2012b/');

v=sdpvar(n,1); 
t=sdpvar(m,1); 
u1=sdpvar(1,1);
u2=sdpvar(1,1);

Constraints=[G*v==t];
Constraints=[Constraints,rcone(t,u1,.5)];
Constraints=[Constraints,rcone(v(indices),u2,.5)];


Objective=v'*c(1:n,1)+t'*c(n+1:n+m,1)+u1+u2*1e4*.5;

Options = sdpsettings('verbose',1,'solver','mosek');

sol = optimize(Constraints,Objective,Options);

v_value=value(v);
t_value=value(t);
u1_value=value(u1);
u2_value=value(u2);

v_value(indices)'*v_value(indices)
u2_value

t_value'*t_value
u1_value


