Skip to content

Instantly share code, notes, and snippets.

@PsichiX
Last active August 12, 2024 23:34
Show Gist options
  • Save PsichiX/b8b597309398dd778349c141479ab1be to your computer and use it in GitHub Desktop.
Save PsichiX/b8b597309398dd778349c141479ab1be to your computer and use it in GitHub Desktop.
NEAT - XOR
#[test]
fn test_neat_xor() {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
enum Input {
A,
B,
Control,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
struct Output;
const POPULATION: usize = 100;
const BREEDING_POPULATION: usize = 50;
const ITERATION_LIMIT: usize = 250;
fn run(genotype: &NeatGenotype<Input, Output>, input_a: bool, input_b: bool) -> Scalar {
let network = genotype.build_network(ClosureScoreMapping::new(|score| score.abs()));
network.write_to_input(&Input::A, input_a.into());
network.write_to_input(&Input::B, input_b.into());
for _ in 0..network.calculate_layers_depth() {
network.propagate();
}
network.read_from_output(&Output).unwrap()
}
fn evaluate_error(
genotype: &NeatGenotype<Input, Output>,
database_row: (bool, bool, bool),
) -> Scalar {
let output = run(genotype, database_row.0, database_row.1);
let expected = Scalar::from(database_row.2);
expected - output
}
fn calculate(genotype: &NeatGenotype<Input, Output>, input_a: bool, input_b: bool) -> bool {
let output = run(genotype, input_a, input_b);
output > 0.5
}
fn found_best_fitness(fitness: Scalar) -> bool {
(1.0 - fitness).abs() < 1.0e-4
}
let mut rng = rand::thread_rng();
let config = NeatEvolutionConfig::default().no_bias();
let database_xor = vec![
(false, false, false),
(false, true, true),
(true, false, true),
(true, true, false),
];
let mut genotypes_with_fitness = (0..POPULATION)
.map(|_| {
(
NeatGenotype::new(vec![Input::A, Input::B, Input::Control], vec![Output], &config),
Scalar::INFINITY,
)
})
.collect::<Vec<_>>();
let mut iteration = 0;
while iteration < ITERATION_LIMIT
&& !found_best_fitness(genotypes_with_fitness.first().unwrap().1)
{
iteration += 1;
for (genotype, fitness) in &mut genotypes_with_fitness {
*fitness = 1.0
- database_xor
.iter()
.copied()
.map(|row| {
let error = evaluate_error(genotype, row);
error * error
})
.sum::<Scalar>();
}
genotypes_with_fitness.sort_by(|(_, a), (_, b)| b.partial_cmp(&a).unwrap());
println!(
"=== ITERATION: {} | BEST / WORST FITNESS: {} / {}",
iteration,
genotypes_with_fitness.first().unwrap().1,
genotypes_with_fitness.last().unwrap().1
);
let mut new_genotypes_with_fitness = genotypes_with_fitness[..BREEDING_POPULATION]
.iter()
.map(|(a, _)| {
let b = &genotypes_with_fitness[rng.gen_range(0..genotypes_with_fitness.len())].0;
let mut offspring = a.crossover(b);
offspring.mutate(&config);
(offspring, Scalar::INFINITY)
})
.collect::<Vec<_>>();
new_genotypes_with_fitness.extend(
genotypes_with_fitness[..(POPULATION - BREEDING_POPULATION)]
.iter()
.cloned(),
);
genotypes_with_fitness = new_genotypes_with_fitness;
}
let genotype = &genotypes_with_fitness.first().unwrap().0;
println!(
"=== BEST GENOTYPE | HIDDEN NEURONS: {} | ENABLED CONNECTIONS: {}",
genotype
.nodes
.iter()
.filter(|node| matches!(node.kind, NeatNodeKind::Hidden))
.count(),
genotype
.connections
.iter()
.filter(|connection| connection.enabled)
.count()
);
for (input_a, input_b, _) in &database_xor {
println!(
"=== XOR of {} and {} gives {} output",
input_a,
input_b,
run(genotype, *input_a, *input_b)
);
}
for (input_a, input_b, result) in database_xor {
assert_eq!(
calculate(genotype, input_a, input_b),
result,
"XOR of {} and {} expects {}",
input_a,
input_b,
result
);
}
}
=== ITERATION: 1 | BEST / WORST FITNESS: -1 / -1
=== ITERATION: 2 | BEST / WORST FITNESS: -1 / -1
=== ITERATION: 3 | BEST / WORST FITNESS: -1 / -1
=== ITERATION: 4 | BEST / WORST FITNESS: -1 / -1
=== ITERATION: 5 | BEST / WORST FITNESS: -1 / -1
=== ITERATION: 6 | BEST / WORST FITNESS: -0.77527654 / -1
=== ITERATION: 7 | BEST / WORST FITNESS: -0.6146872 / -2.1546593
=== ITERATION: 8 | BEST / WORST FITNESS: -0.719288 / -1.6429732
=== ITERATION: 9 | BEST / WORST FITNESS: -0.7571602 / -1.5876913
=== ITERATION: 10 | BEST / WORST FITNESS: -0.48948193 / -1
=== ITERATION: 11 | BEST / WORST FITNESS: -0.5020149 / -1.1953132
=== ITERATION: 12 | BEST / WORST FITNESS: -0.22905111 / -20.290897
=== ITERATION: 13 | BEST / WORST FITNESS: 0.07739103 / -2.9985282
=== ITERATION: 14 | BEST / WORST FITNESS: 0.09491289 / -13.315895
=== ITERATION: 15 | BEST / WORST FITNESS: 0.76031196 / -15.741087
=== ITERATION: 16 | BEST / WORST FITNESS: 0.32262987 / -13.208592
=== ITERATION: 17 | BEST / WORST FITNESS: 0.09986532 / -4.289443
=== ITERATION: 18 | BEST / WORST FITNESS: 0.1768645 / -17.631378
=== ITERATION: 19 | BEST / WORST FITNESS: 0.019170642 / -3.8723822
=== ITERATION: 20 | BEST / WORST FITNESS: 0.40348208 / -7.036479
=== ITERATION: 21 | BEST / WORST FITNESS: 0.40348208 / -7.0565796
=== ITERATION: 22 | BEST / WORST FITNESS: 0.39127898 / -12.495049
=== ITERATION: 23 | BEST / WORST FITNESS: 0.4889984 / -1.6272259
=== ITERATION: 24 | BEST / WORST FITNESS: 0.47326005 / -3.5860252
=== ITERATION: 25 | BEST / WORST FITNESS: 0.6563167 / -1.8563883
=== ITERATION: 26 | BEST / WORST FITNESS: 0.8339354 / -1.1517768
=== ITERATION: 27 | BEST / WORST FITNESS: 0.7649915 / -1.6783717
=== ITERATION: 28 | BEST / WORST FITNESS: 0.67316794 / -1.0192618
=== ITERATION: 29 | BEST / WORST FITNESS: 0.67441106 / -0.5284028
=== ITERATION: 30 | BEST / WORST FITNESS: 0.9949678 / -1.019454
=== ITERATION: 31 | BEST / WORST FITNESS: 0.7534766 / -1.0628953
=== ITERATION: 32 | BEST / WORST FITNESS: 0.8869028 / -0.5593668
=== ITERATION: 33 | BEST / WORST FITNESS: 0.83167905 / -0.3755926
=== ITERATION: 34 | BEST / WORST FITNESS: 0.8143178 / -80.336845
=== ITERATION: 35 | BEST / WORST FITNESS: 0.8650736 / -0.6940869
=== ITERATION: 36 | BEST / WORST FITNESS: 0.9789191 / -1.8905182
=== ITERATION: 37 | BEST / WORST FITNESS: 0.8551229 / -0.6848457
=== ITERATION: 38 | BEST / WORST FITNESS: 0.9291055 / -4.2563963
=== ITERATION: 39 | BEST / WORST FITNESS: 0.93145704 / -0.3692392
=== ITERATION: 40 | BEST / WORST FITNESS: 0.93303585 / -15.9639015
=== ITERATION: 41 | BEST / WORST FITNESS: 0.9691829 / -0.69903743
=== ITERATION: 42 | BEST / WORST FITNESS: 0.91631943 / -1.2216873
=== ITERATION: 43 | BEST / WORST FITNESS: 0.92507714 / -3.067627
=== ITERATION: 44 | BEST / WORST FITNESS: 0.91115725 / -3.3743973
=== ITERATION: 45 | BEST / WORST FITNESS: 0.9376591 / -0.5115392
=== ITERATION: 46 | BEST / WORST FITNESS: 0.9800541 / -0.09357476
=== ITERATION: 47 | BEST / WORST FITNESS: 0.92869306 / -0.30724645
=== ITERATION: 48 | BEST / WORST FITNESS: 0.92009884 / -0.8996353
=== ITERATION: 49 | BEST / WORST FITNESS: 0.93555963 / -1.4952102
=== ITERATION: 50 | BEST / WORST FITNESS: 0.94319063 / -0.72674024
=== ITERATION: 51 | BEST / WORST FITNESS: 0.9468342 / -0.188555
=== ITERATION: 52 | BEST / WORST FITNESS: 0.94205993 / -0.38219666
=== ITERATION: 53 | BEST / WORST FITNESS: 0.9463292 / -0.1474551
=== ITERATION: 54 | BEST / WORST FITNESS: 0.938361 / -0.121810555
=== ITERATION: 55 | BEST / WORST FITNESS: 0.956379 / 0.28961855
=== ITERATION: 56 | BEST / WORST FITNESS: 0.9430545 / 0.32734317
=== ITERATION: 57 | BEST / WORST FITNESS: 0.9179625 / -1.5578644
=== ITERATION: 58 | BEST / WORST FITNESS: 0.9555326 / -0.020229578
=== ITERATION: 59 | BEST / WORST FITNESS: 0.9272536 / -1.5733156
=== ITERATION: 60 | BEST / WORST FITNESS: 0.96223295 / -0.2012639
=== ITERATION: 61 | BEST / WORST FITNESS: 0.95598793 / -7.2616577
=== ITERATION: 62 | BEST / WORST FITNESS: 0.95582336 / -1.7681453
=== ITERATION: 63 | BEST / WORST FITNESS: 0.958771 / -2.3179715
=== ITERATION: 64 | BEST / WORST FITNESS: 0.9451652 / 0.094531596
=== ITERATION: 65 | BEST / WORST FITNESS: 0.9577939 / -1.2577353
=== ITERATION: 66 | BEST / WORST FITNESS: 0.98501307 / -0.10553324
=== ITERATION: 67 | BEST / WORST FITNESS: 0.96191007 / -0.76195943
=== ITERATION: 68 | BEST / WORST FITNESS: 0.9826287 / -2.2291443
=== ITERATION: 69 | BEST / WORST FITNESS: 0.98173606 / -2.0454516
=== ITERATION: 70 | BEST / WORST FITNESS: 0.9844446 / -0.6278181
=== ITERATION: 71 | BEST / WORST FITNESS: 0.9835158 / -1.6172276
=== ITERATION: 72 | BEST / WORST FITNESS: 0.9889958 / -3.4045668
=== ITERATION: 73 | BEST / WORST FITNESS: 0.9803996 / -0.076897144
=== ITERATION: 74 | BEST / WORST FITNESS: 0.963093 / -2.769056
=== ITERATION: 75 | BEST / WORST FITNESS: 0.9835829 / 0.07392424
=== ITERATION: 76 | BEST / WORST FITNESS: 0.9844236 / -3.3423843
=== ITERATION: 77 | BEST / WORST FITNESS: 0.9771553 / -1.4461479
=== ITERATION: 78 | BEST / WORST FITNESS: 0.9807258 / 0.20117348
=== ITERATION: 79 | BEST / WORST FITNESS: 0.9879394 / -1.1532869
=== ITERATION: 80 | BEST / WORST FITNESS: 0.9895181 / -2.4408038
=== ITERATION: 81 | BEST / WORST FITNESS: 0.99007237 / -1.5658803
=== ITERATION: 82 | BEST / WORST FITNESS: 0.98797065 / -1.4214792
=== ITERATION: 83 | BEST / WORST FITNESS: 0.9969464 / 0.05078149
=== ITERATION: 84 | BEST / WORST FITNESS: 0.9976263 / -0.13607168
=== ITERATION: 85 | BEST / WORST FITNESS: 0.99899614 / -1.343051
=== ITERATION: 86 | BEST / WORST FITNESS: 0.9968658 / -27.577862
=== ITERATION: 87 | BEST / WORST FITNESS: 0.9918426 / -0.37656522
=== ITERATION: 88 | BEST / WORST FITNESS: 0.99633527 / -0.15949881
=== ITERATION: 89 | BEST / WORST FITNESS: 0.9934808 / -1.5857506
=== ITERATION: 90 | BEST / WORST FITNESS: 0.9919566 / -0.22426212
=== ITERATION: 91 | BEST / WORST FITNESS: 0.9887579 / -0.057300806
=== ITERATION: 92 | BEST / WORST FITNESS: 0.99441016 / -0.4983213
=== ITERATION: 93 | BEST / WORST FITNESS: 0.9914811 / -2.492352
=== ITERATION: 94 | BEST / WORST FITNESS: 0.9957861 / 0.32934403
=== ITERATION: 95 | BEST / WORST FITNESS: 0.9840609 / -41.704163
=== ITERATION: 96 | BEST / WORST FITNESS: 0.98589593 / -1.0703304
=== ITERATION: 97 | BEST / WORST FITNESS: 0.9939945 / -0.14733648
=== ITERATION: 98 | BEST / WORST FITNESS: 0.9981423 / -0.0080759525
=== ITERATION: 99 | BEST / WORST FITNESS: 0.9926878 / -6.5577283
=== ITERATION: 100 | BEST / WORST FITNESS: 0.9977119 / -4.052305
=== ITERATION: 101 | BEST / WORST FITNESS: 0.99558026 / -0.690344
=== ITERATION: 102 | BEST / WORST FITNESS: 0.99339515 / -0.24864817
=== ITERATION: 103 | BEST / WORST FITNESS: 0.9945372 / -1.1503634
=== ITERATION: 104 | BEST / WORST FITNESS: 0.99479795 / -0.27140093
=== ITERATION: 105 | BEST / WORST FITNESS: 0.9931784 / -0.31468678
=== ITERATION: 106 | BEST / WORST FITNESS: 0.99644065 / -0.36824894
=== ITERATION: 107 | BEST / WORST FITNESS: 0.99239326 / -38.0922
=== ITERATION: 108 | BEST / WORST FITNESS: 0.99645334 / -0.8733543
=== ITERATION: 109 | BEST / WORST FITNESS: 0.9963244 / -0.07598972
=== ITERATION: 110 | BEST / WORST FITNESS: 0.99664915 / -0.020259142
=== ITERATION: 111 | BEST / WORST FITNESS: 0.9967822 / -0.35305572
=== ITERATION: 112 | BEST / WORST FITNESS: 0.9938914 / -0.007534027
=== ITERATION: 113 | BEST / WORST FITNESS: 0.99492246 / 0.048149407
=== ITERATION: 114 | BEST / WORST FITNESS: 0.9996582 / -1.9726663
=== ITERATION: 115 | BEST / WORST FITNESS: 0.99217874 / 0.51301765
=== ITERATION: 116 | BEST / WORST FITNESS: 0.99699736 / -32.58771
=== ITERATION: 117 | BEST / WORST FITNESS: 0.99688065 / -9.589916
=== ITERATION: 118 | BEST / WORST FITNESS: 0.9878049 / -15.578215
=== ITERATION: 119 | BEST / WORST FITNESS: 0.9941331 / -0.44799578
=== ITERATION: 120 | BEST / WORST FITNESS: 0.9972992 / -0.8428805
=== ITERATION: 121 | BEST / WORST FITNESS: 0.9891333 / -1.2327137
=== ITERATION: 122 | BEST / WORST FITNESS: 0.9979143 / -3.9866724
=== ITERATION: 123 | BEST / WORST FITNESS: 0.99615616 / 0.17395818
=== ITERATION: 124 | BEST / WORST FITNESS: 0.9949004 / -8.804122
=== ITERATION: 125 | BEST / WORST FITNESS: 0.9983459 / -2.0997186
=== ITERATION: 126 | BEST / WORST FITNESS: 0.9946824 / -15.229124
=== ITERATION: 127 | BEST / WORST FITNESS: 0.98961955 / -2.8897245
=== ITERATION: 128 | BEST / WORST FITNESS: 0.99270827 / -149.8304
=== ITERATION: 129 | BEST / WORST FITNESS: 0.99826676 / -33.803917
=== ITERATION: 130 | BEST / WORST FITNESS: 0.9919423 / -2.6138685
=== ITERATION: 131 | BEST / WORST FITNESS: 0.9891548 / -3.4993243
=== ITERATION: 132 | BEST / WORST FITNESS: 0.98926157 / -3.2833304
=== ITERATION: 133 | BEST / WORST FITNESS: 0.9958627 / -0.76222396
=== ITERATION: 134 | BEST / WORST FITNESS: 0.9960577 / 0.3477016
=== ITERATION: 135 | BEST / WORST FITNESS: 0.9947052 / 0.42723137
=== ITERATION: 136 | BEST / WORST FITNESS: 0.9900437 / -7.581107
=== ITERATION: 137 | BEST / WORST FITNESS: 0.99868083 / -7.6897125
=== ITERATION: 138 | BEST / WORST FITNESS: 0.9965959 / -0.6538863
=== ITERATION: 139 | BEST / WORST FITNESS: 0.9941167 / 0.6842797
=== ITERATION: 140 | BEST / WORST FITNESS: 0.99502736 / 0.68481827
=== ITERATION: 141 | BEST / WORST FITNESS: 0.98961973 / -49.727844
=== ITERATION: 142 | BEST / WORST FITNESS: 0.9930149 / -6.7992716
=== ITERATION: 143 | BEST / WORST FITNESS: 0.99795187 / -0.93864524
=== ITERATION: 144 | BEST / WORST FITNESS: 0.99461293 / -4.6679235
=== ITERATION: 145 | BEST / WORST FITNESS: 0.99834186 / -6.2594995
=== ITERATION: 146 | BEST / WORST FITNESS: 0.99445504 / -15.4873295
=== ITERATION: 147 | BEST / WORST FITNESS: 0.989486 / -1.6600871
=== ITERATION: 148 | BEST / WORST FITNESS: 0.99759823 / 0.46681267
=== ITERATION: 149 | BEST / WORST FITNESS: 0.9960915 / -7.0655346
=== ITERATION: 150 | BEST / WORST FITNESS: 0.99911165 / 0.18898135
=== ITERATION: 151 | BEST / WORST FITNESS: 0.98667705 / -0.98602843
=== ITERATION: 152 | BEST / WORST FITNESS: 0.99389064 / -2.5075798
=== ITERATION: 153 | BEST / WORST FITNESS: 0.99696213 / -0.039386272
=== ITERATION: 154 | BEST / WORST FITNESS: 0.9918848 / -0.89846635
=== ITERATION: 155 | BEST / WORST FITNESS: 0.99405426 / 0.8219321
=== ITERATION: 156 | BEST / WORST FITNESS: 0.9923286 / 0.49010396
=== ITERATION: 157 | BEST / WORST FITNESS: 0.9894181 / 0.23324358
=== ITERATION: 158 | BEST / WORST FITNESS: 0.9963386 / -0.33920848
=== ITERATION: 159 | BEST / WORST FITNESS: 0.99483216 / -2.3522127
=== ITERATION: 160 | BEST / WORST FITNESS: 0.9885133 / -1.7530046
=== ITERATION: 161 | BEST / WORST FITNESS: 0.99321526 / -6.308146
=== ITERATION: 162 | BEST / WORST FITNESS: 0.993536 / -78.280556
=== ITERATION: 163 | BEST / WORST FITNESS: 0.9922665 / -110.02554
=== ITERATION: 164 | BEST / WORST FITNESS: 0.98611784 / -89.18123
=== ITERATION: 165 | BEST / WORST FITNESS: 0.99822325 / -0.0022864342
=== ITERATION: 166 | BEST / WORST FITNESS: 0.99595815 / 0.7278996
=== ITERATION: 167 | BEST / WORST FITNESS: 0.9982518 / 0.6019373
=== ITERATION: 168 | BEST / WORST FITNESS: 0.9966365 / 0.4172873
=== ITERATION: 169 | BEST / WORST FITNESS: 0.9921233 / -0.059296012
=== ITERATION: 170 | BEST / WORST FITNESS: 0.9956064 / 0.35352075
=== ITERATION: 171 | BEST / WORST FITNESS: 0.9968786 / -1.3593023
=== ITERATION: 172 | BEST / WORST FITNESS: 0.99696904 / -0.89991856
=== ITERATION: 173 | BEST / WORST FITNESS: 0.9955133 / 0.66656286
=== ITERATION: 174 | BEST / WORST FITNESS: 0.99580723 / -0.28597474
=== ITERATION: 175 | BEST / WORST FITNESS: 0.9960562 / 0.15888023
=== ITERATION: 176 | BEST / WORST FITNESS: 0.9954675 / -0.53440475
=== ITERATION: 177 | BEST / WORST FITNESS: 0.9970653 / -0.46772242
=== ITERATION: 178 | BEST / WORST FITNESS: 0.99887866 / -3.5369768
=== ITERATION: 179 | BEST / WORST FITNESS: 0.99739945 / -1.0385833
=== ITERATION: 180 | BEST / WORST FITNESS: 0.99914026 / 0.16119373
=== ITERATION: 181 | BEST / WORST FITNESS: 0.9965813 / -0.60991
=== ITERATION: 182 | BEST / WORST FITNESS: 0.9962695 / -21.809721
=== ITERATION: 183 | BEST / WORST FITNESS: 0.9991117 / -1.1610451
=== ITERATION: 184 | BEST / WORST FITNESS: 0.9960652 / 0.041486442
=== ITERATION: 185 | BEST / WORST FITNESS: 0.99743164 / -17.395899
=== ITERATION: 186 | BEST / WORST FITNESS: 0.9970113 / 0.59478736
=== ITERATION: 187 | BEST / WORST FITNESS: 0.99928963 / -0.8815472
=== ITERATION: 188 | BEST / WORST FITNESS: 0.99632424 / -15.000851
=== ITERATION: 189 | BEST / WORST FITNESS: 0.9989272 / 0.19280213
=== ITERATION: 190 | BEST / WORST FITNESS: 0.9989766 / -1.3211992
=== ITERATION: 191 | BEST / WORST FITNESS: 0.9986536 / 0.7821852
=== ITERATION: 192 | BEST / WORST FITNESS: 0.99502796 / -23.256474
=== ITERATION: 193 | BEST / WORST FITNESS: 0.99713856 / 0.8205371
=== ITERATION: 194 | BEST / WORST FITNESS: 0.99745315 / -1.7991717
=== ITERATION: 195 | BEST / WORST FITNESS: 0.9972739 / -2.6728163
=== ITERATION: 196 | BEST / WORST FITNESS: 0.99876976 / -1.427731
=== ITERATION: 197 | BEST / WORST FITNESS: 0.99745417 / -3.389948
=== ITERATION: 198 | BEST / WORST FITNESS: 0.99930245 / -22.922428
=== ITERATION: 199 | BEST / WORST FITNESS: 0.9993078 / -476.2104
=== ITERATION: 200 | BEST / WORST FITNESS: 0.9995587 / -0.29345047
=== ITERATION: 201 | BEST / WORST FITNESS: 0.99934566 / -1.1073918
=== ITERATION: 202 | BEST / WORST FITNESS: 0.9970461 / 0.08463848
=== ITERATION: 203 | BEST / WORST FITNESS: 0.9987593 / -0.84413016
=== ITERATION: 204 | BEST / WORST FITNESS: 0.9966223 / 0.59703785
=== ITERATION: 205 | BEST / WORST FITNESS: 0.99786246 / -0.899096
=== ITERATION: 206 | BEST / WORST FITNESS: 0.9992533 / 0.34784085
=== ITERATION: 207 | BEST / WORST FITNESS: 0.9971903 / 0.1928367
=== ITERATION: 208 | BEST / WORST FITNESS: 0.99908483 / -3.313078
=== ITERATION: 209 | BEST / WORST FITNESS: 0.99809074 / -6.998849
=== ITERATION: 210 | BEST / WORST FITNESS: 0.99893075 / 0.86757743
=== ITERATION: 211 | BEST / WORST FITNESS: 0.998181 / -1.4463239
=== ITERATION: 212 | BEST / WORST FITNESS: 0.9986515 / 0.85621035
=== ITERATION: 213 | BEST / WORST FITNESS: 0.998178 / 0.71746004
=== ITERATION: 214 | BEST / WORST FITNESS: 0.997443 / 0.34021294
=== ITERATION: 215 | BEST / WORST FITNESS: 0.9990577 / -8.971339
=== ITERATION: 216 | BEST / WORST FITNESS: 0.99829465 / -2.2977803
=== ITERATION: 217 | BEST / WORST FITNESS: 0.99912924 / -1.482861
=== ITERATION: 218 | BEST / WORST FITNESS: 0.9992513 / -16.225988
=== ITERATION: 219 | BEST / WORST FITNESS: 0.9990543 / -1.119792
=== ITERATION: 220 | BEST / WORST FITNESS: 0.9976783 / 0.11781579
=== ITERATION: 221 | BEST / WORST FITNESS: 0.9989179 / -0.5314524
=== ITERATION: 222 | BEST / WORST FITNESS: 0.99854004 / -56.526005
=== ITERATION: 223 | BEST / WORST FITNESS: 0.99900657 / -3.5795484
=== ITERATION: 224 | BEST / WORST FITNESS: 0.99949247 / -901.1904
=== ITERATION: 225 | BEST / WORST FITNESS: 0.9972263 / -4444.0625
=== ITERATION: 226 | BEST / WORST FITNESS: 0.99886614 / -5.6355567
=== ITERATION: 227 | BEST / WORST FITNESS: 0.9985014 / -5.4355454
=== ITERATION: 228 | BEST / WORST FITNESS: 0.9987717 / -8.361226
=== ITERATION: 229 | BEST / WORST FITNESS: 0.99734694 / 0.7313986
=== ITERATION: 230 | BEST / WORST FITNESS: 0.9977773 / 0.6460444
=== ITERATION: 231 | BEST / WORST FITNESS: 0.99673945 / -75.87164
=== ITERATION: 232 | BEST / WORST FITNESS: 0.9980572 / -45.824966
=== ITERATION: 233 | BEST / WORST FITNESS: 0.99685127 / -0.08714783
=== ITERATION: 234 | BEST / WORST FITNESS: 0.9982441 / -5.136134
=== ITERATION: 235 | BEST / WORST FITNESS: 0.99620765 / 0.755834
=== ITERATION: 236 | BEST / WORST FITNESS: 0.99691516 / -4.9575396
=== ITERATION: 237 | BEST / WORST FITNESS: 0.99853396 / -4.208933
=== ITERATION: 238 | BEST / WORST FITNESS: 0.99963456 / 0.762986
=== ITERATION: 239 | BEST / WORST FITNESS: 0.99753994 / -7.245514
=== ITERATION: 240 | BEST / WORST FITNESS: 0.99694264 / -21.700272
=== ITERATION: 241 | BEST / WORST FITNESS: 0.9994587 / -2.7539368
=== ITERATION: 242 | BEST / WORST FITNESS: 0.99770176 / -7.508706
=== ITERATION: 243 | BEST / WORST FITNESS: 0.9999694 / -1.7297435
=== ITERATION: 244 | BEST / WORST FITNESS: 0.9985262 / -1.186523
=== ITERATION: 245 | BEST / WORST FITNESS: 0.9993932 / -598.4546
=== ITERATION: 246 | BEST / WORST FITNESS: 0.99930966 / -1.5387571
=== ITERATION: 247 | BEST / WORST FITNESS: 0.99948794 / -1.5239258
=== ITERATION: 248 | BEST / WORST FITNESS: 0.99946415 / 0.81058824
=== ITERATION: 249 | BEST / WORST FITNESS: 0.99754417 / -0.5918579
=== ITERATION: 250 | BEST / WORST FITNESS: 0.999648 / -0.61270666
=== BEST GENOTYPE | HIDDEN NEURONS: 22 | ENABLED CONNECTIONS: 75
=== XOR of false and false gives 0 output
=== XOR of false and true gives 1.0014242 output
=== XOR of true and false gives 1.08766 output
=== XOR of true and true gives 0.058740254 output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment