Decision Optimization

Decision Optimization

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


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

Call Cplex from matlab and get the cplex.log file

  • 1.  Call Cplex from matlab and get the cplex.log file

    Posted 06/13/13 02:48 AM

    Originally posted by: ILOVEIBMandCPLEX


    Dear all,

    I am using the Cplex12.5 and Matlab R2010a. When I use the function Cplexbilp( ) to call the cplex from matlab, the information goes to screen (command window of the matlab) , does not go to the file cplex.log by default.  How can I get the log file? which parameter do I need to set ? and how to set ?

    The method of calling the cplex from matlab is as follows:

    options = cplexoptimser('cplex');

    options.diagnostics = 'on' ;

    options.Display = 5;

    options.NodeDisplayInterval = 20;

    options.logfile =1;

    [x, fval, exitflag, output] = cplexlp( f, Aineq, bineq, Aeq, beq, LB, UB, [], options );

     

    Thanks for your answers in advance. 

     

    Best regards,

    Huizhen

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Call Cplex from matlab and get the cplex.log file

    Posted 06/13/13 08:42 AM

    Redirecting output (the log) is only possible with the class API. With the class API you can do

    function mydisp(msg)
        disp(msg);
    end

    ...

    cplex = Cplex();
    cplex.DisplayFunc = @mydisp;
    % Initialize the fields lhs, rhs, A, sense, obj, lb, ub, of cplex.Model (see also here)
    cplex.solve();

    With this all output is routed through function mydisp and you can do whatever you like with the messages.


    #CPLEXOptimizers
    #DecisionOptimization