Error when using inequality constraints

Hello,

I am trying to solve the following problem.

cvx_begin
    variables E p(NoD) r o bta(NoD) alfa(NoD) gama(NoD) ;

    maximize( E )
    subject to

        E>= ((2*ri/oi)*r) - (((ri/oi)^2)*o)
        o >= sum (con1+p)
        (r^2) <= sum(bta)

        for ind=1:NoD
             alfa(ind) <= 2^(bta(ind)/con2)
        end

        gama >= con4 + p*Gm 
        for ind=1:NoD
            1 - alfa(ind) <= ((2*G(ind)/gama_i(ind))*p(ind)) - (((G(ind)*poi(ind)/gama_i(ind))^2)*gama(ind))
        end
        
        for ind=1:NoD
            p(ind)*G(ind) >= con3(ind) * gama(ind)
        end
        p <= con5
cvx_end

The main issue is the inequality constraints “alfa(ind) <= 2^(bta(ind)/con2)” since alfa and bta are variables.

I get the following error:

Error using cvxprob/newcnstr
Disciplined convex programming error:
   Invalid constraint: {real affine} <= {log-affine}

Error in  <=  (line 21)
b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '<=' );

Error in SA (line 43)
             alfa(ind) <= 2^(bta(ind)/con2)

Is there a solution/workaround for this error?

That is a non-convex inequality. The inequality is going the wrong direction to be convex.

Thanks for the reply. Actually, I wasn’t sure about the inequality direction because I am approximating a function.
I changed the direction of the inequality, I am not getting the error anymore; however, I am getting a different error.

Unable to use a value of type struct as an index.

Error in cvxprob/solve (line 253)
            [ x, status, tprec, iters2, y, z ] = shim.solve( [ At, Anew2 ], [ b ; bnew ], c, cones, true, prec, solv.settings, eargs{:} );

Error in cvx_end (line 88)
        solve( prob );

Error in SC (line 81)
cvx_end

I got this error before “Unable to use a value of type struct as an index.” I don’t know how to handle it.

Are you using CVX 2.2? DO not use CVX 3.0beta, which is riddled with bugs.

Have you tried a different solver?

This looks like either bug, a screwed up installation, or a screwed up MATLAB session (in which case, using a new MATLAB session might fix it).

If none of that helps, please post a complete reproducible problem, with all input data.

Thank you very much for your help. It was a bad MATLAB session. Now it works.