%% cvxSetOpt
% computes an updated candidate terminal region and the
% corresponding safety-preserving controller.
%
%% Syntax
%
% <html>
%        <div class="syntax">
% [res, opts] = cvxSetOpt(res, opts, enlarge) <br>
%        </div>
% </html>
%
%% Description
% This function computes the ingredients for, solves, and
% post-processes the solution of the convex programming approximation
% for the computation of a robust control invariant (RCI) set for a
% nonlinear sampled-data system.
%
%% Input Arguments
%
% <html>
% <table cellspacing="0" cellpadding="4" width="" border="1" frame="box" rules="none" class="">
% <tbody valign="top">
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             candTermReg
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            current candidate for the terminal region
%            (class: zonotope)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             opts
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            structure containing the algorithm settings
%        </p>
%        <p class="table">
% <table cellspacing="0" cellpadding="4" width="" border="1" frame="box" rules="none" class="inner">
% <tbody valign="top">
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .X
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            set of admissible states (class: interval)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .U
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            set of admissible control inputs
%            (class: interval)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .W
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            set of disturbances (class: interval)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .nx
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            dimension of state space
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .nu
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            dimension of input space
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .nw
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            dimension of disturbance space
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .Ninter
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            number of intermediate time steps
%            [&#123;1&#125; / positive integer]
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .timeStep
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            sampling time [&#123;0.1&#125; / positive scalar]
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .timeStepCtrl
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            sampling time for the control inputs
%            [-.timeStep/-.Ninter]
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .xEq
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            equilibrium point for the terminal region
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .uEq
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            control input for the equilirium point
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .trustRegionAlg
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            structure containing the trust region and
%            parameters for updating the trust region
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .scvx
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            parameters for successive convexification
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .sys
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            structure containing the nonlinearSys
%            object modeling the dynmical system
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .linDyn
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            strucutre containing the matrices of the
%            linearized dynamical system
%        </p>
%    </td>
%    </tr>
% </tbody>
% </table>
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             enlarge
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            enlargement factor for abstraction error -
%            optional argument (class: double)
%        </p>
%    </td>
%    </tr>
% </tbody>
% </table>
% </html>
%
%% Output Arguments
%
% <html>
% <table cellspacing="0" cellpadding="4" width="" border="1" frame="box" rules="none" class="">
% <tbody valign="top">
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             res
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            structure containing the results of the last iteration
%        </p>
%        <p class="table">
% <table cellspacing="0" cellpadding="4" width="" border="1" frame="box" rules="none" class="inner">
% <tbody valign="top">
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .termReg
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            updated candidate terminal Region
%            (class: zonotope)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .inputFF
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            sets representing the safety-preserving
%            controller associated with -.termReg
%            (cell array of zonotopes)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .assignInput
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            maps generators of -.inputFF to generators
%            of -.termReg (cell array of double arrays)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .flag
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            indicates feasibility of the solution of
%            convex program (class: boolean)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .time.cvx
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            (approx. of) solver time
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .time.cvxSetup
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            elasped time for setting up the convex
%            program in standard form
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .cost.set
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            set whose volume is was maximized
%            (-.termReg or inscribed set)
%            (class: zonotope)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .linReach.Rtp
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            approximation of the time-point reachable
%            set, see [1] (class: zonotope)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .linReach.Rti
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            approximation of the time-interval
%            reachable set, see [1] (class: zonotope)
%        </p>
%    </td>
%    </tr>
% </tbody>
% </table>
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             opts
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            updated opts structure - updated fields:
%        </p>
%        <p class="table">
% <table cellspacing="0" cellpadding="4" width="" border="1" frame="box" rules="none" class="inner">
% <tbody valign="top">
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .trustRegionAlg.trustRegion
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            updated trust region
%            (class: zonotope)
%        </p>
%    </td>
%    </tr>
% </tbody>
% </table>
%        </p>
%    </td>
%    </tr>
% </tbody>
% </table>
% </html>
%
%% See also
% <terminalRegionhelp.html |terminalRegion|>, <termRegNonlinSysLinApproachhelp.html |termRegNonlinSysLinApproach|>
%
%% References
% [1] L. Schäfer et al. "Scalable Computation of Robust Control
% Invariant Sets of Nonlinear Systems", 2023, IEEE Transactions
% on Automatic Control
% [2] M. Althoff et al. "Reachability Analysis of Nonlinear Systems
% with Uncertain Parameters using Conservative Linearization",
% 2008 47th IEEE Conference on Decision and Control, 2008,
% pp. 4042-4048
%

%%
% <html>
%   <hr>
%   <p class="copy">&copy; 2018-2026 I6 Technische Universit&auml;t M&uuml;nchen
%        <tt class="minicdot">&#149;</tt>
%        <a href="https://tumcps.github.io/AROC/">Website</a>
%        <tt class="minicdot">&#149;</tt>
%        <a href="file:txts/LICENSE.txt">License</a>
%   </p>
% <div>
% <table>
%  <tr>
%   <td style="background-color:#ffffff; border:0; width:25%; vertical-align:middle; text-align:center">
%             <img src="img/logoAroc.png" alt="logoAroc" height="40px">
%      </td>
%   <td style="background-color:#ffffff; border:0; width:25%; vertical-align:middle; text-align:center">
%      <img src="img/logoCora.png" alt="logoCora" height="40px"></td>
%   <td style="background-color:#ffffff; border:0; width:25%; vertical-align:middle; text-align:center">
%      <img src="img/logoChair.png" alt="logoChair" height="40px"></td>
%   <td style="background-color:#ffffff; border:0; width:25%; vertical-align:middle; text-align:center">
%      <img src="img/logoTum.png" alt="logoTum" height="40px"></td>
%  </tr>
% </table>
% </div>
% </html>
