-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.php
35 lines (30 loc) · 921 Bytes
/
run.php
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
32
33
34
35
<?php
require_once __DIR__ . '/vendor/autoload.php';
$population = \Charlie\Util\StringUtilities::createPopulationWithByteGenes([
'000000000',
'000100000',
'001000000',
'011000000',
'000100000',
'001000000',
'011001000',
'000100000',
'001001000',
'011001000',
'000100000',
'001001000',
'011000000',
'000100100',
'001010000',
'011010000',
]);
$randomizer = new \Charlie\Randomizer\MtRandomizer();
$problem = new \Charlie\Actions\Problem\Problem();
$problem->setCalculator(new \Charlie\Fitness\DummySumCalculator());
$problem->setCrossOver(new \Charlie\Actions\CrossOver($randomizer));
$problem->setMutator(new \Charlie\Actions\Mutator($randomizer));
$problem->setSelection(new \Charlie\Actions\PairSelection());
$problem->setPopulation($population);
$problem->setMaxEvolveCount(100);
$problem->solve();
echo (string) $problem->getPopulation() . PHP_EOL;