Convert model with anonymous variables to "readable" form


I have a code(written by others) that builds a JuMP model, but I can’t see what are the constraints, becouse it has __anon__ variables, like this:

Min __anon__ + __anon__
Subject to
__anon__ - __anon__ == 0.5
__anon__ - __anon__ == 0.5
__anon__ - 1000 __anon__ + 800 __anon__ <= 0
__anon__ - 1000 __anon__ >= -800

Is it possible to create a model with named variables from this?

for (i, x) in enumerate(all_variables(model))
    set_name(x, "v$(i)")

I get ERROR: UndefVarError: all_variables not defined. This applies to the other methods on the site like lower_bound(), num_variables() etc.

  1. You need JuMP 0.20 or 0.21.
  2. If you have import JuMP, you need to prefix JuMP.all_variables. Alternatively, use using JuMP.

for some reason it installs 0.18, tried updating,removing and reinstalling, nothing
edit: it seems like ConditionalJuMP won’t allow higher version of JuMP

Correct. ConditionalJuMP has not been updated. There’s an open issue: It looks like they need some help.