Modified code, prepare for pmap;
This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
import jax
|
|
||||||
from jax import numpy as jnp
|
|
||||||
|
|
||||||
from config import Config
|
|
||||||
from core import Genome
|
|
||||||
|
|
||||||
config = Config()
|
|
||||||
from dataclasses import asdict
|
|
||||||
|
|
||||||
print(asdict(config))
|
|
||||||
|
|
||||||
pop_nodes = jnp.ones((Config.basic.pop_size, Config.neat.maximum_nodes, 3))
|
|
||||||
pop_conns = jnp.ones((Config.basic.pop_size, Config.neat.maximum_conns, 5))
|
|
||||||
|
|
||||||
pop_genomes = Genome(pop_nodes, pop_conns)
|
|
||||||
|
|
||||||
print(pop_genomes)
|
|
||||||
print(pop_genomes[0: 20])
|
|
||||||
|
|
||||||
@jax.vmap
|
|
||||||
def pop_cnts(genome):
|
|
||||||
return genome.count()
|
|
||||||
|
|
||||||
cnts = pop_cnts(pop_genomes)
|
|
||||||
|
|
||||||
print(cnts)
|
|
||||||
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
from enum import Enum
|
|
||||||
from jax import jit
|
|
||||||
|
|
||||||
class NetworkType(Enum):
|
|
||||||
ANN = 0
|
|
||||||
SNN = 1
|
|
||||||
LSTM = 2
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@jit
|
|
||||||
def func(d):
|
|
||||||
return d[0] + 1
|
|
||||||
|
|
||||||
|
|
||||||
d = {0: 1, 1: NetworkType.ANN.value}
|
|
||||||
n = None
|
|
||||||
|
|
||||||
print(n or d)
|
|
||||||
print(d)
|
|
||||||
|
|
||||||
print(func(d))
|
|
||||||
@@ -27,8 +27,8 @@ if __name__ == '__main__':
|
|||||||
pop_size=10000
|
pop_size=10000
|
||||||
),
|
),
|
||||||
neat=NeatConfig(
|
neat=NeatConfig(
|
||||||
maximum_nodes=50,
|
maximum_nodes=20,
|
||||||
maximum_conns=100,
|
maximum_conns=50,
|
||||||
),
|
),
|
||||||
gene=NormalGeneConfig()
|
gene=NormalGeneConfig()
|
||||||
)
|
)
|
||||||
|
|||||||
37
paper.txt
37
paper.txt
@@ -1,37 +0,0 @@
|
|||||||
Abstract
|
|
||||||
Neuroevolution is a subfield of artificial intelligence that
|
|
||||||
leverages evolutionary algorithms to generate and optimize
|
|
||||||
artificial neural networks. This technique has proven to be
|
|
||||||
successful in solving a wide range of complex problems
|
|
||||||
across various domains. The NeuroEvolution of Augmenting
|
|
||||||
Topologies (NEAT) is one of the most renowned algorithms
|
|
||||||
in neuroevolution. Characterized by its openendedness, it
|
|
||||||
starts with minimal networks and progressively evolves both
|
|
||||||
the topology and the weights of these networks to optimize
|
|
||||||
performance. However, the acceleration techniques employed
|
|
||||||
in prevailing NEAT implementations typically rely on par-
|
|
||||||
allelism on CPUs, failing to harness the rapidly expand-
|
|
||||||
ing computational resources of today. To bridge this gap,
|
|
||||||
we present NEATAX, an innovative framework that adapts
|
|
||||||
NEAT for execution on hardware accelerators. Built on top
|
|
||||||
of the JAX, NEATAX represents networks with varying topo-
|
|
||||||
logical structures as tensors with the common shape, facili-
|
|
||||||
tating efficient parallel computation using function vectoriza-
|
|
||||||
tion. Upon rigorous testing across various tasks, we found
|
|
||||||
that NEATAX has the capacity to shrink the computa-
|
|
||||||
tion time from hours or even days down to a matter of
|
|
||||||
minutes. These results demonstrate the potential of NEATAX
|
|
||||||
as a scalable and efficient solution for neuroevolution tasks,
|
|
||||||
paving the way for the future application of NEAT in more
|
|
||||||
complex and demanding scenarios. NEATAX is available at
|
|
||||||
https://github.com/WLS2002/neatax
|
|
||||||
|
|
||||||
\section{Introduction}
|
|
||||||
|
|
||||||
Inspired by the principles of natural selection and genetic inheritance, Evolutionary Computation (EC) has emerged
|
|
||||||
as a powerful approach in the field of Artificial Intelligence (AI). EC exhibits a robust ability to explore vast
|
|
||||||
and complex solution spaces, which is particularly critical when tackling ``black box" optimization problems where the
|
|
||||||
internal structure isn't fully visible or understood. Leveraging the power of population-based search, EC navigates
|
|
||||||
these complexities to arrive at near-optimal solutions \cite{eiben2015introduction}. However, despite these strengths, recent scholarship has
|
|
||||||
highlighted limitations of EC. Important aspects such as ``openendedness" and ``genotype-to-phenotype mappings" warrant
|
|
||||||
further attention, especially in light of EC's tendency to rely on small populations and strong selection pressure \cite{miikkulainen_biological_2021}.
|
|
||||||
Reference in New Issue
Block a user