Hi guys,

I’m trying to impose an inequality constraint in my MILP problem to be solved in MATLAB using CVX, it looks like;

## P_max = a; % a is any constant

P_min = -P_max;

.

.

.

cvx_begin

cvx_solver MOSEK

% define variables

variables P(T,U) . . . . . ;

variable b(T,1) binary;

% objective fun

minimize (----- obj fn ----);

% constraints

subject to

.

.

.

.

P_min .*(1-b) <= P <= P_max .*b;

%

cvx_end

However, I was getting the error “Matrix dimensions must agree” as the dimensions in the inequality weren’t same to multiply element-wise. So I used “gmultiply” command (https://www.mathworks.com/help/deeplearning/ref/gmultiply.html), but CVX doesn’t seems supporting it and this time gave the error “Cannot combine values of class double with cvx”

Where I’m getting it wrong??

This might seem very simple query for you guys, but I’ve been trying to fix it since 4-5 days but couldn’t succeed. Please suggest the solution.

Thanks,

Mohan