summaryrefslogtreecommitdiffstats
path: root/templates/compute_tightening.m
blob: 7095f9cf1bbdcb0737b854e2c922dd9cdc0479f9 (plain)
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 params = compute_tightening(K_tube,H_tube,h_tube,params)  
	% YOUR CODE HERE
	Hx = params.constraints.StateMatrix;
	hx = params.constraints.StateRHS;
	
	Hu = params.constraints.InputMatrix;
	hu = params.constraints.InputRHS;
	
	Pxz = Polyhedron('A',Hx,'b',hx);
	Puz = Polyhedron('A',Hu,'b',hu);
	% Ptube = Polyhedron('A',H_tube,'b',h_tube);
	
	Px_tube = Pxz.minus(Polyhedron('A',H_tube,'b',h_tube));
	params.constraints.StateMatrix = Px_tube.A;
	params.constraints.StateRHS = Px_tube.b;
    
    Pu_tube = Puz.minus(K_tube*Polyhedron('A',H_tube,'b',h_tube))
% 	Pu_tube = Puz.minus(Polyhedron('A',H_tube*K_tube,'b',h_tube));
	params.constraints.InputMatrix = Pu_tube.A;
	params.constraints.InputRHS = Pu_tube.b;
end