This repository has been archived by the owner on Sep 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
benchmarks.py
46 lines (32 loc) · 1.39 KB
/
benchmarks.py
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
# -*- coding: utf-8 -*-
"""
Python code of Spider-Monkey Optimization (SMO)
Coded by: Mukesh Saraswat (emailid: saraswatmukesh@gmail.com), Himanshu Mittal (emailid: himanshu.mittal224@gmail.com) and Raju Pal (emailid: raju3131.pal@gmail.com)
The code template used is similar to code given at link: https://github.com/himanshuRepo/CKGSA-in-Python
and C++ version of the SMO at link: http://smo.scrs.in/
Reference: Jagdish Chand Bansal, Harish Sharma, Shimpi Singh Jadon, and Maurice Clerc. "Spider monkey optimization algorithm for numerical optimization." Memetic computing 6, no. 1, 31-47, 2014.
@link: http://smo.scrs.in/
-- Benchmark.py: Defining the benchmark function along its range lower bound, upper bound and dimensions
Code compatible:
-- Python: 2.* or 3.*
Code further documented and explained by Repo maintainers
@nimishbongale
@tanisha0311
"""
import numpy
import math
# define the function blocks
def F1(x):
s=numpy.sum(x**2)
return s
#More objective functions can be inserted here
#Ex: def F1(x):
# s=numpy.sum(sin(x))
# return s
# define the function parameters
def getFunctionDetails(a):
# [name, lb, ub, dim, acc_err, obj_val]
param = { 0: ["F1",-100,100,30,1.0e-5,0],
}
# add values into param dict depending on which objective function to use and what are the parameters associated with it
return param.get(a, "nothing")