Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Problem with cplexmilp solver

    Posted 03/07/17 02:53 PM

    Originally posted by: VahidDehkordi


    I am trying to replace intlinprog matlab function with cplexmilp but I don't know what's wrong! here is a simple code and it does not find a feasible answer in cplex, however, intlinprog can solve it.

    clc
    clear
    f = [-1 -2 -3]';
    Aeq = [-1 1 1; 1 -3 1];
    beq = [20 30]';
    lb = [0 0 0]';
    ub = [20 90 30]';
    A = [0 0 1; 1 0 0];
    b = [30 200]';
    intcon = [1 2 3];
    % matlab solver
    %  [x, fval, exitflag] = intlinprog(f, intcon, A, b, Aeq, beq, lb, ub);
    % Cplex Solver 
         sostype=[];
         sosind=[] ;
         soswt=[];
         ctype = [];
          for i=1:length(A),
         ctype = [ctype;'I'];
          end
      ctype = ctype'; 
       [x,fval,exitflag,output] = cplexmilp(f,Aeq,beq,A,b,sostype,sosind,soswt,lb,ub,ctype)
    

    Results: cplexstatus: 103 cplexstatusstring: 'integer infeasible' iterations: 0 algorithm: 12 time: 0 message: 'No feasible point was found.'

    I think I made a very simple mistake but I can not find it myself. Can somebody give me a comment about what's wrong with my code!


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Problem with cplexmilp solver

    Posted 03/08/17 03:13 AM

    You mixed up the order of arguments for cplexmilp(). The first matrix and vector are for inequality constraints, the second matrix and vector are for inequality constraints. So you should write

    cplexmilp(f,A,b,Aeq,beq,sostype,sosind,soswt,lb,ub,ctype)


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Problem with cplexmilp solver

    Posted 03/08/17 01:26 PM

    Originally posted by: VahidDehkordi


    Thank you so much. you are right although when I am writing the function in matlab it says in this order ( in pic) but changing the order did work.


    #DecisionOptimization