Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Error when provide MIPstart

  • 1.  Error when provide MIPstart

    Posted Sat August 25, 2018 01:42 PM

    Originally posted by: jasmin12


    Hello,

    I am using MILP solver from CPLEX for MATLAB. I would like to provide some MIPstart to speed up the optimization. The MIPstart is obtained from the last solved problem by applying 'cplex.writeMipStart'.Then I use them as initial value for next round optimization. However, errors pop up as follows:

    Error using cplexlink1280
    CPLEX Error  3003: Not a mixed-integer problem.

    Since I use the same format as for solution, i don't understand why this problem happens. It would be great that anyone has the same experience. You see the MST file for MIPstart in the attachment. 

    Best,


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Error when provide MIPstart

    Posted Sat August 25, 2018 03:05 PM

    The problem is not with the MIP start but with your model: Apparently your model is not a MIP, i.e., it does not have any integer or binary variables. Can you double check that? If you model contains integer or binary variables, can you export your model using cplex.exportModel() to a SAV file and attach it here?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Error when provide MIPstart

    Posted Sat August 25, 2018 03:13 PM

    Originally posted by: jasmin12


    Hi, Daniel,

    you will see the model in the attachment. 

    Thanks for your help! 


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Error when provide MIPstart

    Posted Sat August 25, 2018 04:39 PM

    Ok, your model is indeed a MIP. But how exactly did you obtain that MST file? Did you really just call cplex.writeMIPstart()? I am asking because the file is not even well-formed XML and CPLEX should not produce such a file.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Error when provide MIPstart

    Posted Sat August 25, 2018 05:58 PM

    Originally posted by: jasmin12


    Yes, my full code is 'cplex.writeMipStart('MIP_start')'. Then I use this created MIPstart as the initial value for next round. The only thing I changed is values of some varibles. I send its complete original version in the attachment. Now I also tried 'cplex.writeOrder('VarOrder_cplex.ord') to set new priority order for next optimization round. And the same error comes up. It confuses me. If it creates the format, re-use the same format causes problem. 

     

    '

     

     

    '


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Error when provide MIPstart

    Posted Sun August 26, 2018 05:51 AM

    That all seems pretty odd. Can you share a minimal matlab code that reproduces the problem so that we can check here?


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Error when provide MIPstart

    Posted Sun August 26, 2018 08:49 AM

    Originally posted by: jasmin12


    You will see the matlab file in the attachment!


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Error when provide MIPstart

    Posted Mon August 27, 2018 06:21 AM

    Your code looks fine at first glance. But it is missing the part that actually causes the trouble (using the MIP start). Can you include that as well?


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Error when provide MIPstart

    Posted Mon August 27, 2018 07:25 AM

    Originally posted by: jasmin12


    Hi, Daniel,

    I added the files created by the command 'cplex.writeMipStart' and 'cplex.writeOrder'. You could just use the corresponding read command to see the error. Or you could also use the write command to create the file by yourself. 

    Best,


    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Error when provide MIPstart

    Posted Mon August 27, 2018 10:41 AM

    I manage to reproduce the problem here. I don't know yet what is going wrong but can you please try this workaround: Directly after creating the Cplex instance, call cplex.getProbType() (and just discard the result).

    Alternatively, don't use the Cplex(prob) constructor but use the Cplex() constructor and the various cplex.add* functions to create variables and constraints.


    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: Error when provide MIPstart

    Posted Mon August 27, 2018 01:29 PM

    Originally posted by: jasmin12


    Hi, Daniel,

    thanks for your great help! 

    I tried now using cplex.getProbType() and it works for MIPstart. However, it failed with cplex.readOrder() with the error 'CPLEX Error  1219: No names exist.' It is also strange because I have this file in the correct order with the correct name. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: Error when provide MIPstart

    Posted Mon August 27, 2018 03:44 PM

    I think the problem is that you don't have names for your variables. When you call writeOrder() then CPLEX will assign default names to the variables ("x" followed by the index of the variable). But these names exist only for writing the order file.

    Now if you try to read the order file then CPLEX has to match the variable names in the order file against names in the model so that it can assign the priorities to the correct variables. Since your model has no names, this fails.

    Can you try explicitly assigning names to your variables?


    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: Error when provide MIPstart

    Posted Tue August 28, 2018 02:29 AM

    Originally posted by: jasmin12


    Hi, Daniel, 

    I will try use the command 'cplex.addCol' to add the variables.

    Thanks for helpful advices. 

    Best,  


    #CPLEXOptimizers
    #DecisionOptimization