Home > matpower4.0 > 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 vector (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 vector, uses the following entries:
           OPF_VIOLATION (16)  - used to set opt.simplex.tolerances.feasibility
           VERBOSE (31)        - used to set opt.barrier.display,
               opt.conflict.display, opt.mip.display, opt.sifting.display,
               opt.simplex.display, opt.tune.display
           CPLEX_LPMETHOD (95) - used to set opt.lpmethod
           CPLEX_QPMETHOD (96) - used to set opt.qpmethod
           CPLEX_OPT (97)      - user option file, if MPOPT(97) is non-zero
               non-zero it is appended to 'cplex_user_options_' to form
               the name of a user-supplied function used as FNAME
               described above, except with calling syntax:
                   MODIFIED_OPT = FNAME(DEFAULT_OPT, MPOPT);

   Output is an options struct to pass to CPLEXOPTIMSET.

   Example:

   If MPOPT(97) = 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 Reference
   Manual" section of the CPLEX documentation at:

       http://publib.boulder.ibm.com/infocenter/cosinfoc/v12r2/

   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 vector (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 vector, uses the following entries:
0020 %           OPF_VIOLATION (16)  - used to set opt.simplex.tolerances.feasibility
0021 %           VERBOSE (31)        - 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 (95) - used to set opt.lpmethod
0025 %           CPLEX_QPMETHOD (96) - used to set opt.qpmethod
0026 %           CPLEX_OPT (97)      - user option file, if MPOPT(97) is non-zero
0027 %               non-zero it is appended to 'cplex_user_options_' to form
0028 %               the name of a user-supplied function used as FNAME
0029 %               described above, except with calling syntax:
0030 %                   MODIFIED_OPT = FNAME(DEFAULT_OPT, MPOPT);
0031 %
0032 %   Output is an options struct to pass to CPLEXOPTIMSET.
0033 %
0034 %   Example:
0035 %
0036 %   If MPOPT(97) = 3, then after setting the default CPLEX options,
0037 %   CPLEX_OPTIONS will execute the following user-defined function
0038 %   to allow option overrides:
0039 %
0040 %       opt = cplex_user_options_3(opt, mpopt);
0041 %
0042 %   The contents of cplex_user_options_3.m, could be something like:
0043 %
0044 %       function opt = cplex_user_options_3(opt, mpopt)
0045 %       opt.threads          = 2;
0046 %       opt.simplex.refactor = 1;
0047 %       opt.timelimit        = 10000;
0048 %
0049 %   For details on the available options, see the "Parameters Reference
0050 %   Manual" section of the CPLEX documentation at:
0051 %
0052 %       http://publib.boulder.ibm.com/infocenter/cosinfoc/v12r2/
0053 %
0054 %   See also CPLEXLP, CPLEXQP, MPOPTION.
0055 
0056 %   MATPOWER
0057 %   $Id: cplex_options.m,v 1.3 2010/11/24 21:58:33 cvs Exp $
0058 %   by Ray Zimmerman, PSERC Cornell
0059 %   Copyright (c) 2010 by Power System Engineering Research Center (PSERC)
0060 %
0061 %   This file is part of MATPOWER.
0062 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0063 %
0064 %   MATPOWER is free software: you can redistribute it and/or modify
0065 %   it under the terms of the GNU General Public License as published
0066 %   by the Free Software Foundation, either version 3 of the License,
0067 %   or (at your option) any later version.
0068 %
0069 %   MATPOWER is distributed in the hope that it will be useful,
0070 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0071 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0072 %   GNU General Public License for more details.
0073 %
0074 %   You should have received a copy of the GNU General Public License
0075 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0076 %
0077 %   Additional permission under GNU GPL version 3 section 7
0078 %
0079 %   If you modify MATPOWER, or any covered work, to interface with
0080 %   other modules (such as MATLAB code and MEX-files) available in a
0081 %   MATLAB(R) or comparable environment containing parts covered
0082 %   under other licensing terms, the licensors of MATPOWER grant
0083 %   you additional permission to convey the resulting work.
0084 
0085 %%-----  initialization and arg handling  -----
0086 %% defaults
0087 verbose = 1;
0088 feastol = 1e-6;
0089 fname   = '';
0090 
0091 %% second argument
0092 if nargin > 1 && ~isempty(mpopt)
0093     if ischar(mpopt)        %% 2nd arg is FNAME (string)
0094         fname = mpopt;
0095         have_mpopt = 0;
0096     else                    %% 2nd arg is MPOPT (MATPOWER options vector)
0097         have_mpopt = 1;
0098         %% (make default OPF_VIOLATION correspond to default CPLEX feastol)
0099         feastol = mpopt(16)/5;  %% OPF_VIOLATION
0100         verbose = mpopt(31);    %% VERBOSE
0101         lpmethod = mpopt(95);   %% CPLEX_LPMETHOD
0102         qpmethod = mpopt(96);   %% CPLEX_QPMETHOD
0103         if mpopt(97)            %% CPLEX_OPT
0104             fname = sprintf('cplex_user_options_%d', mpopt(97));
0105         end
0106     end
0107 else
0108     have_mpopt = 0;
0109 end
0110 
0111 %%-----  set default options for CPLEX  -----
0112 opt = cplexoptimset('cplex');
0113 opt.simplex.tolerances.feasibility = feastol;
0114 
0115 %% printing
0116 vrb = max([0 verbose-1]);
0117 opt.barrier.display   = vrb;
0118 opt.conflict.display  = vrb;
0119 opt.mip.display       = vrb;
0120 opt.sifting.display   = vrb;
0121 opt.simplex.display   = vrb;
0122 opt.tune.display      = vrb;
0123 
0124 %% solution algorithm
0125 if have_mpopt
0126     opt.lpmethod = mpopt(95);   %% CPLEX_LPMETHOD
0127     opt.qpmethod = mpopt(96);   %% CPLEX_QPMETHOD
0128 % else
0129 %     opt.lpmethod = 2;
0130 %     opt.qpmethod = 2;
0131 end
0132 
0133 %%-----  call user function to modify defaults  -----
0134 if ~isempty(fname)
0135     if have_mpopt
0136         opt = feval(fname, opt, mpopt);
0137     else
0138         opt = feval(fname, opt);
0139     end
0140 end
0141 
0142 %%-----  apply overrides  -----
0143 if nargin > 0 && ~isempty(overrides)
0144     names = fieldnames(overrides);
0145     for k = 1:length(names)
0146         if isstruct(overrides.(names{k}))
0147             names2 = fieldnames(overrides.(names{k}));
0148             for k2 = 1:length(names2)
0149                 if isstruct(overrides.(names{k}).(names2{k2}))
0150                     names3 = fieldnames(overrides.(names{k}).(names2{k2}));
0151                     for k3 = 1:length(names3)
0152                         opt.(names{k}).(names2{k2}).(names3{k3}) = overrides.(names{k}).(names2{k2}).(names3{k3});
0153                     end
0154                 else
0155                     opt.(names{k}).(names2{k2}) = overrides.(names{k}).(names2{k2});
0156                 end
0157             end
0158         else
0159             opt.(names{k}) = overrides.(names{k});
0160         end
0161     end
0162 end
0163 
0164 
0165 %--------------------------  Default Options Struct  --------------------------
0166 % as returned by ...
0167 %   >> opt = cplexoptimset('cplex')
0168 %
0169 %   opt =
0170 %       advance:        1
0171 %       barrier:        [1x1 struct]
0172 %           algorithm:      0
0173 %           colnonzeros:    0
0174 %           convergetol:    1.0000e-08
0175 %           crossover:      0
0176 %           display:        1
0177 %           limits:         [1x1 struct]
0178 %               corrections:    -1
0179 %               growth:         1.0000e+12
0180 %               iteration:      2.1000e+09
0181 %               objrange:       1.0000e+20
0182 %           ordering:       0
0183 %           qcpconvergetol: 1.0000e-07
0184 %           startalg:       1
0185 %       clocktype:      2
0186 %       conflict:       [1x1 struct]
0187 %           display:        1
0188 %       emphasis:       [1x1 struct]
0189 %           memory:         0
0190 %           mip:            0
0191 %           numerical:      0
0192 %       feasopt:        [1x1 struct]
0193 %           mode:           0
0194 %           tolerance:      1.0000e-06
0195 %       lpmethod:       0
0196 %       mip:            [1x1 struct]
0197 %           cuts:           [1x1 struct]
0198 %               cliques:        0
0199 %               covers:         0
0200 %               disjunctive:    0
0201 %               flowcovers:     0
0202 %               gomory:         0
0203 %               gubcovers:      0
0204 %               implied:        0
0205 %               mcfcut:         0
0206 %               mircut:         0
0207 %               pathcut:        0
0208 %               zerohalfcut:    0
0209 %           display:        2
0210 %           interval:       0
0211 %           limits:         [1x1 struct]
0212 %               aggforcut:      3
0213 %               auxrootthreads: 0
0214 %               cutpasses:      0
0215 %               cutsfactor:     4
0216 %               eachcutlimit:   2.1000e+09
0217 %               gomorycand:     200
0218 %               gomorypass:     0
0219 %               nodes:          2.1000e+09
0220 %               polishtime:     0
0221 %               populate:       20
0222 %               probetime:      1.0000e+75
0223 %               repairtries:    0
0224 %               solutions:      2.1000e+09
0225 %               strongcand:     10
0226 %               strongit:       0
0227 %               submipnodelim:  500
0228 %               treememory:     1.0000e+75
0229 %           ordertype:      0
0230 %           polishafter:    [1x1 struct]
0231 %               absmipgap:      0
0232 %               mipgap:         0
0233 %               nodes:          2.1000e+09
0234 %               solutions:      2.1000e+09
0235 %               time:           1.0000e+75
0236 %           pool:           [1x1 struct]
0237 %               absgap:         1.0000e+75
0238 %               capacity:       2.1000e+09
0239 %               intensity:      0
0240 %               relgap:         1.0000e+75
0241 %               replace:        0
0242 %           strategy:       [1x1 struct]
0243 %               backtrack:      0.9999
0244 %               bbinterval:     7
0245 %               branch:         0
0246 %               dive:           0
0247 %               file:           1
0248 %               fpheur:         0
0249 %               heuristicfreq:  0
0250 %               kappastats:     0
0251 %               lbheur:         0
0252 %               miqcpstrat:     0
0253 %               nodeselect:     1
0254 %               order:          1
0255 %               presolvenode:   0
0256 %               probe:          0
0257 %               rinsheur:       0
0258 %               search:         0
0259 %               startalgorithm: 0
0260 %               subalgorithm:   0
0261 %               variableselect: 0
0262 %           tolerances:     [1x1 struct]
0263 %               absmipgap:      1.0000e-06
0264 %               integrality:    1.0000e-05
0265 %               lowercutoff:    -1.0000e+75
0266 %               mipgap:         1.0000e-04
0267 %               objdifference:  0
0268 %               relobjdifference: 0
0269 %               uppercutoff:    1.0000e+75
0270 %       parallel:       0
0271 %       preprocessing:  [1x1 struct]
0272 %           aggregator:     -1
0273 %           boundstrength:  -1
0274 %           coeffreduce:    2
0275 %           dependency:     -1
0276 %           dual:           0
0277 %           fill:           10
0278 %           linear:         1
0279 %           numpass:        -1
0280 %           presolve:       1
0281 %           qpmakepsd:      1
0282 %           reduce:         3
0283 %           relax:          -1
0284 %           repeatpresolve: -1
0285 %           symmetry:       -1
0286 %       qpmethod:       0
0287 %       read:           [1x1 struct]
0288 %           constraints:    30000
0289 %           datacheck:      0
0290 %           nonzeros:       250000
0291 %           qpnonzeros:     5000
0292 %           scale:          0
0293 %           variables:      60000
0294 %       sifting:        [1x1 struct]
0295 %           algorithm:      0
0296 %           display:        1
0297 %           iterations:     2.1000e+09
0298 %       simplex:        [1x1 struct]
0299 %           crash:          1
0300 %           dgradient:      0
0301 %           display:        1
0302 %           limits:         [1x1 struct]
0303 %               iterations:     2.1000e+09
0304 %               lowerobj:       -1.0000e+75
0305 %               perturbation:   0
0306 %               singularity:    10
0307 %               upperobj:       1.0000e+75
0308 %           perturbation:   [1x1 struct]
0309 %               indicator:      0
0310 %               constant:       1.0000e-06
0311 %           pgradient:      0
0312 %           pricing:        0
0313 %           refactor:       0
0314 %           tolerances:     [1x1 struct]
0315 %               feasibility:    1.0000e-06
0316 %               markowitz:      0.0100
0317 %               optimality:     1.0000e-06
0318 %       threads:        0
0319 %       timelimit:      1.0000e+75
0320 %       tune:           [1x1 struct]
0321 %           display:        1
0322 %           measure:        1
0323 %           repeat:         1
0324 %           timelimit:      10000
0325 %       workdir:        '.'
0326 %       workmem:        128

Generated on Mon 26-Jan-2015 14:56:45 by m2html © 2005