1 | function regress_bmibnb |
---|
2 | |
---|
3 | |
---|
4 | ops = sdpsettings('solver','bmibnb'); % Global solver |
---|
5 | ops = sdpsettings(ops,'bmibnb.lowersolver','glpk'); % Lower solver |
---|
6 | ops = sdpsettings(ops,'bmibnb.uppersolver','penbmi'); % Local solver |
---|
7 | ops = sdpsettings(ops,'bmibnb.lpsolver','glpk'); % LP solver |
---|
8 | ops = sdpsettings(ops,'verbose',0); % LP solver |
---|
9 | ops = sdpsettings(ops,'penbmi.P0',0.01); |
---|
10 | i = 0; |
---|
11 | |
---|
12 | location = fileparts(mfilename('fullpath')); |
---|
13 | files = dir(location); |
---|
14 | searchfor = [mfilename '_']; |
---|
15 | testthese = {}; |
---|
16 | for i = 1:length(files) |
---|
17 | [cc,vv,ff,gg] = fileparts(files(i).name); |
---|
18 | if isequal(ff,'.m') |
---|
19 | if strfind(files(i).name,searchfor) |
---|
20 | testthese{end+1} = files(i); |
---|
21 | end |
---|
22 | end |
---|
23 | end |
---|
24 | |
---|
25 | % Now test them |
---|
26 | for i = 1:length(testthese) |
---|
27 | [cc,functionname,vv,gg] = fileparts(testthese{i}.name); |
---|
28 | fail = feval(functionname,ops); |
---|
29 | regressreport([ '''' functionname ''''],fail) |
---|
30 | end |
---|
31 | |
---|
32 | function regressreport(text,fail) |
---|
33 | |
---|
34 | switch fail |
---|
35 | case 0 |
---|
36 | disp(['No problems in ' text]); |
---|
37 | case 1 |
---|
38 | disp(['Objective wrong in ' text]); |
---|
39 | case 2 |
---|
40 | disp(['Infeasible solution in ' text]); |
---|
41 | otherwise |
---|
42 | end |
---|
43 | |
---|
44 | function fail = getfail(problem,obj,objgoal,infeas) |
---|
45 | fail = 0; |
---|
46 | if problem == 0 |
---|
47 | if (obj-objgoal)>1e-3 |
---|
48 | fail = 1; |
---|
49 | elseif max(infeas)<-1e-6 |
---|
50 | fail = 2; |
---|
51 | end |
---|
52 | else |
---|
53 | fail = 3; |
---|
54 | end |
---|
55 | |
---|