summaryrefslogtreecommitdiffstats
path: root/Submission files/compute_minRPI.m
diff options
context:
space:
mode:
authorYuan Xu <yuanxu@student.ethz.ch>2023-05-24 17:35:46 +0200
committerYuan Xu <yuanxu@student.ethz.ch>2023-05-24 17:35:46 +0200
commita23ba49056a36aff221d0c23e228b981222c3576 (patch)
tree742c18cbe13c1603909b55ee82188ce6360e8fa0 /Submission files/compute_minRPI.m
parentADD: declaration of originality (diff)
downloadmpc_pe-submission.tar.gz
mpc_pe-submission.zip
add submission zipsubmission
Diffstat (limited to 'Submission files/compute_minRPI.m')
-rw-r--r--Submission files/compute_minRPI.m39
1 files changed, 39 insertions, 0 deletions
diff --git a/Submission files/compute_minRPI.m b/Submission files/compute_minRPI.m
new file mode 100644
index 0000000..19df517
--- /dev/null
+++ b/Submission files/compute_minRPI.m
@@ -0,0 +1,39 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Copyright (c) 2023, Amon Lahr, Simon Muntwiler, Antoine Leeman & Fabian Flürenbrock Institute for Dynamic Systems and Control, ETH Zurich.
+%
+% All rights reserved.
+%
+% Please see the LICENSE file that has been included as part of this package.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function [H_tube,h_tube,n_iter] = compute_minRPI(K_tube,params)
+ % YOUR CODE HERE
+ A = params.model.A+params.model.B*K_tube;
+ % A = params.model.A;
+% display(A)
+ nx = params.model.nx;
+ omega = Polyhedron('A',[eye(nx);-eye(nx)],'b',zeros(1,2*nx)');
+ % display(omega.A)
+ % display(omega.b)
+ n_iter = 0;
+ Hw = params.constraints.DisturbanceMatrix;
+ hw = params.constraints.DisturbanceRHS;
+ W = Polyhedron('A',Hw,'b',hw);
+ while true
+ omega_last = copy(omega);
+ % display(n_iter)
+ % A_last = omega.A;
+ % b_last = omega.b;
+ display(n_iter);
+ display(omega.b)
+ omega = omega.plus(A^(n_iter)*W);
+
+ if eq(omega.minHRep(),omega_last.minHRep())
+ % if eq(omega,omega_last)
+ break
+ end
+ n_iter = n_iter+1;
+ end
+ H_tube = omega.A;
+ h_tube = omega.b;
+end \ No newline at end of file