-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample5.py
More file actions
26 lines (18 loc) · 754 Bytes
/
example5.py
File metadata and controls
26 lines (18 loc) · 754 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
# multiple run of each problem with random start point
from algormeter import *
import pandas as pd
def polyak(p, **kwargs):
p.randomSet(center=10,size=5)
for k in p.loop():
if p.gfXk.any():
p.Xkp1 = p.Xk - (p.fXk - p.optimumValue) * p.gfXk / (np.linalg.norm(p.gfXk)**2)
else:
p.Xkp1 = p.Xk
df, pv = algorMeter(algorithms = [polyak], problems = probList_covx, runs=50, iterations = 50, absTol=1E-2
# trace=True,
# dbprint = True
)
print('\n', df)
print('\n', pv)
df2 = df.groupby(['Algorithm','Problem','Dim','Status']).agg({'Status': 'count','Iterations':['min', 'max','mean'],'Delta':['min', 'max','mean']})
print('\n', df2)