%% computeVariableIndices
% Computes the indices optimization variables.
%
%% Syntax
%
% <html>
%        <div class="syntax">
% obj = computeVariableIndices(obj,U) <br>
%        </div>
% </html>
%
%% Description
% To formulate the optimal control problem (OCP) in the generic form
% of a nonlinear programming problem, i.e.,
% min f(y) s.t. lb <= g(y) <= ub,
% the variables must be lumped together into a single vector y. To,
% e.g., easily extract the states or control inputs from the optimal
% solution, this function computes the indices of the entries of y
% storing the corresponding OCP variable.
% These indices are stored in the property idxVars - a structure with
% the following fields:
% .x:             (nominal) states
% (integer array of dimension [obj.nx,obj.N+1])
% .xVec:          vectorized idxVars.x
% (integer array of dimension [obj.nx*(obj.N+1),1])
% .u:             (nominal) control inputs
% (integer array of dimension [obj.nu,obj.N])
% .uVec:          vectorized idxVars.u
% (integer array of dimension [obj.nu*obj.N,1])
% .slack_bu:      slack variables associated with violations
% of the bounds on control inputs
% (integer array of dimension [U.dim,obj.N])
% .slack_buVec:   vectorized idxVars.slack_bu
% (integer array of dimension [obj.nu*obj.N,1])
% .nVars:         number of optimization variables
% (integer)
%
%% 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">
%            obj
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            instance of class optimalControl
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            U
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            set of admissible control inputs
%            (class: polytope)
%        </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">
%            obj
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            updated instance of class optimalControl
%        </p>
%    </td>
%    </tr>
% </tbody>
% </table>
% </html>
%
%% See Also
% <optimalControlhelp.html |optimalControl|>
%

%%
% <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>
