Hi! I am trying to code the following constraint in cvx:

d^Tu + sum_{k=1}^K max_{j \in I_k} {V_j^Td + b_j} \leq tau

Can somebody help me please? I thought of using an epigraph formulation and code it in the following way (note: only the part of the code concerning this constraint is shown, but it contains more constraints like these):

Ivert = 5;

K = 10;

n = 5;

A = -5 + 10*rand(Ivert*K,5);

Ivert = 5;

K = 10;

I = [];

for k = 1:K

I(:,k) = [1+5*(k-1):Ivert+5*(k-1)];

end

D1 = eye(5);

D2 = -eye(5);

D = cat(1,D1,D2);

ub = [5/1,5/2,5/3,5/4,5/5]ā;

lb = [1/5,2/5,3/5,4/5,5/5]ā;

d = cat(1,ub,-lb);

cvx_begin

variable tau;

variable V(size(D,1),K*Ivert)

variable u(size(D,1))

variable epi1(K,1)

variable epi2(K,n)

variable epi3(K,size(D,1))

minimize(tau)

subject to

for k = 1:K

for j = I(1,k):I(end,k)

epi1(k) <= V(:,j)ā*d;

end

end

constraint1term = dā*u;

for k = 1:K

constraint1term = constraint1term + max(epi1(k));

end

constraint1term <= tau;

cvx_end

But I do not think this is correct since using the whole code I get -infinity as optimal value while this should not be the case. Thank you in advance!