Is it possible to create an empty constraint? I need that for coding a row-and-column generation algorithm where I need to generate constraints associated to new variables only. Hence, at some point I’ll need to create new empty constraints, which I’ll populate by creating my new variables column-wise. I guess I can do that using a dummy variable … Is there another way?
JuMP allows you to add constraints to models iteratively (i.e. after solving), so it will probably be more natural to add the constraints as-needed. Something like:
m = Model()
@variable(m, x)
solve(m)
@variable(m, y)
@constraint(m, y <= 1)
solve(m)
That would not help me because I need to have references for my generated constraints and variables, and I can of course not use a new name at each iteration of my algorithm.
I think I can handle my specific algorithm by increasing the dimension of the “constraint array” on demand using the trick mentioned here. However, there does not seem to be a similar way to increase the size of the “variables array” dynamically. While I don’t need it for my current application, this seems to be a severe limitation of JuMP when compared to solvers classical APIs.
This seems to be a nice workaround. Yet, it is not as neat as the mentioned APIs since one is forced to use anonymous variables, which may harden debugging