Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  cplex.solve, cplexmilp, cplexlp

    Posted 07/08/13 05:32 PM

    Originally posted by: yanzhi


    method 1

    [x,fval,exitflag,output] = cplexmilp(f,Aineq,bineq,Aeq,beq,[],[],[],lb,ub,ctype,[],[] );%for MILP problem

    method 2

    cplex=Cplex('');    cplex.Model.sense = 'minimize';    cplex.addCols(f,[],lb,ub,ctype);
        cplex.addRows([-inf*ones(size(bineq,1),1);beq], [Aineq;Aeq], [bineq;beq]);

    method 3

    cplex=Cplex('');    cplex.Model.sense = 'minimize';    cplex.addCols(f,[],lb,ub,[]); %here ctype is set to empty different from that in method 2
        cplex.addRows([-inf*ones(size(bineq,1),1);beq], [Aineq;Aeq], [bineq;beq]);

    method 4

    [x, fval, ~, output, lambda] = cplexlp (f, Aineq, bineq, Aeq, beq, lb, ub, [],  []);%for LP problem

    the first two columns of x1 are the results for MILP problem, the last two are for LP problem.

    the first column is obtained by method 1, the 2nd is by method 2, the 3rd column is by method 3, the last column is by method 4.

    why is the first two-column different for the same MILP and the last two also different for the same LP problem?


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: cplex.solve, cplexmilp, cplexlp

    Posted 07/09/13 04:11 PM

    That behavior is indeed unexpected. Unfortunately I could not reproduce the problem here. I get the exact same x vector for both MIPs (as expected). In your inputdata.zip file there was no Aeq.mat or beq.mat file (is that expected?) so I used empty arrays for them.

    What version of CPLEX/matlab do you use?

    Can you please export the two models as SAV file and attach them here? Do export a model with the toolbox function use

    options = cplexoptimset('cplex');
    options.exportmodel = 'milp.sav';
    [x,fval,exitflag,output] = cplexmilp(f,Aineq,bineq,Aeq,beq,[],[],[],lb,ub,ctype,[], options);

    to export the model with the class API just do

    cplex.writeModel('class.sav');

    right before calling cplex.solve().


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: cplex.solve, cplexmilp, cplexlp

    Posted 07/15/13 06:34 PM

    Originally posted by: yanzhi


    yes, either the Aeq.mat or beq.mat is empty.

    I'm using CPLEX 12.4 and matlab R2010b.

    now it's working. I don't know why it's different at that time.

    thanks a lot.


    #CPLEXOptimizers
    #DecisionOptimization