Message Boards Message Boards

[WSS2016] Controlling a chaotic system with a neural network

Posted 8 years ago

For my project at WSS2016, I implemented PD control on an inverted double pendulum.

The double pendulum is an intrisicall chaotic system, shown below:

Double pedulum

I then produced many data points and taught a neural network how to respond to various forces on the system.

Per my expectation, the neural network performs much more quickly and smoothly for randomized initial conditions than the linearized algorithm that I use for control.

The equations of motion in the simplified system are as follows:

c[t_] := -\[Alpha] x1[t] - \[Beta] x1'[t];
d2x1[t_] := (m2 x2''[t] + m1 g x1[t] + c[t])/m1;
d2x2[t_] := (m2 g x2[t] + c[t]/4)/m2;
d2xc[t_] = c[t];

where

c[t]

is the acceleration of the controller.

This simplification may seem gross, but since the system only works within some reasonable error of the unstable equilibrium (~4%) I used the typical first term expansions of all trigonometric terms and came to these equations.

The neural network I trained on this data is exceedingly simple; this is the initialization code for it:

alconet = 
 NetChain[{DotPlusLayer[12], DropoutLayer[0.2], DotPlusLayer[8], 
   DropoutLayer[0.2], DotPlusLayer[4], DropoutLayer[0.2], 
   DotPlusLayer[2]}, "Input" -> 4]

It consists of only linear transformation layers, and works for the simple PD control system.

POSTED BY: Alexander Coxe
3 Replies
Posted 8 years ago

This looks amazing ! May I ask in what package these commands can be found ? Or are they built in to Mathematica somewhere ?

POSTED BY: Simon Cowell
Posted 8 years ago

They're built in to the version I'm using, but I believe there's a Neural Network package out there for earlier versions.

POSTED BY: Alexander Coxe
Posted 8 years ago

Thank you !

POSTED BY: Simon Cowell
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract