blob: 6be62f1aaeb10c5cae95c8db919ab07df4d4cafd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
function gurobi_setup()
% gurobi_setup Setup and test the Gurobi Matlab interface
% Numeric version
ver = version;
ver(ver=='.') = ' ';
ver = sscanf(ver,'%d');
if (ver(1) ~= 7 && ver(1) ~= 8) || ...
(ver(1) == 7 && ver(2) < 7) || ...
(ver(1) == 8 && ver(2) > 3)
warning('gurobi_setup:MATLABver', ...
['You are using MATLAB %s.\n' ...
'The Gurobi MATLAB interface currently supports ' ...
'R2008b-R2015b.'], version);
end
gurobipath = mfilename('fullpath');
slashes = strfind(gurobipath, '/');
gurobipath = gurobipath(1:slashes(end));
addpath(gurobipath)
try
gurobi(1)
catch me
if ~strcmp(me.identifier, 'gurobi:BadInput')
throw(me)
end
end
% gurobi.mex* is loaded, now test for license issues
model.obj = 1;
model.A = sparse(1,1);
model.rhs = 0;
model.sense = '=';
params.outputflag = false;
result = gurobi(model, params);
fprintf('\nThe MATLAB interface for Gurobi %d.%d.%d has been installed.\n\n', ...
result.versioninfo.major, result.versioninfo.minor, ...
result.versioninfo.technical);
disp('The directory')
disp([' ' gurobipath])
disp('has been added to the MATLAB path.')
disp('To use Gurobi regularly, you must save this new path definition.');
disp('To do this, type the command' );
disp(' savepath' );
disp('at the MATLAB prompt. Please consult the MATLAB documentation');
disp('if necessary.');
|