Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Problems when calling cplex.solve() many times

    Posted 05/12/12 11:36 AM

    Originally posted by: Q2W8_Emanuele_Manni


    Hello,
    I am using Cplex 12.3 with the Java API to solve a MIP. Once that I have created the optimization model, I need to solve it multiple times. What changes from one call of cplex.solve() to the other, is that I fix the values of some integer variables and I remove/add a constraint. My problem is that, when calling cplex.solve() with big instances, there is a setup time before the optimization starts, which is not negligible. So, calling it many times increase very much the whole computing time of my procedure. A sketch of my code is attached.

    Moreover, I have also tried to implement it using Java and OPL. The code is attached as well. There is only a little improvement in terms of running times with respect to the first implementation.

    Am I doing something wrong? Could it be done more efficiently?

    Thanks in advance for your help.
    Emanuele
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Problems when calling cplex.solve() many times

    Posted 05/13/12 09:44 AM

    Originally posted by: SystemAdmin


    A few ideas:
    1. Have you tried using IloNumVar.setBounds() in order to fix a variable instead of adding an equality constraint for the variable?
    2. How much of your model actually stays the same between two iterations? Sometimes it is faster to create the model from scratch every time rather than updating it all the time.
    3. Instead of removing the constraints in a for loop it might be faster to just call model.remove(range) which removes all ranges in the array in one shot.
    4. Did you do some profiling to identify which part in the loop consumes too much time? Or is it the time between you call solve() and the solve actually starts?
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Problems when calling cplex.solve() many times

    Posted 05/13/12 10:05 AM

    Originally posted by: Q2W8_Emanuele_Manni


    Daniel, thanks for your reply.
    I'll try your ideas 1)-3) and let you know. As for point 4), the part of the loop that consumes a lot of time is, as you say, between I call solve() and before the solve actually starts.
    Thanks
    Emanuele
    #CPLEXOptimizers
    #DecisionOptimization