Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  using CPXgetprestat to extract cuts in cplex

    Posted 06/17/15 12:44 AM

    Originally posted by: Hosssein


    I have a question about the extraction of cuts generated by cplex. This topic is well discussed in the following link and a sample code is also provided:

    https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014468982

    In the code presented in this link by SystemAdmin, presolve is called once and then it is turned off and generated cuts are extracted in a branchcallback using CPXgetcallbacknodelp based on presolve variables, but the point is that users usually need to see cuts based on original variables not presolve variables. So I changed this code and added "status = CPXgetprestat (env, lp, &presolvestat,precstat, NULL,NULL, NULL);" to my code to translate the generated cuts from presolve variables to original variables. The problem is that sometime the mapping from presolve to original variables is not one to one because of variable aggregation, etc. To be more clear, when if pcstat[i]>=0 we know that variable pcstat[i] in the presolve model maps to variable i in the original model but if  pcstat[i]<0 we do not have any idea about the mapping. Is there any way to understand the mapping in case of pcstat[i]<0 (specifically for pcstat[i]= -3, -4 and -5)?

    for details of CPXgetprestat see 

    http://www-01.ibm.com/support/knowledgecenter/SS9UKU_12.4.0/com.ibm.cplex.zos.help/refcallablelibrary/html/functions/CPXgetprestat.html?lang=en

    Thanks 
    Hossein 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: using CPXgetprestat to extract cuts in cplex

    Posted 06/23/15 12:34 AM

    You may want to take a look at functions CPXcrushform and CPXuncrushform to translate cuts between original and presolved model.

    Make sure to disable non-linear reductions (CPX_PARAM_PRELINEAR) or the mapping may fail at runtime.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: using CPXgetprestat to extract cuts in cplex

    Posted 06/23/15 09:34 PM

    Originally posted by: Hosssein


    Thank you so much for your reply.  I added the following line to my code within the loop that I read the cuts generated by CPLEX.

     

    status = CPXuncrushform (xenv, MIP_lp, nzcnt, arg->indbuf, arg->valbuf, &len, &offset, ind, val);

     

    I am not sure about the second argument (MIP_lp) that is defined before the cuts loop as follows:

     

    CPXCLPptr MIP_lp;
    status = CPXgetcallbacklp (xenv, cbdata, wherefrom, &MIP_lp);

     

    Is it correct?  MIP_lp here presents the original model.

     

    Also I have another question. In this link it is mentioned that to display cplex cuts the parameter MIPCBREDLP must be set to 1. When I set it to 1 I get the following error

    CPLEX Error 1103: No presolve problem created

    This error is returned from CPXuncrushform, while if I set it to 0 the code works well and displays cuts. I believe that the parameter MIPCBREDLP must be turned off (set to 0) because in this case CPXuncrushform uncrushes the cuts in terms of the original model, but if it is set to 1, MIP_lp will be the same as the presolved model and therefore CPLEX returns Error 1103.

    Do you agree with me?

     


    #CPLEXOptimizers
    #DecisionOptimization