Download presentation
Presentation is loading. Please wait.
Published byLawrence Osborne Modified over 9 years ago
2
GA Applications Peaks function C- code GOAT package for MATLAB minimization and maximization Traveling Salesman Problem genotype and phenotype encoding customizing operators rankscaling Hillis Sorting Problem Sequence Alignment Floating point GAs Constraint optimization Multi-objective optimization The schemata theorem
3
Components of binary GA in Feature Selection Problem: max R 2 110101 111111 000000 f 1 = 0.60 f 2 = 0.30 f 3 = 0.10 0.6 0.3 0.1 110101 000000 Crossover point 111111 000000 111100 000011 Crossover Selection Population Fitness Selected gene 111111111110 Mutation Selected Population Mutated gene R 2 = Goodness of fit
4
Genetic Operators
12
Traveling Salesman Problem
24
void main(int argc, char *argv[]) {char mombassa[80], root[80]; data b; double alpha, beta; //user data int num_cities; MATRIX distances; Container box; //user data to objective function in box double (* fptr) (data*, VECTOR); //function pointer to objective fnctn genotype pop; fptr = Salesman3; MatrixAllocate(&distances, 500, 500); userData(&b, &box); // tells pointer of userdata in data struct for b Read_User_Data(&alpha, &beta, &num_cities, distances); box.pop = &pop; box.alpha = alpha; box.beta = beta; box.num_cities = num_cities; box.distances = distances; if (argc == 2) strcpy( mombassa, argv[1]); Allocate_GA(&pop, &b, argc, mombassa, root, fptr); b.print_flag=0; Loop_GA(&b, &pop, root, fptr); Write_User_Data(&b, &pop, root, fptr); De_Allocate_GA(&pop, &b, root, fptr); MatrixFree(distances, 500); }
25
double Salesman2(data *a, VECTOR x) { int i, isum=0;double tour= 0, pen1=0, pen2=0; double alpha, beta;int num_cities, one, two, help; Container * box = (Container *)(a->ud); alpha = box->alpha; beta = box->beta; num_cities = box->num_cities; help = num_cities/2*(num_cities-1); if (num_cities%2 == 1) help = help+num_cities%2; for (i = 0; i < num_cities-1;i++) { one = (int) x[i]; two = (int) x[i+1]; tour = tour + box->distances[one][two]; } one = (int) x[num_cities-1]; two = (int) x[0]; tour = tour + box->distances[one][two]; for (i = 0; i < num_cities;i++) isum += (int) x[i]; if (isum!=help) pen1=alpha; getche(); box->penn1=pen1; box->penn2=pen2; return tour + pen1; }
26
SCHEMATA THEOREM (Holland) h(i) raw fitness for population sample i f(i) = normalized fitness f(i) = h(i)/Σh(i) A schema denotes a set of substrings that have identical values at certain loci: 1#101 = {10101, 11101} m(S,t) number of scheme exemplars in pop at generation t Number of schema of inividual S present in next generation is proportional to chance of an individual being picked that has the schema according to: m(S,t+1) = m(S,t) n f(S)/Σf = m(S,t) f(S)/f ave = m(S,t) f ave (1+c) m(S,t+1) = m(S,0) (1+c) t Better than average schemata grow exponentially
27
Partially Mapped Crossover
28
Genetic Algorithm cycle Initial Population Evaluation Selection Elitist strategyNext Generation Crossover Mutation Selected Population Parents Offspring Parents Evaluation Rank selection Fitness proportional Tournament Make sure that best individual survives
29
Note: In the plot, fitnesses are plotted as (1-R 2 ) and The problem can be thought as a minimization.
30
Source: A. Yasri and D. Hartsough, Toward an Optimal Procedure for Variable Selection and QSAR Model Building J. Chem. Inf. Comput. Sci. 2001 Vol. 41, No.5, pp. 1218-1227.
31
Search space in feature selection A data set with 10 features
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.