问题
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:
- Increase the parameter by x (This parameter is being read by CPLEX -but i don't know the VBA code for that-)
- Solve the model using the new value for x.
- Write all results back to the Excel sheet (using VBA codes, once again)
- Repeat all steps by k times.
So to sum it all up I'd be really happy to know how I can,
- Integrate VBA and CPLEX
- VBA codes for making CPLEX read from my Excel sheet.
- 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