The fix! function in the Convex.jl packages allows to fix the value of a variable to a constant during the optimization.

I was wondering how I can get the same result with a multi-dimensional variable for which I want to fix only certain regions of the variable.

To illustrate my question, imagine I have a (n, k) Variable array over which I am running an optimization procedure in several steps. After each step I want to fix some of the rows of this array so that they cannot change during the next optimization step. Ideally I could do something like:

fix!(var[idx,:])

… solving problem …

free!(var[idx,:])

But this doesn’t seem to work.

Any idea on how to tackle this problem ?

Thanks for your help.