Home > matpower5.1 > gurobiver.m

gurobiver

PURPOSE ^

GUROBIVER Prints or returns GUROBI version info.

SYNOPSIS ^

function rv = gurobiver(varargin)

DESCRIPTION ^

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.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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 %   Copyright (c) 2010-2015 by Power System Engineering Research Center (PSERC)
0013 %   by Ray Zimmerman, PSERC Cornell
0014 %
0015 %   $Id: gurobiver.m 2644 2015-03-11 19:34:22Z ray $
0016 %
0017 %   This file is part of MATPOWER.
0018 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0019 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0020 
0021 try
0022     model = struct( ...
0023         'A', sparse(1), ...
0024         'rhs', 1, ...
0025         'sense', '=', ...
0026         'vtype', 'C', ...
0027         'obj', 1, ...
0028         'modelsense', 'min' ...
0029     );
0030     params = struct( ...
0031         'outputflag', 0 ...
0032     );
0033     result = gurobi(model, params);
0034     vn = sprintf('%d.%d.%d', result.versioninfo.major, result.versioninfo.minor, result.versioninfo.technical);
0035 catch gurobiError
0036     fprintf('Gurobi Error!\n');
0037     disp(gurobiError.message);
0038     vn = '<unknown>';
0039 end
0040 
0041 v = struct( 'Name',     'Gurobi', ... 
0042             'Version',  vn, ...
0043             'Release',  '', ...
0044             'Date',     '' );
0045 if nargout > 0
0046     if nargin > 0
0047         rv = v;
0048     else
0049         rv = v.Version;
0050     end
0051 else
0052     fprintf('%-22s Version %-10s %-11s\n', v.Name, v.Version, v.Date);
0053 end

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005