Skip to content

Avoiding duplicate constraint/objective signature #229

@sshin23

Description

@sshin23

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions