CPLEX OPL and Excel VBA Integration

为君一笑 提交于 2020-01-03 06:59:31

问题


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:


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



来源:https://stackoverflow.com/questions/27209189/cplex-opl-and-excel-vba-integration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!