Skip to content

Commit

Permalink
Merge pull request anyoptimization#270 from ahcheriet/develop
Browse files Browse the repository at this point in the history
Adding DF benchmarks
  • Loading branch information
blankjul authored May 2, 2022
2 parents 7a22e24 + 2977613 commit 78e325d
Show file tree
Hide file tree
Showing 199 changed files with 38,555 additions and 30,892 deletions.
426 changes: 400 additions & 26 deletions pymoo/problems/dynamic/df.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/problems/test_correctness.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def load(name, suffix=[]):

try:
F = anp.loadtxt(os.path.join(path, "%s.f" % name))

T = anp.loadtxt(os.path.join(path, "%s.t" % name))
CV = None
if os.path.exists(os.path.join(path, "%s.cv" % name)):
CV = anp.loadtxt(os.path.join(path, "%s.cv" % name))

except:
return X, None, None

return X, F, CV
return X, F, T, CV
39 changes: 26 additions & 13 deletions tests/problems/test_problems_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

problems = [
('DF1', [10, 5]), ('DF2', [10, 5]), ('DF3', [10, 5]), ('DF4', [10, 5]), ('DF5', [10, 5]),
('DF5', [10, 5]), ('DF6', [10, 5]), ('DF7', [10, 5]), ('DF8', [10, 5]), ('DF9', [10, 5]),
('DF6', [10, 5]), ('DF7', [10, 5]), ('DF8', [10, 5]), ('DF9', [10, 5]),
('DF10', [10, 5]), ('DF11', [10, 5]), ('DF12', [10, 5]), ('DF13', [10, 5]), ('DF14', [10, 5])
]

Expand All @@ -22,26 +22,39 @@ def test_problems(name, params):

problem = get_problem(name, nt=nt, taut=taut)

X, F, _ = load(name, suffix=["DF"])
X, F, T, _ = load(name, suffix=["DF"])

if F is None:
print("Warning: No correctness check for %s" % name)
return

_F = problem.evaluate(X)
_F = []
i = 0
for x_i in X:
problem.tau = T[i]
f_i = problem.evaluate(x_i)
_F.append(f_i)
i += 1
_F = np.array(_F)

np.testing.assert_allclose(_F, F)


@pytest.mark.parametrize('name,params', problems)
def test_pf(name, params):
nt, taut = params
problem = get_problem(name, nt=nt, taut=taut)

path = path_to_test_resource("problems", "DF")

pf = np.loadtxt(join(path, "%s.pf" % name))

_pf = problem.pareto_front(n_pareto_points=len(pf))
nt, taut = 5, 1

path = path_to_test_resource("problems", "DF", "PF")
for tau in range(1,11):
problem = get_problem(name, nt=nt, taut=taut)
file = name+'-'+str(tau)+'-'+str(taut)+'-'+str(nt)+".pf"
pf = np.loadtxt(join(path, file))
if pf is not None and pf.shape[1] == 2:
pf = pf[np.argsort(pf[:, 0])]
problem.tau = tau
if pf is not None and pf.shape[1] == 2:
pf = pf[np.argsort(pf[:, 0])]
_pf_t = problem.pareto_front(n_pareto_points=200)
if _pf_t is not None and _pf_t.shape[1] == 2:
_pf_t = _pf_t[np.argsort(_pf_t[:, 0])]
np.testing.assert_allclose(pf, _pf_t)

np.testing.assert_allclose(_pf, pf)
300 changes: 100 additions & 200 deletions tests/resources/problems/DF/DF1.f
Original file line number Diff line number Diff line change
@@ -1,200 +1,100 @@
0.8286755102965013 2.808464560883719
0.6687726781642587 3.927018596628819
0.9692121842804707 2.980580596815244
0.1986609973367482 3.400275451774079
0.4634608955126422 2.8790678815284
0.5091027811814903 2.27464200032346
0.638747054199412 5.344945047560493
0.177711904764401 3.755542385145602
0.7425417369431535 3.645225000159002
0.4394039834999491 3.795640512625018
0.01226627738261892 4.364039584162431
0.7030114453107914 3.082941157651935
0.2850773161385158 4.64253712533448
0.7872328239557584 4.155950228749015
0.7838684770902707 4.000583252050184
0.4607464073878638 4.514086190476804
0.5208078017515423 3.230393096482638
0.01637393944266579 5.222428272493627
0.710956408248521 4.162660946560929
0.3656750128022357 2.984782365486389
0.6563512347153695 3.176644447531547
0.4786102639106415 2.864810508584223
0.996743131022824 3.007858528892704
0.2851016994880836 3.298979628755922
0.869700900387857 4.055105066121357
0.141305846340739 3.558609874764329
0.4146828996943631 3.241607548755689
0.4172282382975787 3.584783331925038
0.1234381578223458 2.839597527660447
0.2988838087984942 3.569516748315441
0.0295820151592489 4.606561544687499
0.534403942571082 3.756620516707691
0.6707159313217114 3.711687058112352
0.2884434068612716 1.925949164149846
0.845030070563881 2.532554561119004
0.5996523422247115 2.835407984651281
0.05989604367837457 3.823005030117066
0.0004250645423083288 3.936117744292753
0.3381823383119798 2.667983241425271
0.5359740194848818 4.587818607719622
0.1398601835732468 4.199020900644538
0.06150402934976777 4.177886054684381
0.4685051144263397 4.390447824496277
0.4304413939902104 5.008509225247359
0.1715977250494599 5.255029453992165
0.3809854483193814 2.518959769905547
0.2617029700090732 2.922482688979078
0.9482373563502561 4.282047455706909
0.3829818903304888 3.92237031532773
0.02267183272852484 3.369546473589803
0.2393238137075123 2.719280058318531
0.5884789043924102 2.785023515061381
0.3000507483911226 3.892778129875402
0.7084280351136818 3.588503494360606
0.00769608829853512 3.68017961065472
0.7427724629128559 3.775016816296274
0.3768649624696802 4.837990897121012
0.297246856522663 4.37956538132506
0.1963321845432862 4.816698989745356
0.5205789355498468 3.127397138105664
0.8057581412941297 2.875496880788707
0.6907874184033695 6.094565910036692
0.5960041166841243 3.110678213372094
0.4159110204742124 2.587232500176875
0.3673612114285128 4.880136542764515
0.6669168490247895 2.27884739608808
0.7109375198902045 2.772459847388843
0.6595816712509003 3.843608044137439
0.03599816016745243 3.3667061244856
0.6604036132797592 2.068333469526332
0.5037995151193856 3.751515657510942
0.9702793812265453 4.716287210624054
0.9375506665739973 3.352044443742183
0.1239163406403071 3.764735123395814
0.6400316251177476 2.231051854733495
0.4483080086548137 4.651605499604213
0.2668086348283311 3.040674641357545
0.833010370506668 1.548365967429798
0.4124261963405985 3.070374771741846
0.8989956832380549 4.35645810360294
0.4700472876796246 2.737574118620989
0.2136834519617972 4.55084666001526
0.5679479332239143 3.143811353766106
0.9763481168742651 2.822607707209802
0.1333568046629641 3.995769759128227
0.7999724781096146 3.058499624229551
0.2230054387162004 2.730317116287822
0.5553632963540446 3.5686169525153
0.3868666506822941 5.628845555902807
0.8166078856664919 4.651895376994158
0.8943416973677795 3.669740565405244
0.733858460597123 4.173501458486848
0.6099541895679429 3.162708931134531
0.9384666682004859 4.547737181741253
0.7769307113133213 2.217828841126475
0.02336571612657683 5.221790574438886
0.7666936436818806 3.142489314868496
0.5126746779539832 4.336263167659265
0.8459027645970344 2.879950394143767
0.6844445703362698 5.022798339247476
0.5266185468364359 4.071705594544461
0.6066457648016658 4.521104522377478
0.1632902715596439 5.37851620753604
0.8024301810630646 2.121935840992654
0.1068922465189005 4.295786752415113
0.646175702302618 3.194301951155882
0.7077661793626829 3.295143211654427
0.2950387429336236 4.277986068189083
0.8028054889969241 4.608975978336614
0.3293271934639685 5.190173700486491
0.04117974018606045 4.639226575680947
0.2013002652254826 4.271742508495318
0.4565218471397104 2.407891493243594
0.300795908874837 2.776096044332622
0.2713524692459456 3.747020261690864
0.9976248012505464 2.521571520058942
0.2096516337240477 3.372305422064373
0.1553769864977128 3.515860241798455
0.5650980943990673 4.38563257467659
0.9016873687210405 3.224527986318015
0.7864798308897358 2.955486731371329
0.3136634378793889 2.206745466563979
0.8787075643831403 3.97621468318204
0.07122473605273043 4.543208959004399
0.3299584826214843 2.534334088308452
0.5653642142287024 3.903313008535232
0.2013339130286504 4.26131771390537
0.50422565968752 1.874092543563731
0.7835607575781237 4.282279631598209
0.9535201762876025 2.95751688443552
0.4994659313828808 3.789800359895212
0.1852106997400092 3.832856732297975
0.0836514618971707 4.335893362333813
0.6582622988213912 3.700641445458281
0.5374743521414584 2.588853648622668
0.9045221133432957 4.05156880230173
0.9237409877225824 4.575714603987517
0.2082987393009249 5.061681542388306
0.1328240800083898 5.072618657047125
0.5087847527790402 1.944030016374316
0.9518973208221164 4.085770085033321
0.9356024053476789 3.740938891348144
0.9189713119430968 4.769999263666468
0.09183897177158655 4.79688315670491
0.7009719203677492 4.243312321458693
0.5056494010012648 4.351021598401567
0.8214366133293449 4.101722005265219
0.6698219838666676 2.385395203207573
0.2010580347075219 3.576266418109402
0.5454129684248666 2.677996454602241
0.643862073128416 2.220350044777799
0.4849045097894002 3.206840308836278
0.8667383013842032 2.356238002992223
0.005149113561518192 3.685080415212241
0.8246920780511476 2.335032623885157
0.3307931205379293 4.561369396224167
0.8650773519401936 2.911640285747058
0.9193744868938193 3.656217949947664
0.7527100330633896 3.761921694988478
0.3754581925213235 5.408113464574253
0.8184902551913034 3.886468674179014
0.4135553451803488 4.680474479939404
0.3774420982619954 2.581555682987724
0.2475385729090862 5.634716310050159
0.7210329243332331 3.157565578033813
0.7239053549518052 2.706787835032935
0.6242731691069829 5.16650340754238
0.9646097629483725 2.703953213827483
0.5951220451757452 3.330845610646215
0.6909539203392897 3.743468316687192
0.405898927734683 3.619395492443872
0.2078827486850084 3.856880912759861
0.2811710272460039 5.646071107631569
0.04565048764893813 3.243921916903284
0.421464484424729 4.666605745223526
0.4272665137351448 2.837608543246643
0.7473410004897239 4.65845789776879
0.5237656407564073 6.17469739297108
0.5298569939015659 2.755328034162447
0.5760629839624246 4.080304764555152
0.9745090641259619 2.694848619347854
0.7686082132217671 5.147915675387983
0.5652349708404679 4.157672780254111
0.8540084968136566 3.251849489003384
0.9225979469462757 2.915520215532834
0.07676942175143324 4.460867894695643
0.56718448676519 4.813826095801606
0.3347795929813888 5.068923332516523
0.9342601181349747 4.536039335200125
0.3043021518647404 5.006516228768822
0.718303964656182 3.767024617698492
0.3747594557921402 3.743117432120235
0.139257086613972 3.952739142142481
0.8745148012538874 4.551494415585058
0.6730461138872176 4.173002399721786
0.5785617474315027 3.876293389622017
0.4960147757434232 5.860446818379996
0.5026082859657376 3.617041902609381
0.8231756184900452 2.402325193747724
0.8932691642679048 2.480444308409304
0.6915779559733687 2.931006390645023
0.4742880374107515 1.793244913654621
0.3336671785583621 1.568612146888875
0.9614799151199348 2.170202124961051
0.6122232596493308 3.196123968795788
0.9752421133569804 1.260580975509424
0.6246482334837707 1.061031363879771
0.1726886651574669 3.132636044267863
0.8781969960991821 3.714602154790688
0.7843581955890283 2.255970992519272
0.5038104870365526 2.499732807648524
0.9259214277822611 3.056556117769305
0.5119857630367156 1.457725692448192
0.7957549616899832 1.045175921457576
0.7736525717550823 1.16600361100918
0.2229600601711608 2.961057399524909
0.2674590548657363 1.887797463207696
0.620765914027937 3.67081234412015
0.2740867418943706 1.945279754423716
0.09268121474888628 2.879877140877576
0.1899965687031996 2.228510330928401
0.8066053870159483 2.166210665952487
0.09647179451860748 2.659683521643481
0.2179598236466401 1.283344799333605
0.268904709081188 1.575765165979176
0.5211288072948426 2.394536957925245
0.7910587527952474 2.349008302144106
0.8429113136879169 2.644888706279684
0.361767688957743 3.000551451002077
0.3196713456686502 1.818594068876336
0.4164521884014913 1.270473664517258
0.1251315733401281 3.000320309132594
0.478285196830098 1.219542156468453
0.5944694719930239 1.492435418204197
0.738323169679635 1.785485790950258
0.197751768600025 1.576314643677682
0.6915508636474644 1.918635457439199
0.6275296070545815 2.16628178264231
0.1576269664565964 4.1256509137508
0.6141478739475145 4.863268644102632
0.6134692993332431 1.449427146099478
0.461274174393815 3.519405602670924
0.2249879232276522 3.987840009321933
0.4541436445805961 1.828322185804978
0.1487235845016449 1.603924785547933
0.04569178622421592 2.244281098519093
0.6654775542573477 1.925596662381883
0.7849067822597817 0.9073677730336234
0.2015997592796727 3.444995812652492
0.6561560161420044 2.955325537676635
0.7814382409901531 1.475352207530791
0.2563810530091223 2.570196259214509
0.6473283120450775 1.636773482396315
0.4901226122522407 4.385042881051437
0.837593035298245 1.744997274653685
0.812478019728293 0.9751095442933366
0.1589452907545 4.23133738288829
0.5178867399327015 1.169729592845662
0.4496951907454785 2.583746995648992
0.5028334449127393 1.164981049527306
0.5403576285164565 1.627192492741068
0.9559095587790398 5.109705081831889
0.5554798646318875 4.046369598843746
0.1663923757345642 1.594889685996254
0.9083570304694046 3.21967751814602
0.6387090344409747 3.124924788681569
0.8912861573878222 3.691776341809745
0.7546933102779492 1.299406396472177
0.02320490107785016 1.467729623629947
0.7058474622191716 1.892636676327609
0.4617655681273937 1.36030469229989
0.6597293586808209 1.79570188961335
0.6700391063754936 2.380376760498042
0.5804643953618385 2.133753047475394
0.3794072969034161 3.583308594955551
0.6085290191384768 1.653943787796233
0.2142488266610786 4.012788407800746
0.3450035062072015 2.084558689451845
0.9302944737762718 2.829307710516076
0.4966667253922523 1.99287244573024
0.8982241945338109 2.052781401983602
0.1038542506348841 2.971893369193857
0.2058392286954043 2.429207869939736
0.03457424502821697 3.950449957944318
0.4160446771636571 1.293918537058321
0.2056124680618681 3.499430274726586
0.2206573522078865 2.869067899912868
0.06602716145834735 1.815658998862991
0.9031535278774155 1.2129632811993
0.9733408060834216 1.574590543860823
0.9718236450368226 0.8059332290402649
0.6467733994102743 4.564136859999627
0.3462101097935095 4.789672765292521
0.7848709067180425 3.082422243049726
0.9150591045250384 0.8676105756514534
0.1198209394550372 3.307711966488914
0.1177048164680893 1.908969593519124
0.06316721946474461 2.216433888804423
0.5873950739354871 1.976149181674213
0.3755538318161849 1.822154863012941
Loading

0 comments on commit 78e325d

Please sign in to comment.