GUROBIVER Prints or returns GUROBI version info. V = GUROBIVER returns the current GUROBI version numbers. V = GUROBIVER('all') returns a struct with the fields Name, Version, Release and Date (all strings). Calling GUROBIVER without assigning the return value prints the version and release date of the current installation of GUROBI. See also MPVER.
0001 function rv = gurobiver(varargin) 0002 %GUROBIVER Prints or returns GUROBI version info. 0003 % V = GUROBIVER returns the current GUROBI version numbers. 0004 % V = GUROBIVER('all') returns a struct with the fields Name, Version, 0005 % Release and Date (all strings). Calling GUROBIVER without assigning the 0006 % return value prints the version and release date of the current 0007 % installation of GUROBI. 0008 % 0009 % See also MPVER. 0010 0011 % MATPOWER 0012 % $Id: gurobiver.m 2335 2014-06-17 19:57:18Z ray $ 0013 % by Ray Zimmerman, PSERC Cornell 0014 % Copyright (c) 2010, 2012 by Power System Engineering Research Center (PSERC) 0015 % 0016 % This file is part of MATPOWER. 0017 % See http://www.pserc.cornell.edu/matpower/ for more info. 0018 % 0019 % MATPOWER is free software: you can redistribute it and/or modify 0020 % it under the terms of the GNU General Public License as published 0021 % by the Free Software Foundation, either version 3 of the License, 0022 % or (at your option) any later version. 0023 % 0024 % MATPOWER is distributed in the hope that it will be useful, 0025 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0027 % GNU General Public License for more details. 0028 % 0029 % You should have received a copy of the GNU General Public License 0030 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0031 % 0032 % Additional permission under GNU GPL version 3 section 7 0033 % 0034 % If you modify MATPOWER, or any covered work, to interface with 0035 % other modules (such as MATLAB code and MEX-files) available in a 0036 % MATLAB(R) or comparable environment containing parts covered 0037 % under other licensing terms, the licensors of MATPOWER grant 0038 % you additional permission to convey the resulting work. 0039 0040 try 0041 model = struct( ... 0042 'A', sparse(1), ... 0043 'rhs', 1, ... 0044 'sense', '=', ... 0045 'vtype', 'C', ... 0046 'obj', 1, ... 0047 'modelsense', 'min' ... 0048 ); 0049 params = struct( ... 0050 'outputflag', 0 ... 0051 ); 0052 result = gurobi(model, params); 0053 vn = sprintf('%d.%d.%d', result.versioninfo.major, result.versioninfo.minor, result.versioninfo.technical); 0054 catch gurobiError 0055 fprintf('Gurobi Error!\n'); 0056 disp(gurobiError.message); 0057 vn = '<unknown>'; 0058 end 0059 0060 v = struct( 'Name', 'Gurobi', ... 0061 'Version', vn, ... 0062 'Release', '', ... 0063 'Date', '' ); 0064 if nargout > 0 0065 if nargin > 0 0066 rv = v; 0067 else 0068 rv = v.Version; 0069 end 0070 else 0071 fprintf('%-22s Version %-10s %-11s %s\n', v.Name, v.Version, v.Date, computer); 0072 end