Hello,
I am trying to maximize the following function which is concave. However, when I try to solve it in YALMIP with mosek or sdpt3, it says “Solver not applicable”. I have implemented it with CVX and it has no issue with the convexity of the problem.
My function: max x*log(1+y/x)
X and Y are real positive variables with boundaries. I am
sure that my optimization problem is feasible and bounded. I am new to YALMIP and I do not know what the problem is.
My code in YALMIP:
X = sdpvar(a,b,c);
Y = sdpvar(a,b,c);
Constraint = [K <= X.*log(1+Y./X)];
Constraint = [Constraint, some other “linear” constraints];
solvesdp(Constraint,-1*sum(sum(sum(K,1),2),3))
I would be very thankful if you could help me.
Jane
My code in YALMIP for this function is:
X = binvar(a,b,c);
Y = sdpvar(a,b,c);
K = sdpvar(a,b,c);
Constraint = [K <= -1*crossentropy(X,(1+Y))];
Constraint = [Constraint, Y>=0, X.*Y <= T];
solvesdp(Constraint,-1*sum(sum(sum(K,1),2),3))
Constraint = [Y>=0, X.*Y <= T];
objective = 0;
for i = 1:numel(X)
objective = objective + crossentropy(X(i),(1+Y(i)));
end
optimize(Constraint,objective)
for i = 1:numel(X)
objective = objective -X(i)*log(1+Y(i));
end
Constraint = [Y>=0, X.*Y <= T];
Constraint = binmodel([Constraint, Y <= 100]);
[log(1+Y) >= Z - M*(1-X), Z <= M*X
Thank you for your great hints. Binmodel command did not work
for me. So I linearize constraints myself. But I still cannot solve the problem.
My optimization problem and YALMIP code are as follows:
My optimization problem is:
Max sum(sum(sum(X.*log(1+Y))
S.t. sum(X.*log(1+Y), 3) >= A
sum(sum(X,2),1) == 1
sum(sum(X.*Y,3),2) <= T
Y >= 0
Running code in YALMIP:
a= 2;
b=2;
c=4;
A = [1 3; 3 1];
M1 = 100;
M2 = 10000;
T = [2000; 2000];
X = binvar(a,b,c);
Y = sdpvar(a,b,c);
Z = sdpvar(a,b,c);
K = sdpvar(a,b,c);
Constraints = [Z <= M1*X, Z>=0];
for i=1:a
for j=1:b
for l=1:c
Constraints = [Constraints, Z(i,j,l) - M1*(1-X(i,j,l)) <= log(1+ Y(i,j,l))];
end
end
end
Constraints = [Constraints, sum(Z,3)>=A];
Constraints = [Constraints, sum(sum(X,2),1) == ones(1,1,c)];
Constraints = [Constraints, sum(sum(K,3),2)<=T , K<=Y+M2*(1-X), K>=Y-M2*(1-X), K>=0, K<=M2*X];
Constraints = [Constraints, Y>=0];
optimize(Constraints,-1*sum(sum(sum(Z,1),2),3))
M1 is the big-M constant and M2 is upper bound on variable K.
X = binvar(a,b,c,'full');
Y = sdpvar(a,b,c,'full');
Z = sdpvar(a,b,c,'full');
K = sdpvar(a,b,c,'full');
a= 2;
b=2;
c=4;
A = [1 3; 3 1];
M1 = 100;
M2 = 10000;
T = [2000; 2000];
X = binvar(a,b,c,'full');
Y = sdpvar(a,b,c,'full');
Z = sdpvar(a,b,c,'full');
K = sdpvar(a,b,c,'full');
Constraints = [Z(:) == X(:).*log(1+Y(:))];
Constraints = [Constraints, sum(Z,3)>=A];
Constraints = [Constraints, sum(sum(X,2),1) == ones(1,1,c)];
Constraints = [Constraints, sum(sum(K,3),2)<=T, K<=Y+M2*(1-X), K>=Y-M2*(1-X), K>=0, K<=M2*X];
Constraints = [Constraints, Y>=0];