diff --git a/calmapf/include/log.hpp b/calmapf/include/log.hpp index 239d17f..cefa2f4 100644 --- a/calmapf/include/log.hpp +++ b/calmapf/include/log.hpp @@ -39,5 +39,5 @@ struct Log { void make_step_log(const Instance& ins, const std::string& output_name, const double comp_time_ms, const std::string& map_name, const int seed, const bool log_short = false); void make_life_long_log(const Instance& ins, std::string visual_name); void make_throughput_log(uint index, uint* start_cnt, uint make_span); - void make_csv_log(double cache_hit_rate, uint make_span, std::vector* step_percentiles, bool failure); + void make_csv_log(double cache_hit_rate, uint make_span, std::vector* step_percentiles, uint ngoals, bool failure); }; \ No newline at end of file diff --git a/calmapf/src/log.cpp b/calmapf/src/log.cpp index d867cdd..fdadb3a 100644 --- a/calmapf/src/log.cpp +++ b/calmapf/src/log.cpp @@ -304,10 +304,10 @@ void Log::make_throughput_log(uint index, uint* start_cnt, uint make_span) } } -void Log::make_csv_log(double cache_hit_rate, uint make_span, std::vector* step_percentiles, bool failure) +void Log::make_csv_log(double cache_hit_rate, uint make_span, std::vector* step_percentiles, uint ngoals, bool failure) { if (!failure) { - csv_output_handler << cache_hit_rate << "," << make_span << "," << (*step_percentiles)[0] << "," << (*step_percentiles)[2] << "," << (*step_percentiles)[6] << std::endl; + csv_output_handler << cache_hit_rate << "," << make_span << "," << (double)ngoals / (double)make_span << "," << (*step_percentiles)[0] << "," << (*step_percentiles)[2] << "," << (*step_percentiles)[6] << std::endl; } else { csv_output_handler << "fail to solve" << std::endl; diff --git a/main.cpp b/main.cpp index 5bf0fad..14348e4 100644 --- a/main.cpp +++ b/main.cpp @@ -62,7 +62,7 @@ int main(int argc, char* argv[]) // Failure if (solution.empty()) { - log.make_csv_log(.0, 0, nullptr, true); + log.make_csv_log(.0, 0, nullptr, parser.num_goals, true); console->error("failed to solve"); return 1; } @@ -105,7 +105,7 @@ int main(int argc, char* argv[]) } log.make_life_long_log(ins, parser.output_visual_file); - log.make_csv_log(total_cache_rate, makespan, &step_percentiles, false); + log.make_csv_log(total_cache_rate, makespan, &step_percentiles, parser.num_goals, false); return 0; } diff --git a/tools/experiment.py b/tools/experiment.py index b15e8c6..5f0eeb6 100644 --- a/tools/experiment.py +++ b/tools/experiment.py @@ -54,7 +54,7 @@ def check_and_create_csv(output_csv_path: str): csv_path.parent.mkdir(parents=True, exist_ok=True) # Create the file and write the header with open(csv_path, 'w') as csv_file: - csv_file.write("map_name,cache,look_ahead,delay_deadline,goal_generation_type,ngoals,nagents,seed,verbose,time_limit_sec,goals_m,goals_k,cache_hit_rate,makespan,p0_steps,p50_steps,p99steps\n") + csv_file.write("map_name,cache,look_ahead,delay_deadline,goal_generation_type,ngoals,nagents,seed,verbose,time_limit_sec,goals_m,goals_k,cache_hit_rate,makespan,throughput,p0_steps,p50_steps,p99steps\n") def check_and_create_throughput(output_throughput_path: str): # Convert string path to Path object for easier handling