Demo entry 6733072



Submitted by anonymous on Apr 16, 2018 at 15:27
Language: Python 3. Code size: 776 Bytes.

'''find min[F1, F2]'''

import matplotlib.pyplot as plt 

# Raw data
x = list(range(1,9))
F1 = [2,7,1,9,-3,5,13,6]
F2 = [7,2,15,0,-8,5,2,1]

#plot the scatter chart
plt.title("Task 1")
plt.scatter(x, F1)
plt.scatter(x, F2)

# plot the line chart
plt.plot(x, F1, label="f1")
plt.plot(x, F2, label="f2")
plt.legend(loc='upper left')

plt.annotate("F1 minimun", xy=(5,-3), xytext=(6,-3),
            arrowprops=dict(facecolor='blue', shrink=0.05))
plt.annotate("F2 minimun", xy=(5,-8), xytext=(6,-8),
            arrowprops=dict(facecolor='orange', shrink=0.05))
plt.vlines(5,-8,15,linestyles = "dashed")

# solution

'''It is easy to find that the minimum points are 
the place where X=5, and actually they are global optimum

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).