# In my JuMP model, the LP file preserves the original variable names, but the MPS file appears to rename them, so how can I map the Gurobi .sol solution back to the original JuMP variables?

**URL:** <https://discourse.julialang.org/t/in-my-jump-model-the-lp-file-preserves-the-original-variable-names-but-the-mps-file-appears-to-rename-them-so-how-can-i-map-the-gurobi-sol-solution-back-to-the-original-jump-variables/139462>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump, gurobi, julia\
**Created:** [September 14, 2026, 7:31am UTC](https://discourse.julialang.org/t/in-my-jump-model-the-lp-file-preserves-the-original-variable-names-but-the-mps-file-appears-to-rename-them-so-how-can-i-map-the-gurobi-sol-solution-back-to-the-original-jump-variables/139462 "2026-09-14T07:31:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amit\_97](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amit_97/32/224072_2.png) [@amit\_97](https://discourse.julialang.org/u/amit_97)\
**Post date:** [September 14, 2026, 7:31am UTC](https://discourse.julialang.org/t/in-my-jump-model-the-lp-file-preserves-the-original-variable-names-but-the-mps-file-appears-to-rename-them-so-how-can-i-map-the-gurobi-sol-solution-back-to-the-original-jump-variables/139462/1 "2026-09-14T07:31:01Z")

</div>

Hi everyone,

I’m generating both `.lp` and `.mps` files from the same JuMP model using Gurobi.

In the LP file, the original JuMP variable names are preserved, for example:

```plaintext
1200 x2[1,(1,_0)]
- 41054.62117964038 B2[1,(1,_0)]
- 0.15 Tnk[1,1]

```

However, in the MPS file, the variables/constraints appear to be renamed to generic names such as:

```plaintext
c0
c1
c2
...

```

I solve the MPS file on another machine using Gurobi and get a feasible solution in a `.sol` file.

My problem is that I want to map the `.sol` solution back to the original JuMP variables, such as:

```julia
x2[1,(1,_0)]
B2[1,(1,_0)]
Tnk[1,1]

```

but because the MPS file uses different/generic names, I’m not able to identify which solution variable corresponds to which original JuMP variable.

The model is generated in Julia, solved on another machine from the exported MPS, and then I want to analyze the solution back in my original Julia code.

Any recommended workflow for this would be helpful. Thanks!

---

<div class="post-metadata">

**Author:** ![langestefan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/langestefan/32/207923_2.png) [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Post date:** [September 14, 2026, 7:35am UTC](https://discourse.julialang.org/t/in-my-jump-model-the-lp-file-preserves-the-original-variable-names-but-the-mps-file-appears-to-rename-them-so-how-can-i-map-the-gurobi-sol-solution-back-to-the-original-jump-variables/139462/2 "2026-09-14T07:35:34Z")

</div>

This answer by Oscar showed up, could you try that? [JuMP : how to read a lp problem from file (lp FORMAT) with variables names? - #2 by odow](https://discourse.julialang.org/t/jump-how-to-read-a-lp-problem-from-file-lp-format-with-variables-names/133008/2)

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 14, 2026, 10:19pm UTC](https://discourse.julialang.org/t/in-my-jump-model-the-lp-file-preserves-the-original-variable-names-but-the-mps-file-appears-to-rename-them-so-how-can-i-map-the-gurobi-sol-solution-back-to-the-original-jump-variables/139462/3 "2026-09-14T22:19:23Z")

</div>

Hi @amit_97,

JuMP’s MPS write does preserve names, but the MPS file does have some limits on what names it can preserve.

```Julia
julia> using JuMP

julia> begin
           model = Model()
           @variable(model, x >= 0)
           @objective(model, Min, 2 * x)
           @constraint(model, c, x <= 1)
           write_to_file(model, "/tmp/model.mps")
           print(read("/tmp/model.mps", String))
       end
NAME
ROWS
 N OBJ
 L c
COLUMNS
    x c 1
    x OBJ 2
RHS
    rhs c 1
RANGES
BOUNDS
 LO bounds x 0
 PL bounds x
ENDATA

```

Use the MathOptFormat file instead:

```Julia
julia> begin # Computer A
           using JuMP
           model = Model()
           @variable(model, x >= 0)
           @objective(model, Min, 2 * x)
           @constraint(model, c, x <= 1)
           write_to_file(model, "/tmp/model.mof.json")
       end

julia> begin # Computer B
           using JuMP, Gurobi, JSON
           model = read_from_file("/tmp/model.mof.json")
           set_optimizer(model, Gurobi.Optimizer)
           set_silent(model)
           optimize!(model)
           write(
               "/tmp/sol.json",
               JSON.json(Dict(name(x) => value(x) for x in all_variables(model))),
           )
       end;
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 722777
WLS license 722777 - registered to JuMP Development

julia> begin # Computer A
           using JSON
           JSON.parsefile("/tmp/sol.json")
       end
JSON.Object{String, Any} with 1 entry:
  "x" => 0.0

```
