I intend to solve the following formulation using 2-dimension variables.
the following lines shows my code in cvx and it seems works fine without any error and return the results successfully.
% variable w_{i} is ignored (w_{i} = 1)
r = [ 54 36; 36 36; 24 36 ];
m = 3;
n = 2;
cvx_begin
variable tp(m,n);
f1 = sum(log(sum(tp(1:m,1:n).*r(1:m,1:n))));
g1 = sum(sum(tp(1:m,1:n).*log(r(1:m,1:n))));
maximize (f1 + g1)
subject to
0 <= tp <= 1;
sum(tp(2)) <= 1;
sum(tp(1)) == 1;
cvx_end
The returned results:
Successive approximation method to be employed.
For improved efficiency, SDPT3 is solving the dual problem.
SDPT3 will be called several times to refine the solution.
Original size: 22 variables, 7 equality constraints
2 exponentials add 16 variables, 10 equality constraints
-----------------------------------------------------------------
Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------+---------------------------------+---------
2/ 2 | 2.963e+00 9.612e-01 0.000e+00 | Solved
2/ 2 | 7.430e-01 4.706e-02 1.279e-08 | Solved
2/ 2 | 3.057e-02 7.469e-05 2.723e-08 | Solved
0/ 2 | 3.035e-04 5.209e-08 4.473e-08 | Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +30.9194
>> tp
tp = 1.0000 1.0000
1.0000 1.0000
1.0000 1.0000
1.0000 1.0000
although it seems cvx has solved the problem, when I check the calculated tp values w.r.t the defined constraints, they have been violated! for instance, the sum of each row of tp(i,j) has to be less equal than 1, but it doesn’t follow this constraint for all the rows. the same concern exists for the second constraint.
Is there anything that I missed in my coding part?