function trExploitation = computeTrustRegionExploitation(obj,var_s,termRegSet)
%COMPUTETRUSTREGIONEXPLOITATION - computes a scalar measure for the
%       exploitation of the trust region.
%
% Syntax:
%       trExploitation = computeTrustRegionExploitation(obj,var_s,termRegSet)
%
% Description:
%       This function computes the smallest value of the auxiliary variable
%       tau_0 in the constraint in [1, Eq. 28a], which is considered a
%       scalar measure for the exploitation of the trust region. It holds 
%       that
%           zonotope(termReg.c,termReg.G*diag(var_s)) \subseteq 
%               termReg + trExploitation*tr_set,
%       i.e., 0 <= trExploitation <= 1 for any feasible var_s.
%       We require (a feasible value of) tau_0 to evaluate the 
%       parameterized approximation of the abstraction error.
%
% Input Arguments:
%       -obj:       instance of class computeTermRegNonlinSysLinApproach
%       -var_s:     generator scaling factors
%                   (array of dimension [size(termReg.G,2),1])
%       -termReg:   current candidate for the terminal region
%                   (class: zonotope)
%
% Output Arguments:
%       -trExploitation:    scalar between 0 and 1
%
% See Also:
%       @computeTermRegNonlinSysLinApproach/approxAbsErrQuad_eval
% 
% References:
%       [1] L. Schäfer et al. "Scalable Computation of Robust Control 
%           Invariant Sets of Nonlinear Systems", in IEEE Transactions 
%           on Automatic Control, vol. 69, no. 2, pp. 755-770, 2024
%
%------------------------------------------------------------------
% This file is part of <a href="matlab:docsearch aroc">AROC</a>, a Toolbox for Automatic Reachset-
% Optimal Controller Synthesis developed at the Chair of Robotics, 
% Artificial Intelligence and Embedded Systems, 
% Technische Universitaet Muenchen. 
%
% For updates and further information please visit <a href="http://aroc.in.tum.de">aroc.in.tum.de</a>
%
% More Toolbox Info by searching <a href="matlab:docsearch aroc">AROC</a> in the Matlab Documentation
%
%------------------------------------------------------------------
% Authors:      Lukas Schäfer
% Website:      <a href="http://aroc.in.tum.de">aroc.in.tum.de</a>
% Work Adress:  Technische Universitaet Muenchen
% Copyright (c) 2024 Chair of Robotics, Artificial Intelligence and
%               Embedded Systems, TU Muenchen
%------------------------------------------------------------------ 

trExploitation = max(0,max((abs(termRegSet.G)*var_s - ...
    sum(abs(termRegSet.G),2))./sum(abs(obj.tr_set.G),2)));

end
