handbook of neuroevolution through erlang - springer978-1-4614-4463-3/1.pdf · foreword vi erlang...

20
Handbook of Neuroevolution Through Erlang

Upload: nguyenquynh

Post on 30-Jan-2018

249 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Handbook of Neuroevolution Through Erlang

Page 2: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and
Page 3: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Gene I. Sher

Handbook of NeuroevolutionThrough Erlang

Page 4: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

ISBN 978-1-4614- -DOI 10.1007/978-1-4614-4463-3Springer New York Heidelberg Dordrecht London

4462 6 ISBN 978-1-4614-4463-3 (eBook)

© Springer Science+Business Media New York 2013 This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com)

Gene I. SherDepartment of Electrical Engineering and Computer ScienceUniversity of Central FloridaOrlando, FL, USA

Library of Congress Control Number: 2012941276

Page 5: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Foreword by Joe Armstrong

I was delighted to be asked to write a foreword to Gene Sher’s book on

Neuroevolution.

To be honest I didn’t have a clue what Neuroevolution was before I started reading his manuscript, but the more I read the more I became engaged in the con-tent.

Gene addresses what is a fascinating problem: How can we simulate a biologi-cal system in a computer. Can we make a system that learns from its mistakes?

Gene chose to program his system in Erlang, which is where I come in. Erlang was designed over twenty five years ago to solve a completely different problem. What we were trying to do at the time and we are still trying, is to make a lan-guage for programming extremely large systems that never stop.

Our application was telephony. We wanted to write the control software for a set of large telephone exchanges. This software should in principle run forever. The telephone networks span the planet, and the control systems for these net-works were running before the invention of the computer.

Any system like this must be able to tolerate both software and hardware fail-ures, and thus we built a programming language where failures were not a prob-lem. Our approach was to say, “well if something crashes, some other part of the system will detect the error, fix the problem and the system as a whole will not fail.”

We also thought that such a system should evolve and change with time. It would never be the case that the software in the system would be correct, right from the start, instead we would have to change the software many times during the life of the product. And we would also have to make these changes without stopping the system.

The view of the world that Erlang presents the programmer is intrinsically dis-tributed, intrinsically changing and capable of self-repair. Neuroevolution was far from our thoughts.

Twenty years later Gene comes along and discovers Erlang - to him, Erlang processes are neurons. Well of course Erlang processes are not neurons, but they can easily be programmed to behave like neurons.

v

Page 6: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Foreword

vi

Erlang was designed to scale. So today we can run a few million processes per node, and a few dozen nodes per chip. Computer architectures have changed from the single core Von-Neumann machine, to the multicore processor, and the archi-tectures will change again. Nobody actually knows how they are going to change, but my bet is that the change will be towards network-on-chip architectures.

We’re already talking about putting a few hundred to a thousand cores on a single chip, but for this to happen we have to move to network on chip architec-tures. We can imagine large regular matrices of CPUs connected into a regular switching infrastructure. So we’ll soon end up with thousands of cores, each capa-ble of running millions of Erlang processes.

What will we do with such a monster computer and how are we going to pro-gram it? Well I suspect Gene has an answer to this question; he’ll want to build a brain.

This book will tell you how. Will it work in the near future or will this take hundreds of years? Nobody knows, but the journey will be interesting and we might build some other useful things on the way.

Joe Armstrong

Stockholm

Page 7: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Dedication

To my father Ilya Aleksandrovich Sher

To my mother Zinaida Lvovna Sher

Page 8: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and
Page 9: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Preface

We biological organisms are fragile things. We are machines whose only armor is skin, a thin layer composed of lipids and proteins, easily damageable. The cells that make us up require constant nourishment, this nourishment is supplied by our blood, which itself easily and rapidly begins to leak when our thin shield is pene-trated. We can only exist in a very limited range of temperatures. 36.7 degrees Celsius is our standard, a few degrees above that and we are uncomfortable, a bit higher and our cells begin to die and our flesh suffers permanent damage. When our temperature drops below 36.7 by a few degrees Celsius, we too can begin to suffer permanent damage unless the temperature is raised again. We burn easily. Our sensory organs are limited, we see electromagnetic radiation in only a very narrow spectrum, between 400 and 800 THz. The same for pressure waves, sound, which we only perceive between 12 and 20000 Hz. Our actuators, how and where we can move are, once again, extremely limited. The maximum speed we can achieve on land, without mechanical assistance, is 44.72km/h (record by Usain Bolt), and only for a limited amount of time, in water 2.29 m/s (record by Tom Jager). We require a constant supply of energy, food and fluid, if we do not con-sume fluids for just a few days we die, we survive only a bit longer when left without food. We are mortal, decaying, with only a few decades of being func-tional, and that only if everything else goes perfectly right.

We can study as much as we want, but at the end of the day we will still be lim-ited by our biological nature. Within our brains the signals propagate from neuron to neuron at a maximum speed of 120m/s, this cannot be improved much further. The best of our kind, Feynman, Newton, Gauss, Einstein... They are at the limit of what our specie can achieve, and yet even they are limited by time and what they can do with it. Because there is no longer an evolutionary push towards greater level of intelligence, evolution will not save us, we will not give birth to another biological specie with greater minds, and natural evolution is too slow in either case. Plus, let us be perfectly honest, the evolutionary pressure in our modern so-ciety is actually against intelligence, the Feynmans, Newtons and Einsteins of our world have less children on average than anyone else.

But we have Science on our side, and through the application of the Scientific method we are hill climbing towards deeper knowledge and understanding of what we are, how we work, and most importantly, how to improve upon our condition.

Make no mistake, there is absolutely nothing mystical about the human brain. It is but a vast graph of interconnected simple biological signal integrators. But though our brain is limited, the non biological based intelligence does not have to be so. Unlike a biological computer, the non biological one, its speed, the vastness

ix

Page 10: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

x

[1] The Blue Brain Project EPFL, http://bluebrain.epfl.ch

-Gene I. Sher

Preface

and the complexity it can achieve, can all be improved and increased at the speed of technological evolution, which would be under its own control. The brain is complex, and we are actively trying to reverse engineer it [1]... so we are on our way. But even if we somehow won’t be able to reverse engineer our own brains, there is another approach to the creation of intelligence, by creating a new one using the basic elements that we know work, neurons, and through a process that we know works, evolution. We know that this method works, we are the proof of it. We are the proof that evolution works, that simple spatio-temporal signal processors evolved to be connected in vast topologies can produce intelligent systems. If we can supply the elements flexible enough, the environment complex enough, the evolutionary process dynamic enough, and enough computational power to simulate trillions of organisms... it will only be a matter of time... once again, we are the proof of that.

Page 11: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Acknowledgments I would like to thank my father for always showing by example, for his love of

knowledge and erudition and instilling the same in me, for his creativity and dedi-cation, for his support of my work and research, for teaching me to always pursue the highest possible standard within all my work, and to never waste a moment. I would also like to thank Joe Armstrong for his Foreword, and his numerous con-tributions to Erlang, and for Erlang itself, a language which I believe is the future

of computational intelligence. And finally, I would like to thank my editors, for making the publication of this volume such a pleasant experience.

xi

Page 12: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and
Page 13: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Contents

Chapter 1 Introduction: Applications & Motivations ........................................ 1 1.1 Motivations ................................................................................................... 2 1.2 Applications .................................................................................................. 5

1.2.1 Robotics ................................................................................................ 5 1.2.2 Financial Markets ................................................................................ 10 1.2.3 Artificial Life ...................................................................................... 14 1.2.4 Image Analysis & Computer Vision ................................................... 18 1.2.5 Data Compression ............................................................................... 19 1.2.6 Games & Entertainment ...................................................................... 21 1.2.7 Cyber Warfare ..................................................................................... 22 1.2.8 Circuit Creation & Optimization ........................................................ 26 1.2.9 Optimizing Shapes and Structures ...................................................... 30 1.2.10 Computational Intelligence & Towards Singularity ......................... 34

1.3 A Whirlwind Overview .............................................................................. 34 1.4 Endgame ..................................................................................................... 37 1.5 References .................................................................................................. 38

PART I FOUNDATIONS

Chapter 2 Introduction to Neural Networks ..................................................... 43 2.1 Biological Neural Network ......................................................................... 45 2.2 Artificial Neural Network ........................................................................... 51

2.2.1 The Neurode in Detail ......................................................................... 54 2.3 Neural Networks and Neural Network Based Systems .............................. 57

2.3.1 Recurrent Neural Networks and Memory Loops ................................ 59 2.3.2 A Neural Network Based System ....................................................... 60

2.4 Learning Vs. Training ................................................................................ 61 2.5 Neural Network Supervised “Learning” Algorithms ................................. 63 2.6 Neural Network Unsupervised Learning Algorithms ................................ 66

2.6.1 Hebbian Learning ................................................................................ 67 2.6.2 Neuromodulation ................................................................................ 70 2.6.3 Competitive Learning ......................................................................... 73 2.6.4 Kohonen/Self Organizing Map ........................................................... 74 2.6.5 Putting it All Together ........................................................................ 76

2.7 Summary ..................................................................................................... 78 2.8 References .................................................................................................. 78

xiii

Page 14: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Contents

xiv

Chapter 3 Introduction to Evolutionary Computation .................................... 81 3.1 Evolution .................................................................................................... 81 3.2 Extracting the Essentials of Biological Evolution ...................................... 85 3.3 Formulating a Given Problem in Evolutionary Terms ............................... 88 3.4 The Different Flavors of Evolutionary Algorithms .................................... 93

3.4.1 Genetic Algorithms ............................................................................. 94 3.4.2 Genetic Programming ......................................................................... 96 3.4.3 Evolutionary Strategies ....................................................................... 97 3.4.4 Evolutionary Programming ................................................................. 98

3.5 A Few Words on Memetic Computing ...................................................... 98 3.6 The Different Sides of the Same Coin ...................................................... 102 3.7 References ................................................................................................ 103

Chapter 4 Introduction to Neuroevolutionary Methods ................................ 105 4.1 Neural Network Encoding Approaches and Mutation Operators ............ 106

4.1.1 Neural Network Mutation Operators ................................................ 106 4.1.2 Neural Network Genotype Encoding ................................................ 108 4.1.3 The Neural Network Phenotype ........................................................ 113

4.2 Neuroevolution Through Genetic Algorithms ......................................... 118 4.2.1 Example 1: Evolving a XOR Logical Operator ................................ 118 4.2.2 Example 2: Evolving a pole balancing neurocontroller ................... 123 4.2.3 Example 3: End Game; Evolving Intelligence ................................. 127

4.3 Neuroevolution Through Memetic Algorithms ........................................ 135 4.4 Neural Networks as Graph Based Genetic Programming Systems .......... 138 4.5 References ................................................................................................ 14

Chapter 5 The Unintentional Neural Network Programming Language .... 143 5.1 The Necessary Features ............................................................................ 144 5.2 Erlang: From Telecommunications Networks To Neural Networks ....... 146 5.3 The Conceptual Mapping of a NN to Erlang’s Architecture ................... 147 5.4 Robustness and Fault Tolerance in Computational Intelligence .............. 149 5.5 I’ve Done This Once Before; And We Are On Our Way ........................ 149 5.6 References ................................................................................................ 150

PART II NEUROEVOLUTION: TAKING THE FIRST STEP

Chapter 6 Developing a Feed Forward Neural Network ............................... 153 6.1 Simulating A Neuron ................................................................................ 155 6.2 A One Neuron Neural Network ................................................................ 158 6.3 Planning Our Neural Network System’s Architecture ............................. 162 6.4 Developing a Genotype Representation ................................................... 1666.5 Programming the Genotype Constructor .................................................. 1686.6 Developing the Genotype to Phenotype Mapping Module ...................... 174 6.7 Summary ................................................................................................... 184

0

Page 15: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Contents

xv

Chapter 7 Adding the “Stochastic Hill-Climber” Learning Algorithm ....... 187 7.1 The Learning Method ............................................................................... 188

7.1.1 Comparing EA to Random Restart SHC .......................................... 191 7.2 The Trainer ............................................................................................... 194 7.3 The Exoself ............................................................................................... 195 7.4 The Scape ................................................................................................. 197 7.5 Scapes, Sensors, Actuators, Morphologies, and Fitness .......................... 199 7.6 Developing the Extended Architecture .................................................... 202

7.6.1 Modifying the genotype Module ...................................................... 203 7.6.2 Modifying the morphology Module ................................................. 204 7.6.3 Developing the trainer Module ......................................................... 205 7.6.4 Modifying the exoself Module .......................................................... 2077.6.5 Developing the scape Module ........................................................... 210 7.6.6 Modifying the cortex Module ........................................................... 213 7.6.7 Modifying the neuron Module .......................................................... 214 7.6.8 Modifying the sensor Module ........................................................... 218 7.6.9 Modifying the actuator Module ........................................................ 219

7.7 Compiling Modules & Simulating the XOR Operation ........................... 219 7.8 Adding the benchmarker Module ............................................................. 223 7.9 Summary ................................................................................................... 226

Chapter 8 Developing a Simple Neuroevolutionary Platform ....................... 2298.1 The New Architecture .............................................................................. 231 8.2 The New Data Structures .......................................................................... 233 8.3 Developing the polis Module ................................................................... 236 8.4 Updating the genotype Module ................................................................ 242

8.4.1 Moving from ETS to Mnesia ............................................................ 243 8.4.2 A NN Based Adaptive Agent ............................................................ 243 8.4.3 A New Neuron Id Structure; Adding Recursive Connections .......... 244 8.4.4 Seed Computational Intelligence ...................................................... 247 8.4.5 Constraints ........................................................................................ 248 8.4.6 The Updated genotype Module ......................................................... 249

8.5 Developing the genotype_mutator ........................................................... 262 8.5.1 The Precursor Connection Making and Breaking Functions ............ 266 8.5.2 mutate_weights ................................................................................. 274 8.5.3 add_bias & remove_bias ................................................................... 276 8.5.4 mutate_af ........................................................................................... 278 8.5.5 add_outlink ........................................................................................ 279 8.5.6 add_inlink .......................................................................................... 281 8.5.7 add_sensorlink .................................................................................. 284 8.5.8 add_actuatorlink ................................................................................ 285 8.5.9 add_neuron ........................................................................................ 287 8.5.10 outsplice .......................................................................................... 289 8.5.11 add_sensor ....................................................................................... 294 8.5.12 add_actuator .................................................................................... 296

Page 16: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Contents

xvi

8.5.13 Planning the Remaining Few Details of the Genotype Mutator Module ............................................................................................ 298

8.5.14 Implementing the genotype_mutator Module ................................. 301 8.5.15 Developing the population_monitor ............................................... 3098.5.16 Updating the exoself Module .......................................................... 327 8.5.17 Updating the neuron Module .......................................................... 337

Chapter 9 Testing the Neuroevolutionary System .......................................... 347 9.1 Testing the Mutation Operators ................................................................ 347 9.2 Testing the Neuroevolutionary System on the Simple XOR Benchmark 369

9.2.1 The mutate_af Error .......................................................................... 375 9.2.2 Same Neuron, But Different Ids in the evo_hist List ....................... 3789.2.3 Multiple Actuators of the Same Type ............................................... 3799.2.4 Making Fingerprint Store Generalized Sensors & Actuators ........... 382 9.2.5 The Quizzical Topology of the Fittest NN System ........................... 383

9.3 Retesting Our Neuroevolutionary System ................................................ 3889.4 Summary ................................................................................................... 395

PART III A CASE STUDY

Chapter 10 DXNN: A Case Study ..................................................................... 39910.1 The Reason for the Memetic Approach to Synaptic Weight

Optimization ............................................................................................. 39910.2 The DXNN Encoding and Architecture ................................................. 402 10.3 Generational Evolution ........................................................................... 405

10.3.1 Step-1: Initialization Phase ............................................................. 407 10.3.2 Step-4: Parametric Tuning Phase .................................................... 40910.3.3 Step-8 & 13: The Selection & Offspring Allocation Phase ............ 413 10.3.4 Step-18: The Topological Mutation Phase ..................................... 415

10.4 Steady-State Evolution ........................................................................... 417 10.5 Direct (Neural) and Indirect (Substrate) Encoding ................................ 421

10.5.1 Neural Substrates ............................................................................ 423 10.5.2 Genotype Representation ................................................................ 427 10.5.3 Substrate Phenotype Representation ............................................... 435

10.6 DXNN Research Group & the NN Research Repository ...................... 43910.7 Currently Active Projects ....................................................................... 440

10.7.1 Cyberwarfare ................................................................................... 440 10.7.2 Coevolving Unmanned Ariel Vehicle Combat Maneuvers ............ 441 10.7.3 Evolving New CPU Architectures & Optimizing Existing Ones ... 442

10.8 Summary and Future Work .................................................................... 443 10.9 References .............................................................................................. 443

8.6 Summary ....................................................................................................3458.7 Reference ...................................................................................................346

Page 17: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Contents

xvii

PART IV ADVANCED NEUROEVOLUTION: CREATING THE CUTTING EDGE

Chapter 11 Decoupling & Modularizing Our Neuroevolutionary Platform 447 11.1 What Can be Decoupled? ....................................................................... 448 11.2 Updating the Genotype Representation .................................................. 451

11.2.1 The sensor & actuator Records ....................................................... 452 11.2.2 The neuron Record .......................................................................... 453 11.2.3 The agent Record ............................................................................ 454 11.2.4 The population Record .................................................................... 456 11.2.5 The constraint Record ..................................................................... 457

11.3 Updating the records.hrl ......................................................................... 460 11.4 Updating the Modules ............................................................................ 465

11.4.1 Updating the genotype Module ....................................................... 465 11.4.2 Updating the genome_mutator Module .......................................... 468 11.4.3 Updating the population_monitor Module ..................................... 478 11.4.4 Creating the selection_algorithm Module ....................................... 485 11.4.5 Creating the fitness_postprocessor Module .................................... 48911.4.6 Creating the steady_state Evolutionary Loop ................................. 490 11.4.7 Updating the exoself Module .......................................................... 495 11.4.8 Updating the neuron Module .......................................................... 50811.4.9 Creating the signal_aggregator Module .......................................... 514 11.4.10 Creating the plasticity Module ...................................................... 516

11.5 Compiling & Testing the New System ................................................... 51811.6 Summary & Discussion .......................................................................... 525 11.7 References .............................................................................................. 526

Chapter 12 Keeping Track of Important Population and Evolutionary Stats ................................................................................................. 527

12.1 The Necessary Additions to the System ................................................. 52812.2 The Trace Format ................................................................................... 530 12.3 Implementation ....................................................................................... 532

12.3.1 Updating records.hrl ....................................................................... 532 12.3.2 Building the Topological Summary of a Neural Network .............. 533 12.3.3 Implementing the Trace Updating Cast Clause .............................. 535 12.3.4 Updating the exoself Module .......................................................... 541

12.4 Compiling & Testing .............................................................................. 542 12.5 Summary & Discussion .......................................................................... 545

Chapter 13 The Benchmarker .......................................................................... 547 13.1 The benchmarker Architecture ............................................................... 54813.2 Adding New Records ............................................................................. 54913.3 Updating the population_monitor Module ............................................. 555 13.4 Implementing the benchmarker .............................................................. 557

Page 18: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

xviii Contents

13.5 Compiling and Testing ........................................................................... 564 13.6 Summary ................................................................................................. 570 13.7 References .............................................................................................. 571

Chapter 14 Creating the Two Slightly More Complex Benchmarks ............ 573 14.1 Pole Balancing Simulation ..................................................................... 573

14.1.1 Implementing the Pole Balancing Scape ........................................ 577 14.1.2 Implementing the Pole Balancing morphology .............................. 581 14.1.3 Benchmark Results ......................................................................... 583

14.2 T-Maze Simulation ................................................................................. 590 14.2.1 T-Maze Implementation .................................................................. 59814.2.2 Benchmark Results ......................................................................... 604

14.3 Summary & Discussion .......................................................................... 607 14.4 References .............................................................................................. 608

Chapter 15 Neural Plasticity ............................................................................. 60915.1 Hebbian Rule .......................................................................................... 610

15.1.1 Implementing the New input_idps & pf Formats ........................... 613 15.1.2 Implementing the Simple Hebbian Learning Rule ......................... 617

15.2 Oja’s Rule ............................................................................................... 620 15.2.1 Implementing the Oja’s Learning Rule .......................................... 621

15.3 Neuromodulation .................................................................................... 623 15.3.1 The Neuromodulatory Architecture ................................................ 626 15.3.2 Implementing the self_modulation Learning Rules ....................... 631 15.3.3 Implementing the input_idps_modulation Based

Neuromodulated Plasticity .............................................................. 635 15.4 Plasticity Parameter Mutation Operators ............................................... 641

15.4.1 Implementing the Weight Parameter Mutation Operator ............... 642 15.4.2 Implementing the Neural Parameter Mutation Operator ................ 643 15.4.3 Implementing the Hybrid, Weight & Neural Parameters

Mutation Operator ........................................................................... 644 15.4.4 Updating the genome_mutator Module .......................................... 645

15.5 Tuning of a NN which has Plastic Neurons ........................................... 650 15.6 Compiling & Testing .............................................................................. 656 15.7 Summary & Discussion .......................................................................... 65815.8 References .............................................................................................. 659

Chapter 16 Substrate Encoding ........................................................................ 661 16.1 A Brief Overview of Substrate Encoding ............................................... 662 16.2 The Updated Architecture of Our NN Based Systems ........................... 66916.3 The Genotype of the Substrate Encoded NN ......................................... 672 16.4 The SENN Phenotype ............................................................................. 67916.5 Implementing the substrate_cpps & substrate_ceps ............................... 686

16.5.1 Implementing the substrate_cpp Module ........................................ 691 16.5.2 Implementing the substrate_cep Module ........................................ 694

Page 19: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Contents

xix

16.6 Updating the genotype Module .............................................................. 696 16.7 Updating the exoself Module ................................................................. 70 16.8 Implementing the substrate Module ....................................................... 705 16.9 Updating the genome_mutator Module .................................................. 724 16.10 Implementing the add_cpp and add_cep Mutation Operators ............. 726 16.11 Testing the New Encoding Method ...................................................... 728 16.12 Summary and Discussion ..................................................................... 733 16.13 References ............................................................................................ 733

Chapter 17 Substrate Plasticity ........................................................................ 735 17.1 The Updated Architecture ...................................................................... 736 17.2 Implementing the abcn Learning Rule ................................................... 737

17.2.1 Updating the substrate Module ....................................................... 737 17.2.2 Updating the Morphology Module ................................................. 741 17.2.3 Updating the substrate_cpp & substrate_cep Modules ................... 743 17.2.4 Benchmarking the New Substrate Plasticity ................................... 745

17.3 Implementing the iterative Learning Rule .............................................. 746 17.3.1 Benchmarking the New iterative Substrate Plasticity .................... 750

17.4 Discussion ............................................................................................... 752

PART V APPLICATIONS

Chapter 18 Artificial Life .................................................................................. 755 18.1 Simulated Environment and Artificial Organisms: Flatland .................. 755 18.2 The Scape and the Fitness Function ...................................................... 756

18.2.1 Public Scape Architectures, Polis Interface, and Scape Sectors ..... 75918.2.2 The Flatland Interface ..................................................................... 761

18.3 Flatland’s Avatar Encoding .................................................................... 762 18.4 Updating the Morphology, Sensor, and Actuator Modules ................... 763 18.5 Updating the exoself Module ................................................................. 766 18.6 The Simulation and Results .................................................................... 768

18.6.1 Simple Food Gathering Simulation ................................................ 76918.6.2 Dangerous Food Gathering Simulation .......................................... 773 18.6.3 Predator Vs. Prey Simulation .......................................................... 776

18.7 Discussion ............................................................................................... 781 18.8 Summary ................................................................................................. 782 18.9 References .............................................................................................. 783

Chapter 19 Evolving Currency Trading Agents ............................................. 785 19.1 Introduction to Forex .............................................................................. 786 19.2 Trading and the Objective ...................................................................... 78819.3 The Forex Simulator ............................................................................... 794 19.4 Implementing the Forex Simulator ......................................................... 797

1

Page 20: Handbook of Neuroevolution Through Erlang - Springer978-1-4614-4463-3/1.pdf · Foreword vi Erlang was designed to scale. So today we can run a few million processes per node, and

Contents

xx

19.5 Implementing the New Sensors and Actuators ...................................... 806 19.6 Generalization Testing ............................................................................ 80919.7 Benchmark & Results ............................................................................. 815

19.7.1 Running the Benchmark ................................................................. 817 19.8 Discussion ............................................................................................... 822 19.9 Summary ................................................................................................. 823 19.10 References ............................................................................................ 824

PART VI PROMISES KEPT

Chapter 20 Conclusion ...................................................................................... 82920.1 References .............................................................................................. 830

Abbreviations ..................................................................................................... 831