-
Notifications
You must be signed in to change notification settings - Fork 0
/
rastrigin.html
72 lines (58 loc) · 2.68 KB
/
rastrigin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!-- Local files containing the website icon and stylesheet. -->
<link rel="stylesheet" type="text/css" href="theme.css">
<!--<link rel="stylesheet" type="text/css" href="https://sagecell.sagemath.org/static/sagecell_embed.css">-->
<!-- Imports needed to use the Sage cell server. -->
<script type="text/javascript" src="https://sagecell.sagemath.org/static/jquery.min.js"></script>
<script type="text/javascript" src="https://sagecell.sagemath.org/embedded_sagecell.js"></script>
<!--<script>sagecell.makeSagecell({"inputLocation": ".sage"});</script>-->
<!--<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="embedded_sagecell.js"></script>-->
<script type="text/javascript" src="sagecell.js"></script>
<script type="text/javascript" src="sage-text.js"></script>
<!-- Additional CSS customizations -->
<style type="text/css"></style>
<!-- Page title -->
<title>Vaganov-Shashkin Growth Model</title>
</head>
<body>
<h1>Vaganov-Shashkin Growth Model</h1>
<p>It's coming!
<!--<div class="sagecell-plot" id="sagecell2"><script type="application/sage">-->
<div class="sagecell-auto-hide">
<script type="application/sage">
import numpy as np
#http://www.math.usm.edu/perry/old_classes/mat305sm14/interactive_worksheets.pdf
#http://docs.scipy.org/doc/scipy/reference/optimize.html
import scipy.optimize
import math
import matplotlib.cm
def fitnessRastrigin(x):
"""
In mathematical optimization, the Rastrigin function is a non-convex function used as a performance test problem for optimization algorithms.
"""
A=np.array(x)
return 10.*len(A) + sum(A^2-10.*np.cos(2.*n(pi)*A))
def fitnessRastrigin2(x,y):
return fitnessRastrigin([x,y])
def rosen2(x,y):
return scipy.optimize.rosen([x,y])
var('y');
#print matplotlib.cm.datad.keys()
@interact
def rastrigin_contour_plot(f=selector(values=[fitnessRastrigin2(x,y), rosen2(x,y)], label="Select Test Function"),
x_range=range_slider(-10,10,1,(-5,5), label='X-Y Range'),
plotpoints=('Value of plot_points',[50,100, 250,500, 750]),
color_map = selector(matplotlib.cm.datad.keys(),default = 'hsv'),
fill_box=checkbox(True, 'Fill'), color_bar=checkbox(False, 'Color Bar')):
xmin, xmax = x_range
show(contour_plot(f, (x,xmin, xmax), (y,xmin, xmax),
plot_points=plotpoints, fill=fill_box, contours=15, colorbar=color_bar,
cmap=color_map, axes=False, frame=True))
</script>
</div>
<script type="text/javascript">sageFooter()</script>
</body>
</html>