Skip to content

Commit

Permalink
Use have_feature() everywhere in place of deprecated have_fcn().
Browse files Browse the repository at this point in the history
  • Loading branch information
rdzman committed Sep 23, 2020
1 parent 1cf19d4 commit 0c42512
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion lib/mpoption_info_most.m
Original file line number Diff line number Diff line change
Expand Up @@ -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(...
Expand Down
10 changes: 5 additions & 5 deletions lib/t/most_ex6_uc.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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');
Expand Down
10 changes: 5 additions & 5 deletions lib/t/most_ex7_suc.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions lib/t/t_most_30b_1_1_0.m
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 4 additions & 4 deletions lib/t/t_most_30b_1_1_0_uc.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions lib/t/t_most_30b_1_1_17.m
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions lib/t/t_most_30b_3_1_0.m
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 4 additions & 4 deletions lib/t/t_most_30b_3_1_17.m
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions lib/t/t_most_3b_3_1_2.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
Expand Down
10 changes: 5 additions & 5 deletions lib/t/t_most_fixed_res.m
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions lib/t/t_most_mpopf.m
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/t/t_most_sp.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions lib/t/t_most_spuc.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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');
Expand Down Expand Up @@ -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});
Expand Down
18 changes: 9 additions & 9 deletions lib/t/t_most_suc.m
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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');
Expand Down Expand Up @@ -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});
Expand Down Expand Up @@ -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

Expand Down
Loading

0 comments on commit 0c42512

Please sign in to comment.