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

basic_example   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 22
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
9
# we will run 10 repetitions of Grey Wolf Optimizer against Pinter benchmark function
10
for i in range(10):
11
    # first parameter takes dimension of problem
12
    # second parameter is population size
13
    # third parameter takes the number of function evaluations
14
    # fourth parameter is benchmark function 
15
    algorithm = GreyWolfOptimizer(10, 20 , 10000, 'pinter')
16
        
17
    # running algorithm returns best found minimum
18
    best = algorithm.run()
19
20
    # printing best minimum
21
    print(best)
22