Home > matpower7.1 > mp-opt-model > lib > cplex_options.m

cplex_options

PURPOSE ^

CPLEX_OPTIONS Sets options for CPLEX.

SYNOPSIS ^

function opt = cplex_options(overrides, mpopt)

DESCRIPTION ^

CPLEX_OPTIONS  Sets options for CPLEX.

   OPT = CPLEX_OPTIONS
   OPT = CPLEX_OPTIONS(OVERRIDES)
   OPT = CPLEX_OPTIONS(OVERRIDES, FNAME)
   OPT = CPLEX_OPTIONS(OVERRIDES, MPOPT)

   Sets the values for the options struct normally passed to
   CPLEXOPTIMSET.

   Inputs are all optional, second argument must be either a string
   (FNAME) or a struct (MPOPT):

       OVERRIDES - struct containing values to override the defaults
       FNAME - name of user-supplied function called after default
           options are set to modify them. Calling syntax is:
                   MODIFIED_OPT = FNAME(DEFAULT_OPT);
       MPOPT - MATPOWER options struct, uses the following fields:
           opf.violation    - used to set opt.simplex.tolerances.feasibility
           verbose          - used to set opt.barrier.display,
               opt.conflict.display, opt.mip.display, opt.sifting.display,
               opt.simplex.display, opt.tune.display
           cplex.lpmethod   - used to set opt.lpmethod
           cplex.qpmethod   - used to set opt.qpmethod
           cplex.opts       - struct containing values to use as OVERRIDES
           cplex.opt_fname  - name of user-supplied function used as FNAME,
               except with calling syntax:
                   MODIFIED_OPT = FNAME(DEFAULT_OPT, MPOPT);
           cplex.opt        - numbered user option function, if and only if
               cplex.opt_fname is empty and cplex.opt is non-zero, the value
               of cplex.opt_fname is generated by appending cplex.opt to
               'cplex_user_options_' (for backward compatibility with old
               MATPOWER option CPLEX_OPT).

   Output is an options struct to pass to CPLEXOPTIMSET.

   There are multiple ways of providing values to override the default
   options. Their precedence and order of application are as follows:

   With inputs OVERRIDES and FNAME
       1. FNAME is called
       2. OVERRIDES are applied
   With inputs OVERRIDES and MPOPT
       1. FNAME (from cplex.opt_fname or cplex.opt) is called
       2. cplex.opts (if not empty) are applied
       3. OVERRIDES are applied

   Example:

   If cplex.opt = 3, then after setting the default CPLEX options,
   CPLEX_OPTIONS will execute the following user-defined function
   to allow option overrides:

       opt = cplex_user_options_3(opt, mpopt);

   The contents of cplex_user_options_3.m, could be something like:

       function opt = cplex_user_options_3(opt, mpopt)
       opt.threads          = 2;
       opt.simplex.refactor = 1;
       opt.timelimit        = 10000;

   For details on the available options, see the "Parameters of CPLEX"
   section of the CPLEX documentation at:

       http://www.ibm.com/support/knowledgecenter/SSSA5P

   See also CPLEXLP, CPLEXQP, MPOPTION.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function opt = cplex_options(overrides, mpopt)
0002 %CPLEX_OPTIONS  Sets options for CPLEX.
0003 %
0004 %   OPT = CPLEX_OPTIONS
0005 %   OPT = CPLEX_OPTIONS(OVERRIDES)
0006 %   OPT = CPLEX_OPTIONS(OVERRIDES, FNAME)
0007 %   OPT = CPLEX_OPTIONS(OVERRIDES, MPOPT)
0008 %
0009 %   Sets the values for the options struct normally passed to
0010 %   CPLEXOPTIMSET.
0011 %
0012 %   Inputs are all optional, second argument must be either a string
0013 %   (FNAME) or a struct (MPOPT):
0014 %
0015 %       OVERRIDES - struct containing values to override the defaults
0016 %       FNAME - name of user-supplied function called after default
0017 %           options are set to modify them. Calling syntax is:
0018 %                   MODIFIED_OPT = FNAME(DEFAULT_OPT);
0019 %       MPOPT - MATPOWER options struct, uses the following fields:
0020 %           opf.violation    - used to set opt.simplex.tolerances.feasibility
0021 %           verbose          - used to set opt.barrier.display,
0022 %               opt.conflict.display, opt.mip.display, opt.sifting.display,
0023 %               opt.simplex.display, opt.tune.display
0024 %           cplex.lpmethod   - used to set opt.lpmethod
0025 %           cplex.qpmethod   - used to set opt.qpmethod
0026 %           cplex.opts       - struct containing values to use as OVERRIDES
0027 %           cplex.opt_fname  - name of user-supplied function used as FNAME,
0028 %               except with calling syntax:
0029 %                   MODIFIED_OPT = FNAME(DEFAULT_OPT, MPOPT);
0030 %           cplex.opt        - numbered user option function, if and only if
0031 %               cplex.opt_fname is empty and cplex.opt is non-zero, the value
0032 %               of cplex.opt_fname is generated by appending cplex.opt to
0033 %               'cplex_user_options_' (for backward compatibility with old
0034 %               MATPOWER option CPLEX_OPT).
0035 %
0036 %   Output is an options struct to pass to CPLEXOPTIMSET.
0037 %
0038 %   There are multiple ways of providing values to override the default
0039 %   options. Their precedence and order of application are as follows:
0040 %
0041 %   With inputs OVERRIDES and FNAME
0042 %       1. FNAME is called
0043 %       2. OVERRIDES are applied
0044 %   With inputs OVERRIDES and MPOPT
0045 %       1. FNAME (from cplex.opt_fname or cplex.opt) is called
0046 %       2. cplex.opts (if not empty) are applied
0047 %       3. OVERRIDES are applied
0048 %
0049 %   Example:
0050 %
0051 %   If cplex.opt = 3, then after setting the default CPLEX options,
0052 %   CPLEX_OPTIONS will execute the following user-defined function
0053 %   to allow option overrides:
0054 %
0055 %       opt = cplex_user_options_3(opt, mpopt);
0056 %
0057 %   The contents of cplex_user_options_3.m, could be something like:
0058 %
0059 %       function opt = cplex_user_options_3(opt, mpopt)
0060 %       opt.threads          = 2;
0061 %       opt.simplex.refactor = 1;
0062 %       opt.timelimit        = 10000;
0063 %
0064 %   For details on the available options, see the "Parameters of CPLEX"
0065 %   section of the CPLEX documentation at:
0066 %
0067 %       http://www.ibm.com/support/knowledgecenter/SSSA5P
0068 %
0069 %   See also CPLEXLP, CPLEXQP, MPOPTION.
0070 
0071 %   MP-Opt-Model
0072 %   Copyright (c) 2010-2020, Power Systems Engineering Research Center (PSERC)
0073 %   by Ray Zimmerman, PSERC Cornell
0074 %
0075 %   This file is part of MP-Opt-Model.
0076 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0077 %   See https://github.com/MATPOWER/mp-opt-model for more info.
0078 
0079 %%-----  initialization and arg handling  -----
0080 %% defaults
0081 verbose = 1;
0082 feastol = 1e-6;
0083 fname   = '';
0084 
0085 %% second argument
0086 if nargin > 1 && ~isempty(mpopt)
0087     if ischar(mpopt)        %% 2nd arg is FNAME (string)
0088         fname = mpopt;
0089         have_mpopt = 0;
0090     else                    %% 2nd arg is MPOPT (MATPOWER options struct)
0091         have_mpopt = 1;
0092         %% (make default opf.violation correspond to default CPLEX feastol)
0093         feastol  = mpopt.opf.violation/5;
0094         verbose  = mpopt.verbose;
0095         if isfield(mpopt.cplex, 'opt_fname') && ~isempty(mpopt.cplex.opt_fname)
0096             fname = mpopt.cplex.opt_fname;
0097         elseif mpopt.cplex.opt
0098             fname = sprintf('cplex_user_options_%d', mpopt.cplex.opt);
0099         end
0100     end
0101 else
0102     have_mpopt = 0;
0103 end
0104 
0105 %%-----  set default options for CPLEX  -----
0106 opt = struct( ...
0107     'simplex', struct('tolerances', struct('feasibility', feastol)), ...
0108     'output', struct('clonelog', -1) ...
0109 );
0110 
0111 %% printing
0112 if verbose > 2
0113     opt.display = 'iter';
0114 elseif verbose > 1
0115     opt.display = 'on';
0116 elseif verbose > 0
0117     opt.display = 'off';
0118 end
0119 
0120 %% solution algorithm
0121 if have_mpopt
0122     opt.lpmethod = mpopt.cplex.lpmethod;
0123     opt.qpmethod = mpopt.cplex.qpmethod;
0124 end
0125 
0126 %%-----  call user function to modify defaults  -----
0127 if ~isempty(fname)
0128     if have_mpopt
0129         opt = feval(fname, opt, mpopt);
0130     else
0131         opt = feval(fname, opt);
0132     end
0133 end
0134 
0135 %%-----  apply overrides  -----
0136 if have_mpopt && isfield(mpopt.cplex, 'opts') && ~isempty(mpopt.cplex.opts)
0137     opt = nested_struct_copy(opt, mpopt.cplex.opts);
0138 end
0139 if nargin > 0 && ~isempty(overrides)
0140     opt = nested_struct_copy(opt, overrides);
0141 end
0142 
0143 
0144 %--------------------------  Default Options Struct  --------------------------
0145 % as returned by ...
0146 %   >> opt = cplexoptimset('cplex')
0147 %
0148 %   opt =
0149 %       advance:        1
0150 %       barrier:        [1x1 struct]
0151 %           algorithm:      0
0152 %           colnonzeros:    0
0153 %           convergetol:    1.0000e-08
0154 %           crossover:      0
0155 %           display:        1
0156 %           limits:         [1x1 struct]
0157 %               corrections:    -1
0158 %               growth:         1.0000e+12
0159 %               iteration:      9.2234e+18
0160 %               objrange:       1.0000e+20
0161 %           ordering:       0
0162 %           qcpconvergetol: 1.0000e-07
0163 %           startalg:       1
0164 %       clocktype:      2
0165 %       conflict:       [1x1 struct]
0166 %           display:        1
0167 %       diagnostics:    'off'
0168 %       emphasis:       [1x1 struct]
0169 %           memory:         0
0170 %           mip:            0
0171 %           numerical:      0
0172 %       exportmodel:    ''
0173 %       feasopt:        [1x1 struct]
0174 %           mode:           0
0175 %           tolerance:      1.0000e-06
0176 %       lpmethod:       0
0177 %       mip:            [1x1 struct]
0178 %           cuts:           [1x1 struct]
0179 %               cliques:        0
0180 %               covers:         0
0181 %               disjunctive:    0
0182 %               flowcovers:     0
0183 %               gomory:         0
0184 %               gubcovers:      0
0185 %               implied:        0
0186 %               mcfcut:         0
0187 %               mircut:         0
0188 %               pathcut:        0
0189 %               zerohalfcut:    0
0190 %           display:        2
0191 %           interval:       0
0192 %           limits:         [1x1 struct]
0193 %               aggforcut:      3
0194 %               auxrootthreads: 0
0195 %               cutpasses:      0
0196 %               cutsfactor:     4
0197 %               eachcutlimit:   2.1000e+09
0198 %               gomorycand:     200
0199 %               gomorypass:     0
0200 %               nodes:          9.2234e+18
0201 %               polishtime:     0
0202 %               populate:       20
0203 %               probetime:      1.0000e+75
0204 %               repairtries:    0
0205 %               solutions:      9.2234e+18
0206 %               strongcand:     10
0207 %               strongit:       0
0208 %               submipnodelim:  500
0209 %               treememory:     1.0000e+75
0210 %           ordertype:      0
0211 %           polishafter:    [1x1 struct]
0212 %               absmipgap:      0
0213 %               mipgap:         0
0214 %               nodes:          9.2234e+18
0215 %               solutions:      9.2234e+18
0216 %               time:           1.0000e+75
0217 %           pool:           [1x1 struct]
0218 %               absgap:         1.0000e+75
0219 %               capacity:       2.1000e+09
0220 %               intensity:      0
0221 %               relgap:         1.0000e+75
0222 %               replace:        0
0223 %           strategy:       [1x1 struct]
0224 %               backtrack:      0.9999
0225 %               bbinterval:     7
0226 %               branch:         0
0227 %               dive:           0
0228 %               file:           1
0229 %               fpheur:         0
0230 %               heuristicfreq:  0
0231 %               kappastats:     0
0232 %               lbheur:         0
0233 %               miqcpstrat:     0
0234 %               nodeselect:     1
0235 %               order:          1
0236 %               presolvenode:   0
0237 %               probe:          0
0238 %               rinsheur:       0
0239 %               search:         0
0240 %               startalgorithm: 0
0241 %               subalgorithm:   0
0242 %               variableselect: 0
0243 %           tolerances:     [1x1 struct]
0244 %               absmipgap:      1.0000e-06
0245 %               integrality:    1.0000e-05
0246 %               lowercutoff:    -1.0000e+75
0247 %               mipgap:         1.0000e-04
0248 %               objdifference:  0
0249 %               relobjdifference: 0
0250 %               uppercutoff:    1.0000e+75
0251 %       output:         [1x1 struct]
0252 %           clonelog:       1
0253 %           intsolfileprefix: ''
0254 %           mpslong:        1
0255 %           writelevel:     0
0256 %       parallel:       0
0257 %       preprocessing:  [1x1 struct]
0258 %           aggregator:     -1
0259 %           boundstrength:  -1
0260 %           coeffreduce:    -1
0261 %           dependency:     -1
0262 %           dual:           0
0263 %           fill:           10
0264 %           linear:         1
0265 %           numpass:        -1
0266 %           presolve:       1
0267 %           qpmakepsd:      1
0268 %           reduce:         3
0269 %           relax:          -1
0270 %           repeatpresolve: -1
0271 %           symmetry:       -1
0272 %       qpmethod:       0
0273 %       read:           [1x1 struct]
0274 %           apiencoding:    ''
0275 %           constraints:    30000
0276 %           datacheck:      0
0277 %           fileencoding:   'ISO-8859-1'
0278 %           nonzeros:       250000
0279 %           qpnonzeros:     5000
0280 %           scale:          0
0281 %           variables:      60000
0282 %       sifting:        [1x1 struct]
0283 %           algorithm:      0
0284 %           display:        1
0285 %           iterations:     9.2234e+18
0286 %       simplex:        [1x1 struct]
0287 %           crash:          1
0288 %           dgradient:      0
0289 %           display:        1
0290 %           limits:         [1x1 struct]
0291 %               iterations:     9.2234e+18
0292 %               lowerobj:       -1.0000e+75
0293 %               perturbation:   0
0294 %               singularity:    10
0295 %               upperobj:       1.0000e+75
0296 %           perturbation:   [1x1 struct]
0297 %               indicator:      0
0298 %               constant:       1.0000e-06
0299 %           pgradient:      0
0300 %           pricing:        0
0301 %           refactor:       0
0302 %           tolerances:     [1x1 struct]
0303 %               feasibility:    1.0000e-06
0304 %               markowitz:      0.0100
0305 %               optimality:     1.0000e-06
0306 %       solutiontarget: 0
0307 %       threads:        0
0308 %       timelimit:      1.0000e+75
0309 %       tune:           [1x1 struct]
0310 %           display:        1
0311 %           measure:        1
0312 %           repeat:         1
0313 %           timelimit:      10000
0314 %       workdir:        '.'
0315 %       workmem:        128

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005