//-----------------------------------Run---------------------------------- // // This is the function that starts everything. It is mainly another // windows message pump using PeekMessage instead of GetMessage so we // can easily and dynamically make updates to the window while the GA is // running. Basically, if there is no msg to be processed another Epoch // is performed. //------------------------------------------------------------------------ void CgaBob::Run() { //The first thing we have to do is create a random population //of genomes CreateStartPopulation(); m_bBusy = true; }
void EnumKare::Run(HWND hwnd) { CreateStartPopulation(); m_bBusy = true; //int i; //for (i = 0; i < 500; i++) //{ // Epoch(); // if (m_bBusy == false) // { // return; // } //} //i = 0; }
void GAMachine::Update(float dt) { // Find best out of the maximum tries, then start over if (generations > NUM_MAX_GENERATIONS) { WriteSolution(); // Reset CreateStartPopulation(); Reset(); } liveCount = 0; for (int i = 0; i < POPULATION_SIZE; i++) { if (!Session->ships[i]->active) continue; parent->UpdatePerceptions(dt, i); ApplyBehaviorRule(i); UpdateFitness(i); } if (!liveCount) SetupNextGeneration(); }