-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeas_kothare.m
163 lines (152 loc) · 4.63 KB
/
feas_kothare.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
151
152
153
154
155
156
157
158
159
160
161
162
163
% FEAS_KOTHARE
%
% FEAS_KOTHARE evaluates feasibility check of controller design
% optimization problem.
%
%
% est.:2013.07.17.
% rev.:2016.05.12.
% Copyright is with the following author(s):
%
% (c) 2016 Juraj Oravec, Slovak University of Technology in Bratislava,
% (c) 2016 Michal Kvasnica, Slovak University of Technology in Bratislava,
% (c) 2016 Monika Bakosova, Slovak University of Technology in Bratislava,
% ------------------------------------------------------------------------------
% Legal note:
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public
% License as published by the Free Software Foundation; either
% version 2.1 of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public
% License along with this library; if not, write to the
% Free Software Foundation, Inc.,
% 59 Temple Place, Suite 330,
% Boston, MA 02111-1307 USA
%
% ------------------------------------------------------------------------------
%% Output initialization
chk = 0;
chk_eig = -Inf;
%% Timer initilaization
t0 = toc;
%% Counter initialization
cnt = 0;
%% Feasibility-Check tolerance
ZERO_tol = -1e-6;
%% Inverted Lyapunov matrix
entity = min(eig(X_opt));
mup_verbose(2,vbs,' FEAS_CHK: Inverse Lyapunov matrix MIN_EIG = %x.',entity)
if(entity < ZERO_tol);
cnt = cnt + 1;
chk(cnt) = 1;
chk_eig(cnt) = entity;
mup_verbose(2,vbs,' FEAS_CHK: Inverse Lyapunov matrix failed!')
end % if
%% Robust invariant ellipsoid
entity = min(eig([1, xk'; xk, X_opt]));
mup_verbose(2,vbs,' FEAS_CHK: Invariant ellipsoid matrix MIN_EIG = %x.',entity)
if(entity < ZERO_tol);
cnt = cnt + 1;
chk(cnt) = 1;
chk_eig(cnt) = entity;
mup_verbose(2,vbs,' FEAS_CHK: Invariant ellipsoid failed!')
end % if
%% Convergency
for v = 1 : nv
entity = min(eig([...
X_opt,...
X_opt*A{v}' + Y_opt'*B{v}',...
X_opt*Wx^(1/2),...
Y_opt'*Wu^(1/2);...
A{v}*X_opt + B{v}*Y_opt,...
X_opt,...
ZEROx,...
ZEROxu;...
Wx^(1/2)*X_opt,...
ZEROx,...
g_opt*Ix,...
ZEROxu;...
Wu^(1/2)*Y_opt,...
ZEROux,...
ZEROux,...
g_opt*Iu,...
]));
mup_verbose(2,vbs,' FEAS_CHK: VTX:%d: Stability condition matrix MIN_EIG = %x.',v,entity)
if(entity < ZERO_tol);
cnt = cnt + 1;
chk(cnt) = 1;
chk_eig(cnt) = entity;
mup_verbose(2,vbs,' FEAS_CHK: VTX:%d: Stability condition failed!',v)
end % if
end % for v : nv
%% Input constraints
if(isempty(u_sat) == 0)
%% Part I
entity = min(eig([diag(u_sat.^2), Y_opt; Y_opt', X_opt ]));
mup_verbose(2,vbs,' FEAS_CHK: Input contraints matrix L2 MIN_EIG = %x.',entity)
if(entity < ZERO_tol);
cnt = cnt + 1;
chk(cnt) = 1;
chk_eig(cnt) = entity;
mup_verbose(2,vbs,' FEAS_CHK: Input contraints matrix failed!')
end
%% Part II
entity = min(eig([ U_opt, Y_opt; Y_opt', X_opt ]));
mup_verbose(2,vbs,' FEAS_CHK: Input contraints matrix L1 MIN_EIG = %x.',entity)
if(entity < ZERO_tol);
cnt = cnt + 1;
chk(cnt) = 1;
chk_eig(cnt) = entity;
mup_verbose(2,vbs,' FEAS_CHK: Input contraints matrix failed!')
end % if
%% Part III
entity = min([diag(U_opt) - u_sat.^2]);
mup_verbose(2,vbs,' FEAS_CHK: Input contraints matrix MIN_EIG = %x.',entity)
if(entity > -ZERO_tol);
cnt = cnt + 1;
chk(cnt) = 1;
chk_eig(cnt) = entity;
mup_verbose(2,vbs,' FEAS_CHK: Input contraints matrix failed!')
end % if
end % if
%% State constraints
if(isempty(y_sat) == 0)
for v = 1 : nv
entity = min(eig([
X_opt,...
(A{v}*X_opt + B{v}*Y_opt)'*C{v}';...
C{v}*(A{v}*X_opt + B{v}*Y_opt),...
diag(y_sat{v}.^2),...
]));
mup_verbose(2,vbs,' FEAS_CHK: VTX:%d: State contraints matrix MIN_EIG = %x.',v,entity)
if(entity < ZERO_tol);
cnt = cnt + 1;
chk(cnt) = 1;
chk_eig(cnt) = entity;
mup_verbose(2,vbs,' FEAS_CHK: VTX:%d: State contraints failed!',v)
end % if
end % for v
end % if
%% Feasibility Check - Summary
t_load2 = toc;
t_load = t_load2 - t0;
if(sum(chk) > 0)
chk_feas = 0;
feas_info = 'Failed!';
mup_verbose(2,vbs,' %d. step: FEAS_CHK: Failed! (%d infeasible constraint(s) found) (%.2f)',k,sum(chk),t_load)
mup_verbose(2,vbs,' %d. step: FEAS_CHK: Maximal eigenvalue: %x ',k,max(chk_eig))
else
chk_feas = 1;
feas_info = 'Valid';
mup_verbose(2,vbs,' %d. step: FEAS_CHK: Valid. (%.2f)',k,t_load)
end % if