Decision Optimization

Decision Optimization

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


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

Cplex 12.6.2 Error with Null message

  • 1.  Cplex 12.6.2 Error with Null message

    Posted 07/15/15 05:44 PM

    Originally posted by: Artt


    Hello,

    I tried to solve for a rather complicated quadratic programming problem (with simple linear constraints) and got the following message:

     

    ??? Error using ==> cplexlink1262
    (null)

    Error in ==> C:\Program
    Files\IBM\ILOG\CPLEX_Studio1262\cplex\matlab\x64_win64\@Cplex\Cplex.p>Cplex.solve at 1721


    Error in ==> C:\Program
    Files\IBM\ILOG\CPLEX_Studio1262\cplex\matlab\x64_win64\@Cplex\Cplex.p>Cplex.subsref at 3969

     

    Since the error message is "(null)," I really have no idea how to resolve this or what went wrong. Cplex did run fine when I remove the quadratic objective matrix. Suspecting that there might be something wrong with quadratic programming, I also tried running the example file qcpex1.m and it works fine.

     

    Any help is highly appreciated!


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/15/15 06:01 PM

    Try exporting the model just before solving as described here.  Can you reproduce the crash using the exported model with the CPLEX interactive?  Can you attach the model here (or your matlab code)?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/15/15 06:20 PM

    Originally posted by: Artt


    Hi, 

    Below is the model. I am now looking into how I can run my model using CPLEX interactive. So far, I have been using matlab API.

    Thanks.


    lb = [zeros(Nbid+length(Nzone)*Hofday,1)];
    ub = [qbid; 100000*ones(length(Nzone)*Hofday,1)];
    f = [pbid; BB1{day,1}];

    %----------------------------------------------------------
    % Populate and solve the model using CPLEX
    %----------------------------------------------------------
    cplex = Cplex();
    cplex.Model.sense = 'minimize';
    cplex.DisplayFunc = [];


    cplex.Model.Q = BB2{day,1};
    cplex.addCols(f,[],lb,ub);
    cplex.addRows(zeros(Hofday,1),AA{day,1},zeros(Hofday,1), char(ones([Hofday 1])*'d'));
    cplex.addRows(lowerb{day,1}, DD{day,1}, upperb{day,1}, char(ones([Hofday*(length(Nzone)-1) 1])*'cong'));

    solution = cplex.solve();
    solution = solution.x;
    cost1 = cplex.Solution.objval;
    dual = cplex.Solution.dual;


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/15/15 06:57 PM

    Originally posted by: Artt


    Additional information: I tried running my code using Cplex on the school's server and it works fine. I suspect that it might have something to do with how Cplex is installed on my machine. I re-install Cplex on my machine, but still see the same error message. Any thoughts?


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/15/15 07:04 PM

    Do you have the same exact version of MATLAB installed on your personal computer?  Could it be that you've installed a version of MATLAB that is not supported?  Could it be a 32bit vs 64bit problem (e.g., see this thread)?  The detailed system requirements can be found here.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/15/15 06:57 PM

    I'm not a MATLAB expert, but when I try to run that I get:

     MException
    
      Properties:
        identifier: 'MATLAB:UndefinedFunction'
           message: 'Undefined function or variable 'Nbid'.'
             cause: {}
             stack: [2x1 struct]
    
    
    ??? Undefined function or variable 'Nbid'.
    

    There must be some missing pieces from the snippet you provided....

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/15/15 08:15 PM

    Originally posted by: Artt


    I have matlab 2010a (64 bit) and I downloaded Cplex for 64 bit. From the page you directed to, my Matlab is outdated and is probably unsupported by Cplex 12.6.2. Thus, matlab version might explain that.

     

    The school's server has matlab 2015a (which I don't), so there is really no way to test if it is the case. 

     

    I do have matlab 2012b in my Mac OS. This is reported to be compatible with Cplex 12.6.2. I tried running my program/code on my Mac and get the exact same error message :(


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/16/15 12:30 PM

    Did you see my message above about missing code?  If you provide the rest of your matlab code, I can try to reproduce.  Otherwise, please do try to export your model to .sav format (using the instructions I pointed at above).  After doing that, it should be easy to read your model into the CPLEX interactive and see if you get any other clues from the behavior there.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/16/15 07:40 PM

    Originally posted by: Artt


    Sorry for the delay. I attach a zip file that contains the complete code and other .mat files needed to run the program here. Thank you so much for your advice and suggestions so far!


    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/17/15 12:34 PM

    Now, I get this error:

     

      MException
    
      Properties:
        identifier: 'MATLAB:UndefinedFunction'
           message: 'Undefined function or variable 'day'.'
             cause: {}
             stack: [2x1 struct]
    
    
    {??? Undefined function or variable 'day'.
    
    Error in ==> example at 16
    f = [pbid; BB1{day,1}];
    

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/20/15 12:38 AM

    Originally posted by: Artt


    Hi,

    That can be fixed by adding "day = 1" to the beginning of the matlab code. Sorry for the bug.


    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/20/15 11:59 AM

    I'm able to reproduce this now.  I'll investigate more and get back to you.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/20/15 12:14 PM

    Originally posted by: Artt


    Thank you so much!


    #CPLEXOptimizers
    #DecisionOptimization


  • 14.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/20/15 12:42 PM

    If you move the line of code where you set cplex.Model.Q below the last call to addRows (and before the call to cplex.solve) then it seems to solve fine.

    For example:

    cplex = Cplex();
    cplex.Model.sense = 'minimize';
    cplex.DisplayFunc = [];
    
    cplex.addCols(f,[],lb,ub);
    
    cplex.addRows(zeros(Hofday,1),AA{day,1},zeros(Hofday,1), char(ones([Hofday 1])*'d'));
    cplex.addRows(lowerb{day,1}, DD{day,1}, upperb{day,1}, char(ones([Hofday*(length(Nzone)-1) 1])*'cong'));
    
    cplex.Model.Q = BB2{day,1};
    cplex.writeModel('example.lp')
    solution = cplex.solve();
    

    I've also include the call to writeModel as an example of how to export the model.  Can you give this a try and report back whether things are working as you expect after this change?

     

    The error message that you were getting wasn't particularly helpful, but it looks like this has been addressed (and should be included in a future fix-pack/release).

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 15.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/20/15 02:31 PM

    The error message that you were getting wasn't particularly helpful, but it looks like this has been addressed (and should be included in a future fix-pack/release).

    I take it back.  You get the nicer error message when you set the datacheck parameter, and this is expected.  You can do this, like so:

    cplex = Cplex();
    cplex.Param.read.datacheck.Cur = 1;
    

    When you set this after initializing the cplex object, you'll get the something similar to the following output:

    ??? Error using ==> Cplex.Cplex>Cplex.isConsistent at 4551
    Model Error: Model.Q is not a valid CPLEX Q matrix
    
    Error in ==> Cplex.Cplex>Cplex.addCols at 2721
                [cpx out] = cplexlink1262 (cpx, 'addCols', {obj, A, lb, ub});
    
    Error in ==> Cplex.Cplex>Cplex.subsref at 3978
                               out = cpx.(firstsubs)(s(2).subs{1}, s(2).subs{2},
                               ...
    
    Error in ==> example at 34
    cplex.addCols(f,[],lb,ub);
    

    It's a good idea to debug with the datacheck parameter turned on.  Then, when you have something that works, you can turn it off, so that you don't get the performance penalty.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 16.  Re: Cplex 12.6.2 Error with Null message

    Posted 07/21/15 03:08 PM

    Originally posted by: Artt


    Your trick of moving matrix Q below all the addrows commands works perfectly! Thank you so much!

    Also, I'll add datacheck option onto my cplex code. Again, thank you for pointing out this functionality.


    #CPLEXOptimizers
    #DecisionOptimization