Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  MIP Start Syntax Issues (Java)

    Posted 06/11/19 10:25 AM

    Originally posted by: LaylaM


    Hi, 

    I've just started to use MIP start with the Java API. I'm having issues with the syntax. I have two MIP starts, which both provide a partial solution. No matter how I order them, the first one will be used (I guess that is due to MIPStartEffort "Repair"), but the second one is being ignored. I've tried changing the MIPStartEffort by setting

    model.addMIPStart(startVar,startVal,IloCplex.MIPStartEffort.SolveMIP);
    

    or 

    model.addMIPStart(startVar,startVal,IloCplex.MIPStartEffort.Repair);
    

    but none of the both yielded the anticipated result. 

    Is there anything else I can try? I didn't find good examples of how to use the MIPStartEffort.

    Thanks

    Layla


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: MIP Start Syntax Issues (Java)

    Posted 06/11/19 04:39 PM

    Is the the same one ignored both times, or when you swap the order is the previously ignored one accepted and vice versa? If the latter, do they (meaning the completed solutions from them) have the same objective value?

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: MIP Start Syntax Issues (Java)

    Posted 06/12/19 02:48 AM

    Originally posted by: LaylaM


    Hi Paul,

    thanks for replying!

    No matter the order, it always accepts the first added MIP start. Let's say I call my start solutions start1 and start2. If I add start1 first, this will be accepted, if I add start2 first, this will be accepted.

    The objective value is not the same (I'm looking at a multi-modal routing problem and pass the single mode solutions).

    Best

    Layla


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: MIP Start Syntax Issues (Java)

    Posted 06/12/19 09:02 AM

    How do you know which solution is being accepted each time? Are you going by the incumbent value at the root node?


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: MIP Start Syntax Issues (Java)

    Posted 06/12/19 09:04 AM

    Originally posted by: LaylaM


    exactly. incumbent value. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: MIP Start Syntax Issues (Java)

    Posted 06/12/19 09:04 AM

    Originally posted by: LaylaM


    but also the selected route. when I print out the incumbnets, I see which one was chosen


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: MIP Start Syntax Issues (Java)

    Posted 06/12/19 03:09 PM

    Just to make it unambiguous, you could add a name to each MIP start (there are versions of the addMIPStart method that take a string argument). If you do that, CPLEX will print out the name of the start it is using near the top of the log.

    Also, do you get a message at the top of the log saying "1 of 2 MIP starts provided solutions"? When I add two MIP starts here (both feasible), I get "2 of 2 MIP starts provided solutions" (regardless of order). CPLEX then uses the better one (again, regardless of order).


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: MIP Start Syntax Issues (Java)

    Posted 07/01/19 10:32 AM

    Originally posted by: LaylaM


    I did that. Now I get the following: If I first add "Truck" (the best MIP start), only this one is added

    1 of 2 MIP starts provided solutions.
    MIP start 'Truck' defined initial solution with objective 85.4953.
    Retaining values of 1 MIP starts for possible repair.
    

    If I first add "Bike" (the second best MIP start), both are added

    2 of 2 MIP starts provided solutions.
    MIP start 'Truck' defined initial solution with objective 85.4953.
    

    So once, both are accepted, and in the other case only one of both is accepted. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: MIP Start Syntax Issues (Java)

    Posted 07/01/19 01:33 PM

    Well, as long as it accepts the better solution, I think your program should run fine. I have no idea, though, why you get two acceptances only if you start with the inferior solution and I get two acceptances in either order ... unless it has to do with the version of CPLEX you have. I'm using 12.9.0.0.

     

    Paul


    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: MIP Start Syntax Issues (Java)

    Posted 07/02/19 05:39 AM

    A MIP start should be accepted if it

    - is feasible

    - provides an objective value that is better than the current incumbent

    So the order indeed matters. If you want each MIP start to be accepted then you have to list them in order of improving objective value (starting with the worst). Having more than one MIP start can affect performance: algorithms that construct new solutions from old solutions (like genetic algorithms) can potentially benefit if there are more "old" solutions.

    Another thing that can change things here is the effort level. Depending on the effort level CPLEX may try or try hard to find a solution from your MIP start. This can result in MIP starts that look different than expected. If you don't want CPLEX to mess with your MIP start at all then you must provide a full MIP start that contains a value for every variable and use either the "checkfeas" or "nocheck" effort levels.

    @LaylaM: I am not clear whether your issue is solved now. If not, can you please repeat what does not work yet?


    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: MIP Start Syntax Issues (Java)

    Posted 07/02/19 02:17 PM

    Daniel,

    I ran a trivial test problem (pure IP with five binary variables) and fed it two MIP starts, one optimal and one distinctly suboptimal. Here is the output (including a dump of the model):
     

    IloModel  {
    IloMinimize  : (1.0*San_Jose + 1.0*Detroit + 1.0*Pittsburgh + 1.0*Newark + 1.0*Fresno)
    IloRange Central_Ohio : 1.0 <= (1.0*San_Jose + 1.0*Detroit + 1.0*Newark + 1.0*Fresno) <= infinity
    IloRange Metro_NY : 1.0 <= (1.0*Fresno) <= infinity
    IloRange SF_Oakland : 1.0 <= (1.0*Pittsburgh) <= infinity
    
    }
    CPXPARAM_MIP_Limits_Nodes                        0
    CPXPARAM_TimeLimit                               60
    2 of 2 MIP starts provided solutions.
    MIP start 'opt' defined initial solution with objective 2.0000.
    Tried aggregator 1 time.
    MIP Presolve eliminated 3 rows and 5 columns.
    All rows and columns eliminated.
    Presolve time = 0.00 sec. (0.00 ticks)
    
    Root node processing (before b&c):
      Real time             =    0.01 sec. (0.01 ticks)
    Parallel b&c, 4 threads:
      Real time             =    0.00 sec. (0.00 ticks)
      Sync time (average)   =    0.00 sec.
      Wait time (average)   =    0.00 sec.
                              ------------
    Total (root+branch&cut) =    0.01 sec. (0.01 ticks)
    Solver status = Optimal
    Objective value = 2.0
    

    This is the code that added the MIP starts (where x is the vector of binary variables):

        mip.addMIPStart(x, new double[] {0.0, 0.0, 1.0, 0.0, 1.0},
                        IloCplex.MIPStartEffort.Auto, "opt");
        mip.addMIPStart(x, new double[] {1.0, 0.0, 1.0, 1.0, 1.0},
                        IloCplex.MIPStartEffort.Auto, "subopt");
    

    The first solution has cost 2 and is optimal; the second solution has cost 4 and is suboptimal. The output says both "provided solutions", even though the optimal solution was added first. I'm not sure how to reconcile this with what you said about the order of entry (which seems logical enough). This is with CPLEX 12.9.

    Paul


    #CPLEXOptimizers
    #DecisionOptimization