Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Different solution and solution times / CPXmipopt and interactive optimizer

    Posted 10/07/11 11:39 AM

    Originally posted by: guvencdegirmenci


    I read MIP model from a file (.lp file) and optimize in C++ as below.

    status = CPXreadcopyprob(env, lp, "lpmodel.lp", NULL); 
    if(status)
       cout << "External model file cannot be accessed";
    status = CPXmipopt (env, lp);   
    if ( status ) {
       cout << "Failed to optimize MIP." << endl;
    }
    


    CPLEX 12.2 failed to optimize the model in about 3000sec. However when I use interactive optimizer through command window, the same model model can be solved to the optimal in about 240sec.

    Does anyone know what the problem is and how I can fix it?
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Different solution and solution times / CPXmipopt and interactive optimizer

    Posted 10/07/11 12:28 PM

    Originally posted by: SystemAdmin


    > CPLEX 12.2 failed to optimize the model in about 3000sec. However when
    > I use interactive optimizer through command window, the same model
    > model can be solved to the optimal in about 240sec.

    Can you send the node logs over in both the cases? Do make sure that the screen indicator is turned on, in your code (
    status = CPXsetintparam (env, CPX_PARAM_SCRIND, CPX_ON);
    
    ).

    It will be great if you can attach the model as well.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Different solution and solution times / CPXmipopt and interactive optimizer

    Posted 10/07/11 01:43 PM

    Originally posted by: guvencdegirmenci


    In my code I made sure that the screen indicator is turned on. However, in the cplex.log file only statement is: "Log started (V12.2.0.0) Tue Mar 15 14:49:27 2011". Should I do something else or look somewhere else?

    I attached the lp model as well.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Different solution and solution times / CPXmipopt and interactive optimizer

    Posted 10/07/11 01:52 PM

    Originally posted by: guvencdegirmenci


    Maybe it might be helpful to understand the problem. When I run my c++ code, this is what I see in the screen:

    +There may be further error information in the clone logs.

    Cover cuts applied: 564
    Flow cuts applied: 59
    Mixed integer rounding cuts applied: 1
    Gomory fractional cuts applied: 65

    Root node processing (before b&c)

    Real time = 10.34
    Parallel b&c, 2 threads"
    Real time = 2338.28
    Sync time (average) = 65.63
    Wait time(average) = 155.44

    Total (root+branch &cut) = 2348.63 sec.
    Warning: MIP starts not constructed because of out-of-memory status.

    Consider using CPLEX node files to reduce memory usage.
    CPLEX Error 1001: Out of memory.+

    I wonder why I get the message above while I can solve it using interactive optimizer.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Different solution and solution times / CPXmipopt and interactive optimizer

    Posted 10/07/11 02:58 PM

    Originally posted by: SystemAdmin


    > In my code I made sure that the screen indicator is turned on. However,
    > in the cplex.log file only statement is: "Log started (V12.2.0.0) Tue
    > Mar 15 14:49:27 2011". Should I do something else or look somewhere
    > else?

    I was referring to the node logs that get printed in your application run and not the cplex.log file.

    > Total (root+branch &cut) = 2348.63 sec.
    > Warning: MIP starts not constructed because of out-of-memory status.
    > Consider using CPLEX node files to reduce memory usage.
    > CPLEX Error 1001: Out of memory.+

    Thank you for sending over the LP file. I was able to run the model to completion with default settings using the interactive optimizer, a C program and a C++ program on a windows dual core machine with CPLEX 12.2.0.2, Visual Studio 2008 and 3Gbs of RAM.

    The message itself does not indicate an error- it shows that you faced an out-of-memory condition. Are you using any non-default settings for your run; in other words do you set any CPLEX parameters before calling CPXmipopt? From the logs it looks like CPLEX kept looking through the B&C in search of the optimal solution, but before it could reach it, the huge tree size may have caused the out-of-memory condition. I am assuming that you are running this application on a 32 bit machine (with a 32 bit CPLEX installation) where the OS will not be able to allocate more than 2Gbs of space for any given application and when your application reaches close to consuming 1-1.5Gbs of space, then you may see this message.

    There are many ways to deal with this:
    1) Firstly to check if default settings can help solve the model or not, please use the attached lpex2.c sample (that comes with the distribution) to see if that solves the model. You will need to invoke the exe as such :
    cmd> lpex2.exe mipmodel.lp o
    (assuming that you are running this on a windows machine)

    2) Setting certain CPLEX parameters to either help converge to the optimal solution quicker and/or reduce the memory consumption by the model. To do this you will need to add the following lines to your application before the CPXmipopt call:
    status = CPXsetintparam (env, CPX_PARAM_MIPEMPHASIS , 2);//setting MIPEmphasis to 2 or optimality
       if(status){
               cout<<"Error setting MIPEmphasis"<<endl;
       }
       status = CPXsetintparam (env, CPX_PARAM_MEMORYEMPHASIS , CPX_ON);//setting MemoryEmphasis to CPX_ON
       if(status){
               cout<<"Error setting MemoryEmphasis"<<endl;
       }
    


    3) Ultimately, if you have large problems to solve and you suspect that some of them may require more than 2Gbs by the application, then moving to a 64 bit machine (with a 64 bit CPLEX Optimization Studio installation and adequate RAM) would serve as the ultimate solution.

    Here's a documentation link which talks more about the out-of-memory condition:
    http://publib.boulder.ibm.com/infocenter/cosinfoc/v12r2/index.jsp?topic=%2Filog.odms.cplex.help%2FContent%2FOptimization%2FDocumentation%2FCPLEX%2F_pubskel%2FCPLEX582.html

    Hope this helps.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Different solution and solution times / CPXmipopt and interactive optimizer

    Posted 10/07/11 02:59 PM

    Originally posted by: guvencdegirmenci


    I solved my problem, it was totaly my mistake. In my c++ code I turned-off presolve with the following:
    status = CPXsetintparam (env, CPX_PARAM_PREIND, CPX_ON);
    


    I turned it on and it works fine.

    Thanks for your help anyway.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Different solution and solution times / CPXmipopt and interactive optimizer

    Posted 10/07/11 03:01 PM

    Originally posted by: guvencdegirmenci


    Thanks AbhishekRaman. That is very helpful.
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Different solution and solution times / CPXmipopt and interactive optimizer

    Posted 10/07/11 03:16 PM

    Originally posted by: SystemAdmin


    I am glad to know that the issue has been resolved. Yes, with presolve turned off, CPLEX will potentially have a larger model to start with, and could also miss out on some variable fixings and reductions. This could then result in bigger tree traversals and thus the results. Thank you for sharing your resolution with us.

    -Abhishek
    #CPLEXOptimizers
    #DecisionOptimization