~ubuntu-branches/ubuntu/utopic/deap/utopic-proposed

« back to all changes in this revision

Viewing changes to doc/code/benchmarks/shekel.py

  • Committer: Package Import Robot
  • Author(s): Daniel Stender, Miriam Ruiz, Daniel Stender, Jakub Wilk
  • Date: 2014-07-06 00:03:41 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140706000341-s7gij1ki3d8xz6t9
Tags: 1.0.1-1
[ Miriam Ruiz ]
* New Upstream Release. Closes: #675200
* Upgraded Standards-Version from 3.9.2 to 3.9.5
* Switched to dh_python2
* Upgraded debian/compat to 9
* Added build-arch and build-indep targets to debian/rules
* Using awk to remove connection from the documentation to google analytics
* Using jquery.js and underscore.js from libjs-jquery and libjs-underscore
* Added patches/doc.patch

[ Daniel Stender ]
* deb/control:
  + Added myself to Uploaders.
  + Added version to b-p on python-all.
  + Updated Homepage.
  + Wrapped and sorted.
* deb/copyright:
  + Changed copyright file towards DEP-5.
  + Updated Source URI (project source moved to Github).
  + Added email addresses for copyright holders.
  + Dropped license for eap/toolbox.py (not included anymore).
  + Extended copyrights to 2014.
  + Added myself to copyrights for deb/*.
  + Specified license location.
* Added watch file [initial version by Jackson Doak].

[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from mpl_toolkits.mplot3d import Axes3D
 
2
from matplotlib import cm
 
3
from matplotlib.colors import LogNorm
 
4
import matplotlib.pyplot as plt
 
5
 
 
6
try:
 
7
    import numpy as np
 
8
except:
 
9
    exit()
 
10
 
 
11
from deap import benchmarks
 
12
 
 
13
#NUMMAX = 5
 
14
#A = 10 * np.random.rand(NUMMAX, 2)
 
15
#C = np.random.rand(NUMMAX)
 
16
 
 
17
A = [[0.5, 0.5], [0.25, 0.25], [0.25, 0.75], [0.75, 0.25], [0.75, 0.75]]
 
18
C = [0.002, 0.005, 0.005, 0.005, 0.005]
 
19
 
 
20
def shekel_arg0(sol):
 
21
    return benchmarks.shekel(sol, A, C)[0]
 
22
 
 
23
fig = plt.figure()
 
24
# ax = Axes3D(fig, azim = -29, elev = 50)
 
25
ax = Axes3D(fig)
 
26
X = np.arange(0, 1, 0.01)
 
27
Y = np.arange(0, 1, 0.01)
 
28
X, Y = np.meshgrid(X, Y)
 
29
Z = np.zeros(X.shape)
 
30
 
 
31
for i in xrange(X.shape[0]):
 
32
    for j in xrange(X.shape[1]):
 
33
        Z[i,j] = shekel_arg0((X[i,j],Y[i,j]))
 
34
 
 
35
ax.plot_surface(X, Y, Z, rstride=1, cstride=1,  norm=LogNorm(), cmap=cm.jet, linewidth=0.2)
 
36
 
 
37
plt.xlabel("x")
 
38
plt.ylabel("y")
 
39
 
 
40
plt.show()
 
 
b'\\ No newline at end of file'