I have constraint that reads like this
a^T \left( x \odot \left( \exp\left(\beta y \oslash x \right) - 1 \right) \right) - c \leq 0.
How should I add this constraint in the CVX DCP ruleset?
%MY CVX code
n = 5;
a = rand(n,1);
beta = rand;
T = n;
Pmax = 20;
cvx_begin
variables x(n) y(n)
minimize -sum_log ( x );
subject to
ones(1,n) * y == T;
a’ * ( y .* ( exp(beta* x./y) - 1 ) - T * Pmax <= 0;
cvx_end
% ---------------------
% Problem with: a’ * ( y .* ( exp(beta* x./y) - 1 ) - T * Pmax <= 0;
Is my below attempt to solve the problem correct?
cvx_begin
variables x(n) y(n)
minimize -sum_log( x );
subject to
ones(1,n) * y == T;
for ii = 1:n
x1 = beta * x(ii);
y2 = y(ii);
z2 = y(ii) + ((T * Pmax)/(n * a(ii)));
{x1,y1,z1} == exponential;
end
cvx_end
At least the solution rendered by this program meets the constraint. So, I think the CVX problem is good.
Are all elements of a always >= 0? I will assume so.
I’m not sure this is exactly what you want, but presuming I understand your notation,I think you want something like
variables x(n) y(x) z(n)
for i = 1:n
{y(i), beta*x(i), z(i)} == exponential{1}
end
% Now replace y(i)*exp(beta*x(i)/y(i)) by z(i)
% and form the constraint
a'*(z - x) - c <= 0 % fix this up if it's not quite right
I’ll let you figure out whether there is a short cut such as
{y, beta*x, z} == exponential(n}
instead of the for loop.
Edit: Note I just corrected a typo:{ rather than ( in what should be exponential{1}
Thank you for your reply.
Assumption is a \geq 0. The notation \odot means componentwise multiplication and \oslash means componentwise division, which I think you might have understood correctly
I was not aware of the shortcut.
I’m not “aware” of the shortcut either.I haven’t looked into whether that shortcut is correct or not.
Thank you Mark for your help!