danielpower1859 / HebbianEvolution

Code to run LV simulation with Hebbian evolution
MIT License
0 stars 0 forks source link

Grade success by "% of answers finding global optimum" #1

Closed danielpower1859 closed 8 years ago

danielpower1859 commented 8 years ago

For Max2 Sat problem. A difficulty is a confusing spike just befor ethe system finds the global optimum. Also the y axis values are distacting.

Try using % finding global minima first!!! :-)

danielpower1859 commented 8 years ago

def percentage_matching_value_timeseries(something_over_evo_time, value, savename = False, x_label = False, y_label = False): import numpy as np import matplotlib.pyplot as plt

count_value = []
for i in something_over_evo_time:
    listed = list(i)
    count_value.append( listed.count(value) )

fig = plt.figure(figsize = (6, 6))
ax = fig.add_subplot(1,1,1)
ax.scatter( range(len(count_value)) , count_value)
ax.set_xlim(0,)

if y_label:
    ax.set_ylabel(y_label)
if x_label:
    ax.set_xlabel(x_label)

if savename:
    plt.savefig(savename)
    print("saved image to {}".format(savename))
    plt.close()
else:
    plt.show()

return count_value