17 if (ps) probe_tab = ps;
18 else probe_tab =
NULp;
23 probe_combi[i] = pc[i];
30 expected_children = exp;
32 life_counter = life_cnt;
36 delete [] probe_combi;
43 if (exp_child >= 1.0 ||
get_random(1, 100) <= 100 * exp_child) {
49 expected_children = 0.0;
63 quicksort(0, feld_laenge-1);
74 void probe_combi_statistic::quicksort(
long left,
long right) {
83 help = (left + right) / 2;
88 swap(& probe_combi[help2], & probe_combi[help]);
94 while (probe_combi[i]->probe_index < x) i++;
95 while (probe_combi[j]->probe_index > x) j--;
98 swap (& probe_combi[i], & probe_combi[j]);
115 if (get_dupl_pos() == -1)
132 print(probe_combi[i]);
134 printf(
"Fit:%f Expchil: %f\n", fitness, expected_children);
139 for (
int i=0; i<
length; i++)
146 if (expected_children - val > 0)
151 expected_children -= val;
153 if (expected_children < 0)
154 expected_children = 0;
190 int probe_combi_statistic::get_dupl_pos() {
193 for (
int i=0; i<length-1; i++)
194 if (probe_combi[i]->probe_index == probe_combi[i+1]->probe_index)
218 rand_no_of_cross = random_interval ?
get_random(1, random_interval) : 0;
220 for (
int i = 0; i < rand_no_of_cross; i++) {
221 rand_cross_pos1 =
get_random(0, random_interval);
222 rand_cross_pos2 =
get_random(0, random_interval);
224 swap(& probe_combi[rand_cross_pos1], & pcombi2->probe_combi[rand_cross_pos2]);
225 swap(& probe_combi[rand_cross_pos1], & probe_combi[random_interval]);
226 swap(& pcombi2->probe_combi[rand_cross_pos2], & pcombi2->probe_combi[random_interval]);
232 int change1, change2;
240 else change1 = get_dupl_pos();
243 else change2 = pcombi2->get_dupl_pos();
245 swap(&probe_combi[change1], &pcombi2->probe_combi[change2]);
256 expected_children = 0;
269 inline int probe_combi_statistic::modificated_hamming_dist(
int one,
int two) {
274 int i, j, k, mod_ham_dist;
276 double tolerated_non_group_hits, ham_dist;
282 for (i=0; i<len_of_field; i++)
284 probe_combi[i]->allowed_mismatches,
296 mod_ham_dist = modificated_hamming_dist(i, j);
303 for (j=0; j<FITNESSSCALEFACTOR && tolerated_non_group_hits >= 0.0; j++) {
304 tolerated_non_group_hits -= (double) ((
double)hammingarray[k] / (double)
FITNESSSCALEFACTOR);
309 if (tolerated_non_group_hits<0.0) {
310 if (j) ham_dist = (double)k - 1.0 + ((
double)(((double)j - 1.0)/(double)
FITNESSSCALEFACTOR));
311 else ham_dist = (double)k - 1.0;
316 fitness += ham_dist * ((
double) probe_tab->
get_group_tab(i));
319 delete [] hammingarray;
324 expected_children = fitness / average_fitness;
325 return expected_children;
void sigma_truncation(double average_fit, double dev)
unsigned char ** hamming_tab
double calc_fitness(int len_of_field)
probe ** get_probe_pool()
int calc_index_system3(int *field)
ProbeValuation * get_p_eval()
int sub_expected_children(double val)
bool ok_for_next_gen(int &len_roul_wheel)
void swap(probe **a, probe **b)
probe_combi_statistic(probe **pc=NULp, probe_tabs *ps=NULp, double exp=0, double fit=0, int lifec=MAXLIFEFORCOMBI)
probe_tabs * fill_Stat_Arrays()
double calc_expected_children(double average_fitness)
bool insert(probe_combi_statistic *sondenkombi, bool &result, int depth=0)
char ** get_sondenarray()
void put_Sonde(const char *name, int allowed_mis, double outside_mis)
void sort(long feld_laenge)
probe_combi_statistic * check_duplicates(GenerationDuplicates *dup_tree=NULp)
int get_non_group_tab(int j)
float outside_mismatches_difference
void crossover_Probes(probe_combi_statistic *pcombi2)
#define FITNESSSCALEFACTOR
double get_expected_children()
MO_Liste * Bakterienliste
#define MULTROULETTEFACTOR
probe_combi_statistic * duplicate()
int get_random(int min, int max)
#define SIGMATRUNCATION_CONST