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
.
This function calls:
nested_struct_copy
NESTED_STRUCT_COPY Copies values from one nested struct to another.
This function is called by:
dcopf_solver
DCOPF_SOLVER Solves a DC optimal power flow.
qps_cplex
QPS_CPLEX Quadratic Program Solver based on CPLEX.
t_qps_matpower
T_QPS_MATPOWER Tests of QPS_MATPOWER QP solvers.
0001 function opt = cplex_options(overrides, mpopt)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0071
0072
0073
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0100
0101
0102 verbose = 1;
0103 feastol = 1e-6;
0104 fname = '';
0106
0107 if nargin > 1 && ~isempty(mpopt)
0108 if ischar(mpopt)
0109 fname = mpopt;
0110 have_mpopt = 0;
0111 else
0112 have_mpopt = 1;
0113
0114 feastol = mpopt.opf.violation/5;
0115 verbose = mpopt.verbose;
0116 if isfield(mpopt.cplex, 'opt_fname') && ~isempty(mpopt.cplex.opt_fname)
0117 fname = mpopt.cplex.opt_fname;
0118 elseif mpopt.cplex.opt
0119 fname = sprintf('cplex_user_options_%d', mpopt.cplex.opt);
0120 end
0121 end
0122 else
0123 have_mpopt = 0;
0124 end
0126
0127 opt = cplexoptimset('cplex');
0128 opt.simplex.tolerances.feasibility = feastol;
0129 opt.output.clonelog = -1;
0131
0132 vrb = max([0 verbose-1]);
0133 opt.barrier.display = vrb;
0134 opt.conflict.display = vrb;
0135 opt.mip.display = vrb;
0136 opt.sifting.display = vrb;
0137 opt.simplex.display = vrb;
0138 opt.tune.display = vrb;
0139 if verbose > 2
0140 opt.Display = 'iter';
0141 elseif verbose > 1
0142 opt.Display = 'on';
0143 elseif verbose > 0
0144 opt.Display = 'off';
0145 end
0147
0148 if have_mpopt
0149 opt.lpmethod = mpopt.cplex.lpmethod;
0150 opt.qpmethod = mpopt.cplex.qpmethod;
0151 end
0153
0154 if ~isempty(fname)
0155 if have_mpopt
0156 opt = feval(fname, opt, mpopt);
0157 else
0158 opt = feval(fname, opt);
0159 end
0160 end
0162
0163 if have_mpopt && isfield(mpopt.cplex, 'opts') && ~isempty(mpopt.cplex.opts)
0164 opt = nested_struct_copy(opt, mpopt.cplex.opts);
0165 end
0166 if nargin > 0 && ~isempty(overrides)
0167 opt = nested_struct_copy(opt, overrides);
0168 end
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339