-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
46 lines (37 loc) · 1.29 KB
/
index.js
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
36
37
38
39
40
41
42
43
44
45
46
const { getRobiTestAveScore } = require('./utils');
const { simpleOptimizeGeneList } = require('./geneList');
const GA = require('./GA');
function testGeneListRun() {
const geneList = simpleOptimizeGeneList();
const score = getRobiTestAveScore(geneList);
console.log('GENE LIST:', geneList.join(''));
console.log('SCORE:', score);
return;
}
function testGaList() {
const ga = new GA();
const gaList = ga.getEvolvedGeneList(2000);
console.log('GENE LIST:', gaList.join(''));
const score = getRobiTestAveScore(gaList);
console.log('SCORE:', score);
}
function testMadeGaList() {
const strGaList = require('./ga_history.json')['2000'][0];
const gaList = strGaList
.split('')
.map(t => parseInt(t));
const score = getRobiTestAveScore(gaList);
console.log('GENE LIST:', strGaList);
console.log('SCORE:', score);
// console.log('-----------------------------')
// console.log(gaList[parseInt('21111', 3)]);
// console.log(gaList[parseInt('12111', 3)]);
// console.log(gaList[parseInt('11211', 3)]);
// console.log(gaList[parseInt('11121', 3)]);
// console.log(gaList[parseInt('11112', 3)]);
}
// testGaList();
console.log('-------------run simple optimize geneList-----------')
testGeneListRun();
console.log('-------------run GA geneList-----------')
testMadeGaList();