MOEAFramework / MOEAFramework

A Free and Open Source Java Framework for Multiobjective Optimization
http://moeaframework.org
Other
324 stars 128 forks source link

java.lang.IllegalArgumentException: Comparison method violates its general contract! #136

Closed VictorPih closed 1 year ago

VictorPih commented 6 years ago

The MOEAFramework throws an exception:

Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeLo(TimSort.java:777) at java.util.TimSort.mergeAt(TimSort.java:514) at java.util.TimSort.mergeForceCollapse(TimSort.java:457) at java.util.TimSort.sort(TimSort.java:254) at java.util.Arrays.sort(Arrays.java:1512) at java.util.ArrayList.sort(ArrayList.java:1454) at java.util.Collections.sort(Collections.java:175) at org.moeaframework.core.Population.sort(Population.java:283) at org.moeaframework.core.NondominatedSortingPopulation.sort(NondominatedSortingPopulation.java:161) at org.moeaframework.core.Population.truncate(Population.java:295) at org.moeaframework.core.NondominatedSortingPopulation.truncate(NondominatedSortingPopulation.java:170) at org.moeaframework.core.NondominatedSortingPopulation.truncate(NondominatedSortingPopulation.java:180) ...

It is a 5-objective problem. The population while calling population.truncate(populationSize) is shown as follows:

1.0105671214799175 0.0 0.0 0.0 0.04213025218571173 5.316366792786102E-4 1.3757367868736465 0.0 0.0 0.0 2.5922723109780236E-11 0.0 0.0 1.299853014823899E-7 1.1742401796595066 4.161477742756729E-19 0.0 6.970359301588486E-55 1.6923571353736486E-7 1.0155735441940257 0.07907180904191989 1.3760933623235927E-6 1.2363208731760553 5.826128776651097E-166 4.506495849143057E-152 1.4315766869008632E-40 8.132684884156017E-27 1.6705846720820934E-243 1.3281682342726587E-10 1.011277615112593 1.0164428331348268 0.0 0.0 0.0 0.0 3.69231011392166E-7 4.489804015876911E-167 1.8156971715855813E-118 1.3240109650289424 1.3867074001044323E-99 0.4014999384001007 2.3018756744622362E-179 9.252243429842374E-144 0.0 1.3865462359265972 4.811057468692301E-4 1.244975939663218 1.373519740526123E-149 0.41729516274332923 0.12188659847518846 0.07322339392464618 1.5612235622814712E-152 1.1448784515873505 9.633391744225287E-129 1.3882340108358552E-99 6.721097556371412E-5 0.03323090712337322 1.0191050479457078 0.006431128557691426 0.1755495736627543 1.669481375077618E-11 7.166327700442649E-172 2.4917365075105176E-223 1.0454221485941946E-7 1.2233307735341625 0.09038818836558946 1.138380745117461 0.0 0.5752776683295333 0.4157237584130579 0.13084861975071033 0.646910368954577 0.6624789095776614 0.0643250664799708 0.6386578150292926 9.023816980877426E-4 3.917807572945568E-229 5.549273351363419E-181 1.7146085309086401E-97 1.3453455718806457 0.5785567573826821 6.368603885338031E-6 0.8087194219083254 3.2838287616796564E-159 0.4076142215665818 0.6370413193616978 0.1583232428224891 9.172877440114223E-6 0.1823502433323335 0.8162587274830388 3.301712786249114E-7 4.21983764594002E-167 1.8189643143178372E-112 1.1839482051866563 0.0 0.5498372831436797 0.3926818468834295 1.0084409546835682E-212 0.15142019264004378 0.8051199691714634 0.5735552448058089 0.7818405537772454 0.32946798853041764 4.609516002169113E-263 0.0772029948520815 0.3189357855417298 1.340103767884085E-263 0.9535078611193193 0.0 0.3382464013010564 0.4953877795435566 0.9748196270475451 1.4322417182257244E-291 0.332613417755634 0.048788056828982226 0.35971920770011095 2.945989715593226E-263 0.27355301238415664 0.8549549657923271 0.3220571500454159 0.9299560174523601 0.25510429245383814 0.08281467045858946 0.48327828651602767 3.590238594127581E-109 0.006357365377549562 1.2948608729168647 0.05003260441905452 0.0 0.0 0.2987279044072701 0.1268002497372951 3.910892553310923E-203 0.929451261953894 0.4989846804867801 0.6408961148193771 0.45363026961782915 0.4369944277947326 0.524867687672386 0.02251781956578235 0.34425159746660444 1.0078390566915496 0.05137536210179544 0.0 0.4498923593519156 0.4480948778703229 0.7505338709641617 0.18868858509260103 0.4023192643677275 0.3111775547318176 0.03462351299784182 0.33197657368336086 8.246684444542122E-43 0.825463284951712 0.5243639817545184 1.2940108355926052E-4 0.030670031293694295 0.0 1.017147654030066 0.22698013801794967 0.04660913385106408 0.2168166794485362 1.810392465792207E-19 0.6612075509076457 0.7769795517888566 1.2453195209089553E-4 9.523847204320382E-268 9.602160267055332E-275 1.0894382155940776 7.724374679095022E-13 0.6167427774595143 4.9687797612685966E-179 4.608789551951298E-177 0.7389770707785138 0.37139332889501236 0.5200764868736295 0.0 3.365315501626569E-54 0.22014237536380993 0.8482837212771926 0.008260462464389133 0.6078187882093878 0.6101479728730396 0.08374584874414122 0.5895894790874011 0.07817824567124079 1.3605426036131767E-6 1.2223496353852208 2.1418114026124792E-155 1.4821724826961702E-99 0.5296376837299783 0.3076103752123002 0.6147772151809135 0.054149387732209904 0.5924241242295841 0.16174888507435578 0.4639156818133191 1.0664909156342728 1.5627242033099642E-218 5.154781497433044E-148 0.26265424436606166 1.120020306152856 0.5359807774390194 0.0 4.12835410515233E-146 0.25046738062823887 0.07832195172417872 4.4758945926220245E-110 0.13350872751331885 0.9815030460290002 0.02872303319938288 0.5068323858175274 0.6941402696302041 0.08361831002198128 0.5886915779986976 0.33579102028393965 0.9830696723529042 0.48400020037317615 0.0 0.14853682096576054 0.15374428020159528 0.44393680907900807 1.0819085317269108 0.0 0.0 0.8619545741925588 0.24344505306076364 9.88151840868354E-150 0.719701883610784 0.10665834716022578 0.45078440079204285 0.0 0.14674086943194203 0.8968587095457581 0.24164796065697938 0.48235958083036506 0.2801515379372504 0.641954961638996 0.053066142893645765 0.5805728291053208 0.869734423949381 0.0031203838875915125 0.216955035849753 0.6218429023221407 0.2535041535775621 0.14814386269628205 0.6863805279170357 1.4568349359982455E-17 0.0682769471467383 0.7714908376840376 0.9695974983948099 0.0031966672776525323 0.35662740372639834 1.2090667443293792E-4 0.009067683661901511 0.4471386692670584 0.7519157800407676 0.1926326406832694 0.5509143911117736 0.0 0.8028361497999197 0.5659260030913899 0.3612797268547151 1.224839422254707E-4 0.009185974612007212 0.023901433988855653 0.4217528395744822 0.592706796354756 0.4590705164600607 0.5874748827233203 0.8476030593244986 0.0 0.04139769844863975 0.05034384364777832 0.5792124649431084 1.884590928601567E-4 8.08969562479392E-165 5.2590071507778804E-154 1.1801228376735737 4.867336429323553E-187 0.3666996855633864 0.794509104370804 0.16390102674699797 0.4075964851656353 0.3131551215998927 0.43421735193649563 0.906451214664789 6.952290013215356E-142 6.590430233504245E-12 0.26887494421461783 0.6985532567069368 0.4031791569658613 9.683986669419512E-64 0.5753429137627967 0.37635138679755964 8.675434152906129E-5 0.016600142249950725 0.9204842048840719 7.5879436593878E-193 0.5305669393704134 0.014842071059779046 0.007910865162194533 0.8638096699630302 0.05391009746700588 0.5898061569406237 0.1559084195663402 1.024678341209019 0.5606679122249101 0.0 3.8331911881045686E-146 0.7881631917933499 0.19212234964357172 4.3471935313716205E-6 0.6329288844806887 8.309201379013281E-52 0.5305363652743272 0.018665572726897804 0.7258892594758132 0.002089929787413814 0.6127294087936389 0.314150566585616 0.16832392976591296 5.068579290960807E-198 0.31119954674674133 0.9408750901831726 0.6640264407013473 0.5646821355447172 3.3417103298805875E-307 0.002233018427506714 0.5518027504714023 0.3878829001749411 3.176641698050471E-263 0.294970447848914 0.9218924220664937 0.005770248419702773 0.0027604738289967222 0.5492105411029602 1.0449911585863441E-289 1.069235951003075E-4 0.8832499427720665 0.23163132602933065 0.07243185715270478 0.0054078281618486195 0.12349903573548843 0.987900730197903 3.632049059411481E-4 0.9398793758064992 0.47230941598672793 0.01740251067957095 1.7678069857361197E-8 0.9999554075381074 0.36231404816185586 0.09041202577089906 2.8897985667E-314 1.5146008102893242E-199 0.4581601886558008 0.9040575491401501 1.5196011957867216E-152 0.30829456805203515 0.1904555982874832 0.9076085425199495 0.4007394510341737 0.5366882604816937 9.357993195718985E-148 0.3484630782344564 0.09539289306713361 0.37594912022574606 2.71776624928836E-59 0.9813265911816478 0.16299335626312025 0.0860887569117862 0.3579244012388933 0.00926794481502339 0.9958275783065754 0.02135408692854737 0.2913758109558811 0.12367952592149421 0.3018250001479104 0.37337094442553964 0.9695854451958302 0.47447748121677547 0.7947232567251287 0.21619674033153902 0.015567740278859798 0.4395708012644212 0.5971409139408315 0.0 0.45258554055085715 0.03300054543382031 0.7267896147791858 0.7485733499408112 0.5298448886026932 3.9615662755939717E-22 0.5391856197057496 2.7535240068276563E-260 0.8045990766063523 0.4400640359784957 1.633053495019253E-59 7.558653626182686E-193 0.528518911081159 0.016470909194140942 0.6774093711461473 0.0 0.1923277876769017 0.8058697201887811 0.26975853468768357 2.519085434437394E-4 0.019982516561181357 0.8064897976293597 0.587960935065563 0.7047192424117255 0.0 0.3805788719332518 2.411691206617002E-6 0.6777157803081737 0.049053452007457955 0.7136594153522086 2.0161695764065978E-288 1.814969180420733E-113 0.7591197603775 0.4167115539810181 0.11805835417949792 1.5932745480217167E-23 0.3004579133811862 0.9298246150534277 0.33300479478212586 0.0 0.38576627489537385 0.0 0.927558043037172 0.27317365017590306 0.11595330249673856 3.5763408053677027E-203 0.943433619627669 0.5012806709527653 0.3780052932124236 0.2087538579354536 1.0621398742446655E-152 0.24988262918001738 0.9442629111635725 0.041688832273802774 0.1652249173321031 7.535474800702231E-209 0.43397204588905275 0.9271159915087339 0.72568556128651 0.5136447689606314 0.0346758297631296 0.5196943828878603 2.103203000468455E-98 0.17091732554787034 0.9680041314043117 0.6621635282747892 6.771577601595008E-149 8.040271844592291E-108 0.7317654246869297 5.5382704091196225E-196 0.10876193150326056 0.21345857284497263 0.693529021914904 0.4380280649595274 3.587315180533161E-263 0.1425883836592751 0.8714793244712512 0.3282817911965794 1.5104708639487042E-4 0.02864046494506745 0.8783386052048539 0.0055221321480319295 0.5064711336101942 5.303446525365482E-4 1.3723933593263016 0.0 1.1034505576624443E-126 1.5477439602747121E-139 0.40395810899771245 0.0 0.0310394672160561 0.9582459041810717 0.032308408645933616 0.027305539513199792 3.005723514866696E-7 1.2558531436590672E-198 1.0032378307796718E-143 1.0628867835641012 0.20468152751481797 0.8509881639419209 1.6464331333848417E-58 0.6874221955547591 1.0723016218489723E-46 0.1993941947234867 0.8556500662418772 1.5897929962337747E-152 0.05554554276601209 0.6074111010503441 0.8582959510100615 9.759084917405807E-136 0.27551602817165843 0.37044112255326556 0.32402558417035243 1.2081869432677734 0.0 7.03320306598965E-4 2.161037090101242E-180 0.0 1.1945358751193578 0.0 0.0016273193325163624 0.0256588751901436 0.0 1.1945358751193578 0.0 0.0016273193325163624 0.0256588751901436 0.0 1.1945358751193578 0.0 0.0016273193325163624 0.0256588751901436 0.0 1.1907620581791216 0.0 0.001622178251873966 7.705452309367455E-6 0.0 0.5755555308543313 0.0 1.006293054027384 8.090763770282292E-140 0.0 1.212254862186532 0.0 0.00159889032848749 0.02603948114670041 0.0 1.194773730731371 0.0 8.372801190426167E-4 1.3884841527629478E-5 0.0 1.2383269401717785 0.0 0.0016869760144424416 0.0265995162341066 0.0 1.1992846866907563 0.0 0.0016337886508830813 7.760602460563303E-6 0.0 1.2014987958378536 0.0 0.0016368049375383587 0.025808440152901117 0.0 1.193354256346311 0.0 0.001625709610185628 0.06796156198578861 0.0 1.2099045677776485 0.0 0.0016369094629622666 0.0019468604891471038 0.0 0.686075106703284 0.0 0.9888326466679132 4.540378410570778E-130 0.0 1.5810931737230836E-5 0.0 2.273130078357635E-195 0.0012858989061174221 1.2765812202738 2.319207307179902E-9 2.9100822327616048E-5 5.380358595253147E-223 3.07929255652656E-4 1.1039745546395554 2.9285808912112234E-6 2.039819795104407E-149 1.4616964300928537E-206 3.248765741349236E-4 1.1596138185423879 1.5814122057482185E-5 0.0 1.2558407024627846E-255 0.0012861583740216263 1.2768388080609854 2.3474143748583003E-9 2.9454757425332797E-5 3.8772489263403007E-106 3.0423629353995096E-4 1.2027559249459612 2.3522202776158702E-9 2.9515060668530967E-5 5.456945806189449E-223 3.123676397501461E-4 1.1198851063024773 1.6162364892241923E-5 0.0 4.6869522317119964E-223 0.0013144808718808956 1.2720825285693869 1.9581660560225646E-5 0.0 1.5550307670545992E-255 0.0013273431444701055 1.3177689287211733 2.4257127188338925E-9 3.0437225094146298E-5 5.627441857391676E-223 3.221272105782737E-4 1.1548746398632086 3.2324448515145994E-5 0.0 2.698844949529478E-203 4.4959208142828665E-4 1.3043560349014534 1.0638433299582335 5.300633172799224E-159 0.0 0.0 0.0 1.0291599644260594 2.4131335653239144E-159 0.0 0.0 0.0 1.0529356938946919 5.24628552975154E-159 0.0 0.0 0.0 1.0332904420221347 2.422818545766645E-159 0.0 0.0 0.0 1.0373138425039117 2.432252456028332E-159 0.0 0.0 0.0 1.0635083512245513 5.698689986643838E-164 0.0 0.0 0.0 1.0388379318756331 5.342173935249677E-159 0.0 6.022761928681972E-125 0.0 1.0401511711135414 2.3624716056891424E-159 0.0 0.0 0.0 1.048378470582279 2.1505068347795185E-158 0.0 0.0 0.0 1.0508718037098324 5.404057540459128E-159 0.0 3.6549855679104505E-124 0.0 1.042910580308801 2.4453754653953237E-159 0.0 7.658369187375794E-124 0.0 1.0476149546247557 5.387309351199303E-159 0.0 0.0 0.0 1.0113003985027946 0.0 4.063142822784476E-15 1.7517439672845755E-125 0.0 1.0109326190892902 0.0 5.29390966036591E-15 1.7511069109066172E-125 0.0 1.0076452818784944 0.0 4.0484575117725815E-15 1.745412684803308E-125 0.0 1.011723205651004 0.0 4.0648415522937406E-15 1.7524763410404812E-125 0.0 1.0122618723718453 0.0 4.0670057755293885E-15 1.75340940324436E-125 0.0 1.011037281894133 0.0 4.0620856884635345E-15 1.7512882046520306E-125 0.0 1.0113097379750584 0.0 4.063180346362785E-15 1.7517601448359933E-125 0.0 1.0112167169975008 0.0 4.0628066121905335E-15 1.75159901671174E-125 0.0 1.0122618723718453 0.0 8.431798353933722E-16 1.75340940324436E-125 0.0 1.028392211448226 0.0 4.131813296167476E-15 1.7813498887906302E-125 0.0 1.0076452818784944 0.0 4.0484575117725815E-15 1.745412684803308E-125 0.0 0.6803016198555625 1.4617139013225405E-137 0.0 0.0 0.9645707604044067 0.5849235246995872 5.421622546760674E-188 0.0 0.0 0.8293382119503024 0.41592098299938485 1.1638111640579911E-186 0.0 0.0 0.9740928837923609 0.5963160497666303 8.126746484083006E-242 0.0 0.0 0.8374971949541579 0.4450377889583393 9.009578660649109E-140 0.0 0.0 1.0683277102432778 0.6899237257951569 1.4823882104839527E-137 0.0 0.0 0.9782135355676012 0.6803016198555625 1.4617139013225405E-137 0.0 0.0 0.9645707604044067 0.6827995826495121 1.4670810896906617E-137 0.0 0.0 0.9681125157101395 0.6891484659657359 1.9387451671483927E-143 0.0 0.0 0.9771143275966803 0.678181281871196 1.4571580875234954E-137 0.0 0.0 0.9615644232706969 1.0036657570541863 0.0 0.6749734509633437 8.365814804068568E-141 0.0 1.024081121887768 0.0 0.6887029512053793 9.958959609153132E-141 0.0 1.0124692459366011 0.0 0.6808896640000234 7.837912371259908E-131 0.0 1.0129639370871486 0.0 0.6812265546815715 8.443317555434743E-141 0.0 1.0031668142447125 0.0 0.6746337396587694 7.765898678209248E-131 0.0 1.0107468037030738 0.0 0.6797355128942599 8.61708186016216E-141 0.0 1.011447022973873 0.0 0.6802020157902112 2.7371611001839693E-130 0.0 1.030812176042088 0.0 0.6932295541276838 7.97992706140532E-131 0.0 4.4917730151459E-10 1.617301780455192E-10 0.0 2.750775799409425E-32 1.0305007801366755 0.9782323124667158 0.3610652355708905 0.0 3.932989875905926E-23 0.0 0.97823232234945 0.36106523921860456 0.0 3.9329899156395284E-23 0.0 4.4917974618256077E-10 1.6173105826939703E-10 0.0 2.7507907706323004E-32 1.030506388684219 4.4917730151459E-10 1.617301780455192E-10 0.0 3.1257360952450468E-30 1.0305007801366755 0.9605373792375801 0.3848581625004539 0.0 6.097851131901477E-23 2.179094535945E-312 4.516159263119117E-10 1.6260822602641045E-10 0.0 4.290773870190565E-23 1.0360954634557722 0.9713955707416697 0.3499059408660727 0.0 5.793019893871769E-23 0.04048319509583577 0.9780124226379452 0.36098407430498985 0.0 8.53689786414153E-23 0.0 1.28735171539115E-7 0.001510283786613289 2.682340985509196E-16 2.6320983220733243E-163 1.007865218167834 8.845153647172828E-5 1.0532585207624592 3.9962395480910085E-14 2.414610596256424E-130 0.0 3.0179326599323436E-5 0.2675171168335864 4.751240363749265E-14 1.6430884729627267E-131 0.9779668836089109 3.9327542942844877E-5 1.0044288336769982 1.7047234703764368E-13 2.3151721113619733E-130 5.5962305012869635E-132 4.455200495714424E-5 1.1378620434566906 1.918520895905039E-13 5.816406974814777E-131 1.5238570858618404E-290 1.1155497956017683E-6 0.0015048094279461442 2.6726189701558855E-16 9.242532657344616E-134 1.0042122593613179 4.355967616611665E-5 1.1125178806737652 1.8757887332778815E-13 5.686855272102532E-131 1.6402069804714614E-238 4.024871978726071E-5 1.0303294794070208 2.027137051699796E-13 2.3702793872460925E-130 1.105822468434638E-142 1.490591233175058E-7 0.0015069504174265072 2.676420755298834E-16 1.3121976645246452E-164 1.0056407455356056 1.490591233175058E-7 0.0015069504174265072 2.676420755298834E-16 1.3121976645246452E-164 1.0056407455356056 0.9945596573272263 0.18754908035711146 3.2092992426113206E-58 0.0 0.0 0.9945596573272263 0.18754908035711146 3.2092992426113206E-58 0.0 0.0 0.9945596573272263 0.18754908035711146 3.2092992426113206E-58 0.0 0.0 0.9918648198745524 0.18704090140350385 3.200603394421511E-58 0.0 0.0 0.9945596573272263 0.18754908035711146 3.2092992426113206E-58 0.0 0.0 1.0185697990850673 0.001018304395076857 0.0 1.0238588420456359E-15 0.0 1.0185697990850673 0.001018304395076857 0.0 1.0238588420456359E-15 0.0 1.0185697990850673 0.001018304395076857 0.0 1.0238588420456359E-15 0.0 1.0147171262762666 0.001025790187577289 0.0 1.0199861752391287E-15 0.0 1.0191873467980037 0.0010189217818782502 0.0 1.0244795964473893E-15 0.0 0.5263927921298917 1.0535098058729964 0.0 0.0 0.05012555273314055 0.5263927921298917 1.0535098058729964 0.0 0.0 0.05012555273314055 0.5394130673408445 1.0795682698470226 0.0 0.0 0.05136540347092492 0.5025644423434207 1.0056301884762038 0.0 0.0 0.04784926815734263 0.4581085393677552 1.0449216935357253 0.0 0.0 0.2863715600340473 6.431529956109935E-5 0.0029292730083495845 0.003998697273109292 1.0727296741671835 2.3709478035451516E-8 3.9514179109238344E-4 0.01799693371587624 0.01542225336678198 1.061527147868983 2.3467477985368797E-8

My java version is:

java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

This problem can be solve by running java with -Djava.util.Arrays.useLegacyMergeSort=true

Using TimSort may be the reason of the problem. A bug?

dhadka commented 6 years ago

Yea, that's a bug somewhere. It's usually (1) the Comparator used for sorting violates the interface's requirements (a lot of Java code has this issue since the old merge sort worked fine but broke when they switched to TimSort), or (2) the values (e.g., objectives) are being modified while sorting is ongoing.

Are you using one of the standard algorithms? If so, which one? Did you change the dominance comparator? If so, to which one?

Thanks!

VictorPih commented 6 years ago

I am developing a new algorithm with MOEAframework. The new algorithm is based on NSGAIII. The only different between the new algorithm and NSGAIII are: it extracts individuals before population.truncate(populationSize), changes them by a new operator, evaluates them, adds into population, and run population.truncate(populationSize).

No comparator changes in the new algorithm.

I test the new algorithm on DTLZ and WFG test suites, 30 runs on each test instance. Only one run throws java.lang.IllegalArgumentException.

alxbrd commented 6 years ago

I am seeing the same error with NSGA-II using NondominatedSortingPopulation:

Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeHi(TimSort.java:899) at java.util.TimSort.mergeAt(TimSort.java:516) at java.util.TimSort.mergeCollapse(TimSort.java:441) at java.util.TimSort.sort(TimSort.java:245) at java.util.Arrays.sort(Arrays.java:1512) at java.util.ArrayList.sort(ArrayList.java:1462) at java.util.Collections.sort(Collections.java:175) at org.moeaframework.core.Population.sort(Population.java:283) at org.moeaframework.core.NondominatedSortingPopulation.sort(NondominatedSortingPopulation.java:161) at org.moeaframework.core.Population.truncate(Population.java:295) at org.moeaframework.core.NondominatedSortingPopulation.truncate(NondominatedSortingPopulation.java:170) at org.moeaframework.core.NondominatedSortingPopulation.truncate(NondominatedSortingPopulation.java:180) at org.moeaframework.algorithm.NSGAII.iterate(NSGAII.java:148) at org.moeaframework.algorithm.AbstractAlgorithm.step(AbstractAlgorithm.java:161) at org.moeaframework.Executor.runSingleSeed(Executor.java:816) at org.moeaframework.Executor.run(Executor.java:743)

dhadka commented 6 years ago

@alxbrd Are you able to share the code used to produce this error? Thanks.

alxbrd commented 6 years ago

@dhadka Sure, please see the class below:

https://github.com/mde-optimiser/mde_optimiser/blob/master/src/plugins/uk.ac.kcl.mdeoptimise/src/uk/ac/kcl/optimisation/moea/MoeaOptimisationAlgorithmProvider.xtend

This is the class where the NSGAII algorithm is initialised. Would you like to see the objectives as well?

dhadka commented 6 years ago

After some googling, it seems this error can happen when NaNs or negative zeros show up. I modified the comparators so they use Double.compare, which does a better job of handling NaNs. Also, I found a spot in NondominatedSorting where if all objective values are the same, it would calculate 0/0 and produce a NaN. These changes are in the fix_sort_contract branch and can be found in this commit: https://github.com/MOEAFramework/MOEAFramework/commit/c2e71eb3197480a78f69bf33e75d9ddadd7819b0.

Not sure if this is the cause of the error you're encountering, but you could try this change to see if it fixes the issue. If it doesn't, then it would be useful to see the objectives so I can investigate further.

Thanks!

Abdulqa commented 6 years ago

Thanks!

jcfgonc commented 5 years ago

Greetings,

I am having exactly the same problem with the latest code version (downloaded some days ago) and with NSGA-II. I was using a multi-threaded GA developed by me before but decided to change to MOEA because of the multi-objective features.

The code blows up at the same place (Population.truncate()) but as far as I know only after a long while during the evolution and tens of iterations (I am using a custom piece of code to iterate the evolution based on your SymbolicRegressionGUI). Now that I've found about

-Djava.util.Arrays.useLegacyMergeSort=true

I'll see if the exception still occurs. My code uses a custom Variable (a semantic graph) and a custom Variation (a mutation which works on the graph) and currently the objectives are three double precision values.

Basically I just want to add that this issue still seems to occur.

Best, João Gonçalves

github-actions[bot] commented 1 year ago

This is an automated message. This issue is flagged as stale and will be closed in 7 days. If you feel this issue is still relevant, leave a comment to keep the issue open. Please also consider contributing a fix for the issue.