2

I'm solving an optimization problem in which I need the result from one model to be used as a restriction in another model. I'm using CPLEX with OPL language without any addon.

I tried to save the values from one model into an Excel file and reading those into the next model but since I'm going to work with huge data files that won't be enough to do the job.

Theoretically I want to sequentially compile the two models, in which the data of the first model needs to be saved in memory and used to solve the other one. Is it possible?

Xavier Nodet
  • 5,033
  • 2
  • 37
  • 48
John
  • 37
  • 3

1 Answers1

2

You can do that through flow control and use of a "main" block. I wrote an example at

https://www.ibm.com/developerworks/community/forums/html/topic?id=471cc451-9dc2-44d8-a0e9-5f146fb14765&ps=25

and the information transfer is in

data2.maxOfx=opl1.y.solutionValue; // transfer solution of model1 to input for model2
halfer
  • 19,824
  • 17
  • 99
  • 186
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15