-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrastrigin.py
More file actions
35 lines (22 loc) · 755 Bytes
/
rastrigin.py
File metadata and controls
35 lines (22 loc) · 755 Bytes
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
"""
File: rastrigin.py
By Peter Caven, peter@sparseinference.com
Description:
Rastrigin test function for the Stepping Stone Search Algorithm.
See: http://coco.gforge.inria.fr/
"""
import numpy
from numpy import *
from sss import Optimize
def Rastrigin(x):
return (10.0 * (len(x) - sum(cos(2.0 * pi * x)))) + dot(x,x)
optimum = Optimize( Rastrigin,
dimensions = 100,
lowerDomain = -5.0,
upperDomain = 5.0,
maxMutations = 2,
maxIndexes = 2,
gamma = 0.9999,
minImprovements = 3,
popSize = 20,
maxIterations = 1000000)