Decision Optimization

Decision Optimization

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

 View Only
  • 1.  warm start

    Posted Thu August 19, 2010 11:31 AM

    Originally posted by: Laval


    Hi,
    I'm using Cplex12.1 and opl6.3. My question is related to how to ask cplex to stop as soon as he detect that the initial (start) solution is infeasible. I'm using the IloOplCplexVectors()class and not IloOplCplexBasis(). I also set cplex cplex.rootalg=1; // use primal simplex
    cplex.repairtries=-1 // do not attempt to repair the initial solution.
    var opl2 = new IloOplModel(def, cplex);
      opl2.generate();
      var vectors = new IloOplCplexVectors();
      vectors.attach(opl2.x,opl2.values);
      vectors.attach(opl2.y,opl2.values);
      vectors.setVectors(cplex);
      cplex.rootalg=2;   
      cplex.repairtries=-1
      cplex.solve();
    


    The problem is that Cplex seems ignoring the setting (cplex.repairtries=-1) and try to repair the solution that I'm sur is infeasible. the idea behind the code is to chek if the initial solution is or not feasible by the model. Thanks for your help.
    the cplex log...
    *Warning:  No solution found from 1 MIP starts.*
    *Retaining values of one MIP start for possible repair.*
    Tried aggregator 1 time.
    MIP Presolve eliminated 11 rows and 21 columns.
    All rows and columns eliminated.
    Presolve time =    0.00 sec.
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: warm start

    Posted Fri August 20, 2010 04:06 AM

    Originally posted by: SystemAdmin


    You mis-interpreted the output. CPLEX does not attempt to repair your solution. It only saves the solution for "possible repair". The solution will only be repaired if you interrupt the solve and change the 'repair tries' parameter.
    As you can see from the log file, CPLEX found your solution to be infeasible. It therefore ignores that solution and continues to solve your problem. The problem is so simple that it is solved in presolve.
    If you want to check whether a given solution is feasible you should fix all variables to their value in the solution (don't know how to do this in OPL) and then invoke CPLEX.
    CPLEX just ignores infeasible start vectors and there is no way to stop CPLEX if a start vector is found to be infeasible (after all, a start vector is only a hint to CPLEX).
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: warm start

    Posted Fri August 20, 2010 12:32 PM

    Originally posted by: Laval


    Hi,
    Thanks for your answer. Now I better understand the Cplex Log and make more sense to me as you explained it. The log I showed is for a toy problem for testing puropose only. I have already tried your suggestion to fix variables to their values and the issue is that the script to do sucha task (loop) takes too much time (more than 20 minutes on intel i5 processor) and that's why I tried the idea of initial solution and try to stop cplex. setting an initial solution takes only few seconds... here is the script how I fix a decisiosn variables to valueX (put the LB equal to the UB of Z ): I don't really know why this script takes too much time.Opl script seems similar to other Interfaces API languages like. how can you express this script in such language or wher can I find some examples that can help me. Thanks again for your help.
    var opl2 = new IloOplModel(def, cplex);
                    for(var s in opl2.Pair_Strate_Essence_Age_S)    // 1500 elements in this set 
                            for(var p in opl2.Periodes)             // 30 periods in this set
                            opl2.Z[s][p].UB = opl2.Z[s][p].LB=valueX;
                       cplex.solve();
                     ...............
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: warm start

    Posted Mon August 23, 2010 08:09 AM

    Originally posted by: SystemAdmin


    I don't know OPL (maybe post this question on the OPL-Forum) but CPLEX APIs have methods to set bounds on an array of variables. This is probably faster than setting the bound for each variable individually. Maybe OPL has something similar?
    Or can you add multiple constraints in one shot? In this case you could add equations 'variable = value'. CPLEX presolve will take good care of them and turn them into bounds.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: warm start

    Posted Mon August 23, 2010 12:04 PM

    Originally posted by: Laval


    Thnaks a lot for your suggestions and I will post the question in the OPL forum. I have forgot to mention that Pair_Strate_Essence_Age_S is a set of tuples having this structure:
    tuple Pair_Strate_Essence_Age_Type {
      string  Strates;
      string  Essences;
      int     Ages;  }
    

    Notet that this loop is the most time-consuming.
    for(var s in opl2.Pair_Strate_Essence_Age_S)   // 1500 elements in this set
    

    Thanks again.
    #CPLEXOptimizers
    #DecisionOptimization