MWE:
using JuMP, GLPK
model = Model(GLPK.Optimizer)
@variable(model, x[i=1:4]>= 0.5, Int)
@objective(model, Min, sum(x))
optimize!(model)
for x in all_variables(model)
println("$(name(x)) = $(value(x))")
end
As you know, run it in Jupyter notebook
, you can get the output like this:
x[1] = 1.0
x[2] = 1.0
x[3] = 1.0
x[4] = 1.0
and when you just input x[1]
, you will get: x_1
So, I want to show my output like:
x_1 = 1.0\\
x_2 = 1.0\\
x_3 = 1.0\\
x_4 = 1.0
How to get these result with a simple code? And it will be the best if this result can be showed in REPL.
Thanks in advance!