-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmuptest.m
150 lines (140 loc) · 3.34 KB
/
muptest.m
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
% MUPTEST
%
% Function MUPTEST evaluates the selftest.
%
% [chk,stat] = muptest(vbs)
%
% where:
%
% chk[class:double] - is output flag of the selftest, such that:
% chk == 1 - No problems detected.
% chk == 0 - Problems detected.
% chk == -1 - Selftest was not performed correctly.
%
% stat[class:cell] - is output cell-array of report information, where:
% stat{1} - describes overall result
% stat{2} - describes MUP check
% stat{3} - describes YALMIP check
% stat{4} - describes SDP solver check
%
% vbs[class:double] - is optional verbose-mode setup
%
% juraj.oravec@stuba.sk
%
function [chk,stat] = muptest(vbs)
%% Default Verbose-mode Setup
if(nargin == 0)
vbs = 1;
end % if
%% Initialize outputs
chk = -1;
chk_yalmip = 0;
chk_sdpsolver = 0;
%% Check list of RMPC Methods
[rmpc_list, rmpc_kwds] = mup_get_rmpclist();
if( isempty( rmpc_list ) == 0 )
stat{2,1} = 'RMPC design methods are available.';
chk_mup = 1;
else
stat{2,1} = 'RMPC design methods are unavailable!';
chk_mup = 0;
end % if
%
%% YALMIP Check
if(exist('yalmiptest') ~= 2)
stat{3,1} = 'YALMIP not found!';
chk_yalmip = 0;
else
stat{3,1} = 'YALMIP found.';
chk_yalmip = 1;
end % if
%% SDP Solver Check
stat{4,1} = 'SDP solver(s): ';
if(exist('csdp') ~= 0)
stat{4,1} = [stat{4}, 'CSDP,'];
chk_sdpsolver = 1;
end
if(exist('dsdp') ~= 0)
stat{4,1} = [stat{4}, 'DSDP,'];
chk_sdpsolver = 1;
end
if(exist('lmilab') ~= 0)
stat{4,1} = [stat{4}, 'LMILAB,'];
chk_sdpsolver = 1;
end
if(exist('logdetppa') ~= 0)
stat{4,1} = [stat{4}, 'LOGDETPPA,'];
chk_sdpsolver = 1;
end
if(exist('mosekopt') ~= 0)
stat{4,1} = [stat{4}, 'MOSEK,'];
chk_sdpsolver = 1;
end
if(exist('penbmi') ~= 0)
stat{4,1} = [stat{4}, 'PENBMI,'];
chk_sdpsolver = 1;
end
if(exist('penlab') ~= 0)
stat{4,1} = [stat{4}, 'PENLAB,'];
chk_sdpsolver = 1;
end
if(exist('penlmi') ~= 0)
stat{4,1} = [stat{4}, 'PENLMI,'];
chk_sdpsolver = 1;
end
if(exist('scs') ~= 0)
stat{4,1} = [stat{4}, 'SCS,'];
chk_sdpsolver = 1;
end
if(exist('sdpam') ~= 0)
stat{4,1} = [stat{4}, 'SDPA,'];
chk_sdpsolver = 1;
end
if(exist('sdplr') ~= 0)
stat{4,1} = [stat{4}, 'SDPLR,'];
chk_sdpsolver = 1;
end
if(exist('sdpt3') ~= 0)
stat{4,1} = [stat{4}, 'SDPT3,'];
chk_sdpsolver = 1;
end
if(exist('sdpnal') ~= 0)
stat{4,1} = [stat{4}, 'SDPNAL,'];
chk_sdpsolver = 1;
end
if(exist('sedumi') ~= 0)
stat{4,1} = [stat{4}, 'SeDuMi,'];
chk_sdpsolver = 1;
end
if(chk_sdpsolver == 0)
stat{4,1} = [stat{4}, 'not found '];
end % if
stat{4,1} = [stat{4}(1:end-1),'.'];
%% Soft-Constraints Module
if(exist('feas_init_soft_con') == 2)
stat{5,1} = 'SOFT-CON module is available.';
chk_mup = 1;
else
stat{5,1} = 'SOFT-CON module is not available!';
chk_mup = 0;
end % if
%% Check
if(chk_mup & chk_yalmip & chk_sdpsolver)
chk = 1;
stat{1,1} = 'No problems detected.';
else
chk = 0;
stat{1,1} = 'Problems detected!';
end % if
%% Report
mup_verbose(1,vbs,' MUPTEST finished.');
mup_verbose(1,vbs,' %s',stat{2});
disp(sprintf(' List of available methods:'))
for k = 1 : length(rmpc_list)
mup_verbose(1,vbs,' %2d: %s',k,rmpc_list{k});
end % for k
mup_verbose(1,vbs,' %s',stat{3});
mup_verbose(1,vbs,' %s',stat{4});
mup_verbose(1,vbs,' %s',stat{5});
mup_verbose(1,vbs,' %s',stat{1});
end % function