void FabMapCalculator::RecordConfigParamsToFile(string output_path, double dfTimeTaken) { //Record standard parameters RecordConfigParamsToFile(output_path); //Now add time taken std::ofstream params_file((output_path + "config.params").c_str(),ofstream::out | ofstream::app); if(dfTimeTaken > 60.0) { params_file << endl << "Finished. Total time " << setprecision(3) << ((dfTimeTaken - fmod(dfTimeTaken,60.0))/60.0) << " minutes " << fmod(dfTimeTaken,60.0) << " seconds." << endl; } else { params_file << endl << "Finished. Total time " << dfTimeTaken << " seconds." << endl; } params_file.close(); }
void FabMapCalculator::RecordConfigParamsToFile(string output_path) { //Keep a record of what parameters we ran the algorithm with. std::ofstream params_file((output_path + "config.params").c_str()); params_file << "Mode: " << mp_RankingFunction->DescribeRankingFunction() << endl; params_file << "p(observe | exists) = " << p_observe_given_exists << endl; params_file << "p(observe | !exists) = " << p_z_1_given_e_0[0] << endl; params_file << "p(at new place) = " << p_at_new_place << endl; params_file << "Likelihood Smoothing Factor: " << m_df_likelihood_smoothing_factor << endl; //Prior params_file << mp_PriorProvider->DescribePrior(); //Sampler params_file << "Sampler: "; if(mp_Sampler->DescribeSampler() == "MEAN FIELD") { params_file << "(No Sampling. Mean Field Approximation.)" << endl; } else { params_file << mp_Sampler->DescribeSampler() << endl; params_file << "Minimum Number Of Samples Used: "; if(mp_Sampler->FiniteSampler() && (m_nMinNumSamples<m_nMaxSamples)) { params_file << m_nMinNumSamples << endl; } else { params_file << m_nMaxSamples << endl; } if(m_sAltSamplePath.size()>1) { params_file << "Alternate sampling file: " << m_sAltSampleFile << endl; } } //Data Association #ifdef ALLOW_DATA_ASSOCIATION params_file << "Data Association: ON" << endl; params_file << "Data Association Threshold: " << m_df_likelihood_smoothing_factor << endl; #else params_file << "Data Association: OFF" << endl; #endif //Keyframe detector params_file << "Keyframe Detector: " << mp_KeyframeDetector->DescribeKeyframeDetector() << endl; //Disallow local matches if(m_bDisallowLocalMatches) params_file << "Disallow Local Matches: " << m_nDisallowRegion << endl; else params_file << "Disallow Local Matches: OFF" << endl; //Number of images processed if(!m_bProcessAllScenes) { params_file << "Images Processed: First " << m_nMaxNumberOfScenesToProcess << endl; } else { params_file << "Images Processed: All" << endl; } //Blob response filter params_file << "Blob Response Filter: " << m_dfBlobResponseThreshold << endl; params_file.close(); }
// Load parameters from the given filename void load_parameters(const char* params_fname) { std::ifstream params_file(params_fname); std::string line; line = get_next_line(params_file, "grid_size"); grid_size = atoi(line.c_str()); line = get_next_line(params_file, "num_cycles"); num_cycles = atoi(line.c_str()); line = get_next_line(params_file, "growth_multiplier"); growth_multiplier = atof(line.c_str()); line = get_next_line(params_file, "global_death_rate"); global_death_rate = atof(line.c_str()); line = get_next_line(params_file, "all_die"); all_die = (atoi(line.c_str()) == 1); line = get_next_line(params_file, "report_to_screen"); report_to_screen = (atoi(line.c_str()) == 1); line = get_next_line(params_file, "log_fname"); log_fname = new char[strlen(line.c_str())]; strcpy(log_fname, line.c_str()); line = get_next_line(params_file, "output_fname"); output_fname = new char[strlen(line.c_str())]; strcpy(output_fname, line.c_str()); line = get_next_line(params_file, "output_interval"); output_interval = atoi(line.c_str()); line = get_next_line(params_file, "num_strains"); num_strains = atoi(line.c_str()); line = get_next_line(params_file, "strains_fname"); strains_fname = new char[strlen(line.c_str())]; strcpy(strains_fname, line.c_str()); line = get_next_line(params_file, "enable_antagonism"); enable_antagonism = (atoi(line.c_str()) == 1); line = get_next_line(params_file, "antagonism_table_fname"); antagonism_table_fname = new char[strlen(line.c_str())]; strcpy(antagonism_table_fname, line.c_str()); line = get_next_line(params_file, "use_real_growth"); use_real_growth = (atoi(line.c_str()) == 1); line = get_next_line(params_file, "growth_intercept"); growth_intercept = atof(line.c_str()); line = get_next_line(params_file, "growth_slope"); growth_slope = atof(line.c_str()); line = get_next_line(params_file, "food_source_rations"); food_source_rations = atoi(line.c_str()); line = get_next_line(params_file, "food_source_radius"); food_source_radius = atoi(line.c_str()); line = get_next_line(params_file, "food_source_spawn_rate"); food_source_spawn_rate = atof(line.c_str()); line = get_next_line(params_file, "start_population_per_strain"); start_population_per_strain = atoi(line.c_str()); line = get_next_line(params_file, "start_num_food_sources"); start_num_food_sources = atoi(line.c_str()); }