As @michel2323 pointed out, if the user writes the model in this way:
core = TwoStageExaCore()
d =variable(core)
v1 = variable(core, nv; scenario = 1)
v2 = variable(core, nv; scenario = 2)
constraint(core, v1[j] + d for j in 1:nv; scenario = 1)
constraint(core, v2[j] + d for j in 1:nv; scenario = 2)
The performance degrades because we will separately compile two constraint callbacks.
But maybe there are ways to get around this issue?
julia> typeof(core.con.f) == typeof(core.con.inner.f)
true
julia> typeof(core.con.itr) == typeof(core.con.inner.itr)
true
When we create a constraint, we can just check if we have a constraint of the same type and just augment the itr and recompute the offets, etc. if there is a known constraint type.
As @michel2323 pointed out, if the user writes the model in this way:
The performance degrades because we will separately compile two constraint callbacks.
But maybe there are ways to get around this issue?
When we create a constraint, we can just check if we have a constraint of the same type and just augment the itr and recompute the offets, etc. if there is a known constraint type.