I need to define an expression/variable that resembles a matrix. This matrix is defined sectionwise, so I tried:
@expression(m, O[b=1:n, i=1:n, j=1:n], 0)
@expression(m, O[b=1:n, i=n+1, j=1:n], 0.5T_i[b][j])
@expression(m, O[b=1:n, i=1:n, j=n+1], 0.5T_i[b][i])
@expression(m, O[b=1:n, i=n+1, j=n+1], v[b] - buses[b].v_max - s)
for b in bus_set
@SDconstraint(m, M[b,:,:] >= 0)
@SDconstraint(m, M[b,:,:] - O[b,:,:] >=0)
end
hoping that JuMP would recognize that, for example, O[b=1:n, i=1:n, j=1:n] and O[b=1:n, i=n+1, j=1:n] are part of the same expression. It turns out, that the expression is always overwritten by the last line. I was so far not able to figure out a way to properly define a matrix that can be used in constraints like that. Doing a naive concatenation of the form
for b in 1:n_buses
O[b,:,:] = [O1[b,:,:] O2[b,:,:]; O3[b,:,:] O4[b,:,:]]
end
didn’t help either.
I’d highly appreciate any advice!
Thanks,
Robert