# Anyone can help me interpret the CVX output?

Dear all, I am new to CVX. I am trying to solve a primal form and then a corresponding dual form, but the results made me confusing.

From the primal form, the result is as following, where primal objective value,dual objective value and Optimal value are the same value.

primal objective value = 9.24733749e+001

dual objective value = 9.24733744e+001

gap := trace(XZ) = 4.85e-007

relative gap = 2.61e-009

actual relative gap = 2.59e-009

Status: Solved

Optimal value (cvx_optval): +92.4734

But from the corresponding dual form, I got:

primal objective value = -2.61003379e+002

dual objective value = -2.61003382e+002

gap := trace(XZ) = 2.39e-006

relative gap = 4.58e-009

actual relative gap = 4.53e-009

Status: Solved

Optimal value (cvx_optval): -92.4734

where the primal objective value=dual objective value, but not equal to the Optimal value.(here optimal value of dual form is -92.4734, and we can take it the same as the optimal value of primal form because of some transformation relationship, it is correct).

Can anybody help me interpret what are the primal objective value,dual objective value, and how they are calculated? Why they don’t equal to Optimal value in the dual form result?

Thanks so much.

We probably can’t help if you don’t share your model (or for that matter if the model is too complex to be easily interpreted).

Hi mcg, thanks for your comment. Here is the model

The model of primal form is:

``````l = size(label,1);
d = size(inst(1,:),2);
cvx_begin
variable w(d);
variable b;
variable kxi(l);
minimize( w'*w/2 + C *sum(kxi) );
subject to
label.*(inst*w + b )- 1 + kxi>=0;
kxi>=0;
cvx_end
``````

And the dual form is:

``````cvx_begin
variable alpha(l);
minimize(alpha'*((label*label').*(inst*inst'))*alpha/2-ones(1,l)*alpha);
subject to
label'*alpha==0;
C>=alpha>=0;
cvx_end``````

I’m not sure what to tell you. I really can’t draw any conclusions just by looking at the model, particularly with no data to accompany it. Frankly it is quite likely that your dual formulation is not exactly the same.