I am trying to use Disciplined Convex Programming (CVX) to solve a family of optimization problems in Matlab. But I keep getting the error
the || and && operators must be convertible to logical scalar values".
I have tried replacing the equality constraints with two inequality constraints, but the problem persists.
For some parameter values, this problem goes away and the problem is solved successfully, but I have not been able to figure out a pattern.
Any help solving this problem, or understanding what's causing it would be much appreciated.
x = linspace(0,200,1001)';
fL = lognpdf(x,2,1);
fH = lognpdf(x,3,1);
cc = (max(x)-min(x))/1001;
cvx_begin
variable V(1001,1)
maximize( cc.*sum((x-V.^2).*fH) + G_L(vL).*cc.*sum((x-V.^2).*fL) )
subject to
cc.*sum(V.*fH) == 0.8;
cc.*sum(V.*fL) == 0.2;
V >= 0;
cvx_end
Operands to the || and && operators must be convertible to logical scalar values.
Error in checkdepconstr (line 88)
if (numdencol > 0) && (printlevel)
Error in HSDsqlpmain (line 135)
checkdepconstr(blk,At,b,y,rmdepconstr);
Error in sdpt3 (line 277)
HSDsqlpmain(blk3,At3,C3,b,par,X03,y0,Z03);
Error in cvx_run_solver (line 56)
[ varargout{1:nargout} ] = sfunc( inputs{:} );
Error in cvx_sdpt3>solve (line 288)
[ obj, xx, y, zz, info ] = cvx_run_solver( @sdpt3, blk, Avec, Cvec, b, OPTIONS,
'obj', 'x', 'y', 'z', 'info', 5, params ); %#ok
Error in cvx_solve (line 399)
[ x, status, tprec, iters, y ] = shim.solve( At, b, c, cones, params );
Error in cvx_finish
Error in cvx_end (line 11)
evalin( 'caller', 'cvx_finish' );