Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Ask help with cplex error

  • 1.  Ask help with cplex error

    Posted 05/03/10 01:34 PM

    Originally posted by: ashley19


    I want to solve a network flow problem with benders decomposation approach using cplex 11. When I solve the small instance (total 50 nodes in the network, 8 source nodes, and 12 destinations), everything works very well, but when I tried a large network (total 100 nodes in the network, 30 source nodes, and 17 destinations), there is an error happend.

    The error message is as follows:

    Runtime Error!
    Program: ...ments and settings\~follow with the program's path~
    abnormal program termination

    I think it is not the problem with my codes, is it probabily too big for cplex to solve? Is anyone meet the same problem as mine? Thanks.

    Attached is the printscreen of the error message.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Ask help with cplex error

    Posted 05/03/10 03:15 PM

    Originally posted by: SystemAdmin


    It's very unlikely that your model is too big for CPLEX. You would have to have a very large number of side constraints to being to tax CPLEX. (100 nodes, up to 510 OD pairs is not a particularly large network.) The problem is almost surely a coding error. Knowing C++, I wouldn't be surprised if a null pointer is involved. I also would not be surprised if a memory leak was involved (which might explain why the smaller instance ran).

    Have you tried running the larger instance in a debugger to see where the problem occurs? Other than that, I can recommend using assertions liberally throughout the code, and the old but trusty trick of loading up the code with print statements to see where it blows up (and maybe why). There are also programs you can use to test for memory leaks.

    Good luck,
    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Ask help with cplex error

    Posted 05/03/10 10:31 PM

    Originally posted by: ashley19


    Hi Paul,

    I used the "print" method to check the program, found the error happend at very beginning place of the program. Just when I tried to declare the variables, the error happened. I attach the piece of code, would you please have a look at it? (I use concert technology, and there is nothing before this piece of code in my program)
    typedef IloArray<IloNumVarArray> IloNumVarArray2;
    typedef IloArray<IloNumVarArray2> IloNumVarArray3;
    typedef IloArray<IloNumVarArray3> IloNumVarArray4;

    IloNumVarArray4 z(env, m);
    for(p = 0; p < m; p++)
    {
    z[p] = IloNumVarArray3 (env, o);
    for(i=0; i<o; i++)
    {
    z[p][i] = IloNumVarArray2 (env, o);
    for(j = 0; j < o; j++)
    z[p][i][j] = IloNumVarArray(env, o, 0, 1, ILOINT);
    }
    }
    The error happend during variables z (4 dimensions) are declared.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Ask help with cplex error

    Posted 05/04/10 10:13 AM

    Originally posted by: SystemAdmin


    I see nothing wrong with the code. You should print out the values of m and o to make sure they are valid. Print out env as well, to make sure it is properly initialized.

    You said there was nothing before that piece of code, but there must be -- something must declare m and o and set values for them, and something must declare and initialize the env variable.

    /Paul
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Ask help with cplex error

    Posted 05/06/10 06:21 PM

    Originally posted by: SystemAdmin


    Paul, thank you for your suggestion. I am back, I forgot my id and password, so I got a new account.

    I printed the value for m, n and o, their values are correct. But I am not sure about what were you meaning "initialize the env and print it out", when I constructed it using " IloEnv env;" it has been initialized automatically, right? and did you mean I should print its pointer out? (cout<<env.getImpl()<<endl;) otherwise I do not know how to print it out, since if I use "cout<<env<<endl;" it does not work.

    Yes, you were correct, there are some declare things before those piece of code, the whole piece of code from beginning is as follows, would you please help me look at it again? Thank you very much.

    #include "header.h"
    vector<double> MP_ADD (vector<vector<double> >& matrix_dual_var, int m, int n, int o, vector<vector<double> >& passtime_arc, vector<int>& population, vector<int>& capacity_node, vector<int>& capacity_shelter,vector<vector<int> >& capacity_edge, vector<int>& fixcost_node, vector<int>& fixcost_shelter, vector<vector<int> >& fixcost_edge,vector<vector<vector<vector<int> > > >& open_z, vector<vector<int> >& open_edge, vector<int>& open_shelter,vector<int>& open_transfer, vector<bool>& unbounded_vector)
    {

    vector<double> mp_val;

    ILOSTLBEGIN
    double masteropt;
    typedef IloArray<IloNumArray> IloNumArray2;
    typedef IloArray<IloNumArray2> IloNumArray3;
    typedef IloArray<IloNumArray3> IloNumArray4;
    typedef IloArray<IloNumVarArray> IloNumVarArray2;
    typedef IloArray<IloNumVarArray2> IloNumVarArray3;
    typedef IloArray<IloNumVarArray3> IloNumVarArray4;

    try{
    IloEnv env;
    IloInt i, j, s, q, p, d;

    IloModel model(env);

    IloRangeArray con1(env), con2(env), con3(env), con4(env), con5(env), con6(env), con7(env), con8(env), con9(env), con10(env), con11(env), con12(env), con13(env), con14(env), con_cut(env);

    cout<<"The enviorement pointer is: "<<env.getImpl()<<endl;
    cout<<"m = "<<m<<endl;
    cout<<"n = "<<n<<endl;
    cout<<"o = "<<o<<endl;

    IloNumVarArray y_shelter(env, n, 0, 1, ILOINT);
    IloNumVarArray y_transfer(env, o, 0, 1, ILOINT);

    IloNumVarArray2 y_edge(env, o);
    for(i = 0; i < o; i++)
    {
    y_edge[i] = IloNumVarArray(env, o, 0, 1, ILOINT);
    }
    cout<<"print"<<endl;
    IloNumVarArray4 z(env, m);
    for(p = 0; p < m; p++)
    {
    z[p] = IloNumVarArray3 (env, o);
    for(i=0; i<o; i++)
    {
    z[p][i] = IloNumVarArray2 (env, o);
    for(j = 0; j < o; j++)
    {
    cout<<"p = "<<p<<endl;
    cout<<"i = "<<i<<endl;
    cout<<"j = "<<j<<endl;
    z[p][i][j] = IloNumVarArray(env, o, 0, 1, ILOINT);
    cout<<"F"<<endl;
    }
    }
    }
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Ask help with cplex error

    Posted 05/06/10 06:25 PM

    Originally posted by: SystemAdmin


    I checked the program using the above code, and found that the error happend after p=29, i=97, and j=99, it means the error happend when the program wants to go through for p=29, i=98, j=0.

    The range for p is 0,29, for i is 0, 99, for j is 0, 99.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Ask help with cplex error

    Posted 05/06/10 08:40 PM

    Originally posted by: GuangFeng


    Try to use smaller ranges: set the range for p as 0,3, for i as 0, 10, for j as 0, 10. If it works well for small ranges, but does not for large ranges, it is an out of memory error.
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Ask help with cplex error

    Posted 05/06/10 10:12 PM

    Originally posted by: SystemAdmin


    Thanks, the smaller cases works very well.

    But someone said it is not a big instance (total only 50 nodes, including 30 sources, 17 destinations). I also think it should have the ability to solve even larger problem. How can I make sure it is out of memory or not? If I run this program in another computer which has larger memory, if the program works, then it means it is an out of memory error ?
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Ask help with cplex error

    Posted 05/07/10 03:53 AM

    Originally posted by: SystemAdmin


    Can please try this to figure out more information:
    // This is for the abort() function.
    #include <cstdlib>
     
    try {
       // Your code goes here
       ...
    } catch (IloException& e) {
       std::cerr << "IloException: " << e << std::endl;
       ::abort();
    } catch (std::exception& e) {
       std::cerr << "std::exception: " << e.what() << std::endl;
       ::abort();
    } catch (...) {
       std::cerr << "unknown exception!" << std::endl;
       ::abort();
    }
    

    I.e. wrap your code into an appropriate try-catch and see if you get any meaningful exception.
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Ask help with cplex error

    Posted 05/17/10 03:55 PM

    Originally posted by: SystemAdmin


    Hi Daniel,

    Thank you. I tried the method (that piece of code) you suggested. It showed the error message as follows:

    unknown exception!
    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.

    From this message I still can not know what happend to my program, do you have suggestions about how to find the error in further step?

    Thank you.
    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: Ask help with cplex error

    Posted 05/18/10 01:40 AM

    Originally posted by: SystemAdmin


    Yes, I have another idea how to debug that but it depends on which debuggers you have available and how familiar you are with debuggers. My next idea would be
    • Remove the 'try ... catch' blocks I suggested so that only your is left.
    • Run the code through a debugger.
    • The program will crash due to an unhandled exception. Some debuggers give you an exception backtrace in this case. If your debugger does then you will be able to see exactly at which line the exception is raised.

    Can you do that? If you have further questions or don't know how to do the above then feel free to contact me at 'daniel (dot) junglas (at) de (dot) ibm (dot) com'. If you want you may also send me your code and I will take a look at it.
    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: Ask help with cplex error

    Posted 05/21/10 03:29 PM

    Originally posted by: SystemAdmin


    Hi Daniel,

    Thank you. I sent you an email, did you receive that?
    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: Ask help with cplex error

    Posted 05/26/10 02:01 AM

    Originally posted by: SystemAdmin


    No, I don't think I got an email from you. Maybe something went wrong with my address? Let's try the non-obfuscated version: daniel.junglas@de.ibm.com
    #CPLEXOptimizers
    #DecisionOptimization


  • 14.  Re: Ask help with cplex error

    Posted 05/06/10 06:28 PM

    Originally posted by: SystemAdmin


    I also print out the address that env points to, it is 00382DF8, it looks normal.
    #CPLEXOptimizers
    #DecisionOptimization