问题描述:
遗传算法求Y=X*X最大值,求指导.
问题描述:
遗传算法求Y=X*X最大值,求指导.
/*Thisisasimplegeneticalgorithmimplementationwherethex05x05*/ /*evaluationfunctiontakespositivevaluesonlyandthex05x05*/ /*fitnessofanindividualisthesameasthevalueofthex05x05*/ /*objectivefunctionx05x05x05x05x05x05x05*/ // voidmain(void) { x05intx05i; x05if((galog=fopen("galog.txt","w"))==NULL) x05{ x05x05exit(1); x05} x05generation=0; x05fprintf(galog,"ngenerationbestaveragestandardn"); x05fprintf(galog,"numbervaluefitnessdeviationn"); x05initialize(); x05evaluate(); x05keep_the_best(); x05while(generation