From 0c4251296bf6a2a975cc6ffee83cb5034bc73b85 Mon Sep 17 00:00:00 2001 From: Ray Zimmerman Date: Wed, 23 Sep 2020 15:18:01 -0500 Subject: [PATCH] Use have_feature() everywhere in place of deprecated have_fcn(). --- lib/mpoption_info_most.m | 2 +- lib/t/most_ex6_uc.m | 10 +++++----- lib/t/most_ex7_suc.m | 10 +++++----- lib/t/t_most_30b_1_1_0.m | 4 ++-- lib/t/t_most_30b_1_1_0_uc.m | 8 ++++---- lib/t/t_most_30b_1_1_17.m | 4 ++-- lib/t/t_most_30b_3_1_0.m | 4 ++-- lib/t/t_most_30b_3_1_17.m | 8 ++++---- lib/t/t_most_3b_3_1_2.m | 4 ++-- lib/t/t_most_fixed_res.m | 10 +++++----- lib/t/t_most_mpopf.m | 6 +++--- lib/t/t_most_sp.m | 4 ++-- lib/t/t_most_spuc.m | 12 ++++++------ lib/t/t_most_suc.m | 18 +++++++++--------- lib/t/t_most_uc.m | 18 +++++++++--------- lib/t/t_most_w_ds.m | 22 +++++++++++----------- 16 files changed, 72 insertions(+), 72 deletions(-) diff --git a/lib/mpoption_info_most.m b/lib/mpoption_info_most.m index 3cd32be..9b30fec 100644 --- a/lib/mpoption_info_most.m +++ b/lib/mpoption_info_most.m @@ -28,7 +28,7 @@ if nargin < 1 selector = 'D'; end -if have_fcn('most') +if have_feature('most') switch upper(selector) case {'D', 'V'} %% default and valid options opt = struct(... diff --git a/lib/t/most_ex6_uc.m b/lib/t/most_ex6_uc.m index 64671db..2b7ab33 100644 --- a/lib/t/most_ex6_uc.m +++ b/lib/t/most_ex6_uc.m @@ -22,7 +22,7 @@ function most_ex6_uc(quiet) mpopt = mpoption(mpopt, 'most.price_stage_warn_tol', 1e-5); %% solver options -if have_fcn('cplex') +if have_feature('cplex') %mpopt = mpoption(mpopt, 'cplex.lpmethod', 0); %% automatic %mpopt = mpoption(mpopt, 'cplex.lpmethod', 1); %% primal simplex mpopt = mpoption(mpopt, 'cplex.lpmethod', 2); %% dual simplex @@ -32,12 +32,12 @@ function most_ex6_uc(quiet) mpopt = mpoption(mpopt, 'cplex.opts.mip.tolerances.absmipgap', 0); mpopt = mpoption(mpopt, 'cplex.opts.threads', 2); end -if have_fcn('glpk') +if have_feature('glpk') mpopt = mpoption(mpopt, 'glpk.opts.mipgap', 0); mpopt = mpoption(mpopt, 'glpk.opts.tolint', 1e-10); mpopt = mpoption(mpopt, 'glpk.opts.tolobj', 1e-10); end -if have_fcn('gurobi') +if have_feature('gurobi') %mpopt = mpoption(mpopt, 'gurobi.method', -1); %% automatic %mpopt = mpoption(mpopt, 'gurobi.method', 0); %% primal simplex mpopt = mpoption(mpopt, 'gurobi.method', 1); %% dual simplex @@ -46,7 +46,7 @@ function most_ex6_uc(quiet) mpopt = mpoption(mpopt, 'gurobi.opts.MIPGap', 0); mpopt = mpoption(mpopt, 'gurobi.opts.MIPGapAbs', 0); end -if have_fcn('mosek') +if have_feature('mosek') sc = mosek_symbcon; %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_FREE); %% default %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_INTPNT); %% interior point @@ -61,7 +61,7 @@ function most_ex6_uc(quiet) mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_REL_GAP', 0); mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_ABS_GAP', 0); end -if have_fcn('intlinprog') +if have_feature('intlinprog') %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'interior-point'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'active-set'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); diff --git a/lib/t/most_ex7_suc.m b/lib/t/most_ex7_suc.m index 9213622..fb3002c 100644 --- a/lib/t/most_ex7_suc.m +++ b/lib/t/most_ex7_suc.m @@ -22,7 +22,7 @@ function most_ex7_suc(quiet) mpopt = mpoption(mpopt, 'most.price_stage_warn_tol', 10); %% solver options -if have_fcn('cplex') +if have_feature('cplex') %mpopt = mpoption(mpopt, 'cplex.lpmethod', 0); %% automatic %mpopt = mpoption(mpopt, 'cplex.lpmethod', 1); %% primal simplex mpopt = mpoption(mpopt, 'cplex.lpmethod', 2); %% dual simplex @@ -32,12 +32,12 @@ function most_ex7_suc(quiet) mpopt = mpoption(mpopt, 'cplex.opts.mip.tolerances.absmipgap', 0); mpopt = mpoption(mpopt, 'cplex.opts.threads', 2); end -if have_fcn('glpk') +if have_feature('glpk') mpopt = mpoption(mpopt, 'glpk.opts.mipgap', 0); mpopt = mpoption(mpopt, 'glpk.opts.tolint', 1e-10); mpopt = mpoption(mpopt, 'glpk.opts.tolobj', 1e-10); end -if have_fcn('gurobi') +if have_feature('gurobi') %mpopt = mpoption(mpopt, 'gurobi.method', -1); %% automatic %mpopt = mpoption(mpopt, 'gurobi.method', 0); %% primal simplex mpopt = mpoption(mpopt, 'gurobi.method', 1); %% dual simplex @@ -46,7 +46,7 @@ function most_ex7_suc(quiet) mpopt = mpoption(mpopt, 'gurobi.opts.MIPGap', 0); mpopt = mpoption(mpopt, 'gurobi.opts.MIPGapAbs', 0); end -if have_fcn('mosek') +if have_feature('mosek') sc = mosek_symbcon; %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_FREE); %% default %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_INTPNT); %% interior point @@ -61,7 +61,7 @@ function most_ex7_suc(quiet) mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_REL_GAP', 0); mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_ABS_GAP', 0); end -if have_fcn('intlinprog') +if have_feature('intlinprog') %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'interior-point'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'active-set'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); diff --git a/lib/t/t_most_30b_1_1_0.m b/lib/t/t_most_30b_1_1_0.m index 8b45755..3f75803 100644 --- a/lib/t/t_most_30b_1_1_0.m +++ b/lib/t/t_most_30b_1_1_0.m @@ -29,8 +29,8 @@ function t_most_30b_1_1_0(quiet) mpopt = mpoption(mpopt, 'opf.violation', 5e-7, 'mips.comptol', 5e-8); %mpopt = mpoption(mpopt, 'opf.dc.solver', 'OT'); %mpopt = mpoption(mpopt, 'most.solver', 'OT'); -if have_fcn('linprog') - if have_fcn('linprog_ds') +if have_feature('linprog') + if have_feature('linprog_ds') mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex'); else mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); diff --git a/lib/t/t_most_30b_1_1_0_uc.m b/lib/t/t_most_30b_1_1_0_uc.m index 8bc0140..a5c1aab 100644 --- a/lib/t/t_most_30b_1_1_0_uc.m +++ b/lib/t/t_most_30b_1_1_0_uc.m @@ -24,7 +24,7 @@ function t_most_30b_1_1_0_uc(quiet) % mpopt = mpoption('verbose', 2, 'out.all', -1); mpopt = mpoption(mpopt, 'out.bus', 0, 'out.branch', 0, 'out.gen', 2); mpopt = mpoption(mpopt, 'opf.violation', 5e-7, 'mips.comptol', 5e-8); -if have_fcn('intlinprog') +if have_feature('intlinprog') mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex'); mpopt = mpoption(mpopt, 'intlinprog.RootLPAlgorithm', 'dual-simplex'); mpopt = mpoption(mpopt, 'intlinprog.TolCon', 1e-9); @@ -157,13 +157,13 @@ function t_most_30b_1_1_0_uc(quiet) xgd = loadxgendata(xgd_table, mpc); md = loadmd(mpc, [], xgd); -if have_fcn('cplex') +if have_feature('cplex') mpopt = mpoption(mpopt, 'cplex.lpmethod', 2); %% dual-simplex end -if have_fcn('gurobi') +if have_feature('gurobi') mpopt = mpoption(mpopt, 'gurobi.method', 1); %% dual-simplex end -if have_fcn('linprog') +if have_feature('linprog') mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex'); % mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); % mpopt = mpoption(mpopt, 'linprog.Algorithm', 'interior-point'); diff --git a/lib/t/t_most_30b_1_1_17.m b/lib/t/t_most_30b_1_1_17.m index 620c2fe..a8310d5 100644 --- a/lib/t/t_most_30b_1_1_17.m +++ b/lib/t/t_most_30b_1_1_17.m @@ -30,8 +30,8 @@ function t_most_30b_1_1_17(quiet) mpopt = mpoption('verbose', 0, 'out.all', 0); mpopt = mpoption(mpopt, 'opf.violation', 5e-7, 'mips.comptol', 5e-8); mpopt = mpoption(mpopt, 'sopf.force_Pc_eq_P0', 0); %% don't constrain contracted == base case dispatch -if have_fcn('linprog') - if have_fcn('linprog_ds') +if have_feature('linprog') + if have_feature('linprog_ds') mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex'); else mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); diff --git a/lib/t/t_most_30b_3_1_0.m b/lib/t/t_most_30b_3_1_0.m index 03020eb..59c8d4b 100644 --- a/lib/t/t_most_30b_3_1_0.m +++ b/lib/t/t_most_30b_3_1_0.m @@ -27,8 +27,8 @@ function t_most_30b_3_1_0(quiet) %% options mpopt = mpoption('verbose', 0, 'out.all', 0); mpopt = mpoption(mpopt, 'opf.violation', 5e-7, 'mips.comptol', 5e-8); -if have_fcn('linprog') - if have_fcn('linprog_ds') +if have_feature('linprog') + if have_feature('linprog_ds') mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex'); else mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); diff --git a/lib/t/t_most_30b_3_1_17.m b/lib/t/t_most_30b_3_1_17.m index de8cd4d..78abb5b 100644 --- a/lib/t/t_most_30b_3_1_17.m +++ b/lib/t/t_most_30b_3_1_17.m @@ -30,15 +30,15 @@ function t_most_30b_3_1_17(quiet) mpopt = mpoption('verbose', 0, 'out.all', 0); mpopt = mpoption(mpopt, 'opf.violation', 5e-7, 'mips.comptol', 5e-8); mpopt = mpoption(mpopt, 'sopf.force_Pc_eq_P0', 0); %% don't constrain contracted == base case dispatch -if have_fcn('gurobi') +if have_feature('gurobi') mpopt = mpoption(mpopt, 'gurobi.method', 1); %% dual-simplex end -if have_fcn('mosek') +if have_feature('mosek') sc = mosek_symbcon; mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_DUAL_SIMPLEX); %% dual simplex end -if have_fcn('linprog') - if have_fcn('linprog_ds') +if have_feature('linprog') + if have_feature('linprog_ds') mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex'); else mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); diff --git a/lib/t/t_most_3b_3_1_2.m b/lib/t/t_most_3b_3_1_2.m index 0814b03..b22b9c7 100644 --- a/lib/t/t_most_3b_3_1_2.m +++ b/lib/t/t_most_3b_3_1_2.m @@ -35,7 +35,7 @@ mpopt = mpoption(mpopt, 'most.solver', algs.dc{1}); %% turn off warnings -if have_fcn('octave') +if have_feature('octave') s = warning('query', 'Octave:nearly-singular-matrix'); warning('off', 'Octave:nearly-singular-matrix'); else @@ -204,7 +204,7 @@ %% turn warnings back on -if have_fcn('octave') +if have_feature('octave') warning(s.state, 'Octave:nearly-singular-matrix'); else warning(s7.state, 'MATLAB:nearlySingularMatrix'); diff --git a/lib/t/t_most_fixed_res.m b/lib/t/t_most_fixed_res.m index fc4c66d..734fdbd 100644 --- a/lib/t/t_most_fixed_res.m +++ b/lib/t/t_most_fixed_res.m @@ -27,18 +27,18 @@ function t_most_fixed_res(quiet) mpopt = mpoption(mpopt, 'out.all', 0, 'verbose', verbose, 'opf.ac.solver', 'MIPS'); mpopt = mpoption(mpopt, 'model', 'DC'); mpopt = mpoption(mpopt, 'most.solver', 'DEFAULT'); -if have_fcn('gurobi') +if have_feature('gurobi') mpopt = mpoption(mpopt, 'gurobi.method', 1); %% dual-simplex end -if have_fcn('cplex') +if have_feature('cplex') mpopt = mpoption(mpopt, 'cplex.qpmethod', 2); %% dual-simplex end -% if have_fcn('mosek') +% if have_feature('mosek') % sc = mosek_symbcon; % mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_DUAL_SIMPLEX); %% dual simplex % end -if have_fcn('linprog') - if have_fcn('linprog_ds') +if have_feature('linprog') + if have_feature('linprog_ds') mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex'); else mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); diff --git a/lib/t/t_most_mpopf.m b/lib/t/t_most_mpopf.m index a01efb6..6ec0c24 100644 --- a/lib/t/t_most_mpopf.m +++ b/lib/t/t_most_mpopf.m @@ -25,8 +25,8 @@ function t_most_mpopf(quiet) end % verbose = 2; -if have_fcn('octave') - if have_fcn('octave', 'vnum') >= 4 +if have_feature('octave') + if have_feature('octave', 'vnum') >= 4 file_in_path_warn_id = 'Octave:data-file-in-path'; else file_in_path_warn_id = 'Octave:load-file-in-path'; @@ -156,7 +156,7 @@ function t_most_mpopf(quiet) mdo.om.add_var('test', 10); t_is(mdo.om.var.N, mdi1.om.var.N+10, 12, t); -if have_fcn('octave') +if have_feature('octave') warning(s1.state, file_in_path_warn_id); warning(s.state, 'Octave:nearly-singular-matrix'); end diff --git a/lib/t/t_most_sp.m b/lib/t/t_most_sp.m index fb359dc..dda3426 100644 --- a/lib/t/t_most_sp.m +++ b/lib/t/t_most_sp.m @@ -52,7 +52,7 @@ function t_most_sp(quiet, create_plots, create_pdfs, savedir) % mpopt = mpoption(mpopt, 'out.all', -1); %% turn off warnings -if have_fcn('octave') +if have_feature('octave') s = warning('query', 'Octave:nearly-singular-matrix'); warning('off', 'Octave:nearly-singular-matrix'); end @@ -685,7 +685,7 @@ function t_most_sp(quiet, create_plots, create_pdfs, savedir) end %% turn warnings back on -if have_fcn('octave') +if have_feature('octave') warning(s.state, 'Octave:nearly-singular-matrix'); end diff --git a/lib/t/t_most_spuc.m b/lib/t/t_most_spuc.m index bf41198..fb8bed4 100644 --- a/lib/t/t_most_spuc.m +++ b/lib/t/t_most_spuc.m @@ -56,7 +56,7 @@ function t_most_spuc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'most.price_stage_warn_tol', 10); %% solver options -if have_fcn('cplex') +if have_feature('cplex') %mpopt = mpoption(mpopt, 'cplex.lpmethod', 0); %% automatic %mpopt = mpoption(mpopt, 'cplex.lpmethod', 1); %% primal simplex mpopt = mpoption(mpopt, 'cplex.lpmethod', 2); %% dual simplex @@ -66,12 +66,12 @@ function t_most_spuc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'cplex.opts.mip.tolerances.absmipgap', 0); mpopt = mpoption(mpopt, 'cplex.opts.threads', 2); end -if have_fcn('glpk') +if have_feature('glpk') mpopt = mpoption(mpopt, 'glpk.opts.mipgap', 0); mpopt = mpoption(mpopt, 'glpk.opts.tolint', 1e-10); mpopt = mpoption(mpopt, 'glpk.opts.tolobj', 1e-10); end -if have_fcn('gurobi') +if have_feature('gurobi') %mpopt = mpoption(mpopt, 'gurobi.method', -1); %% automatic %mpopt = mpoption(mpopt, 'gurobi.method', 0); %% primal simplex mpopt = mpoption(mpopt, 'gurobi.method', 1); %% dual simplex @@ -80,7 +80,7 @@ function t_most_spuc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'gurobi.opts.MIPGap', 0); mpopt = mpoption(mpopt, 'gurobi.opts.MIPGapAbs', 0); end -if have_fcn('mosek') +if have_feature('mosek') sc = mosek_symbcon; %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_FREE); %% default %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_INTPNT); %% interior point @@ -95,7 +95,7 @@ function t_most_spuc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_REL_GAP', 0); mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_ABS_GAP', 0); end -if have_fcn('intlinprog') +if have_feature('intlinprog') %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'interior-point'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'active-set'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); @@ -159,7 +159,7 @@ function t_most_spuc(quiet, create_plots, create_pdfs, savedir) end for s = 1:length(solvers) - if ~have_fcn(fcn{s}) %% check if we have the solver + if ~have_feature(fcn{s}) %% check if we have the solver t_skip(ntests, sprintf('%s not installed', solvers{s})); else mpopt = mpoption(mpopt, 'opf.dc.solver', solvers{s}); diff --git a/lib/t/t_most_suc.m b/lib/t/t_most_suc.m index 2f9b8ad..1bfe6ff 100644 --- a/lib/t/t_most_suc.m +++ b/lib/t/t_most_suc.m @@ -55,8 +55,8 @@ function t_most_suc(quiet, create_plots, create_pdfs, savedir) end % verbose = 2; -if have_fcn('octave') - if have_fcn('octave', 'vnum') >= 4 +if have_feature('octave') + if have_feature('octave', 'vnum') >= 4 file_in_path_warn_id = 'Octave:data-file-in-path'; else file_in_path_warn_id = 'Octave:load-file-in-path'; @@ -77,7 +77,7 @@ function t_most_suc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'most.price_stage_warn_tol', 10); %% solver options -if have_fcn('cplex') +if have_feature('cplex') %mpopt = mpoption(mpopt, 'cplex.lpmethod', 0); %% automatic %mpopt = mpoption(mpopt, 'cplex.lpmethod', 1); %% primal simplex mpopt = mpoption(mpopt, 'cplex.lpmethod', 2); %% dual simplex @@ -87,12 +87,12 @@ function t_most_suc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'cplex.opts.mip.tolerances.absmipgap', 0); mpopt = mpoption(mpopt, 'cplex.opts.threads', 2); end -if have_fcn('glpk') +if have_feature('glpk') mpopt = mpoption(mpopt, 'glpk.opts.mipgap', 0); mpopt = mpoption(mpopt, 'glpk.opts.tolint', 1e-10); mpopt = mpoption(mpopt, 'glpk.opts.tolobj', 1e-10); end -if have_fcn('gurobi') +if have_feature('gurobi') %mpopt = mpoption(mpopt, 'gurobi.method', -1); %% automatic %mpopt = mpoption(mpopt, 'gurobi.method', 0); %% primal simplex mpopt = mpoption(mpopt, 'gurobi.method', 1); %% dual simplex @@ -101,7 +101,7 @@ function t_most_suc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'gurobi.opts.MIPGap', 0); mpopt = mpoption(mpopt, 'gurobi.opts.MIPGapAbs', 0); end -if have_fcn('mosek') +if have_feature('mosek') sc = mosek_symbcon; %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_FREE); %% default %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_INTPNT); %% interior point @@ -116,7 +116,7 @@ function t_most_suc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_REL_GAP', 0); mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_ABS_GAP', 0); end -if have_fcn('intlinprog') +if have_feature('intlinprog') %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'interior-point'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'active-set'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); @@ -172,7 +172,7 @@ function t_most_suc(quiet, create_plots, create_pdfs, savedir) xgd0 = xgd; for s = 1:length(solvers) - if ~have_fcn(fcn{s}) %% check if we have the solver + if ~have_feature(fcn{s}) %% check if we have the solver t_skip(ntests, sprintf('%s not installed', solvers{s})); else mpopt = mpoption(mpopt, 'opf.dc.solver', solvers{s}); @@ -307,7 +307,7 @@ function t_most_suc(quiet, create_plots, create_pdfs, savedir) end end -if have_fcn('octave') +if have_feature('octave') warning(s1.state, file_in_path_warn_id); end diff --git a/lib/t/t_most_uc.m b/lib/t/t_most_uc.m index 3fd95ad..87e5935 100644 --- a/lib/t/t_most_uc.m +++ b/lib/t/t_most_uc.m @@ -51,8 +51,8 @@ function t_most_uc(quiet, create_plots, create_pdfs, savedir) end % verbose = 2; -if have_fcn('octave') - if have_fcn('octave', 'vnum') >= 4 +if have_feature('octave') + if have_feature('octave', 'vnum') >= 4 file_in_path_warn_id = 'Octave:data-file-in-path'; else file_in_path_warn_id = 'Octave:load-file-in-path'; @@ -73,7 +73,7 @@ function t_most_uc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'most.price_stage_warn_tol', 1e1); %% solver options -if have_fcn('cplex') +if have_feature('cplex') %mpopt = mpoption(mpopt, 'cplex.lpmethod', 0); %% automatic %mpopt = mpoption(mpopt, 'cplex.lpmethod', 1); %% primal simplex mpopt = mpoption(mpopt, 'cplex.lpmethod', 2); %% dual simplex @@ -86,12 +86,12 @@ function t_most_uc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'cplex.opts.emphasis.numerical', 1); mpopt = mpoption(mpopt, 'cplex.opts.threads', 2); end -if have_fcn('glpk') +if have_feature('glpk') mpopt = mpoption(mpopt, 'glpk.opts.mipgap', 0); mpopt = mpoption(mpopt, 'glpk.opts.tolint', 1e-10); mpopt = mpoption(mpopt, 'glpk.opts.tolobj', 1e-10); end -if have_fcn('gurobi') +if have_feature('gurobi') %mpopt = mpoption(mpopt, 'gurobi.method', -1); %% automatic %mpopt = mpoption(mpopt, 'gurobi.method', 0); %% primal simplex mpopt = mpoption(mpopt, 'gurobi.method', 1); %% dual simplex @@ -100,7 +100,7 @@ function t_most_uc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'gurobi.opts.MIPGap', 0); mpopt = mpoption(mpopt, 'gurobi.opts.MIPGapAbs', 0); end -if have_fcn('mosek') +if have_feature('mosek') sc = mosek_symbcon; %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_FREE); %% default %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_INTPNT); %% interior point @@ -115,7 +115,7 @@ function t_most_uc(quiet, create_plots, create_pdfs, savedir) mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_REL_GAP', 0); mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_ABS_GAP', 0); end -if have_fcn('intlinprog') +if have_feature('intlinprog') %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'interior-point'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'active-set'); %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex'); @@ -179,7 +179,7 @@ function t_most_uc(quiet, create_plots, create_pdfs, savedir) xgd0 = xgd; for s = 1:length(solvers) - if ~have_fcn(fcn{s}) %% check if we have the solver + if ~have_feature(fcn{s}) %% check if we have the solver t_skip(ntests, sprintf('%s not installed', solvers{s})); else mpopt = mpoption(mpopt, 'opf.dc.solver', solvers{s}); @@ -394,7 +394,7 @@ function t_most_uc(quiet, create_plots, create_pdfs, savedir) end end -if have_fcn('octave') +if have_feature('octave') warning(s1.state, file_in_path_warn_id); end diff --git a/lib/t/t_most_w_ds.m b/lib/t/t_most_w_ds.m index 5864aea..17b524a 100644 --- a/lib/t/t_most_w_ds.m +++ b/lib/t/t_most_w_ds.m @@ -46,19 +46,19 @@ function t_most_w_ds(quiet, solver, verbose) CT_LOAD_DIS_P, CT_TGENCOST, CT_TAREAGENCOST, CT_MODCOST_F, ... CT_MODCOST_X] = idx_ct; -if have_fcn('cplex') || have_fcn('gurobi') || have_fcn('mosek') || ... - have_fcn('quadprog_ls') || include_MIPS +if have_feature('cplex') || have_feature('gurobi') || ... + have_feature('mosek') || have_feature('quadprog_ls') || include_MIPS mdi = md_init; %% choose solver if isempty(solver) || strcmp(upper(solver), 'DEFAULT') - if have_fcn('mosek') + if have_feature('mosek') solver = 'MOSEK'; - elseif have_fcn('cplex') + elseif have_feature('cplex') solver = 'CPLEX'; - elseif have_fcn('gurobi') + elseif have_feature('gurobi') solver = 'GUROBI'; - elseif have_fcn('quadprog_ls') + elseif have_feature('quadprog_ls') solver = 'OT'; else solver = 'MIPS'; @@ -67,24 +67,24 @@ function t_most_w_ds(quiet, solver, verbose) mpopt = mpoption('most.solver', solver, 'verbose', verbose); %% set options - if have_fcn('cplex') + if have_feature('cplex') mpopt = mpoption(mpopt, 'cplex.opts.threads', 2); % set this manually here end - if have_fcn('gurobi') + if have_feature('gurobi') mpopt = mpoption(mpopt, 'gurobi.method', 2); %% barrier mpopt = mpoption(mpopt, 'gurobi.threads', 2); mpopt = mpoption(mpopt, 'gurobi.opts.BarConvTol', 1e-6); %% 1e-8 mpopt = mpoption(mpopt, 'gurobi.opts.FeasibilityTol', 1e-4); %% 1e-6 mpopt = mpoption(mpopt, 'gurobi.opts.OptimalityTol', 1e-5); %% 1e-6 end - if have_fcn('quadprog_ls') + if have_feature('quadprog_ls') mpopt = mpoption(mpopt, 'quadprog.TolFun', 1e-13); end - if have_fcn('mosek') + if have_feature('mosek') mpopt = mpoption(mpopt, 'mosek.num_threads', 2); else mpopt = mpoption(mpopt, 'mips.max_it', 500); - if have_fcn('pardiso') + if have_feature('pardiso') mpopt = mpoption(mpopt, 'mips.linsolver', 'PARDISO'); end end