{'fraction_non_alphanumeric': 0.03669724770642202, 'fraction_numerical': 0.01122147243915384, 'mean_word_length': 4.610378562313909, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Efficient reinforcement learning for fluid flow control

Despite the low dimensionalities of dissipative viscous fluids, reinforcement learning (RL) requires many observables in fluid control problems. This is because the observables are assumed to follow a policy-independent Markov decision process in the RL framework. By including policy parameters as arguments of a value function, we construct a consistent algorithm with partial observables. Using typical examples of fluid control around a cylinder, we show that our algorithm is more stable and efficient than the existing RL algorithms, even under a small number of observations.


INTRODUCTION
Nowadays, data-driven modelings based on machine learning are more practical than traditional ones based on theories in various applications including fluid engineering. Machine learning is used to model, control, and optimize flows from the vast amount of data obtained from experiments and simulations. For a detailed review of machine-learning applications in fluid mechanics, refer to Brunton et al. (2020) [1].
Reinforcement learning [2] is one of machine learning techniques. Its algorithm finds the optimal control method that maximizes the total rewards in a given system. The learning algorithms adopt trial and error approach to determine the optimum control from the timeseries of states, actions, and rewards. Recently, deep reinforcement learning [3], the combination with deep learning, has achieved unprecedented performance in artificial intelligence. The first successful examples of applications include Go, Shogi, and other video games. These systems significantly outperform the best human players. [4] Deep reinforcement learning has also been applied to autonomous driving. [5] Previous studies have investigated the applicability of reinforcement learning in the active control of fluids. Value-based reinforcement learning with Q-learning or SARSA has been applied in school movement optimiztion [6][7][8], reduction of drag around cylinders [9], and optimal glider control [10,11]. In recent years, deep reinforcement learning based on the actor-critic algorithm has been applied to flow control problems. Koizumi et al. (2018) used the deterministic actor-critic method to reduce drag around a cylinder optimally through blowing and suction control. [12] Verma et al. (2018) combined deep long short-term memory with reinforcement learning to investigate the mechanism of fish school formation. [13] Moreover, a series of research applies the deep reinforcement learning package Tensorforce to optimal control through blowing and suction. [14][15][16][17] Although fluid systems have infinite degrees of freedom, the number of observations is limited in actual control. In a dissipative system, such as a viscous fluid, the system's final state (attractor) requires only a finite num-ber of observables to determine the state. [18] Since these finite observables can describe the time evolution, their time-series has Markov property. Generally, reinforcement learning algorithms assume the time evolution as a Markov process that does not depend on the way of control (policy). However, this assumption fails when learning is performed with a small number of observable and many policy parameters such as in deep neural networks. In this paper, we describe a framework for consistent reinforcement learning that optimally controls fluid with a small number of observable, and adapt it to the typical problems of optimizing blowing/suction and propulsion direction around a cylinder.

ALGORITHM Deterministic Actor-Critic Algorithm
In this section, the outline of the existing reinforcement learning algorithm is given only for the on-policy deterministic actor-critic method [19] to simplify the analysis. To the best of our knowledge, all previous studies using deep reinforcement learning for fluid control are based on the actor-critic method. Here, we assume that our system evolves deterministically, and control is determined as a function of the state. These assumptions may be sufficient for fluid control. If exploration is to be considered, the algorithm can be changed to an off-policy type, according to the approach described by Silver et al. (2014) [19].
We consider a discrete dynamical system given by the Map F : (1) Here, s t is the state of the system at time t, and a t is the control to the system (action). In the deterministic policy framework the action is a function of a state, a t = µ(s t ), which represents the policy. Generally, a policy is approximated by a parametric function such as µ(s) ≃μ(s; θ). Here, the parameters θ are called design variables of the objective function defined below. Hereafter,· represents a parametric function. Let the reward be r t = R(s t , a t ). Then, we define the value function V and the objective function J as follows: Here, γ is a discount rate and satisfying 0 ≤ γ < 1, and ρ represents the probability density in the state space. Optimum control determines the optimum design parameters θ * that maximize the objective function as When the time-series of the state is a stationary process such as an attractor in a dissipative system, θ * is independent of γ. This is because γ changes J only by a constant multiple. In the actor-critic method, the objective function J is optimized via the action-value function Q as As for the policy, the action-value function is approximated by the parametric function of ω such that Q(s, a; θ) ≃Q(s, a; θ, ω). At the end of every episode, the critic updatesQ, following the SARSA method, as Here, the subscript n represents the episode number, and T n = {t n1 , t n2 , · · · , t nN } represents the set of N samples at episode n. On the other hand, the actor follows the deterministic policy gradient theorem [19] given by and updates the design variables by the stochastic gradient as Here, α is the learning rate. The actor-critic method determines the optimal policy by repeatedly updating the action value functionQ and the policyμ according to equations (8) and (10) respectively.

Algorithm for Fluid Systems
In a dissipative system, such as a fluid, the solution trajectory of the final state of the system is often in a much lower dimensional space (attractor) than that of the system. [18] Assuming that the dimension of the attractor is D e , the state can be specified in most cases with 2[D e ] + 1 observables. ([·] represents the Gauss sign.) [18] For example, we can determine the state of a microorganism that swims in water with periodic motion using only three variables. Let o be observables sufficient to determine the state of the attractor. The transition among the partially observables o is given by the map o n+1 = F (o t ,μ(o t ); θ) , and it depends on theta. The transition map is defined by the equation (1) only when all the variables s are observed. The equation (1) is not directly dependent on θ. Contrarily, the policy (θ) independence of the evolution of a system is a necessary condition of the policy gradient theorem. [19,20] Thus, even if the attractor is low-dimensional, many observations are required to update a policy appropriately when using typical reinforcement learning algorithms for fluid control problems. In the following discussion, we construct the consistent algorithm with partial observables.
The value function can be determined with the minimum number of arguments by specifying o and θ. Therefore, there existsV such that We approximateV as a parametric function for v and w as,V Here, φ is a nonlinear function of o and θ, which are constructed from the time-series data. We assume that the policy is a linear function of the observable o: Arbitrary control becomes possible by increasing the number of observables. Otherwise, the use of nonlinear basis functions enables complex control. In our proposed algorithm, the critic and the actor work as follows. The critic updatesṼ every N e steps of a numerical simulation. The unit of this updating is called episode. The weight w n ofṼ at the end of n episodes is calculated as follows: w n = arg min w t∈Tn Here, δ t represents the N s step TD error. T n = {(n − M )N e , (n − M )N e + 1, · · · , nN e − 1} is the set of steps in the last M episodes. The basis functions φ are constructed from the time series {(o t , θ t )|t ∈ T n }. We use RBF sampler [21] of the package scikit-learn [22] for the basis functions. Then, the actor calculates the stochastic gradient g n at the nth episode by the linear regression algorithm: In both minimization problems, given by equations (15) and (16), the singular value decomposition is used to avoid singularities of linear equations. Using the gradient, g n , the policy is updated at each time step in episode n as follows: Here, α is the learning rate. In the limit α → 0, the orbit o t changes in a quasi-static manner, andṼ is defined on the attractor.

Drag reduction through Blowing and Suction
We apply the proposed algorithm to the active flow control problem [14] to validate its effectiveness. The goal of this problem is to minimize the magnitude of the drag acting on a cylinder by controlling the mass flow rate of two synthetic jets symmetrically located on the top and bottom of a cylinder immersed in a two-dimensional incompressible fluid. The flow configuration and optimization problem have been adopted from   [14]. We use their open source code and replace only the reinforcement learning part of that code. The parameters of reinforcement learning are as follows: N s = 200, N e = 4000, M = 20 , and α = 10 −2 − n/500. Figure. 1 shows the learning history, where N o denotes the number of observables (pressure probes in this problem). From this figure, it can be seen that the drag coefficient C D decreases more stably when learning using the proposed algorithm compared to that in the previous studies. This is mainly because the optimization process in the proposed algorithm is deterministic, and the trajectory remains close to an attractor for each policy parameter θ. The time variation of C D obtained according to the optimal policy for each case is shown in Fig.2. In statistical stationary state, after a sufficiently long term from the initial condition, our linear policy with N o = 11 has achieved mean drag reduction of 0.2%, compared to a previous study [14] adopting a large-scale neural network policy function with N o = 151.

Optimization of propulsion direction
For the second demonstration, we consider a cylinder driven by a constant-magnitude external force F in a 2D incompressible flow field (Fig. 3). The Reynolds number Re based on the external force is set to 100, and thus, a vortex street is observed in the wake of the cylinder, leading to suppression of the cylinder movement. The cylinder is a rigid body whose mass density is two times larger than that of the fluid, and its rotational motion is ignored for simplicity. The goal here is to maximize the time-averaged velocity V x of the cylinder by controlling the direction β of the external force. The observables are the y-component of velocity V y of the cylinder, lift L and time delayed values of these two quantities: o t = (V y,t , L t , V y,t−Ns , L t−Ns , V y,t−2Ns , L t−2Ns , · · · ) T . The reward is defined as r t = V x,t . The parameters of reinforcement learning are N s = 200, N e = 4000, M = 20, and α = 10 −4 − n/500. The immersed boundary method [23] is used for object representation. The time step dt is set at 0.01. Figure 4 shows the learning history in the cases of N o = 2, 4 and 8. As the number of observables increases, the objective function increases rapidly. The performance with N o = 8 is improved by approximately 1%, compared to the case when external forces are applied from a constant angle. In this control problem, the flow becomes unstable when the cylinder velocity is relatively high. Thus, the learning rate α needs to be small for successful and stable learning.

CONCLUTION
Existing reinforcement learning algorithms for fluid control are inefficient under a small number of observables even if the flow is laminar. By incorporating the low-dimensional nature of the dissipative system into the learning algorithm, we resolved this problem and presented a framework for reinforcement learning that stably optimizes the policy for a small number of observables. As demonstrated in previous studies, the orbit of flow hardly reaches the attractor during the learning process in the probabilistic policy framework. This leads to inefficient optimization of the attractor. Moreover, the deterministic policy described in this paper enables stable optimization on an attractor, and it is not necessary to learn the processes repeatedly.
Although the proposed algorithm is simple, the value function can be approximated using a neural network as in deep reinforcement learning, instead of the generalized linear model of form (11). A more complicated regression model may be applied instead of the linear regression model of (15). In addition, although on-policy-type learning was used in this study, the proposed algorithm can be easily modified to the off-policy type to emphasize exploration.