-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathchromosomebuilder.cpp
43 lines (37 loc) · 912 Bytes
/
chromosomebuilder.cpp
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
#include "chromosomebuilder.h"
#include<iostream>
using namespace std;
ChromosomeBuilder::ChromosomeBuilder()
{
//ctor
}
ChromosomeBuilder::ChromosomeBuilder(const ChromosomeBuilder& other)
{
//copy ctor
this->population = other.getPopulation();
this->count = other.getCount();
}
void ChromosomeBuilder::setCount(int n)
{
this->count = n;
}
int ChromosomeBuilder::getCount() const
{
return this->count;
}
vector<Chromosome> ChromosomeBuilder::getPopulation() const
{
return this->population;
}
void ChromosomeBuilder::generate(vector<TestSequence> TSList, int mcount)
{
int size = TSList.size();
this->setCount(size);
Chromosome C;
for(int i =0; i<size; i++)
{
C.generate(TSList,mcount);
// cout<<" "<<C[i].getWeight()<<" "<<C[i].getFitness()<<" "<<C[i].getMessageCount()<<endl<<endl;;
(this->population).push_back(C);
}
}