SharpNEAT

SharpNEAT 4.0.0, 4.0.1

SharpNEAT v4.0.0 release on github
SharpNEAT v4.0.1 release on github

Overview

SharpNEAT 4.0 represents a comprehensive overhaul of the project, worked on over a period of six years from 2017 through to 2022. The headline improvements are:

Work on SharpNEAT 4.0 also included an overhaul and ongoing development of the Redzen project (that SharpNEAT uses), and a rederivation of the equations for the inverted pole balancing task (see Equations of Motion for the Cart and Pole Control Task).

As a matter of record, the major version has jumped from 2 to 4 because there was a previous attempt at a v3 version (circa 2014-15) that was never completed. There are some citations to SharpNEAT v3 in the academic literature despite that version never being completed or officially released, and therefore v4 was chosen as the major version number for this release.

The SharpNEAT 4.0.1 patch version release makes a small change/fix to the variance of the connection weight mutations, to match the weight mutation scheme in SharpNEAT 2.x. This is beneficial when comparing the efficacy of this release with the previous 2.4.4 release (see the Stochastic Efficacy Comparison section below).


Upgrade to .NET Core and .NET 7

With this release SharpNEAT makes the leap from the legacy .NET Framework to .NET Core, now known simply as .NET, and with a current version of .NET 7. This upgrade gives a boost to the project by moving away from a legacy platform that is essentially in maintenance mode, to a platform that is being heavily invested in by Microsoft and the open source community.

The .NET platform also brings technical benefits, with new language features being added in each release, a constantly improving JIT compiler (RyuJIT) that targets x64, x86, and Arm64 CPU architectures, and support for multiple operating systems.


Comprehensive Overhaul of the Codebase

SharpNEAT 4.0 was rewritten from the ground up rather being the product of iterative changes to the existing codebase. This became necessary because architectural and API changes simply made the new codebase incompatible with the old one.

This overhaul, combined with the .NET 7 platform update, provides a cleaner architecture and API, and a solid base for future development of the project and NEAT research. This release represents the biggest update to the project since its inception in 2004.


Summary of Changes

Some of the key changes in this major release are as follows (not an exhaustive list):


Stochastic Efficacy Comparison

The performance (or 'efficacy') of this release was compared to the previous release (v2.4.4). The resulting best fitness histograms are shown below.

To recap, these histograms show the best fitness achieved on each of a large number of independent SharpNEAT runs, each of which terminates after one minute of execution (clock-time). Histograms are also provided comparing the evaluation counts achieved in each 60 second run, and mean genome complexity (see Efficacy Sampling for a more detailed explanation).

The PC hardware used to run these tests is listed at the bottom of the page; and is new compared to the hardware used for previous releases. However, the data used here for the v2.4.4 release was obtained on the new hardware, therefore any differences in Efficacy are due to software differences (a) between the v4.0.1 and v2.4.4 SharpNEAT releases, and (b) between the legacy .NET Framework and .NET [Core] 7.

Eight CPU cores were used these test runs, this is an increase from the four cores used in previous Efficacy Sampling runs for previous releases. This change reflects the wider availability of higher core counts in consumer PC hardware.

As in previous releases, the two problem tasks used for comparing efficacy are the Binary 11-Multiplexer, and Generative Sinewave. Binary 11-Multiplexer uses acyclic neural networks, and Generative Sinewave uses cyclic networks.


Results and Observations

Evaluation Count Histograms

For both problem tasks the evaluation count histograms show significant shifts to the right, with the histogram modes (peaks) shifting from around 550k to 1.1M for the binary11 task, and from about 1.3M to 4M for the sinewave task. So roughly a doubling in the number of genome evaluations within each 60 second run, on average. The histogram shapes remain similar, although the binary11 histogram has broadened out somewhat, and the sinewave task histogram has a long tail to the right, with at least one evaluation count over 11M. This long tail was evident previously (see SharpNEAT 2.4.3), but the tail seems to be even more extended now.

Best Fitness Histograms

The binary11 fitness histograms are very similar in shape between the two SharpNEAT versions, but with a significant shift to the right for v4.0.1, with the mode increasing from a fitness of about 1830 to 1935. Also note that the right hand tail of the v4.0.1 histogram is very close (or indeed equal to) to the maximum fitness score for this task (max = 2048). This suggests that in future this task may start to saturate at the right hand side of the histogram, and we may need a new more difficult task for measuring efficacy of SharpNEAT.

The sinewave task histogram has already begun to saturate at the right hand side of the histogram, with the max fitness for this task being 1000. This issue was already becoming evident in release v2.4.3 (the last release that efficacy sampling was performed on) using the older hardware platform and four CPO cores, and this issue has become more pronounced with the upgrade in hardware, .NET platform, SharpNEAT improvements, and higher CPU core counts. This task wil need to be replaced with a more difficult task for future releases.

Mean Complexity Histograms

The sinewave task histograms show a shift to the right for the v4.0.1 release, with the histogram shape broadly similar between v2.4.4 and v4.0.1. The shift to the right is likely due to the accumulation of redundant nodes and connections, caused by the increased number of generations achieved in each 60 second run, as these test runs have pruning disabled.

The binary11 task histograms show a change in shape, and a shift to the left (i.e., smaller genomes) for the v4.0.1 release compare to v2.4.4. The v4.0.1 histogram is less broad. The reason for this difference is not clear, it may be the result of the increased number of generations per 60 second run, or some difference in the NEAT algorithm implementation between the v2.4.4 and v4.0.1 releases. A similar but less pronounced shift was observed previously (see SharpNEAT 2.4.3)


Figure 1.
Comparison of best fitness histograms obtained from SharpNEAT v2.4.4 and v4.0.1;
on the Binary11 Multiplexer and Generative Sinewave tasks.

Figure 2.
Comparison of evaluation count histograms obtained from SharpNEAT v2.4.4 and v4.0.1;
on the Binary11 Multiplexer and Generative Sinewave tasks.

Figure 2.
Comparison of population mean complexity histograms obtained from SharpNEAT v2.4.4 and v4.0.1;
on the Binary11 Multiplexer and Generative Sinewave tasks.



Appendix 1: Test Platform Environment Details

CPU / Hardware
Software Platform

Appendix 2: Resources

R Scripts
Histogram CSV data

Colin,
August 6th, 2023



Copyright 2023 Colin Green.
This article is licensed under a Creative Commons Attribution 3.0 License