Use set_name
for p in plants, m in markets
set_name(ship[p, m], "ship_$(p.name)_$(m.name)")
end
It would make sense if we added a name keyword to JuMP, so you could go
@variable(model, ship[p=plants, m=markets], name="$(p.name)_$(m.name)")
(Yes, there is base_name, but that changes ship, not the indexing.)
Edit: Add `name` keyword to macros · Issue #2643 · jump-dev/JuMP.jl · GitHub