Home > matpower7.1 > mp-opt-model > lib > have_feature_gurobi.m

have_feature_gurobi

PURPOSE ^

HAVE_FEATURE_GUROBI Detect availability/version info for Gurobi

SYNOPSIS ^

function [TorF, vstr, rdate] = have_feature_gurobi()

DESCRIPTION ^

HAVE_FEATURE_GUROBI  Detect availability/version info for Gurobi

   Feature detection function implementing 'gurobi' tag for HAVE_FEATURE
   to detect availability/version of Gurobi optimizer
   (https://www.gurobi.com).

   See also HAVE_FEATURE, QPS_MASTER, MIQPS_MASTER, GUROBI.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [TorF, vstr, rdate] = have_feature_gurobi()
0002 %HAVE_FEATURE_GUROBI  Detect availability/version info for Gurobi
0003 %
0004 %   Feature detection function implementing 'gurobi' tag for HAVE_FEATURE
0005 %   to detect availability/version of Gurobi optimizer
0006 %   (https://www.gurobi.com).
0007 %
0008 %   See also HAVE_FEATURE, QPS_MASTER, MIQPS_MASTER, GUROBI.
0009 
0010 %   MP-Opt-Model
0011 %   Copyright (c) 2004-2020, Power Systems Engineering Research Center (PSERC)
0012 %   by Ray Zimmerman, PSERC Cornell
0013 %
0014 %   This file is part of MP-Opt-Model.
0015 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0016 %   See https://github.com/MATPOWER/mp-opt-model for more info.
0017 
0018 TorF = exist('gurobi', 'file') == 3;
0019 vstr = '';
0020 rdate = '';
0021 if TorF
0022     try
0023         model = struct( ...
0024             'A', sparse(1), ...
0025             'rhs', 1, ...
0026             'sense', '=', ...
0027             'vtype', 'C', ...
0028             'obj', 1, ...
0029             'modelsense', 'min' ...
0030         );
0031         params = struct( ...
0032             'outputflag', 0 ...
0033         );
0034         result = gurobi(model, params);
0035         vstr = sprintf('%d.%d.%d', result.versioninfo.major, result.versioninfo.minor, result.versioninfo.technical);
0036     catch % gurobiError
0037         TorF = 0;
0038         fprintf('Gurobi Error!\n');
0039 %         disp(gurobiError.message);
0040     end
0041 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005