Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  CPLEX MIP injecting a new primal bound during optimization

    Posted 04/11/15 12:43 PM

    Originally posted by: AJMaisse


     
    Hi all,
     
    I am interested in MIP optimization, and more particularly, to the problem of imposing CPLEX a new primal bound (=incumbent value) during the optimization. The idea is to cut out nodes that are suboptimal when compared to the externally computed primal bound and thus, speed up the process.
     
    I am using CPLEX Optimization Studio 12.6.1 on Linux and the C Callable Library functions.
     
    I have identified three ways of achieving my goal:
     
    1) Using control callbacks, before branching, if the LP solution of a node is already suboptimal then we do not create sons.
     
    2) We stop the optimization, add a constraint "obj <= C" where C is the new primal bound and run the optimization again.
     
    3) We stop optimization, set the parameter CPXPARAM_MIP_Tolerances_UpperCutoff to the value of the primal bound (since I am minimizing) and run again.
     
    I have two specific questions:
     
    a) I am having trouble with the last solution. Especially as regards solution statuts. I sometimes have a statut corresponding to an optimal solution and then when I fetch the objective value of my solution I have a CPLEX error with no solution (and I indeed know that there is no solution). I also sometimes have the statut that the problem is unbounded and I know that it is bounded. So I was wondering if maybe this CPLEX parameter was not meant to be used in such a way.
     
    b) Do you know any other method that might be proven more efficient time-wise?
     
    Thank you,
     
    Antoine

    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: CPLEX MIP injecting a new primal bound during optimization

    Posted 04/13/15 03:27 PM

    In (a), are you by any chance setting UpperCutoff to a value less than or equal to the objective value of the incumbent? (Bear in mind that, with rounding error, if you set it equal to what seems to be the current objective value, you might in fact be cutting off the incumbent.) I'm not sure what CPLEX does if you set a cutoff that would appear to invalidate the final incumbent.

    For (b), you could add a callback that adds a global lazy constraint or user cut of the form "obj <= C" when C is computed/updated. Technically, I think you are supposed to use a lazy constraint callback, which disables certain dual reductions, because your cut could lop off integer-feasible solutions. Given the specific nature of the cut, though, I'm not positive that a lazy constraint is necessary. (The user cut callback does not place the same restraints on how CPLEX solves the model.)


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: CPLEX MIP injecting a new primal bound during optimization

    Posted 04/14/15 03:28 AM

    Originally posted by: AJMaisse


    Thanks for the input Paul.

     

    In (a), I am on purpose sometimes cutting off the incumbent. This is because I start with an original problem, then I divide it into subproblems and if one subproblem has found a better integer solution, then it is possible that another whole subproblem is cut off. This does not affect the solution of the original problem and in this case, yes sometimes (often) I have Infeasible solutions for subproblems.

    For (b), thank you for the idea, I will have a look to global lazy constraints.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: CPLEX MIP injecting a new primal bound during optimization

    Posted 04/15/15 10:59 AM

    I'm not positive, but I believe that changes to CutUp and CutLo do not cut off an existing incumbent. So if you stop the master problem when it has a feasible solution and set CutUp to a value smaller than the objective value of that solution, then restart, CPLEX will ignore any future solutions whose objective value is above  CutUp but will not discard the one it had when you made the change.

    Combining that (if I'm right) with your getting "unbounded" occasionally, I wonder if your master problem might be numerically unstable? I don't see how CutUp (or CutLo) could cause CPLEX to think a bounded problem was unbounded.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: CPLEX MIP injecting a new primal bound during optimization

    Posted 04/20/15 06:05 AM

    Originally posted by: AJMaisse


    I am pretty sure my master problem is stable. It is a very basic automatically generated problem. However, it was done by someone else and I cannot be 100% sure.


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: CPLEX MIP injecting a new primal bound during optimization

    Posted 04/20/15 11:05 AM

    Stability is fairly easy to test:

    1. Set the CPXPARAM_MIP_Strategy_KappaStats parameter to either 1 or 2.
    2. Run the model (preferably with settings that reproduce the spurious "unbounded" message, but even a run with a correct result may be informative).
    3. Check the results. I think you do this by accessing the solution quality using the parameter CPX_KAPPA, but I'm not a C user.

    The kappa statistics will tell you the fraction of basis matrices encountered that were either "unstable" or "suspicious", along with the worst condition number encountered. If a nontrivial portion of the bases are unstable or the condition number is too high (both being judgment calls), the model may have numerical issues.


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: CPLEX MIP injecting a new primal bound during optimization

    Posted 04/17/15 02:11 AM

    As a 4th option you could use a heuristic callback to inject the new primal solution into CPLEX.

    About the problem with the status after modifying the cutoff: do you have a small code example to reproduce that? It seems like your code is correct but CPLEX behaves in an unexpected way here.


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: CPLEX MIP injecting a new primal bound during optimization

    Posted 04/20/15 06:19 AM

    Originally posted by: AJMaisse


    I will explore your suggestion about heuristic callback.

     

    Here-below is a pseudo-code of my implementation.

    ...
    for(int i = 0; i < numSubproblems; i++)
    {
        /* launchAgain is set when the problem is interrupted by informational callback
         * (return != 0) and not because it has terminated */
            launchAgain = 1;
            while(launchAgain == 1)
            {
                    CPXsetdblparam(environment,
                                   CPXPARAM_MIP_Tolerances_UpperCutoff,
                                   externalPrimalBound);
                    launchAgain = 0;
                    if(CPXmipopt(environment, problem)
                            cout << "Problem in the optimization" << endl;
            }
    }
    ...
    
    /* Info Callback */
    int CPXPUBLIC inquiryCallback(CPXCENVptr env, void *cbdata, int wherefrom, void *cbhandle)
    {
    
        double externalPrimalBound = getNewExternalPrimalBound();
        double currentPrimalBound;
        int status = 0;
            
            if(CPXgetcallbackinfo (env,
                                   cbdata,
                                   wherefrom,
                                   CPX_CALLBACK_INFO_BEST_INTEGER,
                                   &currentPrimalBound))
                    cout << "Something went wrong when obtaining best integer value in informational callback!" << endl;
    
            if(externalPrimalBound < currentPrimalBound)
        {
                    status = 1;
            launchAgain = 1;
        }
            
            return status;
    }
    

     


    #CPLEXOptimizers
    #DecisionOptimization