|
46 | 46 | N_GENERATIONS = 300 |
47 | 47 | PENALTY_FITNESS = -10.0 |
48 | 48 |
|
49 | | -# neat-python's CTRNN uses a single fixed time constant for all nodes. |
50 | | -# The Julia version evolves per-node time constants (mean=1.0, range [0.01, 5.0]). |
51 | | -# We use the Julia mean as the fixed value. |
52 | | -TIME_CONSTANT = 1.0 |
53 | | - |
54 | 49 | # --------------------------------------------------------------------------- |
55 | 50 | # Module-level globals for parallel evaluation |
56 | 51 | # Set by main() before the ParallelEvaluator pool is created so that forked |
@@ -208,7 +203,7 @@ def eval_genome(genome, config): |
208 | 203 |
|
209 | 204 | Returns negative mean squared error (evolution maximizes toward zero). |
210 | 205 | """ |
211 | | - net = neat.ctrnn.CTRNN.create(genome, config, TIME_CONSTANT) |
| 206 | + net = neat.ctrnn.CTRNN.create(genome, config) |
212 | 207 | net.reset() |
213 | 208 |
|
214 | 209 | n_steps = len(_train_inputs) |
@@ -238,7 +233,7 @@ def evaluate_on_test(winner, config, test_input, target_rows): |
238 | 233 | Returns (mse, predictions) where predictions is a list of output vectors |
239 | 234 | in normalized space. |
240 | 235 | """ |
241 | | - net = neat.ctrnn.CTRNN.create(winner, config, TIME_CONSTANT) |
| 236 | + net = neat.ctrnn.CTRNN.create(winner, config) |
242 | 237 | net.reset() |
243 | 238 |
|
244 | 239 | n_steps = len(test_input) - 1 |
@@ -452,7 +447,7 @@ def main(): |
452 | 447 | print(f'After subsampling: {TRAIN_STEPS // SUBSAMPLE} train points, ' |
453 | 448 | f'{TEST_STEPS // SUBSAMPLE} test points') |
454 | 449 | print(f'Evolution: {N_GENERATIONS} generations, pop_size=150') |
455 | | - print(f'CTRNN: time_constant={TIME_CONSTANT} (fixed, all nodes)') |
| 450 | + print(f'CTRNN: per-node time constants (evolved)') |
456 | 451 | print(f'Workers: {num_workers}') |
457 | 452 | print() |
458 | 453 |
|
|
0 commit comments