I had seen the ability to solve an LP in the IDE, but our problem is that a different group generates the .lp file and we are picking it up from a repository and doing "what-if" analysis requiring manipulating variables.
We know the naming convention, so can identify by name what needs adjusted, but the indexing will vary by lp file based on business.
We have put together something in Java now, but would have preferred to do so in the IDE for a wider audience in the company.
I do appreciate the help though as I wasn't the clearest in my question or use case.
------------------------------
Matthew Colvin
------------------------------
Original Message:
Sent: Thu June 22, 2023 03:06 AM
From: ALEX FLEISCHER
Subject: Read and Edit LP File in OPL
Hi,
at https://github.com/AlexFleischerParis/howtowithopl/blob/master/importlpfile.mod you can see a small example
main{ cplex.importModel("zoo.lp"); cplex.solve(); writeln("objective = ",cplex.getObjValue()); }
and in the IDE you can see lp files

------------------------------
[Alex] [Fleischer]
[Data and AI Technical Sales]
[IBM]
Original Message:
Sent: Tue June 20, 2023 11:38 AM
From: Matthew Colvin
Subject: Read and Edit LP File in OPL
Thanks!
While the IDE would be preferable just to help other coworkers out, I can work with this.
------------------------------
Matthew Colvin
Original Message:
Sent: Tue June 20, 2023 11:22 AM
From: Paul Rubin
Subject: Read and Edit LP File in OPL
I don't know if it can be done in the IDE, but in Java you can iterate over the elements of a model. The method IloNumVar.getName() will let you get the name of a variable. I posted some sample code in a rather old blog post, but I think the syntax has not changed.
------------------------------
Paul Rubin
Professor Emeritus
Michigan State University
Original Message:
Sent: Mon June 19, 2023 03:33 PM
From: Matthew Colvin
Subject: Read and Edit LP File in OPL
A separate team is generating an .lp file and we are wanting to pick it up and run variants of the problem by editing variable upper and lower bounds where we know the variable names, but not the indexes which need edited.
I see in Python, you can use cplex.variables.get_names() to get variable names after reading in the .lp file, but is there a similar method in the OPL IDE? Java is another alternative if it can't be done through the IDE.
Thanks.
Matthew Colvin
------------------------------
Matthew Colvin
------------------------------