FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NEToolKit/NEToolKitExamples/src/random_evolution.cpp at master · CBenoit/NEToolKit · GitHub
This repository was archived by the owner on Jul 1, 2021. It is now read-only.
CBenoit
/
NEToolKit
Public archive
Notifications
You must be signed in to change notification settings
Fork
2
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
NEToolKit
/
NEToolKitExamples
/
src
/
random_evolution.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (25 loc) · 919 Bytes
Breadcrumbs
NEToolKit
/
NEToolKitExamples
/
src
/
random_evolution.cpp
Copy path
File metadata and controls
31 lines (25 loc) · 919 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
include
<
netkit/neat/neat.h
>
#
include
<
netkit/neat/parameters.h
>
#
include
<
netkit/neat/species.h
>
#
include
"
random_evolution.h
"
void
run_random_evolution
() {
std::cout <<
"
Starting a random NEAT evolution (random fitness on each generation).
"
<< std::endl;
netkit::parameters params;
params.
initial_population_size
=
10
;
params.
compatibility_threshold
=
1
;
netkit::neat
neat
(params);
neat.
init
();
for
(
unsigned
int
gen =
0
; gen <
10
; ++gen) {
while
(neat.
has_more_organisms_to_process
()) {
netkit::organism org = neat.
generate_and_get_next_organism
();
org.
set_fitness
(
rand
() /
1000000.0
);
}
neat.
update_best_genome_ever
();
std::cout <<
"
\n\n
======== Here's the generation
"
<< gen <<
"
's population. =========
"
<< std::endl;
for
(netkit::species& spec : neat.
get_all_species
()) {
spec.
update_stats
();
std::cout << spec << std::endl;
}
neat.
epoch
();
//
go to next generation
}
}
Back
|
FazBrowse Home
|
New Git URL