Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Conversion from LP to MIP for mipstart

    Posted 04/14/14 04:19 AM

    Originally posted by: samuel269


    Hello,

    I am solving binary linear problems with cplex 12.5.1.0. However, my input files (.mps) correspond to LPs, and I add the binary contraints "by hand" to my model. Moreover, I want to provide a feasible initial solution (mipstart).

    When I do so, I keep on having the following error : Concert exception caught: CPLEX Error  3003: Not a mixed-integer problem.

    Thanks in advance for your help!

    Samuel

     

    There is a short overview of the kind of code it is :

     
    IloEnv env;
    IloModel model(env);
    IloCplex cplex(env);
    IloObjective   obj;
    IloNumVarArray var(env);
    IloRangeArray  rng(env);

    cplex.importModel(model, inputFile, obj, var, rng);

    [... some other code ...]

    // Here, I change the variables to booleans (n is known)
    for(int j=0; j<n; j++){
      model.add(IloConversion(env,var[j],ILOBOOL));
    }
    // Here, I have a routine that gives me the 
    IloNumVarArray startVar = [*some routine to get the set of variables that take value 1 in the initial solution*]
    IloNumArray startVal(env);
    for (int j = 0; j < startVar.getSize(); ++j) {
      startVal.add(1);
    }
    cplex.addMIPStart(startVar, startVal);
     
    cplex.extract(model);
    cplex.solve() 

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Conversion from LP to MIP for mipstart

    Posted 04/14/14 06:57 AM

    What is the function that throws the exception?

    Does it help to call cplex.extract(model) before cplex.addMIPStart()?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Conversion from LP to MIP for mipstart

    Posted 04/14/14 10:18 AM

    Originally posted by: samuel269


    Seems to work much better this way... trying this first could have saved some hours!

    Thanks a lot DanielJunglas!


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Conversion from LP to MIP for mipstart

    Posted 04/15/14 02:32 AM

    Just in case you wonder why swapping the statements fixes the issue:

    Before you do cplex.extractModel(model) (or use the IloCplex(IloModel) constructor) the IloCplex instance has no model extracted. That is, it is looking at an empty model. An empty model is a model without integer or binary variables, hence not a MIP. When you then try to add a MIP start, CPLEX detects that you are adding a MIP start to a problem (the empty problem) that is not a MIP and raises an error.

    Extracting the model before adding the MIP starts makes sure that the IloCplex instance has extracted a MIP.


    #CPLEXOptimizers
    #DecisionOptimization