Completed
Push — master ( cc7745...279fb5 )
by Grega
19s queued 17s
created

basic_customized_example   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 0
1
# This is temporary fix to import module from parent folder
2
# It will be removed when package is published on PyPI
3
import sys
4
sys.path.append('../')
5
# End of fix
6
7
from NiaPy.algorithms.basic import GreyWolfOptimizer
8
from NiaPy.benchmarks import Pinter
9
10
# initialize Pinter benchamrk with custom bound
11
pinterCustom = Pinter(-5, 5)
12
13
# we will run 10 repetitions of Grey Wolf Optimizer against Pinter benchmark function
14
for i in range(10):
15
    # first parameter takes dimension of problem
16
    # second parameter is population size
17
    # third parameter takes the number of function evaluations
18
    # fourth parameter is benchmark function 
19
    algorithm = GreyWolfOptimizer(10, 20 , 10000, pinterCustom)
20
21
    # running algorithm returns best found minimum
22
    best = algorithm.run()
23
24
    # printing best minimum
25
    print(best)
26