Product of Optimization Variables

Uncategorized
Apr 15, 2023
S

I have an optimization problem in CVX MATLAB:

min t
subject to
f(x) <= w^2zeta + wbeta - t*w
w >= 0
trace(x) <= P,

where t, w, and x are optimization parameters, and beta and zeta are positive constant scalars. x has to be a complex semidefinite matrix and f(x) is a convex function of x. The product t*w makes the problem non-convex. How could I convexify the problem?

M

If you have an upper bound on w, you could “grid” w For example w=0:.1:10; and make w input data to CVX rather than declaring as a variable. The pick the value of w which gives the smallest optimal objective value. You could grid in the vicinity of the nest w from the first gridding, and do a finer girdding.

S
Replying to #2

Mark please tell me how to write constraint x*y-z^2 in cvx

M

@Shafaq_Zahra That is an expression, not a constraint.

If the desired constraint is x*y >= z^2 and x >= 0, y >= 0, then that is a rotated 2nd order cone (Lorentz) constraint, which can be entered in CVX as
{z,x,y} == rotated_lorentz(1)

Otherwise, what is your constraint, and have you proven it is convex?

S
Replying to #4

I have two constraints sigma_x*sigma_y- tau^2>= 1-6 and sigma_x+sigma_y>=1e-5 and objective function is regularized least square problem.

M

I’ll presume sigma_x and sigma_y should both be constrained to be >= 0. Those constrains will be enforced by the rotated_lorentz constraint below.

{[tau;1e-3],sigma_x,sigma_y} == rotated_lorentz(2)
sigma_x + sigma_y >= 1e-5
S

I used this but still my constraints are no satisfying. This is actually my problem

M

You haven’t shown your code or the CVX and solver output. Nor have you shown the evidence of constraints not being satisfied.

Constraints are only satisfied to within a feasibility tolerance of perhaps about 1e-6. And you should expect that to be achieved only if CVX reports the problem as being Solved (not reported as Inaccurate/Solved).

Also note that now that you show 1e-5 as the RHS of the 1st constraint (I interpreted 1-6 as being 1e-6 with the e missing), the 1e-3 in my code should be changed to 1e-2.5.

I interpreted sigma_x, sigma_y, and tau as being scalar variables, and don’t see how your formulation would make sense otherwise. if that is not the case, you need to clarify.

S

no sigma_x sigma_y and tau are sub vectors they are part of vectors sigma. tolerqnce can be 1e-4 or 1e-3 or 1e-6. constrained are not satisfied

if i use with tolerance there is issue of dimension and without tolorence constraints are not satisfied.

M

I don’t know what you’ve done or what you are showing me. I don’t know where those messages about inequality constraints being satisfied are coming from.

You should show complete code, coped and pasted into your post using Preformatted text icon. Please re-read my previous post.

Perhaps you did not declare sigma_x, sigma_y, sigma_z as (CVX) variables? That needs to be done, and prior to their first use in your program, If they were declared as expressions, then whenever they are used, such as within a rotated_lorentz constrain or sigma_x+sigma_y>= something constraint, but without having first been set to anything, they have the default value of all elements being zero. That would make your problem infeasible, which CVX would declare after cvx_end. Perhaps that is what you did? Variables are very different than expressions.

As for the rotated_lorentz constraint, you may need to create a column vector for the 1st argument, as I did in my code
{[tau;1e-3],sigma_x,sigma_y} == rotated_lorentz(2)
rather than a row vector as you did. Otherwise, I think you get an error message as you did.
`
Perhaps you should re-read the CVX Users’ Guide, as it seems you might be getting confused on some things.

S

% Solve

% min sigma(sigma_x,sigma_y,sigma_z) ||Dsigma - t||^2 + Set.gamma * ||sigma||^2 s.t

% sigma_xsigma_y-sigma_z^2>=1e-6 and sigma_x+sigma_y>=1e-6

% Determine the size of sigma

D=rand(32,27);

t=rand(32,1);

Set.gamma=1e-6;

Set.InqTol=1e-10;

sigma=Solve(D,t,Set);

% Verification

sigmax=sigma(1:3:end);

sigmay=sigma(2:3:end);

sigmaz=sigma(3:3:end);

const1=zeros(length(sigmax),1);

const2=zeros(length(sigmax),1);

for i=1:length(tau)

const1(i)=sigmax(i).*sigmay(i)-(sigmaz(i)).^2-1e-6;% Constraint 1

const2(i)=sigmax(i)+sigmay(i)-1e-6;% Constraint 2

if any(const1(i)<Set.InqTol) || any(const2(i)<Set.InqTol)

warning(‘Inequality constraints are not staisfied’)

else

disp(‘Inequality contraints are satisfied’)

end

end

%%%%%%%

function sigma=Solve(D,t,Set)

n = size(D, 2); % Assuming sigma has n elements

sigma = zeros(n, 1);

% Initialize CVX

cvx_begin

cvx_precision high

variables sigma(n)

% Define sub-vectors assuming n is a multiple of 3

sigmax = sigma(1:3:n);

sigmay = sigma(2:3:n);

sigmaz = sigma(3:3:n);

% Objective function

minimize((D * sigma - t)’ * (D * sigma - t) + Set.gamma * (sigma’ * sigma))

subject to

for i = 1:length(sigmax)

% Applying rotated Lorentz constraints for each set of 3 elements

{[sigmaz(i);1e-3], sigmax(i), sigmay(i)} == rotated_lorentz(3);

% Applying element-wise addition constraint

sigmax(i) + sigmay(i) >=1e-6;

end

cvx_end

end

M

Apparently you did not understand my earlier post mentioning feasibility tolerance. The solvers called by CVX allow constraints to be violated by up to a feasibility tolerance (perhaps about 1e-6) and the solver and CVX still consider the constraints to be satisfied. Your test does not properly allowing for that. You have essentially already built-in a buffer of 1e-6 on constraint satisfaction (on ensuring satisfaction of the constraints written in “pure” form without the 1e-6 (that is what 1e-3 does on rotated_lorentz, because it is effectively squared)). You should look at the violation amounts.

It is not a good idea, despite being mentioned in the CVX Users’ Guide, to use cvx_precision high - it’s just doesnt’ work out well in many cases.

I don’t know whether it matters, but it should be `rotated_lorentz(2), not rorated_lorentz(3), because the number is supposed to be the length of the vector in the first argument on the LHS, which in your case is 2.