Computed dual is not equal to primal for a simple example from book

Hi, This is an example from Convex Optimization Book. I only want to check the strong duality by using dual variables returned by cvx. For the first problem it does hold. But for the dual problem it is not. Even when I remove negative instances which make the result complex number, the strong duality does not hold. Why? Actually I have the same difficulty with the dual variables returned by cvx, in one of my own problems and when I tried to figure out it using a simple problem using cvx, I encountered this even with problems from the book.

% Section 11.8.4: Network rate optimization
% Boyd & Vandenberghe "Convex Optimization" 
% Argyrios Zymnis - 05/03/08
% some comments
 
rand('state',1)
L = 20;
n = 10;
k = 7; %average links per flow
A = double(rand(L,n) <= k/L);
c = 0.9*rand(L,1)+0.1;

% Solve network rate problem
cvx_begin
    variable x(n);
    dual variable LA % I added this 
    maximize(sum(log(x)))
    subject to
        LA:A*x <= c
cvx_end
primal_obj = cvx_optval;
c'*LA-sum(log(A'*LA))-n % I added this 
% Solve dual problem to obtain link prices
cvx_begin
    variable lambda(L);
    dual variable xd % I added this
    minimize(c'*lambda-sum(log(A'*lambda))-n)
    subject to
        xd:lambda >= 0
cvx_end
sum(log(xd))% I added this
dual_obj = cvx_optval;

What version of CVX are you using? I’m getting that lambda and LA are identical, and xd and c-A*x are identical.

What version of CVX are you using? I’m getting that lambda and LA are identical, and xd and c-A*x are identical, and the objective functions are identical. I tested this with CVX 2.1.

CVX version is ‘2.1’,bld = ‘1088’,bdate = ‘Sat Sep 20 22:03:02 2014’, bcomm = ‘e790d80’. Actually, I have the same problem in my own code in cvx Derivative of Lagrangain with respect to A parameter is not zero?.I’m getting them different.

I’m getting also lambda and LA identical but I expect the result of sum(log(xd)) be equal to objective function of primal problem which is not. it’s equal -129.9515 but the objective of primal problem is -31.5685. Thanks a lot.

I disagree. sum(log(xd)) should not be the same. xd and x are not the same. Rather, xd and c-A*x are the same.

@mcg, Thank you. You are correct. After I derived the dual I understood that you are correct. Would you please have a look at this question, Derivative of Lagrangain with respect to A parameter is not zero?. Thanks a lot.