Home > matpower5.1 > 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://pic.dhe.ibm.com/infocenter/cosinfoc/v12r6/

   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://pic.dhe.ibm.com/infocenter/cosinfoc/v12r6/
0068 %
0069 %   See also CPLEXLP, CPLEXQP, MPOPTION.
0070 
0071 %   MATPOWER
0072 %   Copyright (c) 2010-2015 by Power System Engineering Research Center (PSERC)
0073 %   by Ray Zimmerman, PSERC Cornell
0074 %
0075 %   $Id: cplex_options.m 2644 2015-03-11 19:34:22Z ray $
0076 %
0077 %   This file is part of MATPOWER.
0078 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0079 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0080 
0081 %%-----  initialization and arg handling  -----
0082 %% defaults
0083 verbose = 1;
0084 feastol = 1e-6;
0085 fname   = '';
0086 
0087 %% second argument
0088 if nargin > 1 && ~isempty(mpopt)
0089     if ischar(mpopt)        %% 2nd arg is FNAME (string)
0090         fname = mpopt;
0091         have_mpopt = 0;
0092     else                    %% 2nd arg is MPOPT (MATPOWER options struct)
0093         have_mpopt = 1;
0094         %% (make default opf.violation correspond to default CPLEX feastol)
0095         feastol  = mpopt.opf.violation/5;
0096         verbose  = mpopt.verbose;
0097         if isfield(mpopt.cplex, 'opt_fname') && ~isempty(mpopt.cplex.opt_fname)
0098             fname = mpopt.cplex.opt_fname;
0099         elseif mpopt.cplex.opt
0100             fname = sprintf('cplex_user_options_%d', mpopt.cplex.opt);
0101         end
0102     end
0103 else
0104     have_mpopt = 0;
0105 end
0106 
0107 %%-----  set default options for CPLEX  -----
0108 opt = cplexoptimset('cplex');
0109 opt.simplex.tolerances.feasibility = feastol;
0110 opt.output.clonelog = -1;
0111 
0112 %% printing
0113 vrb = max([0 verbose-1]);
0114 opt.barrier.display   = vrb;
0115 opt.conflict.display  = vrb;
0116 opt.mip.display       = vrb;
0117 opt.sifting.display   = vrb;
0118 opt.simplex.display   = vrb;
0119 opt.tune.display      = vrb;
0120 if verbose > 2
0121     opt.Display = 'iter';
0122 elseif verbose > 1
0123     opt.Display = 'on';
0124 elseif verbose > 0
0125     opt.Display = 'off';
0126 end
0127 
0128 %% solution algorithm
0129 if have_mpopt
0130     opt.lpmethod = mpopt.cplex.lpmethod;
0131     opt.qpmethod = mpopt.cplex.qpmethod;
0132 end
0133 
0134 %%-----  call user function to modify defaults  -----
0135 if ~isempty(fname)
0136     if have_mpopt
0137         opt = feval(fname, opt, mpopt);
0138     else
0139         opt = feval(fname, opt);
0140     end
0141 end
0142 
0143 %%-----  apply overrides  -----
0144 if have_mpopt && isfield(mpopt.cplex, 'opts') && ~isempty(mpopt.cplex.opts)
0145     opt = nested_struct_copy(opt, mpopt.cplex.opts);
0146 end
0147 if nargin > 0 && ~isempty(overrides)
0148     opt = nested_struct_copy(opt, overrides);
0149 end
0150 
0151 
0152 %--------------------------  Default Options Struct  --------------------------
0153 % as returned by ...
0154 %   >> opt = cplexoptimset('cplex')
0155 %
0156 %   opt =
0157 %       advance:        1
0158 %       barrier:        [1x1 struct]
0159 %           algorithm:      0
0160 %           colnonzeros:    0
0161 %           convergetol:    1.0000e-08
0162 %           crossover:      0
0163 %           display:        1
0164 %           limits:         [1x1 struct]
0165 %               corrections:    -1
0166 %               growth:         1.0000e+12
0167 %               iteration:      9.2234e+18
0168 %               objrange:       1.0000e+20
0169 %           ordering:       0
0170 %           qcpconvergetol: 1.0000e-07
0171 %           startalg:       1
0172 %       clocktype:      2
0173 %       conflict:       [1x1 struct]
0174 %           display:        1
0175 %       diagnostics:    'off'
0176 %       emphasis:       [1x1 struct]
0177 %           memory:         0
0178 %           mip:            0
0179 %           numerical:      0
0180 %       exportmodel:    ''
0181 %       feasopt:        [1x1 struct]
0182 %           mode:           0
0183 %           tolerance:      1.0000e-06
0184 %       lpmethod:       0
0185 %       mip:            [1x1 struct]
0186 %           cuts:           [1x1 struct]
0187 %               cliques:        0
0188 %               covers:         0
0189 %               disjunctive:    0
0190 %               flowcovers:     0
0191 %               gomory:         0
0192 %               gubcovers:      0
0193 %               implied:        0
0194 %               mcfcut:         0
0195 %               mircut:         0
0196 %               pathcut:        0
0197 %               zerohalfcut:    0
0198 %           display:        2
0199 %           interval:       0
0200 %           limits:         [1x1 struct]
0201 %               aggforcut:      3
0202 %               auxrootthreads: 0
0203 %               cutpasses:      0
0204 %               cutsfactor:     4
0205 %               eachcutlimit:   2.1000e+09
0206 %               gomorycand:     200
0207 %               gomorypass:     0
0208 %               nodes:          9.2234e+18
0209 %               polishtime:     0
0210 %               populate:       20
0211 %               probetime:      1.0000e+75
0212 %               repairtries:    0
0213 %               solutions:      9.2234e+18
0214 %               strongcand:     10
0215 %               strongit:       0
0216 %               submipnodelim:  500
0217 %               treememory:     1.0000e+75
0218 %           ordertype:      0
0219 %           polishafter:    [1x1 struct]
0220 %               absmipgap:      0
0221 %               mipgap:         0
0222 %               nodes:          9.2234e+18
0223 %               solutions:      9.2234e+18
0224 %               time:           1.0000e+75
0225 %           pool:           [1x1 struct]
0226 %               absgap:         1.0000e+75
0227 %               capacity:       2.1000e+09
0228 %               intensity:      0
0229 %               relgap:         1.0000e+75
0230 %               replace:        0
0231 %           strategy:       [1x1 struct]
0232 %               backtrack:      0.9999
0233 %               bbinterval:     7
0234 %               branch:         0
0235 %               dive:           0
0236 %               file:           1
0237 %               fpheur:         0
0238 %               heuristicfreq:  0
0239 %               kappastats:     0
0240 %               lbheur:         0
0241 %               miqcpstrat:     0
0242 %               nodeselect:     1
0243 %               order:          1
0244 %               presolvenode:   0
0245 %               probe:          0
0246 %               rinsheur:       0
0247 %               search:         0
0248 %               startalgorithm: 0
0249 %               subalgorithm:   0
0250 %               variableselect: 0
0251 %           tolerances:     [1x1 struct]
0252 %               absmipgap:      1.0000e-06
0253 %               integrality:    1.0000e-05
0254 %               lowercutoff:    -1.0000e+75
0255 %               mipgap:         1.0000e-04
0256 %               objdifference:  0
0257 %               relobjdifference: 0
0258 %               uppercutoff:    1.0000e+75
0259 %       output:         [1x1 struct]
0260 %           clonelog:       1
0261 %           intsolfileprefix: ''
0262 %           mpslong:        1
0263 %           writelevel:     0
0264 %       parallel:       0
0265 %       preprocessing:  [1x1 struct]
0266 %           aggregator:     -1
0267 %           boundstrength:  -1
0268 %           coeffreduce:    -1
0269 %           dependency:     -1
0270 %           dual:           0
0271 %           fill:           10
0272 %           linear:         1
0273 %           numpass:        -1
0274 %           presolve:       1
0275 %           qpmakepsd:      1
0276 %           reduce:         3
0277 %           relax:          -1
0278 %           repeatpresolve: -1
0279 %           symmetry:       -1
0280 %       qpmethod:       0
0281 %       read:           [1x1 struct]
0282 %           apiencoding:    ''
0283 %           constraints:    30000
0284 %           datacheck:      0
0285 %           fileencoding:   'ISO-8859-1'
0286 %           nonzeros:       250000
0287 %           qpnonzeros:     5000
0288 %           scale:          0
0289 %           variables:      60000
0290 %       sifting:        [1x1 struct]
0291 %           algorithm:      0
0292 %           display:        1
0293 %           iterations:     9.2234e+18
0294 %       simplex:        [1x1 struct]
0295 %           crash:          1
0296 %           dgradient:      0
0297 %           display:        1
0298 %           limits:         [1x1 struct]
0299 %               iterations:     9.2234e+18
0300 %               lowerobj:       -1.0000e+75
0301 %               perturbation:   0
0302 %               singularity:    10
0303 %               upperobj:       1.0000e+75
0304 %           perturbation:   [1x1 struct]
0305 %               indicator:      0
0306 %               constant:       1.0000e-06
0307 %           pgradient:      0
0308 %           pricing:        0
0309 %           refactor:       0
0310 %           tolerances:     [1x1 struct]
0311 %               feasibility:    1.0000e-06
0312 %               markowitz:      0.0100
0313 %               optimality:     1.0000e-06
0314 %       solutiontarget: 0
0315 %       threads:        0
0316 %       timelimit:      1.0000e+75
0317 %       tune:           [1x1 struct]
0318 %           display:        1
0319 %           measure:        1
0320 %           repeat:         1
0321 %           timelimit:      10000
0322 %       workdir:        '.'
0323 %       workmem:        128

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005