{'fraction_non_alphanumeric': 0.04357549471401464, 'fraction_numerical': 0.015417457305502846, 'mean_word_length': 4.46537037037037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Optimal Determination of Respiratory Airflow Patterns Using a Nonlinear Multicompartment Model for a Lung Mechanics System

We develop optimal respiratory airflow patterns using a nonlinear multicompartment model for a lung mechanics system. Specifically, we use classical calculus of variations minimization techniques to derive an optimal airflow pattern for inspiratory and expiratory breathing cycles. The physiological interpretation of the optimality criteria used involves the minimization of work of breathing and lung volume acceleration for the inspiratory phase, and the minimization of the elastic potential energy and rapid airflow rate changes for the expiratory phase. Finally, we numerically integrate the resulting nonlinear two-point boundary value problems to determine the optimal airflow patterns over the inspiratory and expiratory breathing cycles.


Introduction
Respiratory failure, the inadequate exchange of carbon dioxide and oxygen by the lungs, is a common clinical problem in critical care medicine, and patients with respiratory failure frequently require support with mechanical ventilation while the underlying cause is identified and treated. The goal of mechanical ventilation is to ensure adequate ventilation, which involves a magnitude of gas exchange that leads to the desired blood level of carbon dioxide, and adequate oxygenation, which involves a blood concentration of oxygen that will ensure organ function. Achieving these goals is complicated by the fact that mechanical ventilation can actually cause acute lung injury, either by inflating the lungs to excessive volumes or by using excessive pressures to inflate the lungs. The challenge to mechanical ventilation is to produce the desired blood levels of carbon dioxide and oxygen without causing further acute lung injury.
With the increasing availability of microchip technology, it has been possible to design partially automated mechanical ventilators with control algorithms for providing volume or pressure control [1][2][3][4][5]. More sophisticated fully automated model reference adaptive control algorithms for mechanical ventilation have also been recently developed [6,7]. These algorithms require a reference model for identifying a clinically plausible breathing pattern. However, the respiratory lung models that have been presented in the medical and scientific literature have typically assumed homogenous lung function. For example, in analogy to a simple electrical circuit, the most common model has assumed that the lungs can be viewed as a single-compartment characterized by its compliance (the ratio of compartment volume to pressure) and the resistance to air flow into the compartment [8][9][10]. While a few investigators have considered two compartment models, reflecting the fact that there are two lungs (right and left), there has been little interest in more detailed models [11][12][13].
Early work on the optimality of respiratory control mechanisms using simple homogenous lung models dealt with the frequency of breathing. In particular, the authors in [14][15][16][17] predicted the frequency of breathing by using a minimum work-rate criterion. This work involves a static optimization problem and assumes that the airflow pattern is a fixed sinusoidal function. The authors in [17,18] developed optimality criteria for the prediction of the respiratory airflow pattern with fixed inspiratory and expiratory phases of a breathing cycle. These results were extended in [19] by considering a two-level hierarchical model for the control of breathing, in which the higher-level criterion determines values for the overall control variables of the optimal airflow pattern derived from the lower-level criteria, and the lower-level criteria determine the airflow pattern with the respiratory parameters chosen by minimizing the higherlevel criterion.
Although the problem for identifying optimal respiratory patterns has been addressed in the literature (see [14,[16][17][18][19] and the references therein), the models on which these respiratory control mechanisms have been identified are predicated on a single compartment lung model with constant respiratory parameters. However, the lungs, especially diseased lungs, are heterogeneous, both functionally and anatomically, and are comprised of many subunits, or compartments, that differ in their capacities for gas exchange. Realistic models should take this heterogeneity into account. In addition, the resistance to gas flow and the compliance of the lung units are not constant but rather vary with lung volume. This is particularly true for compliance. While more sophisticated models entail greater complexity, since the models are readily presented in the context of dynamical systems theory, sophisticated mathematical tools can be applied to their analysis. Compartmental lung models are described by a state vector, whose components are the volumes of the individual compartments.
A key question that arises in the consideration of nonlinear multicompartment models is whether or not experimental data support a complex model. This question can be addressed by considering an analogy to pharmacokinetics. Specifically, the earliest pharmacokinetic models were typically one-compartment models. This reflected the challenges of sampling and drug assay. These models were adequate for quantifying drug disposition on a long time scale. For example, simple one-compartment models were adequate in describing the total clearance or volume of distribution. However, for even open-loop control of drug concentrations, the one compartment model was inadequate. More complex models (two-and three-compartment models) were needed that accounted for distribution as well as elimination processes (see [20] and the references therein).
Similarly, for adaptive control of mechanical ventilation, that is, more advanced controller architectures than simple volume-or pressure-controlled ventilation, more elaborate models are needed, especially when accounting for nonlinear compliance and resistance and lung heterogeneity [6]. In the case of pharmacokinetics, the control algorithm can only be as complex as the data supports. This is also true for control of mechanical ventilation. Flow and pressure patterns in the airway are not simple waveforms, although clinicians to date have modeled them as such. There is considerable information embedded in these waveforms. The purpose of our work in this paper is to provide a mathematically rigorous and general framework developing optimal determination of respiratory airflow patterns using a nonlinear multicompartment model for a lung mechanics system. It is a an easy task to simplify this framework to be congruent with the granularity of the data. The reverse process, however, is not possible without the development of a general framework.
In this paper, we extend the work of [17,18] to develop optimal respiratory airflow patterns using a nonlinear multicompartment model for a lung mechanics system. (The usage of the word optimal throughout the paper refers to an optimal solution of the calculus of variations problems addressed in the paper and not an optimal breathing pattern in the sense of respiratory physiology.) First, we extend the linear multicompartment lung model given in [6] to address system model nonlinearities. Then, we extend the performance functionals developed in [17,18] for the inspiratory and expiratory breathing cycles to derive an optimal airflow pattern using classical calculus of variations techniques. In particular, the physiological interpretation of the optimality criteria involves the minimization of work of breathing and lung volume acceleration for the inspiratory breathing phase, and the minimization of the elastic potential energy and rapid airflow rate changes for the expiratory breathing phase. Finally, we numerically integrate the resulting nonlinear two-point boundary value problems to determine the optimal airflow patterns over the inspiratory and expiratory breathing cycles.
The notation used in this paper is fairly standard. Specifically, R n denotes the set of n × 1 real column vectors, and R n×m , denotes the set of n × m real matrices. For x ∈ R n we write x ≥≥ 0 (resp., x 0) to indicate that every component of x is nonnegative (resp., positive). In this case, we say that x is nonnegative or positive, respectively. Likewise, A ∈ R n×m is nonnegative or positive if every entry of A is nonnegative or positive. (In this paper, it is important to distinguish between a square nonnegative (resp., positive) matrix and a nonnegative-definite (resp., positive-definite) matrix.) Furthermore, R n + and R n + denote the nonnegative and positive orthants of R n , that is, if x ∈ R n , then x ∈ R n + and x ∈ R n + are equivalent, respectively, to x ≥≥ 0 and x 0. Finally, we write (·) T to denote transpose, (·) to denote Frèchet derivative, and δx to denote the first variation of the function x.

A Nonlinear Multicompartment Model for Respiratory Dynamics
In this section, we extend the linear multicompartment lung model of [6] to develop a nonlinear model for the dynamic behavior of a multicompartment respiratory system in response to an arbitrary applied inspiratory pressure.
Here, we assume that the bronchial tree has a dichotomy architecture [21]; that is, in every generation each airway unit branches into two airway units of the subsequent generation. In addition, we assume that the lung compliance is a nonlinear function of lung volume. First, for simplicity of exposition, we consider a singlecompartment lung model as shown in Figure 1  by an airway unit with resistance (to airflow) of R. At time t = 0, a driving pressure p in (t) is applied to the opening of the parent airway, where p in (t) is generated by the respiratory muscles or a mechanical ventilator. This pressure is applied over the time interval 0 ≤ t ≤ T in , which is the inspiratory part of the breathing cycle. At time t = T in , the applied airway pressure is released and expiration takes place passively, that is, the external pressure is only the atmospheric pressure The state equation for inspiration (inflation of lung) is given by where x(t) ∈ R, t ≥ 0, is the lung volume, R in ∈ R is the resistance to airflow during the inspiration period, c in : R → R + is a nonlinear function defining the lung compliance at inspiration, and x in 0 ∈ R + is the lung volume at the start of the inspiration and serves as the system initial condition. Equation (1) is simply a pressure balance equation where the driving pressure p in (t), 0 ≤ t ≤ T in , applied to the compartment is proportional to the volume of the compartment via the compliance and the rate of change of the compartmental volume via the resistance. We assume that expiration is passive due to the elastic stretch of the lung unit. During the expiration process, the state equation is given by where x(t) ∈ R, t ≥ 0, is the lung volume, R ex ∈ R is the resistance to air flow during the expiration period, c ex : R → R + is a nonlinear function defining the lung compliance at expiration, and x ex 0 ∈ R + is the lung volume at the start of expiration.
Next, we develop the state equations for inspiration and expiration for a 2 n -compartment model, where n ≥ 0. In this model, the lungs are represented as 2 n lung units which are connected to the pressure source by n generations of airway units, where each airway is divided into two airways of the subsequent generation leading to 2 n compartments (see Figure 2 for a four-compartment model). Let . . , 2 n , denote the compliance at inspiration (resp., expiration) of each compartment as a nonlinear function of the volume of ith compartment, and let R in j,i (resp., R ex j,i ), i = 1, 2, . . . , 2 j , j = 0, . . . , n, denote the resistance (to air flow) of the ith airway in the jth generation during the inspiration (resp., expiration) period with R in 01 (resp., R ex 01 ) denoting the inspiration (resp., expiration) of the parent (i.e., 0th generation) airway.
As in the single-compartment model, we assume that a pressure of p in (t), t ≥ 0, is generated (by the inspiratory muscles) or applied (by a mechanical ventilator) during inspiration. Now, the state equations for inspiration are given by where c in i (x i ), i = 1, 2, . . . , 2 n , are nonlinear functions of x i , i = 1, 2, . . . , 2 n , given by [22] where a in ij , j = 1, 2, 3, and b in ij , j = 1, 3, are model parameters with b in i1 > 0 and b in i3 < 0, x in ij , j = 1, 2, are volume ranges wherein the compliance is constant, V Ti denotes tidal volume, and where q denotes the floor function which gives the largest integer less than or equal to the positive number q.  Figure 3 shows a typical piecewise linear compliance function for inspiration. A similar compliance representation holds for expiration and is also shown in Figure 3.

Computational and Mathematical Methods in Medicine
To further elucidate the inspiration state equation for a 2 n -compartment model, consider the four-compartment model shown in Figure 2 corresponding to a two-generation lung model. Let x i , i = 1, 2, 3, 4, denote the compartmental volumes. Now, the pressure (1/c in i (x i (t)))x i (t) due to the compliance in ith compartment will be equal to the difference between the driving pressure and the resistance to air flow at every airway in the path leading from the pressure source to the ith compartment. In particular, for i = 3 (see Figure 2), or, equivalently, Next, we consider the state equation for the expiration process. As in the single-compartment model, we assume that the expiration process is passive and the external pressure applied is p ex (t), t ≥ 0. Following an identical procedure as in the inspiration case, we obtain the state equation for expiration as where , are volume ranges wherein the compliance is constant, and k j is given by (5).
Next, we provide a smooth (i.e., C ∞ ) characterization of the nonlinear compliance using sigmoidal functions [23]. Specifically, for inspiration, c in i (x i ) can be approximated as where a) ), and β > 0 is an approximation parameter. Figure 4 shows the smoothed approximation of the piecewise linear compliance function c in i (x i ). A similar approximation holds for c ex i (x i ) and is also shown in Figure 4.
Finally, we rewrite the state equations (3) and (8) for inspiration and expiration, respectively, in vector-matrix state space form. Specifically, define the state vector x [x 1 , x 2 , . . . , x 2 n ] T , where x i denotes the lung volume of the ith compartment. Now, the state equations (3) for inspiration can be rewritten as where e [1, . . . , 1] T denotes the one vector of order 2 n , C in (x) is a diagonal matrix function given by where Z j,k ∈ R 2 n is such that the lth element of Z j,k is 1 for all l = (k − 1)2 n− j + 1, (k − 1)2 n− j + 2, . . . , k2 n− j , k = 1, . . . , 2 j , j = 0, 1, . . . , n, and zero elsewhere.
Computational and Mathematical Methods in Medicine Similarly, the state equation (8) for expiration can be rewritten as where Finally, it follows from [6, Proposition 4.1] that R in and R ex are positive definite and, hence, R in and R ex are invertible matrices.

Optimal Determination of Inspiratory and Expiratory Airflow in Breathing
In this section, we use the respiratory dynamical system characterized by (11) and (14) to develop an optimal model for predicting airflow patterns in breathing. The optimization criteria used allows for the minimization of oxygen expenditure of the respiratory muscles as well as rapid changes in the lung volume flow rate. The oxygen consumption of the lung muscles is mainly due to the work carried out by the respiratory muscles to overcome the resistive forces and stretch the lung and chest wall. In [24], this work is defined as PV, where P is the pressure driving inflation and V is the lung unit volume. The efficiency of gas exchange in the lungs is related to the volume acceleration, since rapid changes in lung volume can cause discomfort and inefficacy of muscular contraction and control. Moreover, high-volume acceleration can result in overexpansion of the lung resulting in lung tissue rupture as well as excessive work of breathing with subsequent ventilatory muscle fatigue.
In the ensuing discussion, we assume that the inspiration process starts from a given initial state x in 0 and is followed by the expiration process where its initial state will be the final state of the inspiration. An inspiration followed by an expiration is called a single breathing cycle. Furthermore, we assume that each breathing cycle is followed by another breathing cycle where the initial condition for the latter breathing cycle is the final state of the former breathing cycle.
Since the respiratory process is periodic, we need only focus on one breathing cycle. The next result gives the optimal solution x * (t), 0 ≤ t ≤ T in , for the inspiratory airflow breathing pattern using classical calculus of variations techniques. Theorem 1. Consider the nonlinear system model for inspiration given by (11). Let the optimal air volume x * (t), 0 ≤ t ≤ T in , be given by the solution to the minimization problem subject to the natural boundary conditions where V 0 ∈ R 2 n is the end expiratory volume and V T ∈ R 2 n is the tidal volume. If α 1 > 0, then x * (t), 0 ≤ t ≤ T in , is given by and if α 1 = 0, then where d 1 , d 2 , d 3 , and d 4 ∈ R 2 n are constant vectors determined by the boundary conditions (18) and (19), and R 1/2 in denotes the (unique) positive-definite square root of R in .
Proof. First, note that p in (t)e, 0 ≤ t ≤ T in , in (17) can be eliminated using the state equation (11). Thus, the integrand of the performance criterion (17) can be written as 6 Computational and Mathematical Methods in Medicine The first variation of the performance criterion J in (x) is given by Using the boundary conditions (18) and (19), it follows that δx(0) = δx(T in ) = δẋ(0) = δẋ(T in ) = 0. Now, since T in is fixed, it follows from the fundamental theorem of the calculus of variations that the variation of J in (x) must vanish on x * ; that is, the extremals optimizing the performance criterion J in (x) satisfy the Euler-Lagrange equation Next, using C in (x) given by (12), where (24) yields the fourth-order differential equation where x (n) (t) (d n x(t)/dt n ), with boundary conditions given in (18) and (19). Now, using standard analysis techniques, the solution x(t), 0 ≤ t ≤ T in , to (26) satisfies (20) if α 1 > 0 and (21) if α 1 = 0.
Remark 2. The vectors d 1 , d 2 , d 3 , and d 4 in Theorem 1 can be uniquely determined using the four boundary conditions given by (18) and (19). Specifically, if α 1 = 0, it can be shown that d 1 (26) is increasing during inspiration, and hence, V 0i ≤ x * i (t) ≤ V 0i + V Ti , i = 1, . . . , 2 n , where V 0i , x i (t) and V Ti are the ith components of V 0 , x(t), and V T , respectively. A similar result holds for the case where α 1 > 0.
Next, we give the optimal solution x * (t), T in ≤ t ≤ T in + T ex , for the expiratory airflow breathing pattern. Theorem 3. Consider the nonlinear system model for expiration given by (14). Let the optimal solution x * (t), T in ≤ t ≤ T in + T ex , be given by the solution to the minimization problem subject to the natural boundary conditions where where d 1 , d 2 , d 3 , and d 4 ∈ R 2 n are constant vectors determined by the four boundary conditions (28) and (29).
Proof. Using (14), the integrand of the performance criterion (27) can be written as Computational and Mathematical Methods in Medicine 7 Thus, the variation of J ex (x) on an extremal solution gives Using the boundary conditions (28) and (29), it follows that Hence, the extremals optimizing the performance criterion J ex (x) satisfy the Euler-Lagrange equation Now, using C ex (x) given by (15), which yields (30). Finally, in the case where α 2 = 0, (30) collapses to x (4) (t) = 0, T in ≤ t ≤ T in + T ex , which satisfies (31).

Remark 4.
In the case where α 2 = 0, the vectors d 1 , d 2 , d 3 , and d 4 in Theorem 3 can be uniquely determined using the four boundary conditions (28) and (29). In particular, Hence, where α 2 > 0 involves the solution to (30), and hence, we have been unable to show that x * (t), T in ≤ t ≤ T in + T ex , is decreasing during expiration analytically. However, this has been verified numerically.

Remark 5.
If optimal solutions to Theorems 1 and 3 exist, then the optimal respiratory airflow patterns and their corresponding driving pressures can be computed using the lung mechanics model developed in Section 2. The input signal to this model can then be used as the driving pressure of a mechanical ventilator needed to achieve the optimal respiratory airflow pattern. The physiological interpretations of the performance criteria for inspiration and expiration used in Theorems 1 and 3 are slightly different. In particular, the inspiratory criterion J in (x) involves a weighted sum of squares of the lung volume acceleration and the mechanical work performed by the inspiratory muscles. Alternatively, during the expiratory phase, the respiratory muscles remain active in the beginning of expiration since they continue their action by opposing expiration and hence consume oxygen thereby performing negative work. Thus, mechanical work alone is not a satisfactory criterion for describing control of breathing at rest. As in [25], we assume that oxygen consumption of expiration correlates with the integral square of the driving pressure. This assumption is supported in [26] which shows that an index of average respiratory pressure can predict the total oxygen cost of breathing. Hence, instead of mechanical work, we use the integral square of the applied pressure in the expiratory criterion J ex (x), which corresponds to minimizing the mean standard potential energy in the lung.
It can be seen that the optimal solutions x * (t), t ≥ 0, depend on the variables T in , T ex , V 0 , and V T through the boundary conditions. Moreover, the nonlinearities in (30) are due to nonlinearities in the lung compliance C ex (x), which make analytical solutions to (30) difficult to obtain. It is interesting to note that although the optimal solutions x * (t), T in ≤ t ≤ T in + T ex , to (30) during the expiration phase depend on the nonlinear compliance of C ex (x), the optimal solutions x * (t), 0 ≤ t ≤ T in , to (26) during the inspiration phase are independent of the nonlinear system compliance C in (x). In the case where n = 0 (i.e., a singlelung-compartment model), x(t) ∈ R, R ex ∈ R, and C ex (x) = C ex are constants, (30) reduces to This case is extensively discussed in [25] wherein the authors characterize four different solutions to (36) corresponding to α 2 = 0, 0 < α 2 < 4C 2 ex /R 4 ex , α 2 = 4C 2 ex /R 4 ex , and α 2 > 4C 2 ex /R 4 ex .

Numerical Determination of Optimal Volume Trajectories
The optimal volume trajectories formulated in Section 3 result in two-point nonlinear boundary-value problems. Numerical methods for solving such problems include shooting methods [27] and steepest descent methods [28].
In this section, we use the collocation method implemented 8 Computational and Mathematical Methods in Medicine by bvp4c in MATLAB [29] to numerically integrate the differential equations (26) and (30) to obtain the optimal volume trajectory x * (t), t ≥ 0. For our simulations, we first consider a two-compartment lung model and use the values for the lung compliance found in [22]. In particular, we set a in 23 , x ex i2 = 0.43 , and i = 1, 2. Here, we assume that the bronchial tree has a dichotomy structure (see Section 2). The airway resistance varies with the branch generation, and typical values can be found in [30]. Furthermore, the expiratory resistance will be higher than the inspiratory resistance by a factor 2 to 3. Here, we assume that the factor is 2.5.
For our simulation, we assume that the inspiration time T in = 2 sec and the expiration time T ex = 3 sec. The two weighting parameters α 1 and α 2 differ from person to person. Nominal values for the weighting parameters are α 1 = 2.0l/sec 3 cm H 2 O and α 2 = 0.1 l 2 /sec 4 cm H 2 O, which correspond to spontaneous breathing at rest [25]. Figure  5 shows the optimal air volume e T x * (t), t ≥ 0, and the optimal airflow rate e Tẋ * (t), t ≥ 0, given by the two-point nonlinear boundary-value problems (24) and (34). Note that the airflow curve for inspiration is symmetric, since the nonlinearities in C in (x) do not appear in (26). However, x * (t), t ≥ 0, obtained using (30) during expiration involves C ex (x), and hence, the airflow curve is asymmetric. Figure 6 shows the sensitivity of the optimal volume and airflow rate patterns to changes in the parameters α 1 and α 2 . As can be seen from the figure, the inspiratory airflow rate is symmetric and the maximum value of the airflow rate decreases as a function of increasing α 1 . Furthermore, the asymmetric pattern of the expiratory airflow rate reflects the fact that the minimum value becomes steeper with increasing α 2 . Specifically, if we set the weighting parameter α 2 = 0, it follows from (30) that the airflow curve for the expiration is given by a parabolic arc. The airflow patterns in Figure 6 exhibit typical respiratory characteristics observed in spontaneous breathing, that is, the inspiratory airflow rate curve is relatively flat and the expiratory airflow rate waveform is asymmetric with an initial trough, and quite similar to "real" airflow signals [31]. Figure 7 shows the driving pressure generated by the respiratory muscles using the optimal air volume e T x * (t), t ≥ 0. Figure 8 compares the optimal air volume trajectory e T x * (t), t ≥ 0, with a nonoptimal air volume trajectory e T x(t), t ≥ 0, generated by the linear pressure p in (t) = 20t + 5 cm H 2 O, t ∈ [0, T in ], and p ex (t) = 0 cm H 2 O, t ∈ [T in , T in + T ex ], [6]. Note that e T x * (t), t ≥ 0, switches between the end expiratory level e T V 0 = 0.2 l and the tidal volume e T V T = 1.2 l. Figure 9 shows the phase portrait of the optimal trajectories x * 1 (t) and x * 2 (t) and suboptimal trajectories x 1 (t) and x 2 (t). Note that both sets of trajectories asymptotically converge to a limit cycle, with the optimal solutions satisfying the boundary conditions given in (18), (19), (28), and (29). Figure 10  performance criterion generated by the optimal air volume with the value of the total performance criterion generated by the nonoptimal air volume. Finally, Figure 11 shows the optimal air volume trajectories for a four-compartment model with each air volume trajectory satisfying the boundary conditions given in (18), (19), (28), and (29). For this simulation, the compliance parameters are taken to be identical to those used for the two-compartment model with i = 1, 2, 3, 4, and the values for airway resistances are generated using the results of [30].

Conclusion and Directions for Future Work
In this paper, we developed an optimal respiratory air flow pattern using a nonlinear multicompartment model for a lung mechanics system. The determination of the optimal air volume trajectories is derived using classical calculus of variations techniques and involves optimization criteria that account for oxygen expenditure of the respiratory lung muscles, lung volume acceleration, and elastic potential energy of the lung. Future work will include the development of multivariable and adaptive control algorithms that will utilize these models within a model reference control architecture for fully automating mechanical ventilation to ensure adequate ventilation and oxygenation for critical care patients in intensive care units. Since sedation in intensive care units is often administered to prevent the patient from fighting the ventilator, it seems plausible to use respiratory parameters as a performance variable for closed-loop control. Calculation of patient work of breathing requires measurement of a patientgenerated pressure/volume loop or work of breathing. Since  work of breathing can be measured using a commercially available esophageal balloon [32], work of breathing can serve as a performance variable for closed-loop control of sedation. Furthermore, patient-ventilator dyssynchrony can be identified by analysis of pressure/flow wave forms [33]. Closed-loop control algorithms can use either work of breathing as measured by an esophageal balloon or patient respiratory rate as a performance variable for closed-loop control of sedation. The need for optimal control algorithms is necessary for achieving a target performance value while satisfying certain constraints. For example, we could seek to design a control algorithm that seeks to minimize the patient respiratory rate (above the set ventilator rate) but which does not result in hypotension. This requires the development of a constrained optimal control framework that seeks to minimize a given performance measure (e.g., patient respiratory rate) within a class of fixed-architecture controllers satisfying internal controller constraints (e.g., controller order, control signal nonnegativity, etc.) as well as system constraints (e.g., blood pressure, system state nonnegativity, etc.). The results in the present paper can serve as a starting point for developing multivariable controllers for mechanical ventilation of critically ill patients.