# Plot the results plt.figure(figsize=(10, 5), dpi=300) plt.ticklabel_format(useOffset=False) plt.plot(num_iterations_range, best_obj_list, label='Greedy algorithm') plt.axhline(y=prob.value, color='r', linestyle='--', label='Optimal solution (CVXPY)') plt.xlabel('Number of iterations') plt.xticks(num_iterations_range) plt.xscale("log") plt.ylabel('Best returns ($)') plt.title('Best returns found by the greedy algorithm for different numbers of iterations') plt.legend() plt.show()