static void end_or_check_next_dir (CcnetProcessor *processor, SeafileGetfsProcPriv *priv) { if (check_end_condition (priv)) { seaf_debug ("Get fs end.\n"); ccnet_processor_send_update (processor, SC_END, SS_END, NULL, 0); ccnet_processor_done (processor, TRUE); return; } if (priv->worker_running) { return; } /* Trigger checking the next dir. */ char *next_dir_id = g_queue_pop_head (priv->inspect_queue); if (next_dir_id) { if (check_fs_tree_from (processor, next_dir_id) < 0) { transfer_task_set_error (((SeafileGetfsProc *)processor)->tx_task, TASK_ERR_DOWNLOAD_FS); ccnet_processor_send_update (processor, SC_SHUTDOWN, SS_SHUTDOWN, NULL, 0); ccnet_processor_done (processor, FALSE); } g_free (next_dir_id); } }
void GA::evolve() { // create initial population (generation 0) std::cout << "-- Generation 0 of " << m_generation_max << " ..." << std::endl; m_generation = 0; m_population.resize(m_population_size); m_last_population.resize(m_population_size); for (unsigned int i=0; i<m_population_size; i++){ m_population[i] = new Individual(); for (auto &var : m_variables) { m_population[i]->add_cut(get_random_cut(var)); } } evaluate_fitness(); show_best(); // loop step until condition is satisfied while (check_end_condition()) { m_generation++; std::cout << "-- Generation " << m_generation << " of " << m_generation_max << " ..." << std::endl; step(); show_best(); } std::cout << std::endl; long total_calc = 1; for (auto &var : m_variables) { total_calc *= var.bins; } std::cout << "-- Number of calculations = " << hist_z->GetNbins() << " of " << total_calc << std::endl; output.close(); // make plots std::cout << "-- Doing some plots..." << std::endl; plots(); }