Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Solving CPLEX OPL Models via Excel VBA

    Posted 11/29/14 11:45 AM

    Originally posted by: story_


    Hey there everybody,

    This is a very simple question however I am not sure what I am supposed to do. So basically, I am using CPLEX OPL Version 12.4 and Excel 2007 on a Windows 7 64-bit laptop. 

    I need to solve multiple models in CPLEX with different parameters to observe a pattern in my model. To do this, instead of solving the models one by one (I need to solve around 200 models with different parameters) I am willing to write a code on Visual Basic to do it for me. I am clueless of which add-ins I shall use and which codes I should utilize.

    The basic steps I want my code to do is:

    1- After increasing the parameter make this excel file the document that is used in my optimization model.
    2- Run the optimization model. (The model takes parameters from the excel file and writes the results to the same excel file)
    3- Export the excel file
    4- Copy the results and paste them in another Excel document where all results for different parameters are kept.

    I would be really happy if you could help me with this very simple problem.

    Thanks in advance.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Solving CPLEX OPL Models via Excel VBA



  • 3.  Re: Solving CPLEX OPL Models via Excel VBA

    Posted 11/30/14 08:58 AM

    Originally posted by: story_


    Hey there,

    Thank you for your post.

    The situation is pretty similar, though in my case I'm willing to use Excel Macros and a single cell where the parameter is kept. I am willing to increase the parameter using a For loop in Excel Visual Basic, within the same loop I was thinking of solving the model and executing the results in the same Excel document.

    I am not quite sure how I will integrate Excel Visual Basic and CPLEX. I couln't find VBA codes to command Cplex to solve and execute results to an Excel file. In addition I am almost sure that I have to use an add-in (which I learned via the CPLEX Help Guide) however Excel gives an error which says that the add-in is invalid and could not be used.

    Thanks for your support.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Solving CPLEX OPL Models via Excel VBA



  • 5.  Re: Solving CPLEX OPL Models via Excel VBA

    Posted 11/30/14 02:05 PM

    Originally posted by: story_


    Hello,

    I have seen this article before, however I am not so familiar with VSTO. That's why I was wondering how to work on Excel Visual Basic.

    Thanks


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Solving CPLEX OPL Models via Excel VBA

    Posted 11/30/14 02:15 PM


  • 7.  Re: Solving CPLEX OPL Models via Excel VBA

    Posted 11/30/14 04:29 PM

    Originally posted by: story_


    Hello,

    Well I'm completely new to VSTO so I don't know any of the codes that come with it, for now all I can do is to look them up. I just have a very basic knowledge on VBA.

    I have read the user's manual on the Excel add-in before. I'm using CPLEX OPL version 12.4 and mine came with the add-in file already. My system is x86 and the add-in file is just incompatible with my Excel 2007 somehow. It gives an error where it says the file is not valid. Once I solve this issue I will try using the codes in the link you have sent. 

    Thanks


    #CPLEXOptimizers
    #DecisionOptimization