0

I'm working on an optimization problem at the moment and I'm trying to use the results I receive from the VRPTW for a bin packing problem. Does anyone now how to automatise that? Right now I'm typing in the results manually.

Thanks for helping a newbie:)

nona
  • 84
  • 6
  • How do you run the first optimization and how do you run the second? How does the second one takes its input? I'm certain that you can either do what you want programmatically (use the CPLEX API to extract the solution and then feed the solution the the second optimization via the API, too), or by printing out the solution for the first optimization and parse it to feed it to the second. But you need to provide a bit more information :-). – LaszloLadanyi Dec 25 '19 at 22:06
  • Certainly very possible (easy?) to do, and *strongly* suggest working directly with the results from your first cplex solve to feed into the second. Trying to parse results from a solution file (in xml, text or whatever) is going to be about 10 times more work and harder to program than working directly with a cplex API. Should be easy enough in C#, C++, Java, Python, or even OPL if you have to use it. But as Laszlo says you will need to give us a lot more info about your chosen implementation language, environmemnt etc to get specific guidance, – TimChippingtonDerrick Dec 26 '19 at 13:35
  • In addition to what others said: you should at least tell with which API you are working, whether you use OPL, docplex, etc. – Daniel Junglas Jan 06 '20 at 06:39

1 Answers1

0

If you write your code in a programming language (C, C++, Java, Python, ...) then you can get the solution vector from CPLEX and directly feed it into the part of the code that creates the second model.

If you instead solve on the command line or in different processes you can export the solution to a file and read that file from the code that creates the model. CPLEX has functions to write and read solution files.

Finally, if you are writing in OPL then you could write your models to a text file (using IloOplOutputFile) in .dat format and use that file as input for the second model. Or use the solution from the first model as starting point for the second model as described in the example warmstart that is shipped with CPLEX.

Daniel Junglas
  • 5,830
  • 1
  • 5
  • 22