SCIENTIA 2019-03-03T07:25:46.082Z https://rm-rf.moe/ HSM Hexo Notes-Global uniform asymptotic stabiliztion of an underactuated surface vessel https://rm-rf.moe/2019/02/28/Time-varying-Approach/ 2019-02-28T08:03:58.000Z 2019-03-03T07:25:46.082Z
• This is a Time-varying Continuous Approach.
• The dynamics of an underactuated ship is

The coordinate transformations

are first used to transform the ship system to

where $c = m_{11}/m_{22}$ and $d = d_{22}/m_{22}$. Then the following nontrivial coordinate transformations

are applied to the transformed ship system to obtain the new system:

Let $k_2, k_3, k_\mu$ and $k_r$ be strictly positive constants such that $1 \geq k_2 \geq k_3$. The control $\Omega_1$ and $\Omega_{2\mu}$ are designed in the paper as

where

It is proven that the closed loop system is GAS at the origin in the paper.

Remark: The stabilizer design mentioned above is nontrivial, it is difficult to extend the control design scheme to solve a trajectory-tracking problem, and the convergence of the stabilizing errors to zero is slow. In addition, the physical meaning of feedback is not clear.

]]>
<ul> <li>This is a <em>Time-varying Continuous</em> Approach. </li> </ul> <p>The dynamics of an underactuated ship is</p> <script type="math/tex; mode=display">\begin{aligned} &\dot \eta = J(\eta) v \\ &M\dot v = -C(v)v - Dv + \tau \\ &\eta = [x, y, \psi]^T,\ v = [u, v, r]^T, \ \tau = [\tau_u, 0, \tau_r]^T \end{aligned}</script>
Notes-Stability Theory https://rm-rf.moe/2019/02/20/Lyapunov-Theory/ 2019-02-20T12:34:48.000Z 2019-02-21T08:03:04.196Z Nonlinear Systems

A nonlinear dynamic system can usually be represented by a set of nonlinear differential equations in the form

It is directly applicable to feedback control systems. The reason is that the equation can represent the close-loop dynamics of a feedback control system, with the control input being a function of state $x$ and time $t$, and therefore disappearing in the closed-loop dynamics.

If the plant dynamics is

and some control law has been selected

then the closed-loop dynamics is

A special class of nonlinear systems are linear systems. The dynamics of linear systems are of the form

where $A(t)$ is an $n\times n$ matrix.

## Autonomous and Non-autonomous

Definition: The nonlinear system is said to be automomous if $f$ does depend explicitly on time, i.e., if the system’s state equation can be written

Otherwise, the system is called non-autonomous.

## Equilibrium Points

Definition: A state $x^*$ is an equilibrium state(or equilibrium point) of the system if once $x(t)$ is equal to $x^*$, it remains equal to $x^*$ for all future time.

## Stability and Instability

Definition: The equilibrium state $x=0$ is said to be stable if, for any $R > 0$, there exists $r > 0$, such that if $\|x(0)\|< r$, then $\|x(t)< R\|$ for all $t \geq 0$. Otherwise, the equilibrium point is unstable.

## Asymptotic Stability and Exponential Stability

Definition: An equilibrium point $0$ is asymptotically stable if it is stable, and if in addtion there exists some $r > 0$ such that $\|x(0)\| < r$ implies that $x(t) \to 0$ as $t \to \infty$.

Definition: An equilibrium point $0$ is exponentially stable if there exist two strictly positive numbers $\alpha$ and $\lambda$ such that

in some ball $B_r$ around the origin.

In words, the equation means that the state vector of an exponentially stable system converge to the origin faster than an exponential function. The positive number $\lambda$ is often called the rate of exponential convergence.

## Local and Global Stability

Definition: If asymptotic(or exponential) stability holds for any initial states, the equilibrium point is said to be asymptotically(or exponentially) stable in the large. It is also called globally asymptoticly(or exponentially) stable.

## Positive Definite Functions and Lyapunov Functions

Definition: A scalar continuous function $V(x)$ is said to be locally positive definite if $V(0) = 0$ and, in a ball $B_{R_0}$

If $V(0) = 0$ and the above property holds over the whole state space, then $V(x)$ is said to be globally positive definite.

Definition: If, in a ball $B_{R_0}$, the function $V(x)$ is positive definite and has continuous partial derivatives, and if its time derivative along any state trajectory of system $\dot x = f(x)$ is negative semi-definite, i.e.,

then $V(x)$ is said to be a Lyapunov function for the system $\dot x = f(x)$.

## Lyapunov Theorem for Local Stability

Theorem:(Local Stability) If, in a ball $B_{R_0}$, there exists a scalar function $V(x)$ with continuous first partial derivatives such that

• $V(x)$ is positive definite(locally in $B_{R_0}$)
• $\dot V(x)$ is negative semi-definite(locally in $B_{R_0}$)

then the equilibrium point $0$ is stable. If, actually, the derivative $\dot V(x)$ is locally negative definite in $B_{R_0}$, then the stability is asymptotic.

## Lyapunov Theorem for Global Stability

Theorem:(Global Stability) Assume that there exists a scalar function $V$ of the state $x$, with continuous first order derivatives such that

• $V(x)$ is positive definite
• $\dot V(x)$ is negative definite
• $V(x) \to \infty\$ as $\|x\| \to \infty$.

Then the equilibrium at the origin is globally asympotically stable.

## Invariant Set Theorems

Definite: A set $G$ is an invariant set for a dynamic system if every system trajectory which starts from a point in $G$ remains in $G$ for all future time.

Theorem:(Local Invariant Set Theorem) Consider an autonomous system of the form $\dot x = f(x)$, with $f$ continuous, and let $V(x)$ be a scalar function with continous first partial derivatives. Assume that

• for some $l>0$, the region $\Omega_l$ defined by $V(x) < l$ is bounded.
• $\dot V \leq 0$ for all $x$ in $\Omega_l$.

Let $R$ be the set of all points within $\Omega_l$ where $\dot V(x) = 0$, and $M$ be the largest invariant set in $R$. Then, every solution $x(t)$ originating in $\Omega_l$ tends to $M$ as $t \to \infty$.

Theorem:(Global Invarient Set Theorem) Consider an autonomous system of the form $\dot x = f(x)$, with $f$ continuous, and let $V(x)$ be a scalar function with continous first partial derivatives. Assume that

• $V(x) \to \infty$ as $\|x\| \to \infty$.
• $\dot V(x) \leq 0$ over the whole state space.

Let $R$ be the set of all points where $\dot V(x) = 0$, and $M$ be the largest invariant set in $R$. Then, all solution globally asymptotically converge to $M$ as $t \to \infty$.

## Krasovskii’s Method

Theorem:(Krasovskii) Consider the autonomous system defined by $\dot x = f(x)$, with the equilibrium point of interest being the origin. Let $A(x)$ denote the Jacobian matrix of the system, i.e.,

If the matrix $F = A + A^T$ is negative definite in a neighborhood $\Omega$, then the equilibrium point at the origin is asymptotically stable. A Lyapunov function for this system is

If $\Omega$ is the entire space and, in addition, $V(x) \to \infty$ as $\|x\| \to \infty$, then the equilibrium point is globally asymptotically stable.

## Barbalet’s Lemma

Lemma:(Barbalat) If the differential function $f(t)$ has a finite limit as $t \to \infty$, and if $\dot f$ is uniformly continuous, then $\dot f(t) \to 0$ as $t \to \infty$.

Lemma:(“Lyapunov-Like Lemma”) If a scalar function $V(x, t)$ satisfies the following conditions

• $V(x,t)$ is lower bounded
• $\dot V(x,t)$ is negative semi-definite
• $\dot V(x,t)$ is uniformly continuous in time

then $\dot V(x,t)\to 0$ as $t \to \infty$.

]]>
<h2 id="Nonlinear-Systems"><a href="#Nonlinear-Systems" class="headerlink" title="Nonlinear Systems"></a>Nonlinear Systems</h2><p>A nonlinear dynamic system can usually be represented by a set of nonlinear differential equations in the form</p> <script type="math/tex; mode=display">\dot x = f(x, t)</script><p>It is directly applicable to feedback control systems. The reason is that the equation can represent the close-loop dynamics of a feedback control system, with the control input being a function of state <script type="math/tex">x</script> and time <script type="math/tex">t</script>, and therefore disappearing in the closed-loop dynamics.<br></p>
Notes-Exponential Stabilization of an Underactuated Autonomous Surface Vessel https://rm-rf.moe/2019/02/17/reyhanoglu-1997/ 2019-02-17T07:57:26.000Z 2019-03-03T07:25:30.840Z
• Time-invariant discontinous feedback laws are constructed to asymptotically stabilize the system to the desired configuration with exponential convergence rates.
• ## Mathematical model

The kinematic model which describes the geometrical relationship between the earth-fixed(I-frame) and vehicle-fixed(B-frame) motion is given as

The dynamic equations of motion of the vehicle can be expressed in thr B-frame as

The following simplified model can be obtained by assuming that both inertia matrix $M$ and the damping matrix $D$ are constant and diagonal:

Remark: Rewrite $m_{22} \dot{v}_y + m_{11} v_x \omega_z + d_{22}v_y = 0$

## Global Coordinate Transformation

Define the state variables

so that the state equations are given by

where $\alpha = d_{22}/m_{22},\beta = m_{11}/m_{22}$ and

## Discontinuous feedback control laws

Consider the subsystem and letting $(x_5, x_6)$ be the control variables $(v_1, v_2)$:

## Stabiliztion of the reduced system

Consider the reduced system, restricting considering to $x_1 \not = 0$, apply the $\sigma-$process

to obtain

The feedback control law

where $z = (z_1, z_2, z_3)^T$, and $k > 0$ and $l = (l_1, l_2, l_3)$ are the gains, yields the reduced closed-loop system

The $z-$dynamics can be rewritten as

where

Remark: $\dot y = -ky \Rightarrow y = y_0 e^{-kt}$

If $k \not = \alpha$, the spectrum of the matrix $A_1$ can be assigned arbitrarily through the gain matrix $l$.

The matrix $A_2(t)$ goes to zero as $t \to \infty$ and

The $z-$dynamics can also be rendered globally exponentially stable at the origin $z=0$ by selecting $l$ such that the matrix $A_1$ is a Hurwitz matrix.
(Applied Nonlinear Control, Slotine and Li, Section 4.2.2)

Perturbed linear systems
Consider a linear time-varying system of the form

where the matrix $A_1$ is the constant and Hurwitz(i.e., has all eigenvalues strictly in the left-half plane), and the time-varying matrix $A_2(t)$ is such that $A_2(t) \to 0$ as $t \to \infty$
and

Then the system is globally expoentially stable.

## Stabilization of the complete system

Restrict consideration $x_1 \not = 0$ and consider the following controller:

where

while avoiding the set

Consider the coordinate transformation

It can be shown that in the above coordinates the closed-loop system can be written as

Remark: $\dot w_1 = -K w_1$

where

Remark: $\dot x_2 = x_6 + x_3 x_5$

where

The $(y, \omega_1, \omega_2)-$dynamics is globally exponentially stable at $(y, w_1, w_2)= (0,0,0)$. Moreover, it can be easily shown that if $y_0\omega_{10}\geq 0$, then $A_2(t)$ and $h(t)$ go to zero as $t \to \infty$ and

Thus, for any initial condition$(y_0, z_0, \omega_{10}, \omega_{20})$ satisfying $y_0 \not= 0$ and $y_0 \omega_{10} \geq 0$, both the trajectory $(y(t),z(t),\omega_1(t),\omega_2(t))$ and the control $(u_1(t), u_2(t))$ are bounded for all $t \geq 0$ and converge exponentially to zero.

]]>
<ul> <li>Time-invariant discontinous feedback laws are constructed to asymptotically stabilize the system to the desired configuration with exponential convergence rates.</li></ul>
• Uncertainties

Structured(or parametric) uncertainties
Corresponds to inaccuracies on terms actually included in the model
Unstructured uncertainties(or unmodeled dynamics)
Corresponds to inaccuracies on(i.e., underestimation of) the system order

Consider a nonlinear system

where the parameter $\theta$ is unknown, we assume that $\theta$ is constant.

Objective: $x_1 \to 0$ as $t \to \infty$

For this system the adaptive controller design is in two steps.

## Step 1

We introduce $z_1 = x_1$ and $z_2 = x_2 - \alpha_1$ and consider $\alpha$ as a control to stabilize the $z_1$-system with respect to the Lyapunov function

The $z_1$-system and the corresponding $\dot{V}_1$ are:

let $\tau_1 = z_1 z_1^2$, and if $z_2 = 0$

Objective: $\dot{V}_1 = -z_1^2$

Substitute $\tau_1(z_1)$ and $\alpha_1(z_1, \widehat{\theta})$

we obtain:

where $z_1 z_2 + (\widehat{\theta} - \theta)(\dot{\widehat{\theta}}-\tau_1)$ should be taken off.

## Step 2

With $z_1 = x_1, z_2 = x_2 - \alpha_1$, the original system has been transformed into

Choose Lyapunov Function

Objective: $\dot{V}_2 = -z_1^2-z_2^2$

where $\dot{\widehat{\theta}} = \tau_1-z_1\frac{\partial \alpha_1}{\partial z_1}z_1^2$

# Robust Backstepping

Consider a nonlinear system

we assume that the unknown parameter $\theta$ belongs to a known interval $|\theta| < \overline \theta$

Objective: $x_1 \to 0$ as $t \to \infty$

For this system the robust controller design is in two steps.

## Step 1

To apply backstepping, we design a $v$-controller for

Choose Lyapunov function $V_1 = \frac{1}{2}x_1^2$
Several different designs are possible:

where $s(x)$ is a smooth switching function.

## Step 2

We now employ backstepping to design $u$-controllers for the second order system.
Choose Lyapunov function: $V_2 = \frac{1}{2}x_1^2+\frac{1}{2}(x_2-v)^2$
Choose$v = -c_1x_1 - \frac{\overline{\theta}}{2}(ax_1+\frac{1}{a}x_1^3)$
and we have

Objective: $\dot{V_2} \leq 0$

We should choose $s(x_1,x_2)$ to satisfy $(x_2-v)\frac{\partial v}{\partial x_1} x_1^2(s(x_1,x_2)-\theta) \leq 0$:

• When $(x_2 - v)\frac{\partial v}{\partial x_1}\geq 0$, $s(x_1,x_2) = -\overline{\theta}$
• When $(x_2 - v)\frac{\partial v}{\partial x_1} < 0$, $s(x_1,x_2) = \overline{\theta}$
]]>
<ul> <li>Uncertainties <blockquote> <p><strong>Structured(or parametric) uncertainties</strong><br>Corresponds to inaccuracies on terms actually included in the model<br><strong>Unstructured uncertainties(or unmodeled dynamics)</strong><br>Corresponds to inaccuracies on(i.e., underestimation of) the system order</p></blockquote></li></ul>
Backstepping Technique https://rm-rf.moe/2019/02/02/backstepping/ 2019-02-02T02:20:38.000Z 2019-02-02T04:45:19.440Z Consider the system

where, $x,y \in \mathbb{R}$ are the states, $u \in \mathbb{R}$ is the control input, and $f,g$ are assumed to be known.

Objective: $x \to 0$ as $t \to \infty$ # Single-integrator Backstepping## LaShalle-Yoshizawa TheoremLet $$x = 0$$ be an equilibrium point of $$\dot{x} = f(x,t)$$ and suppose $$f$$ is locally Lipschitz in $$x$$ uniformly in $$t$$. Let $$V: \mathbb{R}^n \to \mathbb{R}_+$$ be a continuously differentiable, positive define and radially unbounded function $$V(x)$$ such that: $$\dot{V} = \frac{\partial V}{\partial x}(x)f(x,t)\leq -W(x) \leq 0,\ \ \ \ \ \ \forall t \geq 0, \ \ \forall x \in \mathbb{R}$$Where $$W$$ is a continuous function. Then all solutions of $$\dot{x} = f(x,t)$$ are globally uniformly bounded and satisfy$$\lim_{t \to \infty} W(x(t)) = 0$$If $$W(x)$$ is positive define, then equilibrium is **Globally Uniformly Asymptotically Stable**(GUAS)## Method Objective1: $x \to 0$
Objective2: $\eta \to \eta_d$

Subsystem $\dot{x} = F(x)$, where $F(x) \triangleq f(x)+g(x)\eta_d$
Choose Lyapunov Function $V_x$

add and minus $g(x)\eta_d$

Regroup

Objective: Find Control $v_1$ stabilizing the system at $e_1 = 0$

Lyapunov Candidate:

Let $v_1 = -\frac{\partial V_x}{\partial x}g(x) - k_1 e_1$, with $k_1 > 0$

Actual Control Law is

# Conclusions

• The designer can start the design process at the known-stable system and “back out” new controllers that progressively stabilize each outer subsystem.
• Any strict-feedback system can be feedback stabilized using a straightforward procedure.
• Backstepping design doesn’t require a differentiator.
]]>
<p>Consider the system </p> <script type="math/tex; mode=display"> \left\{ \begin{aligned} &\dot{x} = f(x) + g(x)\eta,\ g(x) > 0\\ &\dot{\eta} = u \end{aligned} \right.</script><p>where, <script type="math/tex">x,y \in \mathbb{R}</script> are the states, <script type="math/tex">u \in \mathbb{R}</script> is the control input, and <script type="math/tex">f,g</script> are assumed to be known.</p> <blockquote> <p><em>Objective:</em> <script type="math/tex">x \to 0</script> as <script type="math/tex">t \to \infty</script> </p> </blockquote> <div align="center"> <img width="350" src="/2019/02/02/backstepping/1.png"> </div>
Neural Network-Assignment https://rm-rf.moe/2019/02/01/neural-network/ 2019-02-01T09:31:52.000Z 2019-02-02T04:47:13.967Z Advanced Control Techniques—Assignment

# Introduction

Artificial neural networks (ANNs) are computational models that are loosely inspired by their biological counterparts. Artificial neurons, which are elementary units in an ANN, appears to have been first introduced by McCulloch and Pitts in 1943 to demonstrate the biological neurons using algorithms and mathematics. An ANN is based on a set of connected artificial neurons. Each connection, like the synapses in a biological brain, can transmit a signal from one artificial neuron to another. Since the early work of Hebb, who proposed cell assembly theory which attempted to explain synaptic plasticity, considerable effort has been devoted to ANNs. Though perceptron was created by Rosenblatt for pattern recognition by training an adaptive McCulloch-Pitts neuron model, it is incapable of processing the exclusive-or circuit. A key trigger for renewed interest in neural networks and learning was Werbos’s back-propagation algorithm, which makes the training of multi-layer networks feasible and efficient.

# Methods

Multi-Layered Perceptron(MLP) gains prestige as a feedforward neural network, which has been the most widely used neural networks. Error Back Propagation(BP) algorithm is implemented as a training method for MLPs.

## Multi-Layered Perceptron

MLP, which is a fully-connected feedforward neural network, uses a supervised learning methods. An MLP consists of an input layer, an output layer and at least one hidden layer. The fundamental structure of MLP is shown schematically in Fig. 1: Considering the input layer, neurons take effect on passing the information, i.e. the activation functions of this layer are identity functions. Each neurons, who consist the input layer, completely connect with the first hidden layer, thus those neurons hold multiple outputs. By giving $M$ neurons in input layer and $N$ neurons in hidden layer, each connection is assigned a weight $v_{nm}$. A bias term added to total weighted sum of inputs to serve as threshold to shift the activation function.The propagation function computes the hidden layer input $X_j$ to the neuron $x(j)$ from the outputs of predecessor neurons $Z_j$ has the form

where $\theta$ donates the bias term.

The activation function, which defines the output of the node, were chosen as “Hyperbolic tangent” and “Softsign” in this case. Equations, plot and derivative are given by TABLE 1. MLPs’ scheme essentially has three features:

• There are no connections between the neurons which are in the layers, and neurons shall not have connections with themselves.
• Full connections exist only between the nearby layers.
• It consists of two aspects: the feed-forward transmission of information and the feed-back transmission of error.

## Error Back Propagation

Back Propagation is a method used in ANNs to calculate a gradient that is needed in the calculation of the weights between layers, and it is commonly used by the gradient descent optimization algorithm. Calculating adjustments of weights in Fig. 1 is chosen as an example to introduce BP algorithm. We represent the parameter $\delta$ with respect to $i$-th layer by the notation $\delta^{(i)}$.

For calculating the weights between hidden layer and output layer, loss function is defined as:

where $\widehat{y}_{qj}$ is expected output, $y_{qj}$ is actual output. Based on gradient descent algorithm with learning rate $\mu$, which controls how much algorithm adjusting the weights of neuron network with respect the loss gradient, and the input of activation function $s_j$, we have

with

and we have

where $\delta_j$ donates the error of the output layer, thus, the adjustment of $w$ shall be:

Consider calculating the weights between input layer and output layer:

with

and

where

thus

In summary, the equations describing the adjustment of weights is:

where $\delta^{(l)}_j$ for output layer is:

for hidden layer and input layer is

respectively.

The process of training MLP with BP algorithm is shown in Algorithm 1.

# Results

In this section, we have designed different model structures for addressing curve fitting problems.

## Network Design

We designed two different structures, which are shown in Fig. 2.  The structure which has one hidden layer with 600 nodes was applied to fitting $f(x) = sin(x)$ and $f(x_1, x_2) = \frac{sin(x_1)}{x_1} \frac{sin(x_2)}{x_2}$. For $y = |sin(x)|$, we chosen the structure with 2 hidden layers to reach a better regression performance.

## $f(x) = sin(x)$

We trained the layers with 9 sample, using $E = \frac{1}{2} (\widehat{y} - y)^2$ as the loss function. The training process will stop when $E_{avg} = (\sum_{i = 1}^{epoch} E_i) /epoch < 2\times 10^{-4}$. The results with 361 test samples are shown in Fig. 3: Runtime loss $E$ and average loss $E_{avg}$ are shown in Fig. 4, where the testing value evaluated by the average loss function is $9.3599\times 10^{-5}$. We notice that the loss suffers a drastic drop within $50,000$ epochs, then, to decrease the average loss $E_{avg}$ from $0.1$ to $0.002$, more than $1\times 10^6$ epochs are needed.

The absolute error is shown in Fig. 5: Apparently, max error between actual value and predict value is less than 0.05, which shows the prestige performance when fitting $f(x) = sin(x)$.

## $f(x) = |sin(x)|$

When it comes to a more complex nonlinear curve, the fitting error using elementary MLP structure which only has one hidden layer is far from satisfactory. A hidden layer with softsign activation function was added to the basic MLP structure. By implementing the structure with 9 training sample, we arrive at the following results: Fig. 7 shows the loss decreased over training epochs: From the figure above, we can conclude that though the loss suffers the chattering within 500,000 epochs, while the average loss obtains a smooth constant rate of descent. Though the training loss which is less than $1\times 10^{-5}$ after $3\times 10^6$ epochs yields the guaranteed performance on training samples, as we can observed in Fig. 6, the test error(more than 0.2) is unbearable for some test samples. We assumed lacking of train samples has brought about the overfitting of neural network, thus we expanded the training sample with 29 independent (x, y) to reach the better performance.

When average loss is less than 0.005, we obtained the following result, as shown in Fig. 8: Apparently, $y = |sin(x)|$ has a non-differentiable point in $(0, 2\pi)$. From Fig. 9, the point which is non-differentiable has the maximal error compared to other points. i.e. providing more training sample can not reinforce the ability of non-linear fitting for a certain MLP model. Still, adding training sample improves the performance of prediction on test sets. From Fig. 9, though we have a test point which posses the error more than 0.1, absolute errors of other test points are less than 0.02. i.e. this approach provides more robust solutions than 9 training sample with the same loss tolerant. The training loss of this approach is shown in Fig. 10 ## $f(x, y) = \frac{sin(x)}{x}\frac{sin(y)}{y}$

In this section, let us consider a function which has two inputs. $11\times 11$ samples are given for training with the basic MLP structure. The hidden layer has 500 nodes, and the training will stop when $E_{avg} < 0.002$. Fig. 11 shows the actual curve and the curve predicted with $21\times 21$ samples respectively.  We plot $E$ and $E_{avg}$, varying $epoch$ from $[1, 100,000]$ in Fig. 12, from which we observe $E_{avg}$ decrease rapidly from 1.1 to 0.1 within 1000 epochs. Thus, the training process shows the efficiency and robust performance of back propagation algorithm. The test error is shown as Fig. 13, from which we observe the maximal training error is less than 0.15. # Conclusions

In this report, we implemented multilayer perceptron to provide the solutions to three specific non-linear functions. Simulation results illustrates the accuracy of artificial neural networks and the efficiency of back propagation algorithm.

# Source Code

]]>
Genetic Algorithm-Assignment https://rm-rf.moe/2019/01/24/genetic-algorithm/ 2019-01-24T07:09:42.000Z 2019-02-02T04:47:27.223Z Advanced Control Techniques—Assignment

# Introduction

Inspired by the process of natural selection and principle of genetics, genetic algorithms are implemented to handle various optimization problems. Basic theorem and mathematical derivation has given by J. H. Holland. This research report is intended as a solution, performing optimization on two fitness functions. The reminder of this report is structured as follows. Section 2 reviews the relevant fundamentals of genetic algorithm, which includes the detailed structure with its component parts. In Section 3, the maximal of two fitness function are given with the optimal populations which contain exhaustive revolutionary process. Conclusions of the report are presented in Section 4.

# Methods

Genetic algorithm is constructed from distinct components, which are the chromosome encoding, the fitness function, selection, crossover and mutation. Starting with a randomly generated population of chromosomes, a genetic algorithm carried out a process of fitness based selection and recombination to produce a successor population, the next generation. During the recombination, parent chromosomes which encoded by binary strings are selected, depending on their fitness. In this case, those chromosomes who can obtain larger function values own larger fitness, and the possibilities of producing offspring increase. Although crossover may decrease the fitness of some individuals, the population fitness will be improved. Mutations ensure genetic diversity within the genetic pool of the parents and therefore ensure the genetic diversity of the subsequent generation of children. As this process is iterated, a sequence of successive generations evolves and the average fitness of the chromosomes tends to increase until stopping criterion is reached. Two functions which needed to be optimized are defined as follows:

## Encoding

Binary encoding is implemented to represent the chromosome, which is a string of bits, 0 or 1. The bit strings with 10 genes can provide a solution space consisting $2^{10}$ individuals. Take function $f_1$ as an example, the domain of function $f_1$ is $[-10, 10]$，and the standard binary encoding can only represent integer, which cannot satisfy the demanded accuracy. Thus, a linear mapping, which map domain: $D \in [-10.0000, 10.0000]$ to $D^* \in [0, 200,000]$, is introduced. Obviously, a binary string, which has 18 genes, provides $262,144$ diverse individuals. In conclusion, the chromosome with 18 genes and the chromosome with 15 genes is adopted, encoding the domains of function$f_1,f_2$ respectively.

## Selection

Roulette wheel selection is a genetic operator for selecting potentially useful solutions for recombination. In roulette wheel selection, the fitness function assigns a fitness to generated individuals. The values, which are achieved by dividing the fitness of a selection by the total fitness of all the selections, determine the possibility that those parents can produce offsprings. If $f_i$ is the fitness of individual $i$ in the population, its probability of being selected is

where $N$ is the number of individuals in the population. This process is introduced in Algorithm 1:

## Crossover

Crossover is used to combine the genetic information of two parents to generate new offspring. Bit strings are used to be recombined by crossover. Uniform crossover, which uses binary mask, makes the crossover more flexible. By choosing a random crossover mask with the same length of parent’s chromosome, genes are copied from one parent when there is $0$ in the crossover mask, the other genes are copied from the other parent when there is $1$ in the crossover mask. Thus, offsprings contain a mixture of genes from each parent. In this case, the probability of crossover is $0.6$.

## Mutation

Mutation is used to maintain and introduce diversity in the genetic population. Bit flip mutation is implemented in our solutions, a certain number of bits was selected to perform flip. Mutation happens with a low frequency, probability of mutation occurrence is selected as 0.001 to 0.01. In this case, mutation occurred once on 2 random genes whose population has 288 genes per iteration.

## Algorithm

Genetic algorithm can be presented by the following algorithm.

# Results

The proposed algorithm has been implemented on analysis of $f_1$ and $f_2$, the solution involves finding the maximal and its corresponding locations. The evolutionary processes are also presented in detail.

## Analysis of $f_1$

Apparently, function $f_1(x , y) = \frac{sinx}{x}\frac{siny}{y}$, whose domain is $x, y\in[-10,10]$, acquires the maximum value when $x, y \to 0$, nevertheless, $x, y$ can not be zero. Under this circumstances, the fitness function used in genetic algorithm is defined by the following equation:

where $\delta$ is a small positive real number.

Because of the Roulette Wheel algorithm, which needs positive input, the values calculated by the fitness function may not satisfy that. Thus, we assume that those parents whose fitness is negative cannot produce offsprings. i.e, if the function $f_1 < 0$, let $f_1 = 0$. Algorithm parameter is listed in TABLE 1.

Parameter NameValue
Iteration600
Individuals Count8, 8 for x, y
Genes Count18 per individual
Probability of Crossover60%
Probability of Mutation0.6%

Genetic algorithm with 600 iteration finished within 0.133901 seconds on average, the highest fitness value achieved is 0.9998. Those maximal fitness values are recorded on 100th, 200th, 300th iteration and the final iteration. The reason why data dropped between the 300th to final iteration is the fitness remain the same practically. Evolutionary process of 8 groups of individuals is shown in Fig. 1, the maximal fitness and its corresponding individuals are shown in TABLE Maximal fitness and groups, which are marked on the curve of $f_1(x, y)$ in Fig. 2.

N_th iterationOptimal GroupsOptimal Fitness
100x=-0.3374,y=2.35620.2944
200x=-0.1838,y=0.66640.9224
300x=-0.1836,y=-0.10160.9904
600x=-0.0001,y=-0.03520.9998 In Fig. 1, the random generated 8 groups whose fitnesses are around $[0 , 0.25]$ reached 0.9998(fitness) on average at the 230th iteration. We further analyze the varieties of each group, noticing that the improvement of the population’s average fitnesses depends on the mutations occur on the isolated group, which elevated the whole population by crossover. The process can be recognized in 70th, 110th and 260th iteration in Fig. 1. ## Analysis of $f_2$

The function $f_2$ is defined as follows:

where there is no need to tweak the function for satisfying the requirements of genetic algorithm except the domain. $x, y$ in $f_2(x, y)$ range from $[-1, 2]$, which are considered as the floating number with 4 decimal. That is, we can use chromosomes with 15 bits which have 32768 individuals to encode the domain.

Differ from function $f_1$ which attained maximal value at $(0, 0)$, $f_2$’s maximal value at the “border” of the domain. Evidently, $f_2$ is symmetric with respect to the x-axis and the y-axis, so we investigate on the positive plane. To achieve maximum, for both x, y shall be the largest numbers in the domain which satisfy

Thus, those individuals generated randomly which range from $(30000, 32768]$ must be rejected to ensure the correctness. In light of this, the following states shall be inserted between line 12-13 in Algorithm 2:

Algorithm parameter is listed in TABLE 3

Parameter NameValue
Iteration1200
Individuals Count8, 8 for x, y
Genes Count15 per individual
Probability of Crossover60%
Probability of Mutation0.8%

Genetic algorithm with 1200 iteration finished within 0.2818147 seconds on average, the highest fitness value achieved was 3.6996, which is shown on Fig. 3: Compared to the fix-step logging strategy for $f_1$, a variable-step strategy was applied to log the evolutionary progress in this section. If a gap with a certain threshold existed between the maximal fitness calculated by the current population and the last population, we call location who gains the first maximal fitness after the gap $node(M, i)$ where M is gap threshold and i is the iteration after a gap. By connecting the nodes, we obtained the evolutionary progress, EP for short. A sample epoch result with 4 nodes is listed in TABLE 4:

N_th iterationOptimal GroupsOptimal Fitness
4x=1.6486,y=-0.49751.6890
15x=1.8262,y=1.24342.5558
41x=1.8514,y=1.45443,2901
157x=1.8512,y=1.84983.6996 Fig. 4 shows a sample progress by connecting $node(0.1, i)$, as the figure shows, evolutionary progress started at $node(0.1, 1)$ doesn’t have plenty of chatter, hence this sample are considered as an efficient evolutionary progress.

# Conclusions

This report has presented the solutions to function optimization problem. In general, we have some interesting observations on genetic algorithms. The evolutionary progress demonstrated genetic algorithm may show an ultimate efficiency though lack robustness hence the stop criterion is not clear in every problem. Moreover, we noticed that genetic algorithms have a tendency to converge towards local optimum, an evolutionary progress may stuck at some certain points for hundreds of iterations, depending on random mutations. Another problem is we can’t simply deploy parallel computing to accelerate the evolutionary progress because the new population are generated by the last population which has a sequential logic.

]]>