Commit 3520a2d5 by Jean-Romain Garnier

Change graph axis to normalized BER

parent 48c53100
 ... ... @@ -205,7 +205,7 @@ def compare(rounds, N, Pmax, step, niter_basin): Pmin0, BERmin0 = local_min(Pmin0, bounds, constraints=cons) time_d0 = time.time() - t0 times[i, 0] = time_d0 bers[i, 0] = BERmin0 bers[i, 0] = BERmin0 / N # Second method: Same as the first, but implemented in Python t1 = time.time() ... ... @@ -213,7 +213,7 @@ def compare(rounds, N, Pmax, step, niter_basin): Pmin1, BERmin1 = local_min(Pmin1, bounds, constraints=cons) time_d1 = time.time() - t1 times[i, 1] = time_d1 bers[i, 1] = BERmin1 bers[i, 1] = BERmin1 / N # Third method: Finding global min with the basinhopping method x0 = np.zeros(N) ... ... @@ -222,7 +222,7 @@ def compare(rounds, N, Pmax, step, niter_basin): Pmin2, BERmin2 = global_min(x0, bounds, constraints=cons, niter=niter_basin, step=step) time_d2 = time.time() - t2 times[i, 2] = time_d2 bers[i, 2] = BERmin2 bers[i, 2] = BERmin2 / N # fourth method: Plain gradient descent t3 = time.time() ... ... @@ -230,7 +230,7 @@ def compare(rounds, N, Pmax, step, niter_basin): Pmin3, BERmin3 = local_min(Pmin3, bounds, constraints=cons) time_d3 = time.time() - t3 times[i, 3] = time_d3 bers[i, 3] = BERmin3 bers[i, 3] = BERmin3 / N return times, bers ... ... @@ -251,17 +251,17 @@ def plot_results(times, bers): ax2.set_xlabel("Round") ax2.set_ylabel("Average min BER found") ax2.plot(x, [averageBers[0]] * rounds, c="tab:green", markersize=0, linestyle="dashed", label="Average BER (custom)") ax2.plot(x, [averageBers[2]] * rounds, c="tab:purple", markersize=0, linestyle="dashed", label="Average BER (Basin Hopper)") ax2.plot(x, [averageBers[0]] * rounds, c="tab:green", markersize=0, linestyle="dashed", label="Normalized average BER (proposed)") ax2.plot(x, [averageBers[2]] * rounds, c="tab:purple", markersize=0, linestyle="dashed", label="Normalized average BER (Basin-Hopping)") # Times ax1.set_xlabel("Round") ax1.set_ylabel("Time (s)") ax1.plot(x, times[:, 0], c="tab:blue", marker="x", linestyle="none", label="Time (custom)") ax1.plot(x, times[:, 0], c="tab:blue", marker="x", linestyle="none", label="Time (proposed)") ax1.plot(x, [averageTimes[0]] * rounds, c="tab:blue", markersize=0, linestyle="dashed") ax1.plot(x, times[:, 2], c="tab:orange", marker="x", linestyle="none", label="Time (Basin Hopper)") ax1.plot(x, times[:, 2], c="tab:orange", marker="x", linestyle="none", label="Time (Basin-Hopping)") ax1.plot(x, [averageTimes[2]] * rounds, c="tab:orange", markersize=0, linestyle="dashed") ax1.legend(loc="upper left") ... ... @@ -300,3 +300,5 @@ if __name__ == "__main__": "times": list(averageTimes), "bers": list(averageBers) } print(results)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!