How to declare the variables inside cvx

Let W = [\alpha, \beta]^\intercal be a variable matrix, where \beta>0 can be fixed as constant in some use-case and 0<\alpha<1. Now, after some transformation, we define Z = [W^\intercal 1]^\intercal and we further define Y= Z\,Z^\intercal.

Now I want to minimize \text{Tr}(Q\,Y) using CVX. Assume that Q is a positive real matrix of size (3\times 3). I guess, we can take variable Y(3,3)after begin_cvx.

  • If I initialize \alpha with random value outside of begin_cvx, CVX does not take this as a variable, thus does not give any optimum values of \alpha, CVX only tries to find optimum values of Y. Based on the random value of \alpha, cvx gives optimum Y. (correct me if I am wrong)

Question-1: What is the right place to define \alpha, inside of CVX, using expression \alpha or outside?

Question-2: I declare \alpha=\text{rand}(1,1) inside of cvx_begin, and then again if I try to impose a constraint 0<Q_\alpha Y<1 to hold 0<\alpha<1, where Q_\alpha is the matrix of size (3\times 3) , then the optimum value gives NaN. See the below, (if I uncomment 1>=(Q_alpha*Y_k)>=0, then it gives NaN)

clear all
clc;

e2 = transpose([0 1 0 0 0 0]);
Q_alpha = [zeros(6,6) 0.5*e2;0.5*transpose(e2) 0];

e4 = transpose([0 0 0 1 0 0]);
Q_r = [zeros(6,6) 0.5*e4;0.5*transpose(e4) 0]

lambda_k_D_in =15000; % Total size in byte
zeta = 0.2
P_k = transpose([lambda_k_D_in, 0, 0, zeta, 0, 0])
Q_k = [zeros(6,6) 0.5*P_k;0.5*transpose(P_k) 0]
Q_r= [zeros(6,6) 0.5*e4;0.5*transpose(e4) 0]
M=3
r_k_i = 4*10^5;
cvx_begin
   variable Y_k(7 7)
   alpha =rand(1,1)
   gamma = rand(1,1)
   W_k = transpose([0.2 alpha gamma r_k_i 2 M])
   Z_k = transpose([transpose(W_k) 1]);
   Y_k==Z_k*transpose(Z_k);
   minimize(trace(Q_k*Y_k))
   trace(Q_r*Y_k)>=0
 %  1>=(Q_alpha*Y_k)>=0
cvx_end 
Y_k
trace(Q_k*Y_k)
Q_k

Either

  1. provide a numerical valuer of alpha prior to its use in a CVX program, in which case do not declare it as a CVX variable or expression
    or
  2. declare it as a CVX variable, in which case CVX will try to find its optimal value. CVX does not make use of starting (initial) values for decision (optomization) variables as some other optimization modeling systems and solvers do.

If I declare \alpha inside cvx as a variable, then I get the error as scalar multiplication.

Besides, I am not getting any clue why uncommenting the following gives primal infeasible.

Either fix the numerical value of alpha and solve the convex optimization problem, oi if you want alpha to be a decision (optimization) variable, find a non-convex tool to handle it.