PyPSA / linopy

Linear optimization with N-D labeled arrays in Python
https://linopy.readthedocs.io
MIT License
159 stars 44 forks source link

Request: allow retention of original variable names when writing to lp file #157

Open JorritHimself opened 12 months ago

JorritHimself commented 12 months ago

In pyomo one could specifiy: model.write(lp_file_name, io_options={'symbolic_solver_labels': True}) Which retains original variable names, rathe rthan having these rewritten to x0, x1, x2 etc.

We use a lot of scripts to parse both problem and solution files for all sorts of analyses/plots, and that'd require having the original variable names used when writing to lp file. From the dicord channel I udnerstood the option has not (yet) been included in Model.to_file(fn) but it might be possible to include. Would help a lot with my projects. Cheers.

OBeaude commented 2 months ago

Having recently started with Linopy, I wanted to check the obtained lp file - also using model.to_file method - against some reference one obtained with pyomo... and faced the same issue.

Anything new since your post in Sept. 2023 @FabianHofmann ?

Thank you

FabianHofmann commented 2 months ago

Hey @OBeaude, unfortunately not. Maintenance swallows a lot of time, and this did not seem pressing to me. What would be your specific use case?

OBeaude commented 2 months ago

Hey @FabianHofmann. In turn, we could code a patch and make a pull request. Would it be convenient for you? Any advice?

N.B. Our first use case is to check that we reproduce the writing of the .lp file we got using Pyomo on a given LP

FabianHofmann commented 2 months ago

Sure! PR's are always welcome!