diff --git a/exec/marseille_execution_time_scaling.cpp b/exec/marseille_execution_time_scaling.cpp index fbf12de983daa8b9c2c69fe0bc276578fcf12149..2abf387994f6b0e60e30723afa8475785ba215c9 100755 --- a/exec/marseille_execution_time_scaling.cpp +++ b/exec/marseille_execution_time_scaling.cpp @@ -10,10 +10,10 @@ int main() { std::ofstream data_log("output/marseille_execution_time_scaling.csv"); data_log << std::fixed << std::setprecision(6); - data_log << "wastelands " - << "local_inc " - << "greedy_dec " - << "MIP " << std::endl; + data_log << "wastelands," + << "local_inc," + << "greedy_dec," + << "mip" << std::endl; std::vector<int> nbs_wastelands; for(int i = 10; i <= 200; i += 10) nbs_wastelands.push_back(i); diff --git a/marseille_execution_time_scaling.pdf b/marseille_execution_time_scaling.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d2bcf42df6a0b298b61506ed3d9867b37424c924 Binary files /dev/null and b/marseille_execution_time_scaling.pdf differ diff --git a/plot_scripts/marseille_execution_time_scaling.py b/plot_scripts/marseille_execution_time_scaling.py new file mode 100755 index 0000000000000000000000000000000000000000..f9cb3d205e760e9b22294c674a85c83ee4de874b --- /dev/null +++ b/plot_scripts/marseille_execution_time_scaling.py @@ -0,0 +1,62 @@ +import matplotlib.pyplot as plt +import csv +import numpy as np +import statistics + +def readCSV(file_name, delimiter=','): + file = csv.DictReader(open(file_name), delimiter=delimiter) + return list([row for row in file]) + +rows = readCSV('output/marseille_execution_time_scaling_tmp.csv') + + +x_datas = [int(float(row["wastelands"])) for row in rows] + +def get_datas(name, linstyle, maker_size, t): + return ((name, (linstyle,maker_size)), (x_datas, + np.array([float(row[t])/1000 for row in rows]) )) + +datas = [ + get_datas("local incremental", "s-",6, "local_inc"), + get_datas("greedy decremental", "o-",6, "greedy_dec"), + get_datas("MIP", "P-",6, "mip") +] + + +fig_size = plt.rcParams["figure.figsize"] +fig_size[0] = 10 +fig_size[1] = 5 +plt.rcParams["figure.figsize"] = fig_size + +# plt.subplots_adjust(left=0.100, right=0.95, top=0.92, bottom=0.150) + +plt.rcParams.update({'font.size': 16}) + +xmin = min(x_datas) +xmax = max(x_datas) + +plt.xlim(xmin , xmax) + +ymin = 0 +ymax = max([float(row["mip"])/1000 for row in rows]) +yrange = ymax - ymin + +y_border_percent = 7.5 +y_bottom = ymin - y_border_percent * yrange / 100 +y_top = ymax + y_border_percent * yrange / 100 + +plt.ylim(y_bottom, y_top) + + +# plt.title("quebec-{}-{}-ECA value vs available budget.pdf".format(orig, median)) +plt.ylabel('computation time in seconds', rotation=90, fontweight ='bold') +plt.xlabel("number of unbuilt lots", fontweight ='bold') + +for ((label,(linestyle,marker_size)),(xdatas,ydatas)) in datas: + plt.plot(xdatas, ydatas, linestyle, markersize=marker_size, label=label) + +legend = plt.legend(loc='upper left', shadow=True, fontsize='medium') + +plt.tight_layout() +plt.show() +plt.savefig("output/marseille_execution_time_scaling_tmp.pdf", dpi=500) \ No newline at end of file