-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_analysis.m
More file actions
75 lines (58 loc) · 2.63 KB
/
Main_analysis.m
File metadata and controls
75 lines (58 loc) · 2.63 KB
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
%% Analysis
clc; clear; close all;
Set_Up
iterations = struct;
solve_times = struct;
Case = "case_2";
methods = ["classic","osm","aggressive","linear_term"];
for loop = ["open", "closed"]
for method = methods
load("shw_"+loop+"_"+method+"_"+Case)
show.(loop)(method).traj = shw.traj;
if loop == "closed"
iterations.(method) = shw.traj.iterations;
solve_times.(method) = shw.traj.solve_times;
end
end
show_results
end
show_solves
%%% Print:
fprintf("\nAverage number of iterations when warm started by previous solution:\n")
for method = methods
fprintf(" %-14s -> %8.2f iterations\n", method, mean(iterations.(method)(2:end)))
% first control signal is not warmstarted
end
fprintf("\nAverage solve time [ms] when warm started by previous solution:\n")
for method = methods
fprintf(" %-14s -> %8.4f ms\n", method, mean(solve_times.(method)(2:end))*1000)
% first control signal is not warmstarted
end
%%
%{
The aggressive tuning is able to produce the same solution as OSM, and
does so with similar efficiency as the OSM implementation. Though, achieving
this decopling effect with an aggressive controller requires careful
tuning. The tuning must be aggressive enough to approximate the OSM
solution well, and must not be so aggressive that the numerics become
poorly conditioned. In general, tuning the controller correctly can be a
complex, time consuming, and difficult process. In contrast, the OSM
strategy does not require tuning, as the sought behavior appears
automatically form the imposed structure. In fact, the OSM strategy can be
tuned to accomodate other preferenecs, while respecting the preferred structure.
Furthermore, note that the cost-function-shaping approah is only possible
for simple cases, such as our example, where a variable can be supressed by
simply increasing its weight. In the general decoupling case, it is not
obvious how to penalize the particular coupling, and not usage of those
inputs in other couplings. Moreover, the preferred strucutre may not be
that of a decoupling scheme, and in general, a cost-function-shaping/tuning
strategy is even less applicable.
The linear term also achieves a decoupling effect, but suffers all the same
caveats as the aggressive tuning strategy; hard to tune, poor numerics, and
not applicable in the general case.
Overall, the OSM strategy offers a simpler path to decoupling when, when
meticulous tuning would otherwise be applicable, and extend the decoupling
capabilities of MPC beyond simple examples, where tuning no longer suffices.
In addition, the OSM strategy allows structural preferences beyond that of
decoupling schemes.
%}