CPLEX OPL and Excel VBA Integration

2019-06-14 18:01发布

I have to run the same optimization model many times with different parameters for research purposes. (I am trying to observe the results I'll get off a single model when I increase a parameter) The easiest way for me to do is to use Excel Macros as it would take me forever to solve each model one by one and record the results. However I have no idea how I will make VBA call the CPLEX Solver and read all my parameters from my excel sheet and write the results back there.

If I am to put what I want to do in steps in VBA, it'd be something like so:

  1. Increase the parameter by x (This parameter is being read by CPLEX -but i don't know the VBA code for that-)
  2. Solve the model using the new value for x.
  3. Write all results back to the Excel sheet (using VBA codes, once again)
  4. Repeat all steps by k times.

So to sum it all up I'd be really happy to know how I can,

  1. Integrate VBA and CPLEX
  2. VBA codes for making CPLEX read from my Excel sheet.
  3. VBA codes for making CPLEX write to my Excel sheet.

Thanks in advance.

Note: I tried reading all of the troubleshooting + CPLEX guides to help me on this issue but it confused me even more.

1条回答
我想做一个坏孩纸
2楼-- · 2019-06-14 18:20

have you had a look at https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014880109 ?

and at the .bas examples in cplex\examples\src\excel ?

regards

查看更多
登录 后发表回答