Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Cplex Matlab Interface - set single thread and turn off/on preprocessing

    Posted 11/17/11 03:57 AM

    Originally posted by: xlr8t


    Hi,
    I'm relatively new to cplex but I couldn't find a solution to my problem in this forum nor was Google able to provide me the needed information...

    I want to compare execution times of different settings in the cplex solver. And need to tune the parameters of the cplex solver (cplexmiqp to be specific) through MATLAB. When I use

    
    opts = cplexoptimset(
    'cplex'); .... % Set parameters [Z,fval,exitflag,output] = ... cplexmiqp(H,f,Ain,bin,Aeq,beq,[],[],[],[],[],ctype,xIC,opts);
    

    in Matlab and set different parameters it seems they don't have an effect on the solver. In the documentation there are lots of parameters mentioned to tune different parameters but it seems that the namings and convention are different for the MATLAB interface and I couldn't find a documentation which one maps to which parameter in the 'cplexoptimset' struct.

    Single Threaded
    First of all I need to run cplex on a single thread. I couldn't find exactly which parameter is responsible for that in the cplexoptimset struct. Is there any documentation which parameter stands for what in the MATLAB interface?
    I tried:
    
    opts.parallel = 1; opts.mip.limits.auxrootthreads = 1;
    

    Cplex always returns 'Parallel mode: deterministic, using up to 4 threads.' while solving.

    Preprocessing
    I saw in the documentation that there is an option 'DepInd = 0' which should turn of preprocessing but where can I find that parameter in the matlab interface. I want to be able to turn off preprocessing completely off (I know that the manual says that even then it will perform some small preprocessing steps).

    Thanks for any help!
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Cplex Matlab Interface - set single thread and turn off/on preprocessing

    Posted 11/17/11 05:32 AM

    Originally posted by: John Cui


    To use single thread, you need to set opts.threads to 1. Say opts.threads = 1;
    To disable presolve, please use opts.preprocessing.presolve = 0;

    John Cui
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Cplex Matlab Interface - set single thread and turn off/on preprocessing

    Posted 11/17/11 06:36 AM

    Originally posted by: xlr8t


    Hi John,
    thanks for your quick response. I actually tried these settings you mentioned but it seems they have no effect.
    It seems it still uses multiple threads for solving. I also set the MATLAB affinity to one processor.

    Then I realized that I was using the cplexoptimset struct not properly.
    I was using

    opts = cplexoptimset('cplex');
    opts.Diagnostics = 'on';
    opts.Display = 'iter'; % 'off'|'iter'|'final'|'notify'
    opts.threads = 1;
    opts.preprocessing.presolve = 0;
    


    Since it was using the changes in the Display option I assumed that would also work for the others but it didn't.
    Now I'm using:

    opts = cplexoptimset('cplex');
    opts = cplexoptimset(opts,'Diagnostics','on','Display','iter',...
                         'threads',1,'preprocessing.presolve',0);
    


    and that seems to work.
    Thanks
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Cplex Matlab Interface - set single thread and turn off/on preprocessing

    Posted 11/18/11 02:53 PM

    Originally posted by: John Cui


    Actually, if you use opts = cplexoptimset('cplex'), you only can set the fields which opts has.

    So:
    opts = cplexoptimset('cplex');
    opts.Diagnostics = 'on';
    opts.Display = 'iter'; % 'off'|'iter'|'final'|'notify'
    opts.threads = 1;
    opts.preprocessing.presolve = 0;
    

    should be changed to:
    opts = cplexoptimset('cplex');
    opts.diagnostics = 'on';
    opts.threads = 1;
    opts.preprocessing.presolve = 0;
    


    And it should work.

    John Cui
    #CPLEXOptimizers
    #DecisionOptimization