{"blocked":null,"sec_per_sim":0.1732370309198359,"n_params":8,"evaluations":111,"log":[{"params":{"w_first":0.75,"w_later":0.75,"lo":0.0001,"hi":0.0036,"c1":3.0,"c2":0.3,"c3":1.0,"scale":0.007},"n":64,"mean_diff":-2.0731753543068674},{"params":{"w_first":0.836396048,"w_later":0.955404536,"lo":0.000248697,"hi":0.001517631,"c1":8.123610971,"c2":0.634780929,"c3":0.328808456,"scale":0.008743354},"n":64,"mean_diff":-2.633633527059195},{"params":{"w_first":0.841143099,"w_later":0.823533124,"lo":0.00011279,"hi":0.004488409,"c1":1.33414727,"c2":0.177817539,"c3":0.397350859,"scale":0.008796539},"n":64,"mean_diff":-1.3945432471841217},{"params":{"w_first":0.759930527,"w_later":0.676885812,"lo":0.000251859,"hi":0.003182063,"c1":3.026997259,"c2":0.093297821,"c3":2.617579768,"scale":0.010020173},"n":64,"mean_diff":-4.081690959985726},{"params":{"w_first":0.07220938,"w_later":0.277746689,"lo":2.1353e-05,"hi":0.002913941,"c1":3.794996691,"c2":0.462991448,"c3":3.647298444,"scale":0.003663938},"n":64,"mean_diff":-8.052146531904931},{"params":{"w_first":0.655598748,"w_later":0.739307098,"lo":0.000391016,"hi":0.004677478,"c1":1.704124373,"c2":0.936056378,"c3":1.20933093,"scale":0.007327042},"n":64,"mean_diff":-3.470972798392978},{"params":{"w_first":0.443161986,"w_later":0.579193335,"lo":6.758e-05,"hi":0.002064779,"c1":2.692542481,"c2":0.371612271,"c3":1.044482796,"scale":0.005481125},"n":64,"mean_diff":-4.462838197492393},{"params":{"w_first":0.898437018,"w_later":0.972791739,"lo":0.000244382,"hi":0.002270376,"c1":6.710334613,"c2":0.076080014,"c3":2.098950773,"scale":0.003784638},"n":64,"mean_diff":-1.4031344550490292},{"params":{"w_first":0.978616801,"w_later":0.744984136,"lo":0.000461937,"hi":0.003089913,"c1":3.184008669,"c2":0.504593504,"c3":0.227735156,"scale":0.003677881},"n":64,"mean_diff":-2.5634823982213364},{"params":{"w_first":0.799896133,"w_later":0.633312596,"lo":0.000205978,"hi":0.004834219,"c1":0.488924415,"c2":0.490791087,"c3":2.530808709,"scale":0.006107419},"n":64,"mean_diff":-2.029526231078136},{"params":{"w_first":0.547296354,"w_later":0.938060957,"lo":0.000214051,"hi":0.00505581,"c1":2.051911236,"c2":0.811363705,"c3":0.862486544,"scale":0.005662516},"n":64,"mean_diff":-2.7102617007494274},{"params":{"w_first":0.922222382,"w_later":0.879474448,"lo":1.5178e-05,"hi":0.004111791,"c1":2.311918263,"c2":1.126070129,"c3":1.777084501,"scale":0.008679505},"n":64,"mean_diff":-0.27140035892899395},{"params":{"w_first":0.817463484,"w_later":0.755534942,"lo":1.6156e-05,"hi":0.001713548,"c1":8.672752671,"c2":0.124451203,"c3":1.347574079,"scale":0.004008414},"n":64,"mean_diff":-3.4927492775482625},{"params":{"w_first":0.935655242,"w_later":0.946015742,"lo":0.000226226,"hi":0.005466307,"c1":2.024057188,"c2":0.755760567,"c3":0.106129067,"scale":0.006237584},"n":64,"mean_diff":-1.2377295095008378},{"params":{"w_first":0.956485322,"w_later":0.958270146,"lo":0.00019803,"hi":0.003412675,"c1":1.548951219,"c2":0.880528441,"c3":2.80094408,"scale":0.009935921},"n":64,"mean_diff":-1.028197127009033},{"params":{"w_first":0.979852001,"w_later":0.896428691,"lo":0.00022301,"hi":0.003939915,"c1":0.569777505,"c2":0.39026018,"c3":0.491743367,"scale":0.005242654},"n":64,"mean_diff":-1.1185657885396916},{"params":{"w_first":0.933519737,"w_later":0.976623818,"lo":0.00016132,"hi":0.00756232,"c1":3.82696413,"c2":0.40755893,"c3":4.170782792,"scale":0.00926322},"n":64,"mean_diff":-0.8308095576721284},{"params":{"w_first":0.821150907,"w_later":0.93546849,"lo":0.00053185,"hi":0.004054413,"c1":3.671676984,"c2":0.109053334,"c3":1.001081771,"scale":0.004450726},"n":64,"mean_diff":-2.6887729201236006},{"params":{"w_first":0.973870431,"w_later":0.868602843,"lo":0.000809505,"hi":0.003182639,"c1":2.603551859,"c2":0.623147653,"c3":0.007045425,"scale":0.008102472},"n":64,"mean_diff":-4.422602494622564},{"params":{"w_first":0.753354334,"w_later":0.66025648,"lo":6.07e-07,"hi":0.003964338,"c1":5.38554357,"c2":0.220718757,"c3":2.082862299,"scale":0.006047218},"n":64,"mean_diff":-3.483294170177923},{"params":{"w_first":0.987872424,"w_later":0.921750541,"lo":0.000839301,"hi":0.006006746,"c1":1.055820106,"c2":0.237661821,"c3":1.13368742,"scale":0.002048099},"n":64,"mean_diff":-4.5236190784135974},{"params":{"w_first":0.955882838,"w_later":0.688247018,"lo":0.0001623,"hi":0.005451759,"c1":0.903679177,"c2":0.875377751,"c3":1.83934605,"scale":0.013052604},"n":64,"mean_diff":-1.5351906682630316},{"params":{"w_first":0.866243787,"w_later":0.954109552,"lo":0.000301042,"hi":0.005342798,"c1":5.606289384,"c2":0.754055964,"c3":3.971849172,"scale":0.007771716},"n":64,"mean_diff":-1.7334143708154937},{"params":{"w_first":0.950631065,"w_later":0.85185007,"lo":0.000493671,"hi":0.007462763,"c1":2.9536932,"c2":1.669684869,"c3":4.396067928,"scale":0.00965858},"n":64,"mean_diff":-2.7316083453930737},{"params":{"w_first":0.767147915,"w_later":0.934881307,"lo":0.000257287,"hi":0.003764323,"c1":4.256634519,"c2":1.211131458,"c3":3.962053789,"scale":0.011533064},"n":64,"mean_diff":-1.8665529749216567},{"params":{"w_first":0.830290805,"w_later":0.600287063,"lo":0.00072261,"hi":0.005681287,"c1":5.176095195,"c2":0.12920635,"c3":0.370045037,"scale":0.01122854},"n":64,"mean_diff":-6.393466722149184},{"params":{"w_first":0.837745389,"w_later":0.871395452,"lo":0.00077627,"hi":0.004742114,"c1":2.789270838,"c2":0.487163614,"c3":4.805464303,"scale":0.009466115},"n":64,"mean_diff":-4.4998108104965455},{"params":{"w_first":0.88278171,"w_later":0.980248297,"lo":0.000469733,"hi":0.004426656,"c1":2.413178233,"c2":0.765202597,"c3":1.105798292,"scale":0.006372188},"n":64,"mean_diff":-2.5621762040879936},{"params":{"w_first":0.80650357,"w_later":0.928482296,"lo":0.000180569,"hi":0.00432177,"c1":3.826676933,"c2":0.898948382,"c3":2.552759587,"scale":0.009461197},"n":64,"mean_diff":-1.3394850274945478},{"params":{"w_first":0.977792337,"w_later":0.937116035,"lo":0.000456931,"hi":0.003407608,"c1":0.938095979,"c2":1.043210702,"c3":3.214072539,"scale":0.010532271},"n":64,"mean_diff":-2.411589160114776},{"params":{"w_first":0.926651689,"w_later":0.728151749,"lo":0.000712779,"hi":0.002743401,"c1":8.215880204,"c2":1.314945084,"c3":1.92598378,"scale":0.007932577},"n":64,"mean_diff":-4.37718837743754},{"params":{"w_first":0.794156182,"w_later":0.661752878,"lo":0.000163379,"hi":0.007118531,"c1":2.4925609,"c2":0.674529326,"c3":0.874670436,"scale":0.01080181},"n":64,"mean_diff":-2.207878297142355},{"params":{"w_first":0.880069222,"w_later":0.954438969,"lo":0.000233217,"hi":0.005613459,"c1":2.654303281,"c2":0.708493527,"c3":3.249549468,"scale":0.009540438},"n":64,"mean_diff":-1.3434493437904642},{"params":{"w_first":0.785773153,"w_later":0.879192927,"lo":0.000211922,"hi":0.00494149,"c1":1.121014004,"c2":1.981807171,"c3":2.570902225,"scale":0.013884732},"n":64,"mean_diff":-1.5769130324245015},{"params":{"w_first":0.971094913,"w_later":0.668674705,"lo":0.000453359,"hi":0.006227864,"c1":2.294444801,"c2":0.741749656,"c3":1.926822323,"scale":0.009493219},"n":64,"mean_diff":-3.13157074556376},{"params":{"w_first":0.301798479,"w_later":0.775375906,"lo":0.000182078,"hi":0.005597152,"c1":0.553402462,"c2":0.489150829,"c3":0.974498909,"scale":0.01295952},"n":64,"mean_diff":-4.369414255281935},{"params":{"w_first":0.948568953,"w_later":0.855767219,"lo":0.000310352,"hi":0.003778565,"c1":3.592678691,"c2":1.12228568,"c3":3.568964638,"scale":0.011872657},"n":64,"mean_diff":-1.8391261837790776},{"params":{"w_first":0.638030646,"w_later":0.956139639,"lo":0.000778955,"hi":0.004186133,"c1":2.969791566,"c2":0.705744434,"c3":2.566186154,"scale":0.011253422},"n":64,"mean_diff":-5.342484180006852},{"params":{"w_first":0.72757184,"w_later":0.881453817,"lo":7.0821e-05,"hi":0.005094141,"c1":0.988301994,"c2":1.8806616,"c3":3.306157647,"scale":0.009740798},"n":64,"mean_diff":-1.0168365392846912},{"params":{"w_first":0.650739542,"w_later":0.536924823,"lo":8.0448e-05,"hi":0.003574245,"c1":2.955433097,"c2":1.02584236,"c3":1.886921124,"scale":0.008372767},"n":64,"mean_diff":-2.8670758927940287},{"params":{"w_first":0.929626565,"w_later":0.816785612,"lo":0.000485539,"hi":0.003353073,"c1":1.14575412,"c2":1.300434607,"c3":0.388366459,"scale":0.010838804},"n":64,"mean_diff":-2.7910834726817964},{"params":{"w_first":0.792321361,"w_later":0.875543201,"lo":3.5801e-05,"hi":0.005099229,"c1":6.170009538,"c2":1.724124971,"c3":3.681608939,"scale":0.010011328},"n":64,"mean_diff":-0.7312923911772673},{"params":{"w_first":0.57476879,"w_later":0.84329615,"lo":0.00063302,"hi":0.004096351,"c1":1.52218925,"c2":1.50991164,"c3":3.138541301,"scale":0.01297627},"n":64,"mean_diff":-5.025443009757726},{"params":{"w_first":0.824163228,"w_later":0.544960045,"lo":0.000123824,"hi":0.006459839,"c1":3.336118549,"c2":1.80626573,"c3":3.016252184,"scale":0.008690142},"n":64,"mean_diff":-2.1790353878467634},{"params":{"w_first":0.71003397,"w_later":0.953784845,"lo":0.000120338,"hi":0.007146369,"c1":0.684292228,"c2":2.010118029,"c3":4.474069705,"scale":0.011023917},"n":64,"mean_diff":-1.2933145972235165},{"params":{"w_first":0.578764621,"w_later":0.838696347,"lo":0.000145365,"hi":0.004580738,"c1":1.22818331,"c2":1.323482079,"c3":3.693300872,"scale":0.013837613},"n":64,"mean_diff":-2.2526103765476657},{"params":{"w_first":0.771959437,"w_later":0.863996189,"lo":6.3393e-05,"hi":0.00687508,"c1":0.534574873,"c2":1.933058961,"c3":3.133981607,"scale":0.012384061},"n":64,"mean_diff":-0.8353995063184936},{"params":{"w_first":0.622335911,"w_later":0.964709441,"lo":0.000411889,"hi":0.007303808,"c1":0.517888857,"c2":0.824392051,"c3":4.283590213,"scale":0.009028163},"n":64,"mean_diff":-3.3172877705622748},{"params":{"w_first":0.887525991,"w_later":0.879802085,"lo":5.2478e-05,"hi":0.005590927,"c1":0.817966598,"c2":0.885572488,"c3":1.627933503,"scale":0.009184162},"n":64,"mean_diff":-0.4839277190858766},{"params":{"w_first":0.90680939,"w_later":0.790699904,"lo":0.000426919,"hi":0.003726431,"c1":2.164709747,"c2":1.612368543,"c3":1.866520326,"scale":0.011749073},"n":64,"mean_diff":-2.649202234706144},{"params":{"w_first":0.658531198,"w_later":0.754069301,"lo":5.4483e-05,"hi":0.006294024,"c1":3.048524163,"c2":0.889492787,"c3":3.026581694,"scale":0.008004606},"n":64,"mean_diff":-1.767568712623417},{"params":{"w_first":0.934936309,"w_later":0.96361357,"lo":0.000152609,"hi":0.005081446,"c1":0.575586686,"c2":0.682224164,"c3":1.758332565,"scale":0.013774069},"n":64,"mean_diff":-0.8190050536968512},{"params":{"w_first":0.983031497,"w_later":0.904770056,"lo":0.000255416,"hi":0.005023732,"c1":8.927352205,"c2":1.327656552,"c3":0.954341608,"scale":0.011079625},"n":64,"mean_diff":-1.4567502345156855},{"params":{"w_first":0.731687821,"w_later":0.902320766,"lo":0.000472055,"hi":0.005612767,"c1":1.36471558,"c2":0.977336837,"c3":2.398695068,"scale":0.00945032},"n":64,"mean_diff":-3.181498604599816},{"params":{"w_first":0.677015547,"w_later":0.826030541,"lo":0.000158291,"hi":0.007178858,"c1":0.388190504,"c2":1.494201291,"c3":2.663606968,"scale":0.010025843},"n":64,"mean_diff":-1.8194693268102},{"params":{"w_first":0.815157296,"w_later":0.895837924,"lo":0.000422192,"hi":0.007068721,"c1":3.42827756,"c2":2.135945487,"c3":3.71417405,"scale":0.009142017},"n":64,"mean_diff":-2.6088036016864287},{"params":{"w_first":0.853961701,"w_later":0.920599447,"lo":0.000219806,"hi":0.004771431,"c1":0.634164298,"c2":0.991504563,"c3":3.558058067,"scale":0.009120007},"n":64,"mean_diff":-1.3588006500907532},{"params":{"w_first":0.910196925,"w_later":0.523919233,"lo":0.00030912,"hi":0.005507981,"c1":2.108704996,"c2":1.595357718,"c3":3.755468309,"scale":0.009139101},"n":64,"mean_diff":-3.159800889883507},{"params":{"w_first":0.912315942,"w_later":0.709792057,"lo":2.6257e-05,"hi":0.004666352,"c1":0.492452547,"c2":1.795550593,"c3":2.113846166,"scale":0.00641736},"n":64,"mean_diff":-0.6990049365315087},{"params":{"w_first":0.828531339,"w_later":0.848812951,"lo":0.000107109,"hi":0.006610568,"c1":0.926552337,"c2":1.619975701,"c3":3.222124622,"scale":0.011434636},"n":64,"mean_diff":-0.8786762398255599},{"params":{"w_first":0.754883286,"w_later":0.866114737,"lo":0.000187082,"hi":0.00630135,"c1":0.605128563,"c2":1.475089892,"c3":2.775828588,"scale":0.011324578},"n":64,"mean_diff":-1.5600088493783701},{"params":{"w_first":0.806895466,"w_later":0.679302784,"lo":8.158e-06,"hi":0.002889062,"c1":2.788061175,"c2":1.489834252,"c3":1.129896032,"scale":0.010904831},"n":64,"mean_diff":-1.0657085070746906},{"params":{"w_first":0.658985591,"w_later":0.847785459,"lo":0.000159736,"hi":0.00464955,"c1":0.499336464,"c2":1.344383446,"c3":2.685896943,"scale":0.011460677},"n":64,"mean_diff":-1.8874397380683803},{"params":{"w_first":0.923543219,"w_later":0.806432933,"lo":0.000132505,"hi":0.007318977,"c1":1.011448356,"c2":1.269745629,"c3":1.657064261,"scale":0.012084852},"n":64,"mean_diff":-0.9914244995941175},{"params":{"w_first":0.856721097,"w_later":0.542012084,"lo":0.000187823,"hi":0.005362843,"c1":0.576859342,"c2":1.562979554,"c3":2.61901485,"scale":0.01134095},"n":64,"mean_diff":-2.3472214685797157},{"params":{"w_first":0.683461544,"w_later":0.981726552,"lo":0.000607854,"hi":0.005445353,"c1":0.739951872,"c2":1.685426252,"c3":2.896730983,"scale":0.01162225},"n":64,"mean_diff":-4.073622923814714},{"params":{"w_first":0.495922509,"w_later":0.460350311,"lo":0.000396383,"hi":0.003727592,"c1":1.00160277,"c2":1.386873509,"c3":1.356987766,"scale":0.008908769},"n":64,"mean_diff":-5.309940385760454},{"params":{"w_first":0.745203783,"w_later":0.879840413,"lo":0.000166487,"hi":0.005504212,"c1":0.516120407,"c2":0.995815264,"c3":3.784548733,"scale":0.011379247},"n":64,"mean_diff":-1.4937433024637192},{"params":{"w_first":0.900691904,"w_later":0.542501221,"lo":9.0938e-05,"hi":0.005890999,"c1":0.709681667,"c2":1.438966446,"c3":0.613995148,"scale":0.010116701},"n":64,"mean_diff":-1.771980357322187},{"params":{"w_first":0.820079061,"w_later":0.745057877,"lo":0.000148403,"hi":0.005139381,"c1":0.488497327,"c2":1.500019874,"c3":2.19088686,"scale":0.012299597},"n":64,"mean_diff":-1.3847179622413321},{"params":{"w_first":0.706570664,"w_later":0.95647427,"lo":0.00031814,"hi":0.005055345,"c1":0.831118961,"c2":1.579751719,"c3":1.238805946,"scale":0.010367901},"n":64,"mean_diff":-2.414461304142633},{"params":{"w_first":0.913792617,"w_later":0.809464544,"lo":0.000227169,"hi":0.005138313,"c1":1.643861336,"c2":1.009183084,"c3":0.279424284,"scale":0.008784463},"n":64,"mean_diff":-1.5108529338085912},{"params":{"w_first":0.917088822,"w_later":0.529242846,"lo":0.000105663,"hi":0.007099882,"c1":1.300800196,"c2":2.533359499,"c3":3.178007161,"scale":0.011157005},"n":64,"mean_diff":-1.903259684760112},{"params":{"w_first":0.882290586,"w_later":0.561681043,"lo":0.000244209,"hi":0.005258949,"c1":2.294446016,"c2":1.279834223,"c3":2.691365562,"scale":0.012656057},"n":64,"mean_diff":-2.7203852644654214},{"params":{"w_first":0.951679782,"w_later":0.861991158,"lo":5.6679e-05,"hi":0.005441265,"c1":1.996916427,"c2":0.822566145,"c3":1.237618819,"scale":0.013374546},"n":64,"mean_diff":-0.4898228253590249},{"params":{"w_first":0.840447988,"w_later":0.662891363,"lo":0.000208277,"hi":0.006358388,"c1":0.529212914,"c2":1.342022135,"c3":3.989702652,"scale":0.011744385},"n":64,"mean_diff":-1.9502939741485417},{"params":{"w_first":0.955014983,"w_later":0.918649186,"lo":0.000260032,"hi":0.005029883,"c1":0.935349108,"c2":2.05950679,"c3":2.131132569,"scale":0.009275035},"n":64,"mean_diff":-1.3995487532315964},{"params":{"w_first":0.788316777,"w_later":0.755847153,"lo":0.000145423,"hi":0.004436834,"c1":2.217553421,"c2":0.871722451,"c3":0.924647039,"scale":0.013941085},"n":64,"mean_diff":-1.6589381984293023},{"params":{"w_first":0.823420934,"w_later":0.808042899,"lo":9.9284e-05,"hi":0.004813506,"c1":0.981742055,"c2":2.340013495,"c3":1.921987948,"scale":0.011891448},"n":64,"mean_diff":-0.9552694850973378},{"params":{"w_first":0.586707813,"w_later":0.520057397,"lo":0.00034148,"hi":0.004692691,"c1":2.352751763,"c2":1.739180962,"c3":0.188945997,"scale":0.009159433},"n":64,"mean_diff":-4.334100244810887},{"params":{"w_first":0.923554348,"w_later":0.770902228,"lo":0.00025396,"hi":0.005119264,"c1":1.652180428,"c2":0.854227083,"c3":2.180835419,"scale":0.012683071},"n":64,"mean_diff":-1.8179375971403164},{"params":{"w_first":0.9129965,"w_later":0.944882179,"lo":0.000255996,"hi":0.005531554,"c1":3.29641352,"c2":1.641165869,"c3":2.220249258,"scale":0.011526959},"n":64,"mean_diff":-1.40912745109536},{"params":{"w_first":0.76469255,"w_later":0.928525885,"lo":6.8606e-05,"hi":0.005136195,"c1":2.430734766,"c2":1.822408753,"c3":1.598728024,"scale":0.013039877},"n":64,"mean_diff":-0.8594245452771014},{"params":{"w_first":0.845755194,"w_later":0.802499687,"lo":0.000296346,"hi":0.006318812,"c1":6.759999821,"c2":1.711808117,"c3":2.513240936,"scale":0.010717526},"n":64,"mean_diff":-2.185464942118294},{"params":{"w_first":0.885455,"w_later":0.945250534,"lo":0.000399816,"hi":0.006276236,"c1":2.819454478,"c2":0.986192266,"c3":0.264309079,"scale":0.013488305},"n":64,"mean_diff":-2.220189779226785},{"params":{"w_first":0.889324737,"w_later":0.702703524,"lo":4.489e-05,"hi":0.004707353,"c1":1.747331531,"c2":1.553717907,"c3":0.552612257,"scale":0.012679091},"n":64,"mean_diff":-0.917450131577346},{"params":{"w_first":0.9511028,"w_later":0.89688088,"lo":3.731e-05,"hi":0.004789964,"c1":0.442515074,"c2":1.286046756,"c3":1.274023482,"scale":0.012934012},"n":64,"mean_diff":-0.27222848365737207},{"params":{"w_first":0.844647042,"w_later":0.558211029,"lo":0.000456263,"hi":0.004579036,"c1":0.816667034,"c2":1.066886945,"c3":1.394072256,"scale":0.012752375},"n":64,"mean_diff":-3.7793490316369125},{"params":{"w_first":0.880961857,"w_later":0.629975793,"lo":6.601e-06,"hi":0.006435742,"c1":3.217792639,"c2":1.413740825,"c3":2.159871309,"scale":0.008372709},"n":64,"mean_diff":-1.116155728008592},{"params":{"w_first":0.745220914,"w_later":0.618227466,"lo":6.8705e-05,"hi":0.003347527,"c1":1.31796298,"c2":1.728164722,"c3":0.60974052,"scale":0.013081898},"n":64,"mean_diff":-1.6912805635400758},{"params":{"w_first":0.7979541,"w_later":0.817253634,"lo":0.000483768,"hi":0.004155807,"c1":1.484768552,"c2":1.613935142,"c3":1.041623461,"scale":0.012084842},"n":64,"mean_diff":-3.1874059125534018},{"params":{"w_first":0.966438442,"w_later":0.662118406,"lo":5.5407e-05,"hi":0.005393814,"c1":2.552314614,"c2":1.067809379,"c3":1.255152632,"scale":0.011206195},"n":64,"mean_diff":-1.281557353828263},{"params":{"w_first":0.854649636,"w_later":0.73087235,"lo":6.2359e-05,"hi":0.004755419,"c1":1.596502571,"c2":1.371647046,"c3":2.561563525,"scale":0.012647204},"n":64,"mean_diff":-0.9912180054439883},{"params":{"w_first":0.817039241,"w_later":0.988681087,"lo":2.1354e-05,"hi":0.003856991,"c1":1.315012241,"c2":0.808089967,"c3":1.399842471,"scale":0.012331667},"n":64,"mean_diff":-0.3924341578426125},{"params":{"w_first":0.880695596,"w_later":0.76870497,"lo":7.2751e-05,"hi":0.005716097,"c1":1.153120631,"c2":0.999854225,"c3":2.506987235,"scale":0.012227272},"n":64,"mean_diff":-0.9325876815929455},{"params":{"w_first":0.97196992,"w_later":0.893396722,"lo":0.00015711,"hi":0.004953815,"c1":2.482782444,"c2":1.440712414,"c3":1.48321537,"scale":0.013903282},"n":64,"mean_diff":-0.9130996666781037},{"params":{"w_first":0.901063462,"w_later":0.97788657,"lo":0.000154633,"hi":0.005863486,"c1":0.444474108,"c2":1.674298915,"c3":2.081508404,"scale":0.013874968},"n":64,"mean_diff":-0.8580764394061111},{"params":{"w_first":0.618849183,"w_later":0.8767473,"lo":0.000163174,"hi":0.00532014,"c1":2.296963388,"c2":0.691084475,"c3":0.318015429,"scale":0.01163363},"n":64,"mean_diff":-2.1475349665046775},{"params":{"w_first":0.832895452,"w_later":0.803480511,"lo":6.0828e-05,"hi":0.004621276,"c1":0.403734714,"c2":1.548835163,"c3":1.794823799,"scale":0.012253673},"n":64,"mean_diff":-0.7568852123649616},{"params":{"w_first":0.881998836,"w_later":0.946591674,"lo":9.3787e-05,"hi":0.005588929,"c1":0.776931305,"c2":1.851965109,"c3":1.111159142,"scale":0.00848978},"n":64,"mean_diff":-0.612186988911942},{"params":{"w_first":0.914545079,"w_later":0.702402568,"lo":0.000162874,"hi":0.005130952,"c1":1.480591914,"c2":0.707939905,"c3":1.37673496,"scale":0.011696133},"n":64,"mean_diff":-1.5990311649635247},{"params":{"w_first":0.995239006,"w_later":0.923955546,"lo":0.00016651,"hi":0.006631345,"c1":0.931704459,"c2":1.714957643,"c3":0.922944751,"scale":0.010915577},"n":64,"mean_diff":-0.8544198819012641},{"params":{"w_first":0.933481692,"w_later":0.957360233,"lo":3.15e-05,"hi":0.004348039,"c1":0.97486237,"c2":1.627510821,"c3":1.417573152,"scale":0.011247558},"n":64,"mean_diff":-0.22341425131036452},{"params":{"w_first":0.85810585,"w_later":0.995498321,"lo":0.000224459,"hi":0.004946185,"c1":0.681263709,"c2":1.585767997,"c3":1.472071533,"scale":0.010516798},"n":64,"mean_diff":-1.3696220506419898},{"params":{"w_first":0.86823376,"w_later":0.957001125,"lo":0.000134707,"hi":0.004947824,"c1":0.678646529,"c2":1.517756691,"c3":2.014643922,"scale":0.01286704},"n":64,"mean_diff":-0.8539722539010235},{"params":{"w_first":0.948893368,"w_later":0.770521988,"lo":5.2952e-05,"hi":0.005262093,"c1":1.60436006,"c2":1.15190625,"c3":1.690349143,"scale":0.010847132},"n":64,"mean_diff":-0.6911455722346256},{"params":{"w_first":0.986114297,"w_later":0.958228383,"lo":0.000321998,"hi":0.004952239,"c1":0.392533049,"c2":1.622780581,"c3":1.565975634,"scale":0.013910965},"n":64,"mean_diff":-1.6949014017314221},{"params":{"w_first":0.708301917,"w_later":0.883402914,"lo":3.5708e-05,"hi":0.004867609,"c1":0.382187386,"c2":1.158346079,"c3":1.061143398,"scale":0.010445608},"n":64,"mean_diff":-0.9283957040367019},{"params":{"w_first":0.933481692,"w_later":0.957360233,"lo":3.15e-05,"hi":0.004348039,"c1":0.97486237,"c2":1.627510821,"c3":1.417573152,"scale":0.011247558},"n":256,"mean_diff":-0.24922139427232226},{"params":{"w_first":0.922222382,"w_later":0.879474448,"lo":1.5178e-05,"hi":0.004111791,"c1":2.311918263,"c2":1.126070129,"c3":1.777084501,"scale":0.008679505},"n":256,"mean_diff":-0.3594747917519838},{"params":{"w_first":0.9511028,"w_later":0.89688088,"lo":3.731e-05,"hi":0.004789964,"c1":0.442515074,"c2":1.286046756,"c3":1.274023482,"scale":0.012934012},"n":256,"mean_diff":-0.3213993838462863}],"best_params":{"w_first":0.933481692,"w_later":0.957360233,"lo":3.15e-05,"hi":0.004348039,"c1":0.97486237,"c2":1.627510821,"c3":1.417573152,"scale":0.011247558},"code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {AMMStrategyBase} from \"./AMMStrategyBase.sol\";\nimport {TradeInfo} from \"./IAMMStrategy.sol\";\n\ncontract Strategy is AMMStrategyBase {\n    uint256 constant SHARE_W_FIRST = 933481692000000000;\n    uint256 constant SHARE_W_LATER = 957360233000000000;\n    uint256 constant SHARE_LO = 31500000000000;\n    uint256 constant SHARE_HI = 4348039000000000;\n    uint256 constant SHARE_C1 = 974862370000000000;\n    uint256 constant SHARE_C2 = 1627510821000000000;\n    uint256 constant SHARE_C3 = 1417573152000000000;\n\n    uint256 constant ELAPSED_CAP = 8;\n    uint256 constant SIGNAL_THRESHOLD = WAD / 650;\n    uint256 constant DIR_DECAY = 750000000000000000;\n    uint256 constant ACT_DECAY = 530000000000000000;\n    uint256 constant SIZE_DECAY = 530000000000000000;\n    uint256 constant TOX_DECAY = 910000000000000000;\n    uint256 constant SIGMA_DECAY = 690000000000000000;\n    uint256 constant LAMBDA_DECAY = 990000000000000000;\n    uint256 constant SIZE_BLEND_DECAY = 828000000000000000;\n    uint256 constant TOX_BLEND_DECAY = 51000000000000000;\n    uint256 constant ACT_BLEND_DECAY = 985000000000000000;\n    uint256 constant PHAT_ALPHA = 270000000000000000;\n    uint256 constant PHAT_ALPHA_RETAIL = 60000000000000000;\n    uint256 constant PHAT_ALPHA_SAME = 120000000000000000;\n    uint256 constant REVERT_U = 0;\n    uint256 constant DIR_IMPACT_MULT = 4;\n    uint256 constant GATE_SIGMA_MULT = 7200000000000000000;\n    uint256 constant MIN_GATE = 30000000000000000;\n    uint256 constant TRADE_TOX_BOOST = 3500 * BPS;\n    uint256 constant STALE_ATTRACT_FRAC = 1050000000000000000;\n    uint256 constant RET_CAP = WAD / 35;\n    uint256 constant TOX_CAP = WAD / 5;\n    uint256 constant TRADE_RATIO_CAP = WAD / 5;\n    uint256 constant LAMBDA_CAP = 1820000000000000000;\n    uint256 constant STEP_COUNT_CAP = 64;\n    uint256 constant BASE_FEE = 4 * BPS;\n    uint256 constant SIGMA_COEF = 200000000000000000;\n    uint256 constant LAMBDA_COEF = 12 * BPS;\n    uint256 constant FLOW_SIZE_COEF = 4842 * BPS;\n    uint256 constant TOX_COEF = 300 * BPS;\n    uint256 constant TOX_QUAD_COEF = 15000 * BPS;\n    uint256 constant ACT_COEF = 91843 * BPS;\n    uint256 constant DIR_COEF = 20 * BPS;\n    uint256 constant DIR_TOX_COEF = 100 * BPS;\n    uint256 constant STALE_DIR_COEF = 6850 * BPS;\n    uint256 constant SIGMA_TOX_COEF = 500 * BPS;\n    uint256 constant TAIL_KNEE = 600 * BPS;\n    uint256 constant TAIL_SLOPE_PROTECT = 930000000000000000;\n    uint256 constant TAIL_SLOPE_ATTRACT = 850000000000000000;\n\n    function afterInitialize(uint256 initialX, uint256 initialY) external override returns (uint256, uint256) {\n        slots[0] = BASE_FEE; slots[1] = BASE_FEE; slots[3] = WAD; \n        slots[5] = initialX > 0 ? wdiv(initialY, initialX) : 100 * WAD;\n        slots[6] = 950000000000000; slots[7] = 800000000000000000; slots[8] = 2000000000000000;\n        slots[13] = 902500000000; slots[14] = slots[5]; \n        return (BASE_FEE, BASE_FEE);\n    }\n\n    function afterSwap(TradeInfo calldata trade) external override returns (uint256, uint256) {\n        uint256 prevBidFee = slots[0]; uint256 prevAskFee = slots[1]; uint256 lastTs = uint64(slots[2]);\n        uint256 dirState = slots[3]; uint256 actEma = slots[4]; uint256 pHat = slots[5];\n        uint256 sigmaHat = slots[6]; uint256 lambdaHat = slots[7]; uint256 sizeHat = slots[8];\n        uint256 toxEma = slots[9]; uint256 stepTradeCount = slots[10];\n\n        uint256 shareProbArb;\n        bool attractAsk;\n        uint256 sigmaForFast = sigmaHat;\n        uint256 fastHat = slots[14];\n        uint256 uncertainty = slots[13];\n        uint256 silent = trade.timestamp > lastTs ? trade.timestamp - lastTs : 0;\n        bool isNewStep = trade.timestamp > lastTs;\n        if (isNewStep) {\n            uint256 elapsedRaw = trade.timestamp - lastTs;\n            uint256 elapsed = elapsedRaw > ELAPSED_CAP ? ELAPSED_CAP : elapsedRaw;\n            dirState = _decayCentered(dirState, DIR_DECAY, elapsed);\n            actEma = wmul(actEma, _powWad(ACT_DECAY, elapsed));\n            sizeHat = wmul(sizeHat, _powWad(SIZE_DECAY, elapsed));\n            toxEma = wmul(toxEma, _powWad(TOX_DECAY, elapsed));\n            if (stepTradeCount > 0 && elapsedRaw > 0) {\n                uint256 lambdaInst = (stepTradeCount * WAD) / elapsedRaw;\n                if (lambdaInst > LAMBDA_CAP) lambdaInst = LAMBDA_CAP;\n                lambdaHat = wmul(lambdaHat, LAMBDA_DECAY) + wmul(lambdaInst, WAD - LAMBDA_DECAY);\n            }\n            uncertainty += wmul(sigmaForFast, sigmaForFast) * elapsedRaw;\n            if (uncertainty > 100000000000000) uncertainty = 100000000000000;\n            stepTradeCount = 0;\n        }\n\n        bool firstInStep = stepTradeCount == 0;\n        uint256 spot = trade.reserveX > 0 ? wdiv(trade.reserveY, trade.reserveX) : pHat;\n        if (pHat == 0) pHat = spot;\n\n        uint256 feeUsed = trade.isBuy ? prevBidFee : prevAskFee;\n        uint256 gamma = feeUsed < WAD ? WAD - feeUsed : 0;\n        uint256 pImplied;\n        if (gamma == 0) { pImplied = spot; }\n        else { pImplied = trade.isBuy ? wmul(spot, gamma) : wdiv(spot, gamma); }\n\n        // S: infer a no-trade interval center from the last post-trade spot.\n        uint256 silenceScale = WAD;\n        if (firstInStep && silent > 1) {\n            uint256 g = silent - 1;\n            if (g > 1) g = 1;\n            uint256 w = WAD - _powWad(800000000000000000, g);\n            uint256 s = slots[2] >> 64;\n            if (s == 0) s = pHat;\n            uint256 c = (wmul(s, WAD - prevBidFee) + wdiv(s, WAD - prevAskFee)) / 2;\n            if (c >= pHat) pHat += wmul(w, c - pHat);\n            else pHat -= wmul(w, pHat - c);\n            silenceScale = WAD - wmul(300000000000000000, w);\n        }\n\n        {\n            uint256 ret = pHat > 0 ? wdiv(absDiff(pImplied, pHat), pHat) : 0;\n            uint256 alpha = firstInStep ? PHAT_ALPHA : PHAT_ALPHA_RETAIL;\n            uint256 prePhat = pHat;\n            bool secondPrint = !firstInStep && stepTradeCount == 1;\n            bool sameDir = false; bool oppDir = false;\n            if (secondPrint) {\n                bool up2 = pImplied >= pHat;\n                uint256 d1 = slots[12];\n                if (d1 != 0) { sameDir = (d1 == 1) == up2; oppDir = !sameDir; }\n                if (sameDir) alpha = PHAT_ALPHA_SAME;\n            }\n            if (firstInStep) { slots[12] = pImplied >= pHat ? 1 : 2; }\n            uint256 adaptiveGate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (adaptiveGate < MIN_GATE) adaptiveGate = MIN_GATE;\n            alpha = wmul(alpha, silenceScale);\n            adaptiveGate = wmul(adaptiveGate, silenceScale);\n            if (ret <= adaptiveGate) { pHat = wmul(pHat, WAD - alpha) + wmul(pImplied, alpha); }\n            if (oppDir && REVERT_U > 0) {\n                uint256 pre = slots[11];\n                if (pre > pHat) pHat = pHat + wmul(pre - pHat, REVERT_U);\n                else pHat = pHat - wmul(pHat - pre, REVERT_U);\n            }\n            if (firstInStep) {\n                if (ret > RET_CAP) ret = RET_CAP;\n                sigmaHat = wmul(sigmaHat, SIGMA_DECAY) + wmul(ret, WAD - SIGMA_DECAY);\n            }\n        }\n\n        // Interior retail routing equalizes fee-adjusted marginal prices.\n        // Subsequent trades in a step cannot be the initial arbitrage trade.\n        if (!firstInStep && feeUsed > 30 * BPS && gamma > 0) {\n            uint256 normalSpot = trade.isBuy\n                ? wdiv(wmul(spot, gamma), WAD - 30 * BPS)\n                : wdiv(wmul(spot, WAD - 30 * BPS), gamma);\n            pHat = wmul(pHat, 90 * WAD / 100) + wmul(normalSpot, 10 * WAD / 100);\n        }\n\n        {\n            uint256 ret = fastHat > 0 ? wdiv(absDiff(pImplied, fastHat), fastHat) : 0;\n            uint256 alpha;\n            if (firstInStep) {\n                uint256 processSigma = sigmaForFast;\n                uint256 obsVar = uncertainty + wmul(processSigma, processSigma);\n                uint256 probArb;\n                uint256 z2 = wdiv(wmul(ret, ret), obsVar);\n                uint256 density = _powWad(wdiv(WAD, WAD + z2 / 16), 8);\n                uint256 sigmaObs = _isqrt(obsVar * WAD);\n                uint256 odds = wmul(density, wdiv(6700000000000000, sigmaObs));\n                bool arbFlag = ret <= wmul(sigmaForFast, 1220000000000000000);\n                uint256 prior = arbFlag ? 650000000000000000 : 400000000000000000;\n                uint256 tr = trade.reserveY > 0 ? wdiv(trade.amountY, trade.reserveY) : 0;\n                if (tr > 3000000000000000) prior = wmul(prior, 6 * WAD / 10);\n                if (silent > 1) prior = wmul(prior, 8 * WAD / 10);\n                odds = wmul(odds, wdiv(prior, WAD - prior));\n                probArb = wdiv(odds, WAD + odds);\n                shareProbArb = probArb;\n                alpha = wmul(probArb, 600000000000000000) + wmul(WAD - probArb, 80000000000000000);\n                slots[15] = pImplied >= fastHat ? 1 : 2;\n                uncertainty = wmul(uncertainty, WAD - alpha);\n            } else {\n                if ((slots[15] == 1) == (pImplied >= fastHat)) alpha = PHAT_ALPHA_RETAIL;\n            }\n            uint256 gate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (gate < MIN_GATE) gate = MIN_GATE;\n            if (ret <= gate) fastHat = wmul(fastHat, WAD - alpha) + wmul(pImplied, alpha);\n            slots[13] = uncertainty;\n        }\n\n        if (!firstInStep && feeUsed > 30 * BPS && gamma > 0) {\n            uint256 normalObs = trade.isBuy\n                ? wdiv(wmul(spot, gamma), WAD - 30 * BPS)\n                : wdiv(wmul(spot, WAD - 30 * BPS), gamma);\n            if ((slots[15] == 1) == (normalObs >= fastHat)) {\n                fastHat = wmul(fastHat, 9 * WAD / 10) + wmul(normalObs, WAD / 10);\n            }\n        }\n        slots[14] = fastHat;\n        uint256 tradeRatio = trade.reserveY > 0 ? wdiv(trade.amountY, trade.reserveY) : 0;\n        if (tradeRatio > TRADE_RATIO_CAP) tradeRatio = TRADE_RATIO_CAP;\n\n        if (tradeRatio > SIGNAL_THRESHOLD) {\n            uint256 push = tradeRatio * DIR_IMPACT_MULT;\n            if (push > WAD / 4) push = WAD / 4;\n            if (trade.isBuy) {\n                dirState = dirState + push;\n                if (dirState > 2 * WAD) dirState = 2 * WAD;\n            } else {\n                dirState = dirState > push ? dirState - push : 0;\n            }\n            actEma = wmul(actEma, ACT_BLEND_DECAY) + wmul(tradeRatio, WAD - ACT_BLEND_DECAY);\n            sizeHat = wmul(sizeHat, SIZE_BLEND_DECAY) + wmul(tradeRatio, WAD - SIZE_BLEND_DECAY);\n            if (sizeHat > WAD) sizeHat = WAD;\n        }\n\n        uint256 tox = pHat > 0 ? wdiv(absDiff(spot, pHat), pHat) : 0;\n        if (tox > TOX_CAP) tox = TOX_CAP;\n        toxEma = wmul(toxEma, TOX_BLEND_DECAY) + wmul(tox, WAD - TOX_BLEND_DECAY);\n        uint256 toxSignal = toxEma;\n\n        stepTradeCount = stepTradeCount + 1;\n        if (stepTradeCount > STEP_COUNT_CAP) stepTradeCount = STEP_COUNT_CAP;\n\n        uint256 flowSize = wmul(lambdaHat, sizeHat);\n        uint256 fBase = BASE_FEE + wmul(SIGMA_COEF, sigmaHat) + wmul(LAMBDA_COEF, lambdaHat) + wmul(FLOW_SIZE_COEF, flowSize);\n        uint256 fMid = fBase + wmul(TOX_COEF, toxSignal) + wmul(TOX_QUAD_COEF, wmul(toxSignal, toxSignal)) + wmul(ACT_COEF, actEma);\n        fMid = fMid + wmul(SIGMA_TOX_COEF, wmul(sigmaHat, toxSignal));\n\n        uint256 dirDev; bool sellPressure;\n        if (dirState >= WAD) { dirDev = dirState - WAD; sellPressure = true; }\n        else { dirDev = WAD - dirState; sellPressure = false; }\n\n        uint256 skew = wmul(DIR_COEF, dirDev) + wmul(DIR_TOX_COEF, wmul(dirDev, toxSignal));\n        uint256 bidFee; uint256 askFee;\n        if (sellPressure) {\n            bidFee = fMid + skew;\n            askFee = fMid > skew ? fMid - skew : 0;\n        } else {\n            askFee = fMid + skew;\n            bidFee = fMid > skew ? fMid - skew : 0;\n        }\n\n        {\n            uint256 staleHat = wmul(pHat, 700000000000000000) + wmul(fastHat, 300000000000000000);\n            uint256 staleTox = wdiv(absDiff(spot, staleHat), staleHat);\n            if (staleTox > TOX_CAP) staleTox = TOX_CAP;\n            uint256 staleShift = wmul(STALE_DIR_COEF, staleTox);\n            uint256 attractShift = wmul(staleShift, STALE_ATTRACT_FRAC);\n            attractAsk = spot >= staleHat;\n            if (spot >= staleHat) {\n                bidFee = bidFee + staleShift;\n                askFee = askFee > attractShift ? askFee - attractShift : 0;\n            } else {\n                askFee = askFee + staleShift;\n                bidFee = bidFee > attractShift ? bidFee - attractShift : 0;\n            }\n        }\n\n        {\n            bool tradeAligned = (trade.isBuy && spot >= pHat) || (!trade.isBuy && spot < pHat);\n            if (tradeAligned) {\n                uint256 tradeBoost = wmul(TRADE_TOX_BOOST, tradeRatio);\n                if (!firstInStep && tradeBoost > 16 * BPS) tradeBoost = 16 * BPS;\n                if (trade.isBuy) { bidFee = bidFee + tradeBoost; }\n                else { askFee = askFee + tradeBoost; }\n            }\n        }\n\n        if (sellPressure) {\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_PROTECT));\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_ATTRACT));\n        } else {\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_PROTECT));\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_ATTRACT));\n        }\n\n        if (firstInStep) {\n            if (askFee > bidFee && bidFee > 30 * BPS) bidFee = 30 * BPS;\n            else if (bidFee > askFee && askFee > 30 * BPS) askFee = 30 * BPS;\n        }\n\n        if (bidFee > askFee && askFee > 36 * BPS) askFee = 36 * BPS;\n        else if (askFee > bidFee && bidFee > 36 * BPS) bidFee = 36 * BPS;\n\n        // Only replace the side reduced by STACK's stale-price shift.\n        {\n            uint256 retailFee = _shareOptimum(wmul(SHARE_C1, sizeHat));\n            uint256 risk = wmul(wmul(SHARE_C2, sigmaHat), _isqrt((1 + silent) * WAD * WAD));\n            risk = wmul(risk, WAD + wmul(SHARE_C3, shareProbArb));\n            retailFee = retailFee > risk ? retailFee - risk : 0;\n            uint256 w = firstInStep ? SHARE_W_FIRST : SHARE_W_LATER;\n            uint256 stackAttract = attractAsk ? askFee : bidFee;\n            uint256 fee = clamp(wmul(w, stackAttract) + wmul(WAD - w, retailFee), SHARE_LO, SHARE_HI);\n            if (attractAsk) askFee = fee;\n            else bidFee = fee;\n        }\n\n        slots[0] = bidFee; slots[1] = askFee; slots[2] = (spot << 64) | trade.timestamp;\n        slots[3] = dirState; slots[4] = actEma; slots[5] = pHat;\n        slots[6] = sigmaHat; slots[7] = lambdaHat; slots[8] = sizeHat;\n        slots[9] = toxEma; slots[10] = stepTradeCount;\n\n        return (bidFee, askFee);\n    }\n\n\n    // Exact supplied two-AMM share formula, divided through by input reserve R.\n    // t = T/R = c1*sizeHat. For X input, convert Y-notional T at spot first.\n    // The eight fee/sqrt pairs are generated constants; no runtime root per entry.\n    function _shareOptimum(uint256 t) internal pure returns (uint256 bestFee) {\n        if (t == 0) return 0;\n        uint256[8] memory fs = [uint256(0), uint256(1606794000000000), uint256(3213588000000000), uint256(4820382000000000), uint256(6427176000000000), uint256(8033970000000000), uint256(9640764000000000), uint256(11247558000000000)];\n        uint256[8] memory rs = [uint256(1001503383459708403), uint256(1000698455177474405), uint256(999892878916498620), uint256(999086653109360575), uint256(998279776182310432), uint256(997472246555233150), uint256(996664062641612382), uint256(995855222848494113)];\n        uint256 bestRevenue;\n        unchecked {\n            uint256 v = WAD + (997000000000000000 * t) / WAD;\n            for (uint256 i; i < 8; ++i) {\n                uint256 f = fs[i];\n                uint256 r = rs[i];\n                uint256 n = r * v / WAD;\n                if (n <= WAD) continue;\n                uint256 d = (WAD - f + 997000000000000000 * r / WAD) * t / WAD;\n                if (d == 0) continue;\n                uint256 share = (n - WAD) * WAD / d;\n                if (share > WAD) share = WAD;\n                uint256 revenue = f * share / WAD;\n                if (revenue > bestRevenue) { bestRevenue = revenue; bestFee = f; }\n            }\n        }\n    }\n\n    function _compressTailWithSlope(uint256 fee, uint256 slope) internal pure returns (uint256) {\n        if (fee <= TAIL_KNEE) return fee;\n        return TAIL_KNEE + wmul(fee - TAIL_KNEE, slope);\n    }\n\n    function _powWad(uint256 factor, uint256 exp) internal pure returns (uint256 result) {\n        result = WAD;\n        while (exp > 0) {\n            if (exp & 1 == 1) result = wmul(result, factor);\n            factor = wmul(factor, factor);\n            exp >>= 1;\n        }\n    }\n\n    function _decayCentered(uint256 centered, uint256 decayFactor, uint256 elapsed) internal pure returns (uint256) {\n        uint256 mul = _powWad(decayFactor, elapsed);\n        if (centered >= WAD) { return WAD + wmul(centered - WAD, mul); }\n        uint256 below = wmul(WAD - centered, mul);\n        return below < WAD ? WAD - below : 0;\n    }\n\n    // Floor square root: bit-length seed and seven Newton steps (all uint256).\n    function _isqrt(uint256 x) internal pure returns (uint256 r) {\n        if (x == 0) return 0;\n        unchecked {\n            uint256 y = x;\n            r = 1;\n            if (y >> 128 != 0) { y >>= 128; r <<= 64; }\n            if (y >> 64 != 0) { y >>= 64; r <<= 32; }\n            if (y >> 32 != 0) { y >>= 32; r <<= 16; }\n            if (y >> 16 != 0) { y >>= 16; r <<= 8; }\n            if (y >> 8 != 0) { y >>= 8; r <<= 4; }\n            if (y >> 4 != 0) { y >>= 4; r <<= 2; }\n            if (y >> 2 != 0) { r <<= 1; }\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            uint256 t = x / r;\n            return r < t ? r : t;\n        }\n    }\n\n    function getName() external pure override returns (string memory) { return \"STACK_SHARE_CMA1\"; }\n}\n","sha256":"35085dc82d2aeb7a34b077e30b5a408a2aed909cafc23253270eeb9756e90681","seeds_kind":"tuning","paired":{"n":512,"mean_diff":-0.23209032978094113,"se":0.01286418335743683,"worst":[{"seed":110087,"diff":-1.222266458397712},{"seed":110389,"diff":-1.0109780583608199},{"seed":110170,"diff":-0.9880123001944412},{"seed":110422,"diff":-0.9538972476333356},{"seed":110194,"diff":-0.9391051860789617}]},"retail_edge_delta":{"mean":-0.20501330487098002,"se":0.011181100972920417},"arb_edge_delta":{"mean":-0.027077024909960744,"se":0.009531165273663529},"gas":{"max_ok":219173,"oog":0,"init":221000,"afterSwap_calls":8630745,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},"notes":["Local development experiment only; no leaderboard score or top-ten claim.","Specific item seed rules used: CRN 100000..100063, re-rank 100512..100767, final held-out 110000..110511. No seed >=5000000. Reference calibration alone uses 0..999.","Each strategy runs in its own market against VanillaStrategy using run_batch(...,8). All seeds retained, including negative paired differences. SE uses sample standard deviation (ddof=1)/sqrt(n).","seeds_kind=tuning is the requested experiment label; the primary paired estimate is the once-only held-out block, not the search objective or rerank.","All STACK estimators and original fee processing retained. After its final caps, replace only the attracting side identified by spot versus the 70/30 pHat/fastHat stale estimate. The exposed fee is unchanged for identical prior state; altered future fees naturally change subsequent observations.","Eight-entry table f_j=scale*j/7, j=0..7; exact supplied share is maximized over this grid, with precomputed WAD square roots. fR=max(0,grid_argmax_fee-c2*sigmaHat*sqrt(1+silent)*(1+c3*probArb)); then fA=clamp(w*fSTACK+(1-w)*fR,lo,hi). w depends on firstInStep. Later prints have probArb=0, since the engine arbitrages before retail.","For Y input T=c1*sizeHat*reserveY; for X input convert this Y notional at current spot. Dividing by input reserve gives t=c1*sizeHat on both sides. This is the exact stated share formula under that symmetric-reserve proxy, not a claim to know the other AMM current reserves.","Retail/arb components numerically reconstructed from recorded prior-step spot and fees, current-step fair price, and constant k=1000000 using engine arb equations. Retail edge=total edge-arb edge. Every final seed checks arb-volume discrepancy <= total Y volume of trades with |profit|<1e-8 plus 1e-5, and direct versus cancellation-stable arb edge differs by <1e-5.","A first held-out STACK baseline batch (110000..110031) was repeated solely after the strict 1e-5 absolute arb-volume check failed at seed 110019 by 0.000102113 Y. The candidate remained frozen and its held-out run had not started. No held-out score informed selection; the candidate was evaluated once on all 512 held-out seeds. Subsequent 32-seed chunks are checkpointed before validation.","The component reconstruction repair was checked on separate tuning diagnostic seeds 100800..100863; these were not optimization or selection evaluations.","One preliminary harness used README-rounded volatility bounds 0.00088..0.00101 and returned reference mean 525.5234442071842; those pilot scores were discarded before CMA. The corrected canonical bounds are 0.000882..0.001008. The preliminary search had one candidate evaluation; the reported search log and final estimates all use corrected bounds.","Gas statistics aggregate selected-code evaluations on CRN, rerank, and held-out (64+256+512 seeds). Any halt or OOG invalidates the candidate; no result is silently retained after an OOG.","Parameters are dimensionless; fee bounds and scale are fractions (0.003=30 bps). c1 uses logarithmic CMA coordinates. Full-covariance CMA-ES uses numpy default_rng(1), population 10, mu 5, initial sigma .25, reflected [0,1] bounds, and the usual rank-one/rank-mu covariance and cumulative-step-size updates.","This mechanism did not improve STACK on the held-out block; retain STACK for production."],"baseline_sha256":"2eaafc7960e520b8a7fd322ec8afaff8fa677c730228a961efb509cc30b25719","simulator_commit":"6b6921f8d463314aa7c96234e1be25a25245f704","calibration":{"n":1000,"mean_edge":525.5258821780834,"expected":525.5258821780834,"difference":0.0,"oog":0},"seed_blocks":{"objective":[100000,100063],"rerank":[100512,100767],"held_out":[110000,110511]},"search":{"cma_seed":1,"population":10,"objective_evaluations":108,"rerank_evaluations":3,"seconds":1770.1927506690263,"parameter_order":["w_first","w_later","lo","hi","c1","c2","c3","scale"],"normalized_initial":[0.75,0.75,0.05555555555555556,0.32307692307692304,0.47682757819771954,0.09999999999999999,0.2,0.4166666666666667],"physical_lower":{"w_first":0,"w_later":0,"lo":0,"hi":0.0015,"c1":0.36787944117144233,"c2":0,"c3":0,"scale":0.002},"physical_upper":{"w_first":1,"w_later":1,"lo":0.0018,"hi":0.008,"c1":30,"c2":3,"c3":5,"scale":0.014},"total_oog":0},"rerank":[{"params":{"w_first":0.933481692,"w_later":0.957360233,"lo":3.15e-05,"hi":0.004348039,"c1":0.97486237,"c2":1.627510821,"c3":1.417573152,"scale":0.011247558},"sha256":"35085dc82d2aeb7a34b077e30b5a408a2aed909cafc23253270eeb9756e90681","paired":{"n":256,"mean_diff":-0.24922139427232226,"se":0.01709063463718312,"worst":[{"seed":100696,"diff":-1.3223988934017825},{"seed":100517,"diff":-1.1561767340784854},{"seed":100701,"diff":-1.0352324196657605},{"seed":100519,"diff":-0.8990429522957584},{"seed":100614,"diff":-0.8322856828591512}]},"valid":true},{"params":{"w_first":0.922222382,"w_later":0.879474448,"lo":1.5178e-05,"hi":0.004111791,"c1":2.311918263,"c2":1.126070129,"c3":1.777084501,"scale":0.008679505},"sha256":"be29604a3328deddaa3c230e0e01c8ac85d1fa0899fa1623063d9dabf7d44785","paired":{"n":256,"mean_diff":-0.3594747917519838,"se":0.021689764040545616,"worst":[{"seed":100696,"diff":-1.529523954657975},{"seed":100658,"diff":-1.3618482475195606},{"seed":100634,"diff":-1.2009368650476517},{"seed":100519,"diff":-1.1989042619162547},{"seed":100554,"diff":-1.1836586005958907}]},"valid":true},{"params":{"w_first":0.9511028,"w_later":0.89688088,"lo":3.731e-05,"hi":0.004789964,"c1":0.442515074,"c2":1.286046756,"c3":1.274023482,"scale":0.012934012},"sha256":"0038c9742e51d2a60c057ec0fbcb5fa80835ed59be0662198b27ef330c8c94d1","paired":{"n":256,"mean_diff":-0.3213993838462863,"se":0.019171565864301326,"worst":[{"seed":100696,"diff":-1.4671477115888365},{"seed":100519,"diff":-1.1030143212783514},{"seed":100648,"diff":-1.0806889909251822},{"seed":100701,"diff":-1.0783200034780975},{"seed":100658,"diff":-0.9492609833954475}]},"valid":true}],"held_out":{"stack_mean_edge":521.3515407170912,"candidate_mean_edge":521.1194503873102,"candidate_sim_seconds":88.69735983095597,"stack_sim_seconds":69.54694133787416,"max_arb_volume_reconstruction_error":0.0001021129937726073,"max_stable_arb_edge_discrepancy":1.426414542038401e-10,"max_near_zero_arb_volume":0.09298582246528739},"checks":{"validation":"Validating strategy...\nCompiling strategy...\nStrategy 'STACK_SHARE_CMA1' validated successfully!","share_math":{"table_math_cases":151,"passed":true},"exposed_side":{"exposed_side_cases":120,"all_estimators_identical":true,"passed":true}},"provenance":{"measurements":"Generated locally by the pinned simulator; not sourced leaderboard observations.","sources_file":"sources.json"},"reproduce_python":"import os,time,json,hashlib\nfrom pathlib import Path\nimport numpy as np\nimport amm_sim_rs as sim\nfrom amm_competition.evm.compiler import SolidityCompiler\nROOT=Path(__file__).resolve().parent\ncompiler=SolidityCompiler()\ndef compile_code(code):\n r=compiler.compile(code, contract_name=\"VanillaStrategy\" if \"contract VanillaStrategy \" in code else \"Strategy\")\n if not r.success: raise RuntimeError(r.errors)\n return list(r.bytecode)\ndef compile_file(name):return compile_code((ROOT/name).read_text())\ndef configs(seeds):\n out=[]\n for seed in seeds:\n  rng=np.random.default_rng(seed)\n  size=rng.uniform(19,21);rate=rng.uniform(.6,1.0);sigma=rng.uniform(.000882,.001008)\n  out.append(sim.SimulationConfig(10000,100.,100.,10000.,0.,sigma,1.,rate,size,1.2,.5,int(seed)))\n return out\ndef run(bc,seeds,vanilla=None):\n if vanilla is None: vanilla=compile_code(Path('contracts/src/VanillaStrategy.sol').read_text())\n t=time.monotonic(); res=sim.run_batch(bc,vanilla,configs(seeds),8)\n elapsed=time.monotonic()-t\n return sorted(res.results,key=lambda r:r.seed),elapsed\n\nimport math\nimport numpy as np\n\ndef components(r,initial_fees):\n # With separately collected fees k is fixed. Reconstruct pre-arb reserves,\n # evaluate the engine's arb, then retail=reported total edge minus arb edge.\n steps=r.steps\n spot=np.array([100.]+[s.spot_prices['submission'] for s in steps[:-1]])\n bid=np.array([initial_fees[0]]+[s.fees['submission'][0] for s in steps[:-1]])\n ask=np.array([initial_fees[1]]+[s.fees['submission'][1] for s in steps[:-1]])\n price=np.array([s.fair_price for s in steps])\n rx=np.sqrt(1000000./spot);ry=1000000./rx;k=rx*ry\n buy=spot<price\n gamma=1.-ask\n raw_dx=rx-np.sqrt(k/(gamma*price))\n dx=np.minimum(raw_dx,rx*.99)\n dy=(k/(rx-dx)-ry)/gamma\n pb=dx*price-dy\n eligible=buy & (dx>0) & (dy>0)\n keep=eligible & (pb>0)\n arb=float(-np.sum(pb[keep]));vol=float(np.sum(dy[keep]))\n # Near-zero arb profit is a subtraction of nearly equal floats. A few tiny\n # trades can flip the engine's profit>0 branch under reconstruction rounding.\n near=eligible & (np.abs(pb)<1e-8)\n uncertain_vol=float(np.sum(dy[near]));near_count=int(np.sum(near))\n stable_pb=np.where(raw_dx<=rx*.99,price*dx*dx/rx,pb)\n stable=float(-np.sum(stable_pb[eligible]))\n gamma=1.-bid\n netx=np.sqrt(k*gamma/price)-rx\n dx=netx/gamma\n dy=ry-k/(rx+dx*gamma)\n ps=dy-dx*price\n eligible=(~buy)&(dx>0)&(dy>0)\n keep=eligible & (ps>0)\n arb-=float(np.sum(ps[keep]));vol+=float(np.sum(dy[keep]))\n near=eligible & (np.abs(ps)<1e-8)\n uncertain_vol+=float(np.sum(dy[near]));near_count+=int(np.sum(near))\n stable_ps=price*gamma*dx*dx/rx\n stable-=float(np.sum(stable_ps[eligible]))\n reported_vol=r.arb_volume_y['submission']\n total=r.edges['submission']\n return dict(seed=r.seed,edge=total,retail_edge=total-arb,arb_edge=arb,arb_volume_reconstruction_error=vol-reported_vol,near_zero_arb_volume=uncertain_vol,near_zero_arb_count=near_count,stable_arb_edge_discrepancy=arb-stable)\n\ndef check_components(row):\n assert abs(row['arb_volume_reconstruction_error']) <= row['near_zero_arb_volume']+1e-5, row\n assert abs(row['stable_arb_edge_discrepancy'])<1e-5,row\n\nif __name__ == '__main__':\n import sys\n start = int(sys.argv[1]) if len(sys.argv)>1 else 110000\n count = int(sys.argv[2]) if len(sys.argv)>2 else 512\n vanilla = compile_code(Path('contracts/src/VanillaStrategy.sol').read_text())\n all_rows = []\n all_gas = []\n for name in ['STACK.sol', 'SHARE.sol']:\n  bc = compile_file(name)\n  rows = []\n  sim.gas_stats_reset()\n  for offset in range(0,count,32):\n   rr, elapsed = run(bc,range(start+offset,start+min(offset+32,count)),vanilla)\n   rows += [components(r,(.0004,.0004)) for r in rr]\n  all_rows.append(rows)\n  all_gas.append(sim.gas_stats())\n base,candidate = all_rows\n assert [r['seed'] for r in base] == [r['seed'] for r in candidate]\n out={}\n for key in ['edge','retail_edge','arb_edge']:\n  d=np.array([a[key]-b[key] for a,b in zip(candidate,base)])\n  out[key]={'n':len(d),'mean':float(d.mean()),'se':float(d.std(ddof=1)/np.sqrt(len(d)))}\n out['gas']=all_gas\n print(json.dumps(out))\n","reproduce_instructions":"With the pinned checkout and setup from the brief: save code as scratch/SHARE.sol, STACK artifact code as scratch/STACK.sol; save reproduce_python as scratch/harness_reproduce.py; compile_file and run support the provided seeds, use components(r,(.0004,.0004)) for each result. Loop in batches of 32, once for each strategy separately against VanillaStrategy; subtract rows by seed and use numpy.std(ddof=1)/sqrt(n). Standard base imports come from that pinned checkout."}