Error in expressing constraint in geometric programming mode

In my optimization problem, one of the constraints is as follows

imag$(hg)==0$; that is the imaginary part of hg is set to 0.

here, h is a complex vector (constant) of size (1 x 4) and g is the variable.

My matlab code is:


cvx_begin gp quiet

variable g(4,1) complex;

variables t(1), x(1);


subject to




The solver shows an error! How do I express these constraints in GP mode?

The error message is as follows:

Error using &
NaN’s cannot be converted to logicals.

Error in cvx/cvx_vexity (line 38)
v( any( imag( x.basis_ ), 1 ) & v ) = NaN;

Error in cvx/mtimes (line 297)
v = cvx_vexity( z );

Error in matGP (line 74)
imag(h*g) == 0;

You cannot. Geometric programs must have real variables, because otherwise the problem cannot later be converted to convex form.

Please consolidate your questions from now on into a single post, since they all effectively involve the same topic. More importantly, please read the user’s guide, particularly “What CVX is not” in the first section.