emoa/0000755000175100001440000000000013630504411011206 5ustar hornikusersemoa/NAMESPACE0000644000175100001440000000237413630503453012440 0ustar hornikusersexport(coalesce) export(crowding_distance) export(dominated_hypervolume) export(emoa_console_logger) export(emoa_control) export(emoa_logger) export(emoa_null_logger) export(epsilon_indicator) export(hypervolume_contribution) export(hypervolume_indicator) export(inbounds) export(is_dominated) export(is_maximally_dominated) export(nds_cd_selection) export(nds_hv_selection) export(nds_rank) export(nondominated_ordering) export(nondominated_points) export(normalize_points) export(pm_control) export(pm_operator) export(r1_indicator) export(r2_indicator) export(r3_indicator) export(sbx_control) export(sbx_operator) export(steady_state_emoa_control) export(sympart) export(UF1) export(UF10) export(UF2) export(UF3) export(UF4) export(UF5) export(UF6) export(UF7) export(UF8) export(UF9) export(unary_r2_indicator) export(which_points_on_edge) useDynLib(emoa,do_crowding_distance) useDynLib(emoa,do_dominated_hypervolume) useDynLib(emoa,do_eps_ind) useDynLib(emoa,do_hv_contrib) useDynLib(emoa,do_is_dominated) useDynLib(emoa,do_pm) useDynLib(emoa,do_r_ind) useDynLib(emoa,do_sbx) useDynLib(emoa,do_sympart) useDynLib(emoa,do_unary_r2_ind) useDynLib(emoa,do_which_points_on_edge) useDynLib(emoa,nondominated_order) importFrom("graphics", "par") importFrom("stats", "runif") emoa/ChangeLog0000644000175100001440000003175612030307154012772 0ustar hornikuserscommit 3551c9dd8df2daa6c5963219836e6028f56d2256 Author: Olaf Mersmann Date: 2012-09-25 12:51:25 +0200 Add unary_r2_indicator(). commit 82b1df869248e0fa82ab4fe056750c037229a7fd Author: Olaf Mersmann Date: 2012-09-25 12:50:54 +0200 Remove duplicate documentation. commit 521070ee319a310cfe325f73fb1ac3d5da55c5b6 Author: Olaf Mersmann Date: 2012-09-25 09:50:07 +0200 Fix off-by-one error in weight vector computation. commit dc0b5191dea459756d4040cdba7e0c456c11ae8e Author: Olaf Mersmann Date: 2011-10-18 11:10:27 +0200 Initialize variable to make compiler happy. commit e124e343be4ae2a055cc3f7d610330ba8ff183e2 Author: Olaf Mersmann Date: 2011-10-18 11:10:07 +0200 Add error handler. commit 6a0e0952d3775dddba102eeaaaaffb5fca37b8d9 Author: Olaf Mersmann Date: 2011-10-18 11:09:45 +0200 Add comments around symbol after closing #endif in auto-generated code. commit 3abf4ea0e57b710c583b630a9e98f47c8fe6b706 Author: Olaf Mersmann Date: 2011-10-17 15:48:30 +0200 Remove printf() from code and incorrect const modifiert. commit 1b5b6be7b1079debabbbf771ed532672023a1e01 Author: Olaf Mersmann Date: 2011-09-06 19:58:32 +0200 Fix CRAN check notes and warnings. commit 9316a375843fecef563e678c634e35a6abaf7545 Author: Olaf Mersmann Date: 2011-07-26 11:26:42 +0200 Add another unit test for the epsilon_indicator(). commit d1faf5f839a8ac51dceeb74cd9d277a68dc5d57f Author: Olaf Mersmann Date: 2011-07-26 11:24:17 +0200 Rename precomputed_weight_vectors.def to precomputed_weight_vectors.h R requires all files in the src/ directory to have a known extension. This changes the customary .def extension for X-macros to .h in order to comply. commit 782a51b5becaaf21d214f3df9ef860fa6a650f71 Author: Olaf Mersmann Date: 2011-07-06 17:11:04 +0200 Change all .Call()s to call-by-symbol instead of call-by-string. Instead of passing the string name of the function to .Call(), we now pass in the symbol which is bound via the NAMESPACE file. This is a bit faster and at the same time more robust. commit 3aedc8f7d3aeff2f5791a13b540bffe28eb009cb Author: Olaf Mersmann Date: 2011-07-06 11:19:11 +0200 Improve performance of R indicators. Weights for common combinations of lambda and number of objectives are now precomputed at compile time, drastically reducing the time it takes to compte the R indicators. commit e1b619b90229d40753aff580831a251d3007500a Author: Olaf Mersmann Date: 2011-07-04 19:20:11 +0200 Add function to calculate which points are on the edge of a front. The new function which_points_on_edge() returns the indices of the points which are on the edge of a front. This function is lightly tested, use with care! commit f299fef9642095d771dab378411c879d371c8bab Author: Olaf Mersmann Date: 2011-06-29 18:29:18 +0200 Fix bug in epsilon_indicator(). The matricies passed to epsilon indicator were interpreted as row-wise instead of column-wise point clouds. Because of this, incorrect values were calculated. These reflect the "epsilon indicator" for the "points" formed by transposing the matrix passed in. This resulted in incorrect values USER VISIBLE CHANGE: epsilon_indicator() now correctly calculates the value of additive epsilon indicator. All previously calculated values were incorrect and should be discarded. RATIONAL: Bugfix. WHAT TO CHANGE: Nothing. But all experiments conducted using the epsilon indicator need to be rerun. commit 6d48e86d8b1c8aafed7b6297d6c6032ddc991698 Author: Olaf Mersmann Date: 2011-06-17 10:00:23 +0200 Pass '...' to hypervolume_contribution in nds_hv_selection. USER VISIBLE CHANGE: The reference point can now be passed to hypervolume_contribution. RATIONAL: Bugfix. WHAT TO CHANGE: Nothing. commit 840e2e7c72b356813977c38f533589f0bd57de3a Author: Olaf Mersmann Date: 2011-01-21 20:49:16 +0100 Fix another bug in hypervolume_contribution(). For more than two dimensions, hypervolume_contribution() permuted the columns of the matrix passed in. This resulted from a missing duplicated() in do_hv_contrib in hypervolume.c. USER VISIBLE CHANGE: sms_emoa() should finally work on three or more dimensional problems. RATIONAL: Bugfix. WHAT TO CHANGE: Nothing. But if you've used a previous version of the package for many objective optimization, you should check your results and rerun the optimization. commit 626f0af82879f626297fcdf81767eae8146bbc37 Author: Olaf Mersmann Date: 2011-01-15 13:05:49 +0100 Remove debug output from hypervolume.c. commit e1a48202e0db2c265e3ddc0569e67ebfe26a85b6 Author: Olaf Mersmann Date: 2011-01-13 23:32:45 +0100 Add RUnit package to list of suggested packages in DESCRIPTION. RUnit is required to run the test suite and therefore belongs in the list of suggested packages in order to pass R CMD check. commit e517304c72b245c290668b0d31c1f4eea1b50fc9 Author: Olaf Mersmann Date: 2011-01-13 23:23:12 +0100 Fix bug in hypervolume_contribution(). For more than two dimensions, hypervolume_contribution() produced false results, because of a row/column mismatch. USER VISIBLE CHANGE: sms_emoa() should now work on functions which have more than two objectives. hypervolume_contribtion() should return positive values instead of all zeros for sets of points in three or more dimensional space. RATIONAL: Bugfix. WHAT TO CHANGE: Nothing. But if you've used a previous version of the package for many objective optimization, you should check your results and rerun the optimization. commit c7e332ed8f346606943f0dc5574d361f0c7c21a0 Author: Olaf Mersmann Date: 2011-01-03 21:31:21 +0100 Update use of replicate for the upcoming R release (2.13). Thanks to Martin Maechler for pointing out the change and sending a patch! commit e373860a02efb64a7ea36c400f3725cab886a66f Author: Olaf Mersmann Date: 2010-12-22 19:37:04 +0100 Fix a small bug in nondominated_points(). nondominated_points() incorrectly dropped one dimension when only one point is nondominated. commit 85558e367c7a5e8bb77a975298c3bff52d5759d2 Author: Olaf Mersmann Date: 2010-09-15 15:50:03 +0200 Add new operator 'is_maximally_dominated'. Sometimes you are only interested in the individuals on the last front after nd sorting. We call these maximally dominated solutions. There is now a function do directly check which points are maximally dominates. It is aptly called 'is_maxiamally_dominated'. commit 69a26dd9995bb5ed4ca57ef34ba0d51a07dd50f0 Author: Olaf Mersmann Date: 2010-05-18 02:34:47 +0200 Correct URL in DESCRIPTION. commit cd57a1ce6a2a439d420856738d84e7de87197837 Author: Olaf Mersmann Date: 2010-05-17 22:15:48 +0200 Documentation fixes for the hypervolume code. commit f548cf0b8051d8bc4600d993de6968caf9d50352 Author: Olaf Mersmann Date: 2010-05-14 22:52:41 +0200 Fix miscapitalized .R file extension in unit test runner. commit da19b744d4e196841e5a12b6994f1f5ac748be7f Author: Olaf Mersmann Date: 2010-05-14 22:45:05 +0200 Fix CFLAGS in Makevars. Last fix did not actually work. Instead of SHLIB_CFLAGS, ALL_CFLAGS and ALL_CPPFLAGS need to be passed to CC. commit 19ca3cc068ff6b61c6ef920817a01e7acdf50106 Author: Olaf Mersmann Date: 2010-05-14 22:19:03 +0200 Fix Makevars to use SHLIB_CFLAGS. commit 2339bfcbf790ef2c62e8ef60f99c140581d33b1d Author: Olaf Mersmann Date: 2010-05-14 22:11:38 +0200 Package documentation for release. commit 70b30a0b91ee97bad6e1c65fb14482623936fc1f Author: Olaf Mersmann Date: 2010-05-12 22:37:15 +0200 Implement automatic versioning. This commit adds an automatic versioning scheme to the Makefile. If this is a clean working copy, we count the number of commits since the last tagged minor release (tag name 'v.') and then use '.-<#commits>' as the version number. If the working copy is not clean, we again determine the major and minor version from the last tagged commit and then use the number of seconds since the Beginning of Time(tm) as the revision. This ensures, that dirty/development packages always have a higher revision number than checked in releases. commit 8e770a1adaafa88c0d67c3aa3ef86220df41afa3 Author: Olaf Mersmann Date: 2010-05-12 09:04:05 +0200 Remove Version: from DESCRIPTION. commit a12119c3772f44a516e46532fc925f468bf090d8 Author: Olaf Mersmann Date: 2010-05-12 08:06:43 +0200 Fix typo in *_indicator() documentation. commit d8bb611f07266293c69a22e13ce549e200e88ca2 Author: Olaf Mersmann Date: 2010-05-12 01:13:04 +0200 Fix unit tests to match implementation with regard to Inf handling. commit 4708542ec8a28ee637fbf06464698dc47a82f554 Author: Olaf Mersmann Date: 2010-05-12 01:11:53 +0200 Fix encoding issue in dominated_hypervolume() documentation. commit a4c9914b24f3747131bec9472a58f56a5b258ad3 Author: Olaf Mersmann Date: 2010-05-12 00:47:33 +0200 Clean up hypervolume documentation. commit 485c24db267bd34e1f704e9f79811a566a4e280a Author: Olaf Mersmann Date: 2010-05-12 00:34:40 +0200 Update Fonseca et.al. hypervolume code to version 1.31rc1. commit 3096d0645a463ffda619fc4703066190cbcdbabd Author: Olaf Mersmann Date: 2010-05-11 19:50:42 +0200 Improve CEC2007 data set documentation This change also fixes a small 'bug' in the convert.r script that creates the data files during the package build process. Previously the metric column was not converted to a factor but instead left as a character vector. commit 1cbee1fd8b1381c485d315585914f1f568be9db9 Author: Olaf Mersmann Date: 2010-05-11 19:42:39 +0200 Change Description: of package to reflect current scope. commit dc53618bbb6c59c2a5235e75145f7bb549ca87be Author: Olaf Mersmann Date: 2010-05-11 19:40:17 +0200 Add preliminary documentation to *_control() functions. commit 4d8d6701aeffdca401c48a51d4d8fad6660efd1d Author: Olaf Mersmann Date: 2010-05-10 22:17:28 +0200 Add control parameter framework. All EMOA implementations should pass their control list() through the appropriate *_control() functions to validate the parameters or fill in missing values with default values. Because all parameters are now stored in the control list(), the default logger hat to be adapted to look in the control list for a reference point instead of in the environment of the EMOA function. commit 77a949f8eb7b40edf34b2bb8ed6a928635e1a510 Author: Olaf Mersmann Date: 2010-05-10 20:16:53 +0200 Remove %dominates% operator. commit 7bcde3b81b4e623b26d249a0d1ba85be98496126 Author: Olaf Mersmann Date: 2010-05-10 20:13:24 +0200 Add a simple logging framework. Generalize logging for EMOAs by providing generic log events (currently 'start', 'step' and 'stop') and hooks to log these. Default implementations for a console and a null logger are provided. commit 50e7fb75ea3f786f9d4580b4c319506b49711d4e Author: Olaf Mersmann Date: 2010-03-11 15:32:29 +0100 Generalize nds_cd_selection() to more than one individual to be eliminated. commit 3336f357b5a19eda03f3382e8f27a9ee4bc4fabb Author: Olaf Mersmann Date: 2010-02-28 22:11:50 +0100 Small whitespace fixes. commit 6de17cfa3491877666809c72721e8da7aa15438c Author: Olaf Mersmann Date: 2010-02-28 22:11:32 +0100 Add static linkage to internal functions. commit 8abbf386a241185fecd8caf24a5525389646454a Author: Olaf Mersmann Date: 2009-11-02 01:24:06 +0100 Fix build machinery. emoa/data/0000755000175100001440000000000012030307154012115 5ustar hornikusersemoa/data/cec2007.rda0000644000175100001440000010320713630503504013657 0ustar hornikusersT۲A@DD *AEA$9HNsd%AhA@ɠ(fc=ܻ;ǘ[֪ݳYU_}5^'@O'pqplKlni+`#{[Oo7o{nFw6x#?ވ7mhwOf9XzZ:mE#)_Z _>Og~n>Φ>[;ʚ[I+SsK};nڍ߶mi3۟zn?߮?aQ֣j,wwOz*8g7g/WͿ̎/(^W0-ɿ)ʉ!!'W_c'COwrBg?sc~O_=_?W_}?!~_\5&IN=wq8w}Wƿzczo%sy+?ϕYw?ԯ<}zD\ߑ&|_Koԭ\I xWssW~篱9WsJ'7<ϯ?_ 173?'k S'~I3w_u~357xß_i9'Npmy }5?=l_ccԯl3+}?{ӾsO?g_$SG9w?Ϻߑi3FsmW6?7Jx۹'7kS~c73/qX[X[X:^r3w\] %P?j1 S{xChTY]<8JEJ׈ܡN-U| UPT)YCU >zB#@> 2DUnD5;ü V|(ju_@H ߕAsl/TOnɔR=P{ $=$޲ ZlOz胨u6T@7vE0x,2:G5?9Q ضpTC_XƊۏdj~!p6vwRܯ!큐FؼO$: ߽H4-Xa{ޡ 8'jVjGB|@f,H7#!!s p桇1W>' @ݘ[y'W̿ k,-}=;KEs*z$q0I9/t&:>Q! c'~ޫ%"8灄3 ASXMM+sZ1<$.~r"y@1[E$dt&@jG`$Q%p? 3]ϯՂ)F+XY _^7P7iUDiLL s%h[q呟JoFh݁r109ұzѹ 0$]n ;XրJO5b bnguPHEpeϾ C, Ӥ/m6,;WV]vI|>H/l)~3IȆrcuNۦ-$;9l@ ZdrYr!-+Ax\K%1NdH{4UgBCp xhpcl| T.v<W. fc Bû%Aw\ ePڞO bw{spy_2C/}?t|d{ 8p) Z3t)[e8 ι ],~[z~s0. ~45nGK9^5c~hR~?mffrA 脯.V,e'4g8D+DZWW*9@Uu#t~Tk ̷Bܣ֎Iiջr% M%JԚAQO_:D"Onޕ $~AO!>=3P OY2~0Qp?q@3fM&crB.)I 5re過ؼq.n7 (Ұss2Aϸ&g%|4D :#BwvkCSstפFJ؊vhJwZ-^64t$22)ٲ`>][py6c:В'LN)F'Fǩ P}֯A~n(ZxyQT/};#hS߹ _zX} eϊ\ "^yg>(v"-ޡDegAfMҭauӒB;gRIMMqod WbDiȖX4Y/H~4Iu>T:GK }}o{._;追'β{U<'·<^%K@"OK=}D7^!tWض momxh>*0͙C!bE2=\W /=!E|s)Sol<[Kbq]8xJϛ5 E: ڢIC(!Kgއ 59RԵv_ N%'#f)U1:"f$_}7ys,J=FB Si[p@yz($Í@ tNyv66M Y7 &m~aGX> .Qa/xG&_Ugnz7VڛH%XğmH/X| ATԧDz.VrN`~"^V=7̎I@4\̔R 3|,n?oV_ǝg#{~>~8VR2.NPc*1P.@;_ͧ *dm8f۽?8#sbJ+pڎwCz?yST =KlIjd$q#>+O }q5q}LR1rnE a ?yB ƗTl"䧊?>3q\P|팬_; 4rtƻ[F>"u cI+>1ĭ.t~m(ƛNΡ+yedJ <TkG[*$=%lmICM{K ELAxkM$ణ\Px< >"(R߈bS 4 ӕZ8cRZt^Td;HlMa"x<4#J먇BcD&t\luA@ Kʳ~)[oYpCh6|(i=mS_y GcJrx@S{_D=]E᭐|I(*>A!xu3tg΋]'%h) 귑bvr+^RG|v 2^<9%q\N>yb m׵%Cu?4/b%McQpm:\{ɒU!:"މ;; ݡ5w%s@"Ɯ< YEA}ۮ;ܭJbtqA}XovΏ14h*oFEt ;7c\Q 4{˜c=cIcsD-P_֋y,m7BF?tfm 7(t'KD_ٲ R^ef"5/RQU:a51z!Q 89fuɑIY.A0\1xlr0(dۣQp'V&-=1\i[ uyCɡ89sAnf LTO4TTSP=!?X|n>?M_B F|(qUtm-e_u)dײt>Q2ϻ%9$zbXT46B&"(zá?TxFu@&|7TE=? nc@vVAD T[?!߳jk>Qt8a 5I揟jT1 `cC:gؼ8r"7N5ny'h؞c?`Ux L Kx phکJ 7I {߃e7+34 Z~4Tmə4r@~)Qw6M#'v9'3//H.B^Ƨ"FΚC;ɈHݿs:D:k,#^/}]E#S cR@P!{aH yh)ZğS ",UOOќ4??^EZ.ͮC3_W鶾, f'mF%z.Ä>f;SUyJ{^CpT61hAÎ: u ɕPe"e/ߨ/]z &0)\: F\yð'M0"y3HLfD}1- H `~{rϏœT^ MuZ ˠ~ t=14| ?N9iCy[ugQ)`aB}[q; agaЅ c6t-w1z> @V WyRtLw>ԿSyJM|[}PLy*(^겪B8SZ8,n 0V\ =,eeF|@#nۦ ̿?qDHJV5q&C9{PFJKV<զI S! ljV7ˋ|`!e4y|oaF'Xy_;gܝD7m|V tw UւHd|ʟ~I 5"2t*-Jx-7Gc!@g-:MSEZ_` V^ RfdW,{ݶ=N_\bC=8^MޗϠ i_`:q+ {C^cx䢅'hA "9nY>9Q컭{ &3{򫥇e;6MeݟQӂyoBr徥BIʇ Dou3Bra1k>Oe# C'w%{'o)4%9~3AGw&*ګxDs e?Ps >}J4rÏF`ݥR~YG&o/$boRO,Sk(~E/}~ՠPvtڠ`%:11P7F{=Q ?fhSN4qњx7,?v74pHg` m/D^E/6ʁ -x$!HgZMdC˧ѽh&=!9ZI'kjlA} JtvMuߧ,~ w# 6~"8u^6>'۸ֱA4 6jg6g|ƗΣU*ߡ~oHP5d>Zk/}^D8hS@C{U e4 44QСO3mh5]A#"ɒ۳}hCV(47֙5NV=]%vU|rb &^B*f# ϒBcbNj_dbGNJy!([&ŒD7X0j!6t9콤ݗx6ڛpBLsѽ!Q5|K.ܫ{f{4VJ 䧕?y6=jZM5*e񣰖Q8^"tۃc5&l>gك7< snF[' F婠.W5цiZ"s+iW3rإdB~Nh$ttB,+_Q3gW@%N@GQ[Ue-hr/i~BSJ}rM}{*՗ @Yzx%<7..jrl4٨.ZJcuT/0e5\8f?`pZW'-2QmNșZx}j8+'Z>rU6!nc\bOj1erC~k#]=Hŧ8M#Մ:FҎD7FdQundM1C c(WCϾ>l.Buw>}d iׇ96gU u^p>HxU˟{1@C@cVحىF ^YsNLc5an魚Hk7-aSfRObVp!܏*|NB4`x{>8V [K VspDV&%,D< /ZiWALmEJ2\(s._./Gp#r?TۚxY']d]Eۺn~"6r}f6h}z8~UĔ3rqBO((h8盽 m}pes\4Hy~ԧLTh6L] Q8-G=?S !R OC.9_U^염}Z ;Vt$m<9g{T9|XId0݃:8{ z4EC"@Òlvc9M0F JhJPbjkx5<bq^QA' Z7ױg d[z)w8mߝ}Ro5~E~%r: pZ_ &6ٵ?Ԑ6V㐍x]=l[!k_W2W=q`yA+ -UL JEtz*daԵ[ɷyz~=4.$ld@za2Jnӛ醴u OH޵!Èt@C<[5/`=p~B1N'D j\bJ<0=%(bvMp7d.-o[8&vi^*6a/q[ƕ ]I`KmD:/j D8\W Wxk> /hk/G $%5`,f57ƚA & )mB>ҧL#`h)BML%Q`Y۠|oʼn!깖0$'&>5¾m/D L3SgH f*2d6غ>[ >2@˒k`RlZj饎+lU逅!n)6Wto-*1Z\c㆏bܤ&Y !\+Yŕ*:ʒeVme&0o$l_2I& L]3%dz_Doͅ21醌P4gD>3y*|S F痕p| x yd`#8[?䝴3hϔ99Gnoڦ >G{N⿅S6y  WRaҟ;Vg/+~2@DpʁXcݜ!v[,Q'k e?B:K͊ڐ;^.(Gj:`Miڸ@sLMe9DȌ3<<م|PյE>8=] &&:˜E)y@Ds /l $6zg 4MG:Ǚא/{Hr):Xqi:TS8)V7mhcm7X.W o7 A<)6 SyS `3i2{DțZ*J'2`QfA7}mD>Z^un8yfK4DoR +oMޚQ1 ˉIhs7™ZHOg>/ ?}bR{ '92'1Њ/<@A ċ nуcO"t.fLM)'U`:،nk?F^}p{{C-ɖd23׳o )6]|HKyD3֕%9(gtdCJ#>M:%!T4C!3Y_8 BB _Pbч?j~J\+ KjT3Zlo@<Ø(ܙ%#"T?eBJ ^?PCG!ғ|hzG\ AO@9e.ՃYH,b(-"PJ b1.P$N/_ @Jo0 i$|ܒIgr Kr$>yAT{p|~=ړO•x)&3ay+`lc- Z;s:8ʮ 9$/SZ&M @U-0 ` 6p\A&j*gO!7NP#ORO@}}8uh*9e"$ 9UV*gpߟpi]cR2 Ƚס߯cXw)L4Zmqۻq:ݏI-8-~Wc#U-xZTVӍ@gk/e?1T4SQCPr)EpDa-odCXRdYum-o(øe ~txA$5_!\)mܚ §OEEhj_e9^B9pd?&>7NF YJ>~:mC5.p™s$h#ڂwe\K,c!p0sSC룗$@,ͺqʍu11[(ICޣ1gNճ<\2 Е*~d'ML2+1-lu&u@_±)\#(ϊrR_c.Қ lƱ86N?x `ߗDDR[̜4Iک>;`k2'}Ku:2&S@6~ׅ7mQQυdAVU-PuE33T nM [õtE+bڇ!. ~6(⧩N=Y"![N)u{+fZ׫kڣN/]BHP6YIIBP)ba0a ocy=_8$ GiYB 7uywqV+D)8{d#PΥu,ݯv*4:;n_, ی+ }_Mhv-mV >)tU1!%HJ_p; y p>vqq $;"+Uj=@Lq NW^^[G4e>=tak8aCKCE>`vtEeWUMm ȗxMN8\`%{HO'KEoϱ7:6dS(#@ p+oeJ<톼d侂E?cOZ_ߜOA$p}f#}Cd?'5CF5W'>gSnȰi}z9?"fmɒ3i&/zU1 /<׆>xȑ||_xU Fv'fxr4hO4ۀ`д1FqT7)6[:NոɅpcGmmTC#~z:v0v^hcw?9^_dN0&"2F?=K8#7udheY?Img\f&1?Ox~w g{tw$2g> 3LU'(潤{>w * 03*'E xΰoY!zw{lk c ?׈C`v*vgA%99f/?@$FG2矟AoX#V8f gc/$zL3"~O{uSLS6*ʼc@x48̥l\)}nf/s'uɂHwǃ#gऊ$;~KI.Y-}K+n @~tAc6$s/*ufʡVNhYpO(`jg&»>,{;@:E|_zwjlzniD7ڹkoST $O&R؏NcZ{ѻb'˛+й?C;  OdaK,[G%qD#j)7w#+ƃ~}wY{y,yϛ_^[hpy1(Tb.\ ?{ՈA!FFRYH(<jwҍèC<}]%=OrXtϻ^2 eP_F=Lx̳s_F+[fBcwF~ 3;m=hqQehi桻,BQڌ0H?;t(D'~NǃsQrGJ |' 4(E5Xn5iye얳Pls@.chThAtJ2]:ZZ-ͣs=|y| 1Ter ٍwv40wQy4Do :[zQ˫9ty}xC^.%/; ,hk]A6oF\( $a@1B,QJ_zNWv]o'܎;KӄlB>cql\"920*A٨9~lvAW2?xWeT_@D_= Iٲts,8_[UA*vLPOxb.2eW2Qq0AYi(gɶ %!f)Qs\0 54juvW=NC6cPH3pꎁ72 / @$U_/t% Ӑw^ (a G3{ I~ d`Hݷf[CrV ۄb +mZQMݼ+Tݴ[|hw [DQ3tFM4{A4&0 Kmfū=ng\$"ͽ^n9 (or\yyD'6K簾MrI"Myk@ݔx"&?9 Q[ؚ;@u*&d3 T|h x_H)k &pP AM&Jp ~lrL :r*ef}zl=M>F?A: }#ݹ_퉬ǑdQK%{\£>!V-yYq=yhs7)htsD$a>˞ˎ ȗ\dff5ܻ}Zb#?fA5G2 W%DTTȲ @hYe?n\;tĻqh9{6)84nքB>\~1aX̜^H2dk۬<;ז+CRP\$"^:83rO%<6ʱkwo!H22LV $ T| "?#` >FWF`xa҃QH$q/*Es 76PWPJm*LI lޑ<8y!o{9 i usfIN(n B>#4G ]wєwu{=oʚtZJ)XUm4='KJIljQk)sQG9W7\6uW6[y>%a ȴJԄm=M{/&#(;PR~<8͵g=8oҒ15xBL!".:? F;1w Ϗ=`zpAUx7Nꕐu p"厍ec{DΠB|^rU@>,+{hk! FHF%\gd"GfG60+ϚyY\K(V1 s#"M*WO\e1.\-Zb7+%"CP)0tOZDGx;!t |Kҽ!%Au*>}"MM{@5!_vBZ`Ro%;) A8$mH+ x ,zFH~uN! c>_Fy/ [2Tշ kO%r3~0?RHoqu"_o9}ƯރlOX/Ft5'u$ CrF7R1 d^2~=8C;d>jo&BnVu*"-gwBH󸌋 #̝Nqzؑ )j-㴰¾cu!m{=\sTeҳ֦-c8|KR8vSA WwWy{@ɎIudWiVsL`{!|(g3Tw8̞Rb8yƥEՇo۟w kŕ^#,A.6NZ/&6(';2ueZ ]8;i&IV f$~=j1yԶԜ/8cɾW7\42U9ji驴\G }2<2kq5R8q@pL5=U%UEO:,µ .P88=+A;ftp8Iv}#|:Zq|;H<$5"-Q7Tq@$CodF` PӨ([Mu(?Xɏ@HHB ?x>Nl=X㧲XGe>CDH✏rN5ЂbymI~FbEDVr 9ZA$o.ePWb$aǘsŠG`5& T'ӿ # 0`3ltҡú, $r'C]b>Gk' <۞2Dߙ8mr"1{ Z|1lc&}MEUjtL? ;4)Nh4YE;(t[;$l$ Dؤ'W_-ɣk,r58P|Tԍ;T$,C&. uZ*jʯfn'::ũ6 mbxCNgEgW;Cv`+\U-k=>d8}_߫*p-trsXWt\|3a@NU_qYA_=Sffx.)LeEs6S!4Sy=8+6lm%Y x}@y=s2-5~`K.oS{ ljNL0A2-hǜg܏pk `=FGoWiWL9{|@(uG{-nϩ&i@S|݊*ԂV8\m=TZVkR?ɹwp0ω}ȸ1rku$+RHqmєa"$F8g_F:ŎGPE~\T&=JC|l+0BސbV0i}Sf'yǠz{pN[QG+4f[m6bf¡ nx~h CKBsEc?a6&v>^ѝ kƸS7uV0W̑vR";gtjEz}fNb;ThLwj؁)v M3p' 1touX &'JӓyI0axqF$FqTB>x~4U=@iȠMu\;@׍5J'1,B,`Mq|0,xF.$Uʺa:-&S vP!C} a|U}o@-IX"`4LjS/Pcsa GZ +1HaCLF Eah$e/ozN ePJA16 :Kv(Av"5cPG (c8QuÒ&;10 y#c3; 3:;bh %ٗ߯>#JgPjJw(IȤb{ʼn#W !tS>dq c4ۮ2Z6H,&ox}Hdd@Vf۔4D ^\'8$iadm"P՗"w!/#`@k$%'05),]?Ex`;z1K{dyМ]U h.Ɣ2F3vhڭ;?VKT`ɐXfw^p(hNy %4pF&b $,{|6 |%(^\;=ѓ.6<(G㦝Z{ͧ5^\X=tpI;B&w06; F`.9iu|C4%Lg='假1ԋl [=Md9zg"t b|w06!fFx$QA| H~%*Dw+YD#v¨[AN԰hT9dVtQ<&S[pl^],/=&w| cyXnw:il%y!SƄoxUeG<6&vd!;@/ΙDו>H)"\z5+lʣoNdz%*@cwhbh>N>4mi8G~6l{:_/VF={$Q@ Qn;v.l$ e]3Ȣ`14`܄64w Z~u%ZV =LPX!Z5G*HRBIO[ԟso? )x Vib wҺP);;\,SLbֶn ]X] L /Yn ڹۘ*qoH׿C2[0ǔ}xCK zBj%O?QAM%npQLzO J^Y11& j/ir_ヅ [W(ҁ=JbN%'yq 1_I3o闺hסZT=Klj{$SF Fh; {8~~M8*'p#jxwƌ> 7PZ{3lj7XZfa`}y|XH Kh!Ù[ݧӈl8 [)W!*X3$%)B'&$\/;9{ ص5U@1"_P4Tn^&Myuh( {iWrs<T?ܠӀ埃;A4T}?_PeUY?A*~g(߉Bĵ,/ 4|d87GZ}j3)1.z? sp_R?pSj4-RwTCg˚phjWN+rb o_CXFz+dS#WEhDdf(RHCXFOݝ 1 %duU$ P'>E;pmOgVxLd'AD"o}g\L!vdZdj 1  !R)!%ϐ4˚.ش7Bw!M xL e`e:fbџ5Γ;ղpqU9&n ~nz 9n66|(ZĺALFeá-hH5DNEdcP+W{sȆН4Δ!N.*epM(i{fS>jMI+Wu@gB,!U%1Ӱu~ oE_}-op[۳ dĶ0c8pT ^,\L 9@ W1iN~|/l2mie l>ۋeG _u=fU`_B!dkH-Z&]8xR0Sȇؽ+àrHKbۖ#UMYkG7p[iZP_g]L% '@`a;q]ܬQ3R ̦, fWAYj~\>Q~("d@+C‡b*\SlWඊ}~8u@.]`|O\g9L0Ul86DvP^fX3ܗS@&Z|#y8Z}NGNz!ҏ4iO{c8՘O itԣ@~V6J&We%t?JU7ڇY@D?M8OB|뭜q`[Φ=I:߭^v[@һQv $㉙iP+ 类,r yHgKgA/N9`)NHojJ{83e7līW-_ :Z!^IVcs(pKm!8(?3@4&MY 9C -avԌJ$^_( _/5{gq=A%TH?R.rOʧ^!*0qU]?cZÀNQĭAz>7FV&8ssHDuiNy} oAANJw'/!E#Fj5k^"G:Ot.= L#1yQGN[s@MҥpIw7r!䝡`IhKΣoA`|SˡW ySuQ/ RHt,4J!+9dKZd)OQi;BH*kL =$z|J:|>b l8˺ tܫ%K3)1v|IJm/4>M\7q c|t>%;7{"6oNK 1< 鶂 rdRD{Y) o(<'&flNΠqrোX~]}Bp d q-DxR#ND]bM\P/XūK#)qH1UuDɉf@J#3r(2SKw ~ŇĐtbn}h i+h+h)0r M%-Ҝv|Mb2u+@aLHѧ3y%تsXl<S.;g ;@#Q duӅB.t%$aqOY˭e䌗c(cqD?M'F,0c)|Jt<mdA'/p%P퍧y [<%m nZuÁ#d˲8(f='1YxcdmC) UAXk)C!wN ŧHu  .jP ԇѕa0&ɉ$xa4A;7QXptm5J( 4ܪ{:1弲ƶ/KUoPX> 10%?[yssztWHy@%5el}&.LU-^ζ>4i8Sh3QCvC£JóBs@+]"tFgo;i7$wI|@bugw4|PW0& CƜaap%>R(¸><rok+`*b:z\^^ ?ح4Nݻ (6^TwЌ)MLooմCЈԇWTB5f[Rfҙ}H!z9O7!aZ#U:<`S"%4M'rhVUhռVu0<>ls/ycFvSx{5^);t!#h('0ժԧ݅cЍaS8AFT샶R9u#JXmK84i[0 FxDƹ9>qC"nJ0_@5%`_zLՇ~ CuT9DJ<# 1afH5 #Z \RyqziuO.#SӋ!lp}9?䢧qW&~D o\'0Pyq<9Kw,>3: u3!=!e}V!/au!MG)C H8V;WA% $T7]rnB4LM/\HM U} ̇Wn޹;&H919 pƉ%s^fIT|gO܁-$Tҽy@vӞ=33x,%7*4@M[ZlX?]WmAr9K"=Ȫ3';4^c.w/Ti'rM ?m*< 'RKt C&Y]l 41v% يurcQ({ OB¿kSEZnϗ#"l[iCzw"'`Dzҋ/.L}¬0+:YG+Tc 0 7Y4$)#u "rF꠺g [hD-lxid2r cq`cLcb`rY\;,Eb:|VݡA&Ġ͡ [Ǩ[GSƔ*=1Dp7:TN?d_g|mMv0pA<Tٍ@.:![0ƽyR@gP3kұ5\F Tޝ*dva o &]yvԍ,cJZa *%,(rCVKǗF(Ph9u&?0'`B:jՋ(\susE &z=ٝ^0_S1lQ(JwG)=xY*_R4lRԡ(@NfvT$ cv" K_Bj܀>oK; OMg_+ԣSvvPyi (O 2 %N]4G+*`;OR:֡NQCBknĠE:S Ǥ"j sx]8J֠,%C&-}KE< ?GmNghQ;ѐuT]|BC;@o@{,Hh=YJ唱mj4k#H>J]4+U*F9ԇf0}$pp8*[.2{ր4PEzoom[w[ [  ݯh.Ѥq\cC8hZoL5CGh6b27I2nhzܟF}7*{$ɍCu5 k(~oМ{o%Q׌h?@1L~ˣCȯTCڽ.G646iW/l" -|+Ltxw i=;i(2:60Fȇ~ P޽? R?LtaXG&ѠhQn"iI, ?t8<2I:]ѻB,,*0G'Έ_Ziq?h ”ٕE}s/=k:{PGˋ2aLEZ4rGnK'{'yTrmc>y,<79CR섙#4[o>>$Mj؅ӹQ(W)C9e HJC=0"0͢U7gbЊnj!Thn)Zsjn޺8Zraz"S&5 (.34 r wp4귓us LUc9(D-qWNZIRBc u^eeњ:h0ihc y Wp1 C"40Yt%Dv҆7 [g `^}.=T#MS0.l>}j@4-\P`LP0͛B"`wwOAz+ot>:5DcAe%?0 M9v ͇,/zuG ,|#ó!0Gq:k MGoJ[0$2~~SBsr|hi5Wz{ۻnEwҋ|J.4evӠj=wE/~RX>K~㐎fRܙg7"o2 "qy{IX=O36 "mFXس+J~'yPFpD!$s2U@%e{ ixkGh |Qi˜L9wB$kG=XNYl[x`<lhBYKg26/Ap@Hy)y\y^ݥI}?#.XfGLz@V,;Bt gf=zWk9>Ł'FqV(K?\sG_fx }D><?'a<>#XqC&z9 7SQܚ`bN۾$X`v2GK'PϺ/ n}&|['{gq* ADU. qbO{ @vl%ޢ4 c ,o~O@"<d}cM]coSL 8 31K)G.&lm&ˣ'[ǹTOR6~  H^yS&"%lPxPE-uݷC~Trrl3o]yIO`AY'CG'AMddU/])~"omY2ʤh ޲ -vW-xL m]+JcJ݋l\J}0o= %@1u{Ph&՟เ.ބ; (fDݿ(%% CVC@b>HlQ(F:oJE>o!ynm|OኸkȗAB C. 0]{t9o8˛ξ>&JsNq:Ks{k%@.p,=ߣ yȄ9!twTzD4 ;0I[ ͼ2m -IN @RIOWPJf $^>Lć3-NRAu=Kywt .h<" Z^ W~KWp !(OO "섧ĊV>62) +d$RzCs=T@<֒Dl*~l,bpRVR`qB-dUڿ8y#zH[=VE!/һdžfzdǰ tȖM3C^rlGWj/m!c焅|,GCH!  住3hl0DF9;D|ɮ,22r3iBm\É6ۢ :*O_: Ys MZ30voKAV7#hj <G7p&sd/#or+!oh!gE RRǒNCkͦRɻp>wurXwra?Û˰Sֺؠx[6D8Orב͕_n$KwdqyO=$W>$y7g4nn!X!W D0 Ֆ6Dxq*sv7P_ tv !}=stm2 Ip w!Hf:+gӨ5-Q]BFM&7}NmN7Ab<J3l񘥫G ('4Π%Gn03;TJςc_m)ĵ{> תzjZB%!C.HdJ~k `rRRFe||ay!S,ߑzhlط5pHѤe[ߑ"N OC>v0Nmfny3AԌ饈LHv鼢:şl|m.6&Kя:Bu]p5Tso`e(8 }6lUq:\)͏&G1 3Lg4>I^#Afo7i^[xX&-o#/Iй}x/6 fAPq>.-/ 'WhV/e?З A¼z-,UY冃0+!d%8E'xgRݘv+<) ruJ HD=iѴ-pvrD8UH }r:dY 0Q.7P34Bȋu…TRN7 $7޻7JԑA ~';N }{/?U|js ڑ_>Napbv)b 8Ϋvo? >dםx ZM7y "d{B%I!(ebث*`٠"7cJ(Rv2JkfߥHfG!}i!%=^PYYc'}/AgNC'UyHM[u z{$_R>`eY՘"KN"'s8 ͪD Nv #RnN*A^gQd`Щ*C_dDbw/LDs7TRAP6{Eܷ~zK`Mi5 Q]7@e{V(pѨoۃzag x]^4l~N@@kxipfU5{G NϢD|P~M\> dAV=`3qOq$ 2άf;|`0Q(-jlS/̳pbQH p N{&A/}!ߘq\Y@3Ч!- ѻW'?˲W/`HOzyPA>^OgC Mk,u5AFЯ>LK40̈́CP5\?p<)~<;m[dk+ s5VKSAze0 MdB,*hkjdpXK=@Z Ω!h@=_cd`X3Tq辇x绌g[K,\"LpRm]Z*=>#QkpK\oEX+PZ?k`+|%܌|D6ͥsAC.\pt~2 Z+ ~`]w 0т<bL v+9㘃qXyw}fI;Mҟ0jBCA;a |(Hmܙ)uN%A^1ص"iA^$3~FCGWX9cMWHbsaGz1]4avw'T@]虒*13Sx\.mρfu}py]Zb إU_`qIz~Ղ c'I9 :o0>^ z$'Ov=JY<l (hhi"oX¥+O=y=z\ \8p6~ UI!zB]vAxwPwC6~Fg vC*q Sbx1cyMilW 9\@ o:^W %ezLqiTc6䂫3 !%{n~?7"깥gŊ$0=_B,2v +AoK=>– r r=$uLLa6CELE He9^-$|`ԽAf$lu8dhd}[oO2_KD˦v! c%Ak2gFC,ZJ|8b:\RpMH ]vHdjc:/yIw o@[`i S0HǧvF'*+ݏ "ݾ)DO ߕN=OOH ֌4C]_CQdti)ɡi@@?OLAW.Y7bc0b*8? t I0=)8(Ľl wʂԣ+W!בC'zz}@g+`"]ܜ fxǤ ''gcm{ BZ0q4zxkXm?jLy?u['=}hȇWj zWhS(ȯT0%Jk4pPק`ΡWo n䷿CxWМ\7ח?ܺ@BD ]4%}: jp)> L@}> Ù|ʧpH)Oqv&G \\uv# 4#ً!&/_}_4hGEf/_4h뫥a( mJ[7.\p8.\p&)զI~p1&4~sឧsEVp )W`܃1<@8 0`VA l&2Xi!P:Z >h' V@lFp:97`<  A t nx ,w .ĹXGƂ6uJQ ҸѢd~0@$,sh&k-~OyM(e۩nɖQݐ\O\ tS]ұ˪0Z?JU.Ri);;[rscemoa/man/0000755000175100001440000000000012030307153011756 5ustar hornikusersemoa/man/crowding_distance.Rd0000644000175100001440000000052512030307153015735 0ustar hornikusers\name{crowding_distance} \alias{crowding_distance} \title{Crowding Distance} \usage{ crowding_distance(front) } \arguments{ \item{front}{matrix of function values.} } \value{ crowding distance for each function value. } \description{ Calculate crowding distances. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/dominated_hypervolume.Rd0000644000175100001440000000413612030307153016654 0ustar hornikusers\name{dominated_hypervolume} \alias{dominated_hypervolume} \alias{hypervolume_contribution} \title{Dominated Hypervolume calculation} \usage{ dominated_hypervolume(points, ref) hypervolume_contribution(points, ref) } \arguments{ \item{points}{Matrix containing the points one per column.} \item{ref}{Optional reference point. If not provided the maximum in each dimension is used.} } \value{ For \code{dominated_hypervolume} the dominated hypervolume by the points in \code{points} with respect to the reference point \code{ref}. For \code{hypervolume_contribution} a vector giving the hypervolume soley dominated by that point. } \description{ \code{dominated_hypervolume} calculates the dominated hypervolume of the points in \code{points}. } \details{ \code{hypervolume_contribution} calculates the hypervolume contribution of each point. If no reference point \code{ref} is given, one is automatically calculated by determening the maximum in each coordinate. Currently only one general algorithm is implemented due to Fonseca et.al. but work is underway to include others such as the Beume & Rudolph approach as well as the approach by Bradstreet et.al. The 1D and 2D cases are handle seperately by efficient algorithms. Calculates the exact dominated hypervolume of the points given in \code{x} subject to the reference point \code{ref}. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \references{ This code uses version 1.3 of the hypervolume code available from \url{http://iridia.ulb.ac.be/~manuel/hypervolume}. For a description of the algorithm see Carlos M. Fonseca, Luis Paquete, and Manuel Lopez-Ibanez. \emph{An improved dimension-sweep algorithm for the hypervolume indicator}. In IEEE Congress on Evolutionary Computation, pages 1157-1163, Vancouver, Canada, July 2006. } \seealso{ \code{\link{nondominated_points}} to extract the pareto front approximation from a given set of points and \code{\link{nds_hv_selection}} for a selection strategy based on the hypervolume contribution of each point. } \keyword{optimize} emoa/man/dom_op.Rd0000644000175100001440000000137712030307153013532 0ustar hornikusers\name{is_dominated} \alias{is_dominated} \alias{is_maximally_dominated} \title{Pareto dominance checks.} \usage{ is_dominated(points) is_maximally_dominated(points) } \arguments{ \item{points}{Matrix containing points one per column.} } \value{ For \code{is_dominated} and \code{is_maximally_dominated} a boolean vector and for \code{\%dominates\%} a single boolean. } \description{ \code{is_dominated} returns which points from a set are dominated by another point in the set. \code{\%dominates\%} returns true if \code{x} Pareto dominates \code{y} and \code{is_maximally_dominated} returns TRUE for those points which do not dominate any other points. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \keyword{optimize} emoa/man/cec2007.Rd0000644000175100001440000000245412030307153013315 0ustar hornikusers\name{cec2007} \Rdversion{1.1} \alias{cec2007} \docType{data} \title{CEC 2007 multiobjective optimization competition results} \description{ This data set contains the hypervolume and R2 indicator results of the 8 different algorithms that took part in the CEC 2007 multiobjective optimization benchmark. } \usage{data(cec2007)} \format{ A data frame with 456 observations of the following 9 variables. \describe{ \item{\code{algo}}{Abbreviated name of algorithm} \item{\code{fun}}{Name of benchmark function} \item{\code{d}}{Dimension of objective space} \item{\code{n}}{Number of function evaluations} \item{\code{metric}}{Name of quality metric} \item{\code{pdef}}{Unique id for each combination of \code{fun}, \code{d}, \code{n} and \code{metric}} \item{\code{best}}{Largest value of metric} \item{\code{median}}{Median value of metric} \item{\code{worst}}{Smallest value of metric} \item{\code{mean}}{Average value of metric} \item{\code{std}}{Standard deviation of metric} } } \source{ \url{ http://web.mysites.ntu.edu.sg/epnsugan/PublicSite/Shared\%20Documents/CEC2007-final-pdfs.zip } } \examples{ \dontrun{ data(cec2007) require(lattice) print(dotplot(algo ~ median | fun + metric, cec2007, groups=cec2007$n)) } } \keyword{datasets} emoa/man/emoa-package.Rd0000644000175100001440000000161212030307153014557 0ustar hornikusers\docType{package} \name{emoa-package} \alias{emoa-package} \title{The EMOA package} \description{ This package provides functions to construct evolutionary multiobjective optimization algorithms (EMOA). The long term goal is to also provide standard implementations of the most common EMOA in use today. } \details{ Without the hard work of many researchers who have published their source code under a liberal license, this package would not have been possible. In alphabetical order they are \itemize{ \item Michael H. Buselli \item Wessel Dankers \item Carlos Fonseca \item Joshua Knowles \item Huang Ling \item Wudong Liu \item Manuel Lopez-Ibanez \item Luis Paquete \item Ponnuthurai Nagaratnam Suganthany \item Santosh Tiwar \item Qingfu Zhang \item Aimin Zhou \item Shizheng Zhaoy } } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \keyword{package} emoa/man/pm_control.Rd0000644000175100001440000000152212030307153014421 0ustar hornikusers\name{pm_control} \alias{pm_control} \title{Polynomial muation (PM) control parameters} \usage{ pm_control(f, upper, lower, ..., control, default = list()) } \arguments{ \item{f}{Multiobjectve optimization function.} \item{upper}{Upper bounds of parameter space.} \item{lower}{Lower bounds of parameter space.} \item{...}{Further arguments passed to \code{f}.} \item{control}{List of control parameters.} \item{default}{List of default control parameters.} } \value{ The \code{control} list with suitably adjusted arguments. Missing control parameters are taken from \code{default} or, if not present there, from an internal default. } \description{ Control parameters: \describe{ \item{pm.n}{Nu parameter of PM.} \item{pm.p}{p parameter of PM.} } } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/binary_indicator.Rd0000644000175100001440000000322312030307153015565 0ustar hornikusers\name{hypervolume_indicator} \alias{epsilon_indicator} \alias{hypervolume_indicator} \alias{r1_indicator} \alias{r2_indicator} \alias{r3_indicator} \title{Binary quality indicators} \usage{ hypervolume_indicator(points, o, ref) epsilon_indicator(points, o) r1_indicator(points, o, ideal, nadir, lambda, utility = "Tchebycheff") r2_indicator(points, o, ideal, nadir, lambda, utility = "Tchebycheff") r3_indicator(points, o, ideal, nadir, lambda, utility = "Tchebycheff") } \arguments{ \item{points}{Matrix of points for which to calculate the indicator value stored one per column.} \item{o}{Matrix of points of the reference set.} \item{ref}{Reference point, if omitted, the nadir of the point sets is used.} \item{ideal}{Ideal point of true Pareto front. If omited the ideal of both point sets is used.} \item{nadir}{Nadir of the true Pareto front. If ommited the nadir of both point sets is used.} \item{lambda}{Number of weight vectors to use in estimating the utility.} \item{utility}{Name of utility function.} } \value{ Value of the quality indicator. } \description{ Calculates the quality indicator value of the set of points given in \code{x} with respect to the set given in \code{o}. As with all functions in \code{emoa} that deal with sets of objective values these are stored by column. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \references{ Zitzler, E., Thiele, L., Laumanns, M., Fonseca, C., and Grunert da Fonseca, V (2003): Performance Assessment of Multiobjective Optimizers: An Analysis and Review. IEEE Transactions on Evolutionary Computation, 7(2), 117-132. } emoa/man/nds_rank.Rd0000644000175100001440000000127112030307153014045 0ustar hornikusers\name{nds_rank} \alias{nds_rank} \alias{nondominated_ordering} \title{Nondominated sorting ranks} \usage{ nds_rank(points, partial) nondominated_ordering(points, partial) } \arguments{ \item{points}{Matrix containing points one per column.} \item{partial}{Optional integer specifying the number of points for which the rank should be calculated. Defaults to all points.} } \value{ Vector containing the ranks of the first \code{partial} individuals or all individuals. } \description{ Perform (partial) nondominated sort of the points in \code{points} and return the rank of each point. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \keyword{optimize} emoa/man/emoa_null_logger.Rd0000644000175100001440000000036512030307153015563 0ustar hornikusers\name{emoa_null_logger} \alias{emoa_null_logger} \title{null logger} \usage{ emoa_null_logger(...) } \arguments{ \item{...}{ignored.} } \value{ An \code{emoa_logger} object. } \description{ Logger object that discards all log events. } emoa/man/emoa_logger.Rd0000644000175100001440000000102713630503474014540 0ustar hornikusers\name{emoa_logger} \alias{emoa_logger} \title{generic logger factory} \usage{ emoa_logger(output, every = 10L) } \arguments{ \item{output}{function used to display logging messages.} \item{every}{number of steps of the emoa between evaluations.} } \value{ An \code{emoa_logger} object. } \description{ Basic logger object with a flexible output routine. } \seealso{ \code{\link{emoa_console_logger}} and \code{\link{emoa_null_logger}} for convinience wrappers around \code{emoa_logger} providing useful defaults. } emoa/man/cec2007_functions.Rd0000644000175100001440000000051112030307153015375 0ustar hornikusers\name{sympart} \alias{sympart} \title{Functions from the CEC 2007 EMOA competition.} \usage{ sympart(x) } \arguments{ \item{x}{Parmater vector.} } \value{ Function value. } \description{ Functions from the CEC 2007 EMOA competition. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \keyword{optimize} emoa/man/pm_operator.Rd0000644000175100001440000000110612030307153014572 0ustar hornikusers\name{pm_operator} \alias{pm_operator} \title{Polynomial mutation operator} \usage{ pm_operator(n, p, lower, upper) } \arguments{ \item{n}{Distance parameter mutation distribution (\eqn{\eta}{eta}).} \item{p}{Probability of one point mutation.} \item{lower}{Lower bounds of parameter space.} \item{upper}{Upper bounds of parameter space.} } \value{ Function which implements the specified mutation operator. } \description{ Returns a polynomial mutation operator with the given parameters. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/cec2009_functions.Rd0000644000175100001440000000100512030307153015376 0ustar hornikusers\name{UF1} \alias{UF1} \alias{UF10} \alias{UF2} \alias{UF3} \alias{UF4} \alias{UF5} \alias{UF6} \alias{UF7} \alias{UF8} \alias{UF9} \title{Functions from the CEC 2009 EMOA competition.} \usage{ UF1(x) UF2(x) UF3(x) UF4(x) UF5(x) UF6(x) UF7(x) UF8(x) UF9(x) UF10(x) } \arguments{ \item{x}{Parmater vector.} } \value{ Function value. } \description{ Functions from the CEC 2009 EMOA competition. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \keyword{optimize} emoa/man/nds_hv_selection.Rd0000644000175100001440000000146612030307153015602 0ustar hornikusers\name{nds_hv_selection} \alias{nds_cd_selection} \alias{nds_hv_selection} \title{Selection strategies} \usage{ nds_hv_selection(values, n = 1, ...) nds_cd_selection(values, n = 1, ...) } \arguments{ \item{values}{Matrix of function values.} \item{n}{Number of individuals to select for replacement.} \item{...}{Optional parameters passed to \code{\link{hypervolume_contribution}}.} } \description{ Selection strategies for EMOA. } \details{ The currently implemented strategies are nondominated sorting followed by either hypervolume contribution or crowding distance based ranking. Both of these implementations are currently limited to selecting a single individual for replacement. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \keyword{nonlinear} \keyword{optimize} emoa/man/emoa_control.Rd0000644000175100001440000000177512030307153014740 0ustar hornikusers\name{emoa_control} \alias{emoa_control} \title{Basic EMOA control parameters.} \usage{ emoa_control(f, upper, lower, ..., control, default) } \arguments{ \item{f}{Multiobjectve optimization function.} \item{upper}{Upper bounds of parameter space.} \item{lower}{Lower bounds of parameter space.} \item{...}{Further arguments passed to \code{f}.} \item{control}{List of control parameters.} \item{default}{List of default control parameters.} } \value{ The \code{control} list with suitably adjusted arguments. Missing control parameters are taken from \code{default} or, if not present there, from an internal default. } \description{ The following control parameters are recognized by \code{emoa_control}: \describe{ \item{logger}{\code{emoa_logger} object used to log events.} \item{n}{Number of parameters, defaults to the length of the longer of \code{upper} or \code{lower}.} \item{d}{Number of dimensions.} } } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/inbounds.Rd0000644000175100001440000000063012030307153014065 0ustar hornikusers\name{inbounds} \alias{inbounds} \title{Clip value to a given range} \usage{ inbounds(x, l, u) } \arguments{ \item{x}{Value to clip.} \item{l}{Lower limit.} \item{u}{Upper limit.} } \value{ l if x < l, u if x > u else x. } \description{ Clip \eqn{x} to the interval \eqn{[l, u]}. This is useful to enforce box constraints. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/normalize_points.Rd0000644000175100001440000000102412030307153015636 0ustar hornikusers\name{normalize_points} \alias{normalize_points} \title{Scale point cloud} \usage{ normalize_points(points, minval, maxval) } \arguments{ \item{points}{Matrix containing points, one per column.} \item{minval}{Optional lower limits for the new bounding box.} \item{maxval}{Optional upper limits for the new bounding box.} } \value{ Scaled points. } \description{ Rescale all points to lie in the box bounded by \code{minval} and \code{maxval}. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/which_points_on_edge.Rd0000644000175100001440000000104512030307153016423 0ustar hornikusers\name{which_points_on_edge} \alias{which_points_on_edge} \title{Determine which points are on the edge of a Pareto-front approximation.} \usage{ which_points_on_edge(front) } \arguments{ \item{front}{Pareto-front approximation.} } \value{ An integer vector containing the indicies of the points (columns) of \code{front} which are on the edge of the Pareto-front approximation. } \description{ Determine which points are on the edge of a Pareto-front approximation. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/nondominated_points.Rd0000644000175100001440000000100612030307153016315 0ustar hornikusers\name{nondominated_points} \alias{nondominated_points} \title{Nondominated points} \usage{ nondominated_points(points) } \arguments{ \item{points}{Matrix of points, one per column.} } \value{ Those points in \code{points} which are not dominated by another point. } \description{ Return those points which are not dominated by another point in \code{points}. This is the Pareto front approximation of the point set. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \keyword{optimize} emoa/man/sbx_control.Rd0000644000175100001440000000177012030307153014606 0ustar hornikusers\name{sbx_control} \alias{sbx_control} \title{Simulated binary crossover (SBX) control parameters} \usage{ sbx_control(f, upper, lower, ..., control, default = list()) } \arguments{ \item{f}{Multiobjectve optimization function.} \item{upper}{Upper bounds of parameter space.} \item{lower}{Lower bounds of parameter space.} \item{...}{Further arguments passed to \code{f}.} \item{control}{List of control parameters.} \item{default}{List of default control parameters.} } \value{ The \code{control} list with suitably adjusted arguments. Missing control parameters are taken from \code{default} or, if not present there, from an internal default. } \description{ \code{sbx_control} interprets the following parameters used to control the behaviour of the simulated binary crossover operator (see \code{\link{sbx_operator}}): \describe{ \item{sbx.n}{Nu parameter of SBX.} \item{sbx.p}{$p$ parameter of SBX.} } } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/unary_r2_indicator.Rd0000644000175100001440000000104712030307153016044 0ustar hornikusers\name{unary_r2_indicator} \alias{unary_r2_indicator} \title{Unary R2 indicator} \usage{ unary_r2_indicator(points, weights, ideal) } \arguments{ \item{points}{Matrix of points for which to calculate the indicator value stored one per column.} \item{weights}{Matrix of weight vectors stored one per column.} \item{ideal}{Ideal point of true Pareto front. If omited the ideal of \code{points} is used.} } \value{ Value of unary R2 indicator. } \description{ Unary R2 indicator } \author{ Olaf Mersmann \email{olafm@p-value.net} } emoa/man/coalesce.Rd0000644000175100001440000000066512030307153014032 0ustar hornikusers\name{coalesce} \alias{coalesce} \title{Return first non null argument.} \usage{ coalesce(...) } \arguments{ \item{...}{List of values.} } \value{ First non null element in \code{...}. } \description{ This function is useful when processing complex arguments with multiple possible defaults based on other arguments that may or may not have been provided. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/steady_state_emoa_control.Rd0000644000175100001440000000171112030307153017477 0ustar hornikusers\name{steady_state_emoa_control} \alias{steady_state_emoa_control} \title{Steady state EMOA parameters} \usage{ steady_state_emoa_control(f, upper, lower, ..., control, default = list()) } \arguments{ \item{f}{Multiobjectve optimization function.} \item{upper}{Upper bounds of parameter space.} \item{lower}{Lower bounds of parameter space.} \item{...}{Further arguments passed to \code{f}.} \item{control}{List of control parameters.} \item{default}{List of default control parameters.} } \value{ The \code{control} list with suitably adjusted arguments. Missing control parameters are taken from \code{default} or, if not present there, from an internal default. } \description{ \code{steady_state_emoa_control} interprets the following control parameters: \describe{ \item{mu}{Population size.} \item{maxeval}{Maximum number of function evaluations to use.} } } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } emoa/man/emoa_console_logger.Rd0000644000175100001440000000064212030307153016251 0ustar hornikusers\name{emoa_console_logger} \alias{emoa_console_logger} \title{console logger} \usage{ emoa_console_logger(...) } \arguments{ \item{...}{passed to \code{\link{emoa_logger}}.} } \value{ An \code{emoa_logger} object. } \description{ Logger object that outputs log messages to the console } \details{ This is a wrapper that calls \code{emoa_logger(output=output, ...)} internally and returns that logger. } emoa/man/sbx_operator.Rd0000644000175100001440000000172712030307153014763 0ustar hornikusers\name{sbx_operator} \alias{sbx_operator} \title{Simulated binary crossover operator} \usage{ sbx_operator(n, p, lower, upper) } \arguments{ \item{n}{Distance parameter of crossover distribution (\eqn{\eta}{eta}).} \item{p}{Probability of one point crossover.} \item{lower}{Lower bounds of parameter space.} \item{upper}{Upper bounds of parameter space.} } \value{ Function with one parameter \code{x} which takes a matrix containing two sets of parameters and returns a matrix of two sets of parameters which resulted from the crossover operation. As with all \code{emoa} functions, the parameter sets are stored in the columns of \code{x}. \code{x} should therefore always have two columns and a warning will be given if it has more than two columns. } \description{ Returns a simulated binary crossover operator with the given parameters. } \author{ Olaf Mersmann \email{olafm@statistik.tu-dortmund.de} } \seealso{ \code{\link{pm_operator}} } emoa/DESCRIPTION0000644000175100001440000000145213630504411012716 0ustar hornikusersPackage: emoa Title: Evolutionary Multiobjective Optimization Algorithms Description: Collection of building blocks for the design and analysis of evolutionary multiobjective optimization algorithms. Author: Olaf Mersmann Maintainer: Olaf Mersmann License: GPL-2 URL: http://www.statistik.tu-dortmund.de/~olafm/software/emoa/ LazyData: yes Version: 0.5-0.1 Suggests: RUnit Collate: 'cec2009.r' 'control.R' 'crowding_distance.r' 'dominance.r' 'emoa.r' 'front_edge.R' 'hypervolume.r' 'indicators.r' 'logger.R' 'poly_mutation.r' 'sb_crossover.r' 'selection.r' 'sympart.r' 'utilities.r' Date: Packaged: 2020-03-06 17:24:20 UTC; hornik Repository: CRAN Date/Publication: 2020-03-06 17:31:53 UTC NeedsCompilation: yes emoa/tests/0000755000175100001440000000000012030307153012345 5ustar hornikusersemoa/tests/RUnit.R0000644000175100001440000000071612030307153013535 0ustar hornikusers## ## RUnit.r - run unit tests in inst/unittests ## ## This file is based on code in the CRAN package 'fBasics', which in ## turn is based on code from the 'gdata' package. ## pkg <- "emoa" if (require("RUnit", quietly=TRUE)) { wd <- getwd() library(package=pkg, character.only=TRUE) path <- system.file("unittests", package = pkg) stopifnot(file.exists(path), file.info(path.expand(path))$isdir) source(file.path(path, "runner.r"), echo = TRUE) } emoa/src/0000755000175100001440000000000012030307153011772 5ustar hornikusersemoa/src/crowding_distance.c0000644000175100001440000000362512030307155015634 0ustar hornikusers#include #include #include #include "sexp_macros.h" static R_INLINE void do_merge(double *data, int *index, int *work, R_len_t low, R_len_t mid, R_len_t high, R_len_t d, R_len_t offs) { int i, j, k; i=low; j=mid+1; k=low; while(i <= mid && j <= high) { if (data[d*index[i] + offs] < data[d*index[j] + offs]) { work[k++] = index[i++]; } else { work[k++] = index[j++]; } } while(i <= mid) work[k++] = index[i++]; while(j <= high) work[k++] = index[j++]; for(i = low; i <= high; ++i) index[i] = work[i]; } static void do_index_mergesort(double *data, int *index, int *work, R_len_t low, R_len_t high, R_len_t d, R_len_t i) { if (low < high) { R_len_t mid = (low + high)/2; do_index_mergesort(data, index, work, low, mid, d, i); do_index_mergesort(data, index, work, mid+1, high, d, i); do_merge(data, index, work, low, mid, high, d, i); } } static R_INLINE void index_mergesort(double *data, int *index, int *work, R_len_t n, R_len_t d, R_len_t i) { R_len_t k; for (k = 0; k < n; ++k) index[k] = k; do_index_mergesort(data, index, work, 0, n-1, d, i); } SEXP do_crowding_distance(SEXP s_front) { SEXP s_res; int i, j; UNPACK_REAL_MATRIX(s_front, front, d, n); /* Work arrays: */ int *index = Calloc(n, int); int *work = Calloc(n, int); /* Result: */ PROTECT(s_res = allocVector(REALSXP, n)); double *res = REAL(s_res); for (i = 0; i < n; ++i) res[i] = 0.0; /* Main loop. Calculate distance for each dimension: */ for (i = 0; i < d; ++i) { index_mergesort(front, index, work, n, d, i); res[index[0]] = R_PosInf; res[index[n-1]] = R_PosInf; for (j = 1; j < (n-1); ++j) { res[index[j]] += front[index[j+1]*d + i] - front[index[j-1]*d + i]; } } Free(work); Free(index); UNPROTECT(1); /* s_res */ return(s_res); } emoa/src/eps_ind.c0000644000175100001440000000722112030307155013563 0ustar hornikusers/*===========================================================================* * eps_ind.c: implements the unary epsilon indicator as proposed in * Zitzler, E., Thiele, L., Laumanns, M., Fonseca, C., and * Grunert da Fonseca, V (2003): Performance Assessment of * Multiobjective Optimizers: An Analysis and Review. IEEE * Transactions on Evolutionary Computation, 7(2), 117-132. * * IMPORTANT: * To make the epsilon indicator work for mixed optimization problems * where some objectives are to be maximized while others are to be * minimized, in the case of minimization the value -epsilon (for the * additive case) resp. 1/epsilon (for the multiplicative version) is * considered and returned. Example: suppose f1 is to be minimized and * f2 to be maximized, and the multiplicative epsilon value computed by * this program is 3.0; this means that the considered nondominated front * needs to be multiplied by 1/3 for all f1 values and by 3 for all * f2 values. Thus, independently of which type of problem one considers * (minimization, maximization, mixed minimization/maximization), a lower * indicator value corresponds to a better approximation set. * * Author: * Eckart Zitzler, February 3, 2005 / last update August 9, 2005 * * Adapted for use in R by: * Olaf Mersmann */ #include #include #include #include typedef enum {additive, multiplicative} method_t; #define MAX(A, B) ((A > B) ? A : B) #define MIN(A, B) ((A < B) ? A : B) /* * calc_eps_ind: * a - reference front * b - current front */ static double calc_eps_ind(double *a, const size_t a_points, double *b, const size_t b_points, const size_t number_of_objectives, method_t method) { size_t i, j, current_objective; double maximal_eps, minimal_pointwise_eps, pointwise_eps, eps; maximal_eps = (additive == method) ? -DBL_MAX : 0.0; for (i = 0; i < a_points; i++) { minimal_pointwise_eps = DBL_MAX; const double *ai = a + i * number_of_objectives; for (j = 0; j < b_points; j++) { pointwise_eps = -DBL_MAX; const double *bj = b + j * number_of_objectives; for (current_objective = 0; current_objective < number_of_objectives; ++current_objective) { switch (method) { case additive: eps = bj[current_objective] - ai[current_objective]; break; case multiplicative: eps = bj[current_objective] / ai[current_objective]; break; } pointwise_eps = MAX(pointwise_eps, eps); } minimal_pointwise_eps = MIN(minimal_pointwise_eps, pointwise_eps); } maximal_eps = MAX(maximal_eps, minimal_pointwise_eps); } return maximal_eps; } #define UNPACK_REAL_VECTOR(S, D, N) \ double *D = REAL(S); \ const R_len_t N = length(S); #define UNPACK_REAL_MATRIX(S, D, N, K) \ double *D = REAL(S); \ const R_len_t N = nrows(S); \ const R_len_t K = ncols(S); SEXP do_eps_ind(SEXP s_data, SEXP s_ref) { /* Unpack arguments */ UNPACK_REAL_MATRIX(s_data, data, number_of_objectives, number_of_points); UNPACK_REAL_MATRIX(s_ref, ref, number_of_ref_objectives, number_of_ref_points); if (number_of_ref_objectives != number_of_objectives) error("Reference and current front must have the same dimension."); /* Calculate criterion */ double res = calc_eps_ind(ref, number_of_ref_points, data, number_of_points, number_of_objectives, additive); return ScalarReal(res); } emoa/src/hv.c0000644000175100001440000003547312030307155012571 0ustar hornikusers/************************************************************************* hypervolume computation --------------------------------------------------------------------- Copyright (c) 2010 Carlos Fonseca Manuel Lopez-Ibanez Luis Paquete This program is free software (software libre); you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, you can obtain a copy of the GNU General Public License at: http://www.gnu.org/copyleft/gpl.html or by writing to: Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ---------------------------------------------------------------------- Relevant literature: [1] C. M. Fonseca, L. Paquete, and M. Lopez-Ibanez. An improved dimension-sweep algorithm for the hypervolume indicator. In IEEE Congress on Evolutionary Computation, pages 1157-1163, Vancouver, Canada, July 2006. [2] L. Paquete, C. M. Fonseca and M. Lopez-Ibanez. An optimal algorithm for a special case of Klee's measure problem in three dimensions. Technical Report CSI-RT-I-01/2006, CSI, Universidade do Algarve, 2006. *************************************************************************/ #include "hv.h" #include "avl.h" #include #include #include #include #include #include #if !defined(VARIANT) || VARIANT < 1 || VARIANT > 4 #error VARIANT must be either 1, 2, 3 or 4, e.g., 'make VARIANT=4' #endif #if __GNUC__ >= 3 # define __hv_unused __attribute__ ((unused)) #else # define __hv_unused /* no 'unused' attribute available */ #endif #if VARIANT < 3 # define __variant3_only __hv_unused #else # define __variant3_only #endif #if VARIANT < 2 # define __variant2_only __hv_unused #else # define __variant2_only #endif typedef struct dlnode { double *x; /* The data vector */ struct dlnode **next; /* Next-node vector */ struct dlnode **prev; /* Previous-node vector */ struct avl_node_t * tnode; int ignore; #if VARIANT >= 2 double *area; /* Area */ #endif #if VARIANT >= 3 double *vol; /* Volume */ #endif } dlnode_t; static avl_tree_t *tree; #if VARIANT < 4 int stop_dimension = 1; /* default: stop on dimension 2 */ #else int stop_dimension = 2; /* default: stop on dimension 3 */ #endif static int compare_node( const void *p1, const void* p2) { const double x1 = *((*(const dlnode_t **)p1)->x); const double x2 = *((*(const dlnode_t **)p2)->x); return (x1 < x2) ? -1 : (x1 > x2) ? 1 : 0; } static int compare_tree_asc( const void *p1, const void *p2) { const double x1 = *((const double *)p1 + 1); const double x2 = *((const double *)p2 + 1); return (x1 > x2) ? -1 : (x1 < x2) ? 1 : 0; } /* * Setup circular double-linked list in each dimension */ static dlnode_t * setup_cdllist(double *data, int d, int n) { dlnode_t *head; dlnode_t **scratch; int i, j; head = malloc ((n+1) * sizeof(dlnode_t)); head->x = data; head->ignore = 0; /* should never get used */ head->next = malloc( d * (n+1) * sizeof(dlnode_t*)); head->prev = malloc( d * (n+1) * sizeof(dlnode_t*)); head->tnode = malloc ((n+1) * sizeof(avl_node_t)); #if VARIANT >= 2 head->area = malloc(d * (n+1) * sizeof(double)); #endif #if VARIANT >= 3 head->vol = malloc(d * (n+1) * sizeof(double)); #endif for (i = 1; i <= n; i++) { head[i].x = head[i-1].x + d ;/* this will be fixed a few lines below... */ head[i].ignore = 0; head[i].next = head[i-1].next + d; head[i].prev = head[i-1].prev + d; head[i].tnode = head[i-1].tnode + 1; #if VARIANT >= 2 head[i].area = head[i-1].area + d; #endif #if VARIANT >= 3 head[i].vol = head[i-1].vol + d; #endif } head->x = NULL; /* head contains no data */ scratch = malloc(n * sizeof(dlnode_t*)); for (i = 0; i < n; i++) scratch[i] = head + i + 1; for (j = d-1; j >= 0; j--) { for (i = 0; i < n; i++) scratch[i]->x--; qsort(scratch, n, sizeof(dlnode_t*), compare_node); head->next[j] = scratch[0]; scratch[0]->prev[j] = head; for (i = 1; i < n; i++) { scratch[i-1]->next[j] = scratch[i]; scratch[i]->prev[j] = scratch[i-1]; } scratch[n-1]->next[j] = head; head->prev[j] = scratch[n-1]; } free(scratch); for (i = 1; i <= n; i++) avl_init_node(head[i].tnode, head[i].x); #if VARIANT >= 2 for (i = 0; i < d; i++) head->area[i] = 0; #endif return head; } static void free_cdllist(dlnode_t * head) { free(head->tnode); /* Frees _all_ nodes. */ free(head->next); free(head->prev); #if VARIANT >= 2 free(head->area); #endif #if VARIANT >= 3 free(head->vol); #endif free(head); } static void delete (dlnode_t *nodep, int dim, double * bound __variant3_only) { int i; for (i = 0; i < dim; i++) { nodep->prev[i]->next[i] = nodep->next[i]; nodep->next[i]->prev[i] = nodep->prev[i]; #if VARIANT >= 3 if (bound[i] > nodep->x[i]) bound[i] = nodep->x[i]; #endif } } static void reinsert (dlnode_t *nodep, int dim, double * bound __variant3_only) { int i; for (i = 0; i < dim; i++) { nodep->prev[i]->next[i] = nodep; nodep->next[i]->prev[i] = nodep; #if VARIANT >= 3 if (bound[i] > nodep->x[i]) bound[i] = nodep->x[i]; #endif } } static double hv_recursive(dlnode_t *list, int dim, int c, const double * ref, double * bound) { /* ------------------------------------------------------ General case for dimensions higher than stop_dimension ------------------------------------------------------ */ if ( dim > stop_dimension ) { dlnode_t *p0 = list; dlnode_t *p1 = list->prev[dim]; double hyperv = 0; #if VARIANT == 1 double hypera; #endif #if VARIANT >= 2 dlnode_t *pp; for (pp = p1; pp->x; pp = pp->prev[dim]) { if (pp->ignore < dim) pp->ignore = 0; } #endif while (c > 1 #if VARIANT >= 3 /* We delete all points x[dim] > bound[dim]. In case of repeated coordinates, we also delete all points x[dim] == bound[dim] except one. */ && (p1->x[dim] > bound[dim] || p1->prev[dim]->x[dim] >= bound[dim]) #endif ) { p0 = p1; delete(p0, dim, bound); p1 = p0->prev[dim]; c--; } #if VARIANT == 1 hypera = hv_recursive(list, dim-1, c, ref, bound); #elif VARIANT >= 3 if (c > 1) { hyperv = p1->prev[dim]->vol[dim] + p1->prev[dim]->area[dim] * (p1->x[dim] - p1->prev[dim]->x[dim]); p1->vol[dim] = hyperv; } else { int i; p1->area[0] = 1; for (i = 1; i <= dim; i++) p1->area[i] = p1->area[i-1] * (ref[i-1] - p1->x[i-1]); p1->vol[dim] = 0; } #endif #if VARIANT >= 2 if (p1->ignore >= dim) { p1->area[dim] = p1->prev[dim]->area[dim]; } else { p1->area[dim] = hv_recursive(list, dim-1, c, ref, bound); if (p1->area[dim] <= p1->prev[dim]->area[dim]) p1->ignore = dim; } #endif while (p0->x != NULL) { #if VARIANT == 1 hyperv += hypera * (p0->x[dim] - p1->x[dim]); #elif VARIANT >= 2 hyperv += p1->area[dim] * (p0->x[dim] - p1->x[dim]); #endif #if VARIANT >= 3 bound[dim] = p0->x[dim]; #endif reinsert(p0, dim, bound); c++; p1 = p0; p0 = p0->next[dim]; #if VARIANT >= 3 p1->vol[dim] = hyperv; #endif #if VARIANT == 1 hypera = hv_recursive(list, dim-1, c, ref, NULL); #elif VARIANT >= 2 if (p1->ignore >= dim) { p1->area[dim] = p1->prev[dim]->area[dim]; } else { p1->area[dim] = hv_recursive(list, dim-1, c, ref, bound); if (p1->area[dim] <= p1->prev[dim]->area[dim]) p1->ignore = dim; } #endif } #if VARIANT == 1 hyperv += hypera * (ref[dim] - p1->x[dim]); #elif VARIANT >= 2 hyperv += p1->area[dim] * (ref[dim] - p1->x[dim]); #endif return hyperv; } /* --------------------------- special case of dimension 3 --------------------------- */ else if (dim == 2) { double hyperv; double hypera; double height; dlnode_t *pp = list->next[2]; hypera = (ref[0] - pp->x[0]) * (ref[1] - pp->x[1]); height = (c == 1) ? ref[2] - pp->x[2] : pp->next[2]->x[2] - pp->x[2]; hyperv = hypera * height; if (pp->next[2]->x == NULL) return hyperv; avl_insert_top(tree, pp->tnode); pp = pp->next[2]; do { height = (pp == list->prev[2]) ? ref[2] - pp->x[2] : pp->next[2]->x[2] - pp->x[2]; #if VARIANT >= 2 if (pp->ignore >= 2) hyperv += hypera * height; else { #endif const double * prv_ip, * nxt_ip; avl_node_t *tnode; if (avl_search_closest(tree, pp->x, &tnode) <= 0) { nxt_ip = (double *)(tnode->item); tnode = tnode->prev; } else { nxt_ip = (tnode->next != NULL) ? (double *)(tnode->next->item) : ref; } if (nxt_ip[0] > pp->x[0]) { avl_insert_after(tree, tnode, pp->tnode); if (tnode != NULL) { prv_ip = (double *)(tnode->item); if (prv_ip[0] > pp->x[0]) { const double * cur_ip; tnode = pp->tnode->prev; /* cur_ip = point dominated by pp with highest [0]-coordinate */ cur_ip = (double *)(tnode->item); while (tnode->prev) { prv_ip = (double *)(tnode->prev->item); hypera -= (prv_ip[1] - cur_ip[1])*(nxt_ip[0] - cur_ip[0]); if (prv_ip[0] < pp->x[0]) break; /* prv is not dominated by pp */ cur_ip = prv_ip; avl_unlink_node(tree,tnode); tnode = tnode->prev; } avl_unlink_node(tree,tnode); if (!tnode->prev) { hypera -= (ref[1] - cur_ip[1])*(nxt_ip[0] - cur_ip[0]); prv_ip = ref; } } } else prv_ip = ref; hypera += (prv_ip[1] - pp->x[1])*(nxt_ip[0] - pp->x[0]); } else pp->ignore = 2; if (height > 0) hyperv += hypera * height; #if VARIANT >= 2 } #endif pp = pp->next[2]; } while (pp->x != NULL); avl_clear_tree(tree); return hyperv; } /* special case of dimension 2 */ else if (dim == 1) { const dlnode_t *p1 = list->next[1]; double hypera = p1->x[0]; double hyperv = 0; const dlnode_t *p0; while ((p0 = p1->next[1])->x) { hyperv += (ref[0] - hypera) * (p0->x[1] - p1->x[1]); if (p0->x[0] < hypera) hypera = p0->x[0]; p1 = p0; } hyperv += (ref[0] - hypera) * (ref[1] - p1->x[1]); return hyperv; } /* special case of dimension 1 */ else if (dim == 0) { return (ref[0] - list->next[0]->x[0]); } else { /* fprintf(stderr, "%s:%d: unreachable condition! \n" "This is a bug, please report it to " "manuel.lopez-ibanez@ulb.ac.be\n", __FILE__, __LINE__); exit(EXIT_FAILURE); */ error("hv: UNREACHABLE CODE REACHED. Please report this to the package author."); return -1.0; /* Never reached. */ } } /* Removes the point from the circular double-linked list. */ static void filter_delete_node(dlnode_t *node, int d) { int i; /* The memory allocated for the deleted node is lost (leaked) until the end of the program, but this should not be a problem. */ for (i = 0; i < d; i++) { node->next[i]->prev[i] = node->prev[i]; node->prev[i]->next[i] = node->next[i]; } } /* Filters those points that do not strictly dominate the reference point. This is needed to assure that the points left are only those which are needed to calculate the hypervolume. */ static int filter(dlnode_t *list, int d, int n, const double *ref) { int i, j; /* fprintf (stderr, "%d points initially\n", n); */ for (i = 0; i < d; i++) { dlnode_t *aux = list->prev[i]; int np = n; for (j = 0; j < np; j++) { if (aux->x[i] < ref[i]) break; filter_delete_node (aux, d); aux = aux->prev[i]; n--; } } /* fprintf (stderr, "%d points remain\n", n); */ return n; } double fpli_hv(double *data, int d, int n, const double *ref) { dlnode_t *list; double hyperv; double * bound = NULL; #if VARIANT >= 3 int i; bound = malloc (d * sizeof(double)); for (i = 0; i < d; i++) bound[i] = -DBL_MAX; #endif tree = avl_alloc_tree ((avl_compare_t) compare_tree_asc, (avl_freeitem_t) NULL); list = setup_cdllist(data, d, n); n = filter(list, d, n, ref); if (n == 0) { /* Returning here would leak memory. */ hyperv = 0.0; } else { hyperv = hv_recursive(list, d-1, n, ref, bound); } /* Clean up. */ free_cdllist (list); free (tree); /* The nodes are freed by free_cdllist (). */ free (bound); return hyperv; } emoa/src/front_edge.c0000644000175100001440000000661412030307155014263 0ustar hornikusers#include #include #include #include #include "sexp_macros.h" #ifndef MIN #define MIN(A, B) ((A < B) ? A : B) #endif SEXP do_which_points_on_edge(SEXP s_front) { size_t point, other_point, objective; SEXP s_result; UNPACK_REAL_MATRIX(s_front, front, number_of_objectives, number_of_points); PROTECT(s_result = allocVector(LGLSXP, number_of_points)); int *result = LOGICAL(s_result); /* Temprary storage for two reference points. Automatically freed * on return. */ double *base_reference_point = (double *)R_alloc(number_of_objectives, sizeof(double)); double *current_reference_point = (double *)R_alloc(number_of_objectives, sizeof(double)); /* Find reference point: */ for (objective = 0; objective < number_of_objectives; ++objective) { base_reference_point[objective] = R_NegInf; for (point = 0; point < number_of_points; ++point) { /* Move up/right/back by 1 to make sure reference point is * really dominated: */ const double value = front[point * number_of_objectives + objective] + 1; if (value > base_reference_point[objective]) { base_reference_point[objective] = value; } } } /* Iterate over all points and... */ for (point = 0; point < number_of_points; ++point) { double *point_values = front + point * number_of_objectives; /* All points start out as points on the edge: */ result[point] = FALSE; /* Initialize reference point: */ for (objective = 0; objective < number_of_objectives; ++objective) current_reference_point[objective] = base_reference_point[objective] ; /* Shrink bounding box w.r.t reference point: */ for (other_point = 0; other_point < number_of_points; ++other_point) { double *other_point_values = front + other_point * number_of_objectives; size_t number_of_dominated_objectives = 0; size_t last_dominated_objective = 0; for (objective = 0; objective < number_of_objectives; ++objective) { const double this_value = point_values[objective]; const double other_value = other_point_values[objective]; if (this_value < other_value) { ++number_of_dominated_objectives; last_dominated_objective = objective; if (number_of_dominated_objectives > 1) break; } } if (number_of_dominated_objectives == 1) { current_reference_point[last_dominated_objective] = MIN(current_reference_point[last_dominated_objective], other_point_values[last_dominated_objective]); } } /* If bounding box still depends on reference point, then the * point is on the edge of the front: */ for (objective = 0; objective < number_of_objectives; ++objective) { if (current_reference_point[objective] == base_reference_point[objective]) { result[point] = TRUE; break; } } } UNPROTECT(1); /* s_result */ return s_result; } emoa/src/r_ind.c0000644000175100001440000001770112030307155013241 0ustar hornikusers/* * r_ind.c - R[123] indicator helpers. * * This file includes both helper functions to calculate R indicator * values from R as well as a utility to precompute common weight * vector sets to speed up the calculation. To generate the weight * vectors, compile this file using * * cc -std=c99 -DGENERATE_WV_HEADER -o gen_header r_ind.c * * and run * * ./gen_header > weight_vectors.h * * afterwards. * * Author: * Olaf Mersmann (OME) * * Based on source code by Joshua Knowles (c) 2008. */ #ifdef GENERATE_WV_HEADER #include #include #include #define error(...) exit(-1) #else #include #include #include #include #include "sexp_macros.h" #include "weight_vectors.h" #endif #define NORMALIZED(x, min, max) ((x - min)/(max - min)) /* * Helper functions: */ static int ipow(const int x, const int exp) { int val = 1; for (int i = 0; i < exp; ++i) val *= x; return(val); } /* * Utility functions: */ static double weighted_sum_utility(const double *wv, const double *x, const double *ideal, const double *nadir, const size_t nobjs) { int i; double total = 0.0; for (i = 0; i < nobjs; ++i) total += wv[i] * NORMALIZED(x[i], ideal[i], nadir[i]); return (1.0 - total); } static double tchebycheff_utility(const double *wv, const double *x, const double *ideal, const double *nadir, const size_t nobjs) { int i; double val, mymax = 0.0; for (i=0; i mymax) mymax = val; } return (1.0 - mymax); } static double augmented_tchebycheff_utility(const double *wv, const double *x, const double *ideal, const double *nadir, const size_t nobjs, const double rho) { double tu, wu; tu = tchebycheff_utility(wv, x, ideal, nadir, nobjs); wu = weighted_sum_utility(wv, x, ideal, nadir, nobjs); return(tu + rho*wu); } static void int2kary(int x, const int basek, const int digits, int *kary) { int i; int val; if (x >= ipow(basek,digits)) { error("Number in int2kary() too large. Exiting."); return; } val = digits-1; for (i=0; i= ipow(basek,val)) { kary[i] += 1; x -= ipow(basek,val); } else { val -= 1; i++; } } } #ifdef GENERATE_WV_HEADER size_t choose(int r, int k) { double result = 1; int lower = r, upper = r - k + 1; if (lower > upper) { int tmp = lower; lower = upper; upper = tmp; } for (int i = lower; i <= upper; ++i) result *= i; size_t val = (result / tgamma(k+1)); return val; } #endif /* * create_weight_vectors - sample from all possible weight vectors */ static double *create_weight_vectors(const int s, const int k, unsigned int *pnwv) { int c = 0, i = 0; size_t nwv = choose(s + k - 1, k - 1); double *wv = (double *)malloc(nwv * k * sizeof(double)); int *count = (int *)malloc(k * sizeof(int)); while (i < ipow(s + 1, k) && c < nwv) { int sum=0; int2kary(i, s + 1, k, count); for (int j = 0; j < k; ++j) sum += count[j]; if (sum == s) { for (int j = 0; j < k; ++j) wv[c * k + j] = (double)count[j] / (double)s; ++c; } ++i; } *pnwv = nwv; free(count); return(wv); } #ifdef GENERATE_WV_HEADER void dump_weights(int lambda, int objectives) { size_t current; int nwv; double *weight_vectors = create_weight_vectors(lambda, objectives, &nwv); printf("unsigned int number_of_weights_%i_%i = %i;\n", lambda, objectives, nwv); printf("double weights_%i_%i[] = {\n", lambda, objectives); for (current = 0; current < nwv * objectives; ++current) { printf("%f, ", weight_vectors[current]); } printf("};\n\n"); free(weight_vectors); } int main(int argc, char **argv) { printf("#ifndef WEIGHT_VECTORS_H\n\n"); #define DO_PRECOMPUTED_WEIGHT_VECTOR(L, D) dump_weights(L, D); #include "precomputed_weight_vectors.h" printf("\n#endif /* WEIGHT_VECTORS_H */\n"); return 0; } #else static double unary_tchebycheff_utility(const double *data, const double *weights, const double *ideal, const size_t n_objectives) { double max_val = -DBL_MAX; for (size_t i = 0; i < n_objectives; ++i) { const double diff = data[i] - ideal[i]; const double weighted_diff = weights[i] * diff; if (weighted_diff > max_val) max_val = weighted_diff; } return -max_val; } SEXP do_unary_r2_ind(SEXP s_data, SEXP s_weights, SEXP s_ideal) { /* Unpack arguments */ /* Matrix is in column major order! */ UNPACK_REAL_MATRIX(s_data, data, k_data, n_data); UNPACK_REAL_MATRIX(s_weights, weights, k_weights, n_weights); UNPACK_REAL_VECTOR(s_ideal, ideal, n_ideal); const int n_objectives = k_data; double res = 0.0; /* Calculate r criterion */ for(int i = 0; i < n_weights; ++i) { /* Find max_weights u(data[i] */ double max_utility = -DBL_MAX; for (int j = 0; j < n_data; ++j) { const double *current_weights = weights + n_objectives * i; const double *current_data = data + n_objectives * j; const double utility = unary_tchebycheff_utility(current_data, current_weights, ideal, n_objectives); if (utility > max_utility) max_utility = utility; } res += max_utility; } return ScalarReal(-res / n_weights); } /* * do_r_ind - R interface routine */ SEXP do_r_ind(SEXP s_data, SEXP s_ideal, SEXP s_nadir, SEXP s_lambda, SEXP s_method) { int must_free_weight_vectors = FALSE; SEXP s_res; /* Unpack arguments */ UNPACK_REAL_MATRIX(s_data, data, k_data, n_data); /* Matrix is in column major order! */ UNPACK_REAL_VECTOR(s_ideal, ideal, n_ideal); UNPACK_REAL_VECTOR(s_nadir, nadir, n_nadir); UNPACK_INT(s_lambda, lambda); UNPACK_INT(s_method, method); const int nobjs = k_data; if (k_data != n_ideal) error("Ideal and current front must have the same dimension."); if (k_data != n_nadir) error("Nadir and current front must have the same dimension."); /* Generate weight vectors */ unsigned int nwv; double *wv = NULL; /* Compute weights: */ #define DO_PRECOMPUTED_WEIGHT_VECTOR(L, D) \ if (lambda == L && k_data == D) { \ nwv = number_of_weights_ ## L ## _ ## D; \ wv = weights_ ## L ## _ ## D; \ } else #include "precomputed_weight_vectors.h" { must_free_weight_vectors = TRUE; wv = create_weight_vectors(lambda, k_data, &nwv); } /* Allocate result */ PROTECT(s_res = allocVector(REALSXP, nwv)); double *res = REAL(s_res); /* Calculate r criterion */ for(int i = 0; i < nwv; ++i) { double maxval = -DBL_MAX; for (int j = 0; j < n_data; ++j) { const double *cwv = wv + nobjs * i; const double *cdata = data + nobjs * j; double val; switch (method) { case 1: val = weighted_sum_utility(cwv, cdata, ideal, nadir, nobjs); break; case 2: val = tchebycheff_utility(cwv, cdata, ideal, nadir, nobjs); break; default: val = augmented_tchebycheff_utility(cwv, cdata, ideal, nadir, nobjs, 0.01); break; } if (val > maxval) res[i] = maxval = val; } } if (must_free_weight_vectors) free(wv); UNPROTECT(1); /* s_res */ return s_res; } #endif emoa/src/sb_crossover.c0000644000175100001440000000510112030307155014646 0ustar hornikusers#include #include #include "sexp_macros.h" #include "utilities.h" #define MIN(A, B) ((A < B) ? (A) : (B)) #define MAX(A, B) ((A > B) ? (A) : (B)) static const double min_diff = 1.0e-14; /* * calc_betaq - calculate betaq parameter based on beta and eta. */ static R_INLINE double calc_betaq(const double beta, const double eta) { const double rand = unif_rand(); const double alpha = 2.0 - pow(beta, -(eta + 1.0)); if (rand <= (1.0/alpha)) { return(pow(rand*alpha, 1.0/(eta + 1.0))); } else { return(pow(1.0/(2.0 - rand*alpha), 1.0/(eta + 1.0))); } } /* * Perform a simulated binary crossover between two individuals and * return two new individuals. */ SEXP do_sbx(SEXP s_parents, SEXP s_lb, SEXP s_ub, SEXP s_eta, SEXP s_p) { SEXP s_res; double betaq; /* Unpack arguments: */ UNPACK_REAL_MATRIX(s_parents, parents, d, n); const double *parent1 = parents; const double *parent2 = parents+d; UNPACK_REAL_VECTOR(s_lb, lb, dlb); UNPACK_REAL_VECTOR(s_ub, ub, dub); UNPACK_REAL(s_eta, eta); UNPACK_REAL(s_p, p); /* Sanity checks; */ if (n < 2) error("do_sbx called with more less than two parents."); if (n > 2) warning("do_sbx called with more than two parents. Only the first two are used."); if (dlb != d || dub != d) error("do_sbx: Dimension of parents and bounds not equal."); /* Allocate result matrix: */ PROTECT(s_res = allocMatrix(REALSXP, d, 2)); double *child1 = REAL(s_res); double *child2 = REAL(s_res)+d; GetRNGstate(); for (int i = 0; i < d; ++i) { /* Perform crossover for i-th dimension with probability p, if * the two parents differ by at least min_diff. */ if (unif_rand() <= p && fabs(parent1[i] - parent2[i]) > min_diff) { const double y1 = MIN(parent1[i], parent2[i]); const double y2 = MAX(parent1[i], parent2[i]); const double yl = lb[i]; const double yu = ub[i]; /* Calculate offsprint: */ betaq = calc_betaq(1.0 + (2.0*(y1-yl)/(y2-y1)), eta); const double c1 = clip_to_limits(0.5*((y1+y2) - betaq*(y2-y1)), yl, yu); betaq = calc_betaq(1.0 + (2.0*(yu-y2)/(y2-y1)), eta); const double c2 = clip_to_limits(0.5*((y1+y2) + betaq*(y2-y1)), yl, yu); /* Flip coin to see which offspring gets which new * value: */ if (flip_coin()) { child1[i] = c2; child2[i] = c1; } else { child1[i] = c1; child2[i] = c2; } } else { child1[i] = parent1[i]; child2[i] = parent2[i]; } } PutRNGstate(); UNPROTECT(1); /* s_res */ return(s_res); } emoa/src/hv.h0000644000175100001440000000304312030307155012562 0ustar hornikusers/************************************************************************* hv.h --------------------------------------------------------------------- Copyright (c) 2005, 2006 Carlos Fonseca Manuel Lopez-Ibanez Luis Paquete This program is free software (software libre); you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, you can obtain a copy of the GNU General Public License at: http://www.gnu.org/copyleft/gpl.html or by writing to: Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ---------------------------------------------------------------------- *************************************************************************/ #ifndef HV_H_ #define HV_H_ #ifdef __cplusplus extern "C" { #endif extern int stop_dimension; double fpli_hv(double *data, int d, int n, const double *ref); #ifdef __cplusplus } #endif #endif emoa/src/avl.h0000644000175100001440000001520212030307155012727 0ustar hornikusers/***************************************************************************** avl.h - Source code for the AVL-tree library. Copyright (C) 1998 Michael H. Buselli Copyright (C) 2000-2002 Wessel Dankers This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Augmented AVL-tree. Original by Michael H. Buselli . Modified by Wessel Dankers to add a bunch of bloat to the sourcecode, change the interface and squash a few bugs. Mail him if you find new bugs. *****************************************************************************/ #ifndef _AVL_H #define _AVL_H /* We need either depths, counts or both (the latter being the default) */ #if !defined(AVL_DEPTH) && !defined(AVL_COUNT) #define AVL_DEPTH #define AVL_COUNT #endif /* User supplied function to compare two items like strcmp() does. * For example: cmp(a,b) will return: * -1 if a < b * 0 if a = b * 1 if a > b */ typedef int (*avl_compare_t)(const void *, const void *); /* User supplied function to delete an item when a node is free()d. * If NULL, the item is not free()d. */ typedef void (*avl_freeitem_t)(void *); typedef struct avl_node_t { struct avl_node_t *next; struct avl_node_t *prev; struct avl_node_t *parent; struct avl_node_t *left; struct avl_node_t *right; void *item; #ifdef AVL_COUNT unsigned int count; #endif #ifdef AVL_DEPTH unsigned char depth; #endif } avl_node_t; typedef struct avl_tree_t { avl_node_t *head; avl_node_t *tail; avl_node_t *top; avl_compare_t cmp; avl_freeitem_t freeitem; } avl_tree_t; /* Initializes a new tree for elements that will be ordered using * the supplied strcmp()-like function. * Returns the value of avltree (even if it's NULL). * O(1) */ extern avl_tree_t *avl_init_tree(avl_tree_t *avltree, avl_compare_t, avl_freeitem_t); /* Allocates and initializes a new tree for elements that will be * ordered using the supplied strcmp()-like function. * Returns NULL if memory could not be allocated. * O(1) */ extern avl_tree_t *avl_alloc_tree(avl_compare_t, avl_freeitem_t); /* Frees the entire tree efficiently. Nodes will be free()d. * If the tree's freeitem is not NULL it will be invoked on every item. * O(n) */ extern void avl_free_tree(avl_tree_t *); /* Reinitializes the tree structure for reuse. Nothing is free()d. * Compare and freeitem functions are left alone. * O(1) */ extern void avl_clear_tree(avl_tree_t *); /* Free()s all nodes in the tree but leaves the tree itself. * If the tree's freeitem is not NULL it will be invoked on every item. * O(n) */ extern void avl_free_nodes(avl_tree_t *); /* Initializes memory for use as a node. Returns NULL if avlnode is NULL. * O(1) */ extern avl_node_t *avl_init_node(avl_node_t *avlnode, void *item); /* Insert an item into the tree and return the new node. * Returns NULL and sets errno if memory for the new node could not be * allocated or if the node is already in the tree (EEXIST). * O(lg n) */ extern avl_node_t *avl_insert(avl_tree_t *, void *item); /* Insert a node into the tree and return it. * Returns NULL if the node is already in the tree. * O(lg n) */ extern avl_node_t *avl_insert_node(avl_tree_t *, avl_node_t *); /* Insert a node in an empty tree. If avlnode is NULL, the tree will be * cleared and ready for re-use. * If the tree is not empty, the old nodes are left dangling. * O(1) */ extern avl_node_t *avl_insert_top(avl_tree_t *, avl_node_t *avlnode); /* Insert a node before another node. Returns the new node. * If old is NULL, the item is appended to the tree. * O(lg n) */ extern avl_node_t *avl_insert_before(avl_tree_t *, avl_node_t *oldnode, avl_node_t *newnode); /* Insert a node after another node. Returns the new node. * If old is NULL, the item is prepended to the tree. * O(lg n) */ extern avl_node_t *avl_insert_after(avl_tree_t *, avl_node_t *oldnode, avl_node_t *newnode); /* Deletes a node from the tree. Returns immediately if the node is NULL. * The item will not be free()d regardless of the tree's freeitem handler. * This function comes in handy if you need to update the search key. * O(lg n) */ extern void avl_unlink_node(avl_tree_t *, avl_node_t *); /* Deletes a node from the tree. Returns immediately if the node is NULL. * If the tree's freeitem is not NULL, it is invoked on the item. * If it is, returns the item. * O(lg n) */ extern void *avl_delete_node(avl_tree_t *, avl_node_t *); /* Searches for an item in the tree and deletes it if found. * If the tree's freeitem is not NULL, it is invoked on the item. * If it is, returns the item. * O(lg n) */ extern void *avl_delete(avl_tree_t *, const void *item); /* If exactly one node is moved in memory, this will fix the pointers * in the tree that refer to it. It must be an exact shallow copy. * Returns the pointer to the old position. * O(1) */ extern avl_node_t *avl_fixup_node(avl_tree_t *, avl_node_t *newnode); /* Searches for a node with the key closest (or equal) to the given item. * If avlnode is not NULL, *avlnode will be set to the node found or NULL * if the tree is empty. Return values: * -1 if the returned node is smaller * 0 if the returned node is equal or if the tree is empty * 1 if the returned node is greater * O(lg n) */ extern int avl_search_closest(const avl_tree_t *, const void *item, avl_node_t **avlnode); /* Searches for the item in the tree and returns a matching node if found * or NULL if not. * O(lg n) */ extern avl_node_t *avl_search(const avl_tree_t *, const void *item); #ifdef AVL_COUNT /* Returns the number of nodes in the tree. * O(1) */ extern unsigned int avl_count(const avl_tree_t *); /* Searches a node by its rank in the list. Counting starts at 0. * Returns NULL if the index exceeds the number of nodes in the tree. * O(lg n) */ extern avl_node_t *avl_at(const avl_tree_t *, unsigned int); /* Returns the rank of a node in the list. Counting starts at 0. * O(lg n) */ extern unsigned int avl_index(const avl_node_t *); #endif #endif emoa/src/poly_mutation.c0000644000175100001440000000270612030307155015050 0ustar hornikusers#include #include #include "sexp_macros.h" #include "utilities.h" /* * Perform polynomial mutation of x with probability p. */ SEXP do_pm(SEXP s_x, SEXP s_lb, SEXP s_ub, SEXP s_eta, SEXP s_p) { SEXP s_res; double deltaq, rnd; #if FALSE /* Only mutate in half of all calls: */ if (flip_coin()) return s_x; #endif /* Unpack arguments: */ UNPACK_REAL_VECTOR(s_x, x, d); UNPACK_REAL_VECTOR(s_lb, lb, dlb); UNPACK_REAL_VECTOR(s_ub, ub, dub); UNPACK_REAL(s_eta, eta); UNPACK_REAL(s_p, p); const double mpow = 1.0 / (eta + 1.0); /* Sanity checks: */ if (dlb != d || dub != d) error("do_pm: Dimension of individual and bounds differ."); /* Allocate results: */ PROTECT(s_res = allocVector(REALSXP, d)); double *res = REAL(s_res); GetRNGstate(); for (int i = 0; i < d; ++i) { /* Mutate with probability p: */ if (unif_rand() < p) { const double delta = ub[i] - lb[i]; rnd = unif_rand(); if (rnd <= 0.5) { const double xy = 1.0 - (x[i] - lb[i]) / delta; deltaq = pow(2.0*rnd + (1.0 - 2.0*rnd)*pow(xy, eta + 1.0), mpow) - 1.0; } else { const double xy = 1.0 - (ub[i] - x[i]) / delta; deltaq = 1.0 - pow(2.0*(1.0 - rnd) + 2.0*(rnd - 0.5) * pow(xy, eta + 1.0), mpow); } res[i] = clip_to_limits(x[i] + deltaq * delta, lb[i], ub[i]); } else { res[i] = x[i]; } } PutRNGstate(); UNPROTECT(1); /* s_res */ return(s_res); } emoa/src/dominance.c0000644000175100001440000001213012030307155014072 0ustar hornikusers/* * domination.c - utility functions relating to pareto dominance * * Most of these functions could just as well have been implemented in * R but were deemed performance critical enough to warrant rewriting * them in C. * * NOTICE: These functions expect the points to be passed in column * major order. That means, we expect each column of the matrix to be * one point and each row to be one coordinate. This may seem counter * intuitive from an R standpoint but makes all C code more cache * efficient. * * Author: * Olaf Mersmann (OME) * */ #include #include #include #include #include "sexp_macros.h" #define BS_INLINE R_INLINE #include "bitstring.h" /* * dominates * * Expects points to be a nxd matrix in _column_ major format. This is * the default format used by R. * * Returns: * -1 iff points[,i] dominates points[,j] * 0 iff points[,i] and points[,j] are incomparable * 1 iff points[,j] dominates points[,i] */ static R_INLINE int dominates(double *p, R_len_t i, R_len_t j, R_len_t nobj) { int i_flagged = 0; int j_flagged = 0; R_len_t k; double *pi = p + i*nobj; double *pj = p + j*nobj; for (k = 0; k < nobj; ++k) { const double p_ik = pi[k]; const double p_jk = pj[k]; if (p_ik < p_jk) { j_flagged = 1; } else if (p_jk < p_ik) { i_flagged = 1; } } return j_flagged - i_flagged; } /* * dp_is_dominated * * Returns a logical vector whose length corresponds to the number of * columns contained in the matrix s_points. TRUE means the point is * dominated by some other point in s_points. */ SEXP do_is_dominated(SEXP s_points) { SEXP s_res; R_len_t i, j; /* Unpack arguments: * Note how we turn the nxd R matrix (which is stored in column major * order) into a dxn C matrix where all individuals are stored * consecutivly instead of interleaved. */ UNPACK_REAL_MATRIX(s_points, points, d, n); /* Allocate result vector: * * res[i] == TRUE <=> i-th point is dominated * res[i] == FALSE <=> i-th point is nondominated */ PROTECT(s_res = allocVector(LGLSXP, n)); int *res = LOGICAL(s_res); /* Initialy all points are not dominated: */ for (i = 0; i < n; ++i) res[i] = FALSE; for (i = 0; i < n; ++i) { if (res[i]) continue; /* Point is dominated, skip */ for (j = (i+1); j < n; ++j) { if (res[j]) continue; /* Point is dominated, skip */ int dom = dominates(points, i, j, d); if (dom > 0) { /* i dominates j */ res[j] = TRUE; } else if (dom < 0) { /* j dominates i */ res[i] = TRUE; } } } UNPROTECT(1); /* s_res */ return s_res; } /* * nondominated_order * * Implements a variant of non dominated sorting, but only returns the * front membership instead of actually sorting the matrix s_points. */ SEXP nondominated_order(SEXP s_points, SEXP s_tosort) { R_len_t i, j; SEXP s_rank; UNPACK_REAL_MATRIX(s_points, points, d, n); /* Note column major layout */ R_len_t nsorted = 0; R_len_t ntosort = INTEGER(s_tosort)[0]; /* Use compact bitstring for speed and ease of managment instead * of a dynamicly sized array of arrays or linked lists. */ bitstring_t *S = (bitstring_t *)Calloc(n, bitstring_t); unsigned int *N = (unsigned int *)Calloc(n, unsigned int); /* Allocate result vector: */ PROTECT(s_rank = allocVector(INTSXP, n)); int *rank = INTEGER(s_rank); /* Check to make sure we exit while() loop further down even if * ntosort is missspecified. */ if (ntosort > n) ntosort = n; /* Initialize bitstrings and array counting the number of * individuals that dominate the i-th individual. */ for (i = 0; i < n; ++i) { bitstring_initialize(&S[i], n); N[i] = 0; } for (i = 0; i < n; ++i) { for (j = i+1; j < n; ++j) { int dom = dominates(points, i, j, d); if (dom < 0) { /* j dominates i */ bitstring_set(S[j], i); ++N[i]; } else if (dom > 0) { /* i dominates j */ bitstring_set(S[i], j); ++N[j]; } else { /* neither dominates the other */ } } } /* Assign initial ranks: */ for (i = 0; i < n; ++i) { if (0 == N[i]) { /* Member of first front */ rank[i] = 1; ++nsorted; } else { /* Not yet decide what front i belongs to */ rank[i] = 0; } } /* Assign remaining ranks: */ unsigned int r = 1; while (nsorted < ntosort) { for (i = 0; i < n; ++i) { if (r != rank[i]) /* Skip all not in current rank */ continue; for (j = 0; j < n; ++j) { if (bitstring_is_set(S[i], j)) { /* j in S_i */ --N[j]; if (0 == N[j]) { /* N_j == 0 -> assign rank */ rank[j] = r + 1; ++nsorted; } } } } ++r; /* Emergency exit: */ if (r > n) { error("r > n. This should never happen. " "Please send a detailed bug report to the package author."); } } /* Free bitstrings and arrays */ for (i = 0; i < n; ++i) bitstring_delete(S[i]); Free(S); Free(N); UNPROTECT(1); /* s_rank */ return(s_rank); } emoa/src/sexp_macros.h0000644000175100001440000000336612030307155014500 0ustar hornikusers/* * sexp_macros.h - helper macros for SEXPs * * Collection of useful macros to handle S expressions. Most of these * are used to unpack arguments passed in via the .Call() or * .External() interface. * * Author: * Olaf Mersmann (OME) */ #if !defined(__SEXP_MACROS_H__) #define __SEXP_MACROS_H__ #include #include #define CHECK_ARG_IS_REAL_MATRIX(A) \ if (!isReal(A) || !isMatrix(A)) \ error("Argument '" #A "' is not a real matrix."); #define CHECK_ARG_IS_REAL_VECTOR(A) \ if (!isReal(A) || !isVector(A)) \ error("Argument '" #A "' is not a real vector."); #define CHECK_ARG_IS_INT_VECTOR(A) \ if (!isInteger(A) || !isVector(A)) \ error("Argument '" #A "' is not an integer vector."); /* * Unpack a real matrix stored in SEXP S. */ #define UNPACK_REAL_MATRIX(S, D, N, K) \ CHECK_ARG_IS_REAL_MATRIX(S); \ double *D = REAL(S); \ const R_len_t N = nrows(S); \ const R_len_t K = ncols(S); /* * Unpack a real vector stored in SEXP S. */ #define UNPACK_REAL_VECTOR(S, D, N) \ CHECK_ARG_IS_REAL_VECTOR(S); \ double *D = REAL(S); \ const R_len_t N = length(S); /* * Unpack a single real stored in SEXP S. */ #define UNPACK_REAL(S, D) \ CHECK_ARG_IS_REAL_VECTOR(S); \ double D = REAL(S)[0]; \ /* * Unpack an integer vector stored in SEXP S. */ #define UNPACK_INT_VECTOR(S, I, N) \ CHECK_ARG_IS_INT_VECTOR(S); \ int *I = INTEGER(S); \ const R_len_t N = length(S); /* * Unpack a single integer stored in SEXP S. */ #define UNPACK_INT(S, I) \ CHECK_ARG_IS_INT_VECTOR(S); \ int I = INTEGER(S)[0]; \ #endif emoa/src/precomputed_weight_vectors.h0000644000175100001440000000101212030307155017602 0ustar hornikusers/* List of precomputed weights. * * To use this definition list, set DO_PRECOMPUTED_WEIGHT_VECTOR to * something useful and include this file. */ DO_PRECOMPUTED_WEIGHT_VECTOR(500, 2) DO_PRECOMPUTED_WEIGHT_VECTOR(30, 3) DO_PRECOMPUTED_WEIGHT_VECTOR(12, 4) DO_PRECOMPUTED_WEIGHT_VECTOR(8, 5) DO_PRECOMPUTED_WEIGHT_VECTOR(3, 6) DO_PRECOMPUTED_WEIGHT_VECTOR(3, 7) /* DO_PRECOMPUTED_WEIGHT_VECTOR(800, 2) DO_PRECOMPUTED_WEIGHT_VECTOR(200, 3) DO_PRECOMPUTED_WEIGHT_VECTOR(40, 5) */ #undef DO_PRECOMPUTED_WEIGHT_VECTOR emoa/src/Makevars0000644000175100001440000000025412030307153013467 0ustar hornikusersall: $(SHLIB) hv.o: hv.c $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -DVARIANT=4 -c -o hv.o hv.c avl.o: avl.c $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -DVARIANT=4 -c -o avl.o avl.c emoa/src/sympart.c0000644000175100001440000000361512030307155013644 0ustar hornikusers/* * sympart.c - SYM-PART test function as used in the CEC 2007 EOMA competition * * Based on source code by Huang Ling * * Author: * Olaf Mersmann (OME) */ #include #include #include #include #include #include /* for memcpy */ #include "sexp_macros.h" static const double a = 1.0; static const double b = 10.0; static const double c = 8.0; static const double c2 = 10.0; /* c + 2*a */ #ifndef PI #define PI M_PI #endif #define MAX(a, b) ((a > b) ? a : b) /* * find_tile - find in which tile of (-1, 0, 1) x lies. */ static R_INLINE int find_tile(const double x, const double c) { const double xx = fabs(x); const double c2 = c / 2.0; int tmp = (int)ceil((xx-c2)/c); if (tmp > 1) tmp = 1; if (x < 0) tmp = -tmp; return tmp; } SEXP do_sympart(SEXP s_x) { R_len_t k; SEXP s_res; const double omega = PI / 4.0; const double si = sin(omega); const double co = cos(omega); UNPACK_REAL_VECTOR(s_x, x, n); /* Allocate return vector */ PROTECT(s_res = allocVector(REALSXP, 2)); double *res = REAL(s_res); res[0] = res[1] = 0.0; /* Copy input and rotate: */ double *xx = (double *)R_alloc(n, sizeof(double)); for (k=0; k+1 < n; k+=2) { const double xk = x[k]; const double xkp = x[k+1]; xx[k] = co * xk - si * xkp; xx[k+1] = si * xk + co * xkp; } /* Find tile (i, j) */ int i = find_tile(xx[0], c2); int j = find_tile(xx[1], b); /* Calculate function values */ for (k=0; k * */ #include #include #include #include #include #include #include #include #include "sexp_macros.h" #include "hv.h" void calc_hv_contrib_2d(const double *data, const double *ref, double *res, const size_t n, const size_t k) { size_t i,j,l; double mindistplus; for (i = 0; i < n; ++i) { double dvol = 1.0; for (j = 0; j < k; ++j) { const double fij = data[k*i + j]; mindistplus = DBL_MAX; for (l = 0; l < n; ++l) { if (l != i) { const double flj = data[k*l + j]; const double delta = flj - fij; if (delta >= 0.0 && delta < mindistplus) mindistplus = delta; } } dvol *= mindistplus; } res[i] = dvol; } } void calc_hv_contrib_anyd(double *data, const double *ref, double *res, const size_t n, size_t k) { const double tothv = fpli_hv(data, k, n, ref); for (int i = 0; i < n; ++i) { const double ihv = fpli_hv(data + k, k, n-1, ref); res[i] = tothv - ihv; /* Swap ith and last row in data matrix: */ if (i != (n - 1)) { for (int j = 0; j < k; ++j) { double tmp = data[k * (i+1) + j]; data[k * (i+1) + j] = data[j]; data[j] = tmp; } } } } SEXP do_dominated_hypervolume(SEXP s_data, SEXP s_ref) { SEXP s_res; /* Unpack arguments: * * Since we need s_data in row major format, it is passed in * transposed in column major format (R's internal format for * matricies). That means the number of rows and columns are * switched. */ UNPACK_REAL_MATRIX(s_data, data, k_data, n_data); UNPACK_REAL_VECTOR(s_ref, ref, n_ref); if (n_ref != k_data) error("ref and data must have the same dimension."); /* Allocate result */ PROTECT(s_res = allocVector(REALSXP, 1)); double *res = REAL(s_res); res[0] = fpli_hv(data, k_data, n_data, ref); UNPROTECT(1); /* s_res */ return s_res; } SEXP do_hv_contrib(SEXP s_data, SEXP s_ref) { SEXP s_res; double *ddata; UNPACK_REAL_MATRIX(s_data, data, k_data, n_data); UNPACK_REAL_VECTOR(s_ref, ref, n_ref); if (n_ref != k_data) error("ref and data must have the same dimension."); /* Allocate result */ PROTECT(s_res = allocVector(REALSXP, n_data)); double *res = REAL(s_res); switch (k_data) { case 2: calc_hv_contrib_2d(data, ref, res, n_data, k_data); break; default: /* calc_hv_contrib modifies 'data', so we need to make sure we * duplicate it before use. */ ddata = (double *)R_alloc(k_data * n_data, sizeof(double)); memcpy(ddata, data, sizeof(double) * k_data * n_data); calc_hv_contrib_anyd(ddata, ref, res, n_data, k_data); break; } UNPROTECT(1); /* s_res */ return s_res; } emoa/src/utilities.h0000644000175100001440000000026412030307155014162 0ustar hornikusers#ifndef __UTILITIES_H__ #define __UTILITIES_H__ #define HEADS 1 #define TAILS 0 int flip_coin(); double clip_to_limits(const double x, const double l, const double u); #endif emoa/src/bitstring.h0000644000175100001440000000244312030307155014155 0ustar hornikusers#ifndef __BITSTRING_H__ #define __BITSTRING_H__ #include #include #include /* for R_INLINE */ typedef uint8_t bs_base_t; typedef struct { bs_base_t *string; } bitstring_t; const size_t bs_base_size = 8 * sizeof(bs_base_t); #define BIT_INDEX(B) ((B) >> 3) #define BIT_MASK(B) (1 << ((B) & 0x7)) static R_INLINE size_t bitstring_size(size_t nbits) { return ((((nbits) - 1) >> 3) + 1); } static R_INLINE void bitstring_initialize(bitstring_t *bs, size_t nbits) { const size_t size = bitstring_size(nbits); bs->string = (uint8_t *)malloc(size); if (NULL == bs->string) error("Could not allocate bitstring of size %i.", size); memset(bs->string, 0, size); } static R_INLINE void bitstring_delete(bitstring_t bs) { free(bs.string); bs.string = NULL; } static R_INLINE void bitstring_set(bitstring_t bs, size_t bit) { bs.string[BIT_INDEX(bit)] |= BIT_MASK(bit); } static R_INLINE void bitstring_clear(bitstring_t bs, size_t bit) { bs.string[BIT_INDEX(bit)] &= ~BIT_MASK(bit); } static R_INLINE int bitstring_is_set(const bitstring_t bs, size_t bit) { return bs.string[BIT_INDEX(bit)] & BIT_MASK(bit); } static R_INLINE int bitstring_is_clear(const bitstring_t bs, size_t bit) { return !bitstring_is_set(bs, bit); } #endif emoa/src/utilities.c0000644000175100001440000000042512030307155014154 0ustar hornikusers#include #include "utilities.h" double clip_to_limits(const double x, const double l, const double u) { if (x < l) { return(l); } else if (x > u) { return(u); } else { return(x); } } int flip_coin() { return(.5 < unif_rand() ? HEADS : TAILS); } emoa/src/cec2009.c0000644000175100001440000010530512030307155013211 0ustar hornikusers/* * cec2009.c - CEC 2009 test functions * * C implementation of the CEC 2009 EMOA competition test functions. * * Based on the file cec2009.cpp by Qingfu Zhang, Aimin Zhou, Shizheng * Zhaoy, Ponnuthurai Nagaratnam Suganthany, Wudong Liu and Santosh * Tiwar: * * http://web.mysites.ntu.edu.sg/epnsugan/PublicSite/Shared%20Documents/CEC2009-MOEA/ * * FIXME: The original author provides no licensing information for * the source code. * * Author: * Olaf Mersmann (OME) * */ #include #include #include #include #include #include "sexp_macros.h" /* We have our own definition of PI: */ #if defined(PI) #undef PI #endif #define PI 3.1415926535897932384626433832795 #define MYSIGN(x) ((x)>0?1.0:-1.0) static void UF1(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, yj; sum1 = sum2 = 0.0; count1 = count2 = 0; for(j = 2; j <= nx; j++) { yj = x[j-1] - sin(6.0*PI*x[0] + j*PI/nx); yj = yj * yj; if(j % 2 == 0) { sum2 += yj; count2++; } else { sum1 += yj; count1++; } } f[0] = x[0] + 2.0 * sum1 / (double)count1; f[1] = 1.0 - sqrt(x[0]) + 2.0 * sum2 / (double)count2; } static void UF2(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, yj; sum1 = sum2 = 0.0; count1 = count2 = 0; for(j = 2; j <= nx; j++) { if(j % 2 == 0) { yj = x[j-1]-0.3*x[0]*(x[0]*cos(24.0*PI*x[0]+4.0*j*PI/nx)+2.0)*sin(6.0*PI*x[0]+j*PI/nx); sum2 += yj*yj; count2++; } else { yj = x[j-1]-0.3*x[0]*(x[0]*cos(24.0*PI*x[0]+4.0*j*PI/nx)+2.0)*cos(6.0*PI*x[0]+j*PI/nx); sum1 += yj*yj; count1++; } } f[0] = x[0] + 2.0 * sum1 / (double)count1; f[1] = 1.0 - sqrt(x[0]) + 2.0 * sum2 / (double)count2; } static void UF3(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, prod1, prod2, yj, pj; sum1 = sum2 = 0.0; count1 = count2 = 0; prod1 = prod2 = 1.0; for(j = 2; j <= nx; j++) { yj = x[j-1]-pow(x[0],0.5*(1.0+3.0*(j-2.0)/(nx-2.0))); pj = cos(20.0*yj*PI/sqrt(j+0.0)); if (j % 2 == 0) { sum2 += yj*yj; prod2 *= pj; count2++; } else { sum1 += yj*yj; prod1 *= pj; count1++; } } f[0] = x[0] + 2.0*(4.0*sum1 - 2.0*prod1 + 2.0) / (double)count1; f[1] = 1.0 - sqrt(x[0]) + 2.0*(4.0*sum2 - 2.0*prod2 + 2.0) / (double)count2; } static void UF4(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, yj, hj; sum1 = sum2 = 0.0; count1 = count2 = 0; for(j = 2; j <= nx; j++) { yj = x[j-1]-sin(6.0*PI*x[0]+j*PI/nx); hj = fabs(yj)/(1.0+exp(2.0*fabs(yj))); if (j % 2 == 0) { sum2 += hj; count2++; } else { sum1 += hj; count1++; } } f[0] = x[0] + 2.0*sum1 / (double)count1; f[1] = 1.0 - x[0]*x[0] + 2.0*sum2 / (double)count2; } static void UF5(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, yj, hj, N, E; sum1 = sum2 = 0.0; count1 = count2 = 0; N = 10.0; E = 0.1; for(j = 2; j <= nx; j++) { yj = x[j-1]-sin(6.0*PI*x[0]+j*PI/nx); hj = 2.0*yj*yj - cos(4.0*PI*yj) + 1.0; if (j % 2 == 0) { sum2 += hj; count2++; } else { sum1 += hj; count1++; } } hj = (0.5/N + E)*fabs(sin(2.0*N*PI*x[0])); f[0] = x[0] + hj + 2.0*sum1 / (double)count1; f[1] = 1.0 - x[0] + hj + 2.0*sum2 / (double)count2; } static void UF6(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, prod1, prod2, yj, hj, pj, N, E; N = 2.0; E = 0.1; sum1 = sum2 = 0.0; count1 = count2 = 0; prod1 = prod2 = 1.0; for(j = 2; j <= nx; j++) { yj = x[j-1]-sin(6.0*PI*x[0]+j*PI/nx); pj = cos(20.0*yj*PI/sqrt(j+0.0)); if (j % 2 == 0) { sum2 += yj*yj; prod2 *= pj; count2++; } else { sum1 += yj*yj; prod1 *= pj; count1++; } } hj = 2.0*(0.5/N + E)*sin(2.0*N*PI*x[0]); if(hj<0.0) hj = 0.0; f[0] = x[0] + hj + 2.0*(4.0*sum1 - 2.0*prod1 + 2.0) / (double)count1; f[1] = 1.0 - x[0] + hj + 2.0*(4.0*sum2 - 2.0*prod2 + 2.0) / (double)count2; } static void UF7(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, yj; sum1 = sum2 = 0.0; count1 = count2 = 0; for(j = 2; j <= nx; j++) { yj = x[j-1] - sin(6.0*PI*x[0]+j*PI/nx); if (j % 2 == 0) { sum2 += yj*yj; count2++; } else { sum1 += yj*yj; count1++; } } yj = pow(x[0],0.2); f[0] = yj + 2.0*sum1 / (double)count1; f[1] = 1.0 - yj + 2.0*sum2 / (double)count2; } static void UF8(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2, count3; double sum1, sum2, sum3, yj; sum1 = sum2 = sum3 = 0.0; count1 = count2 = count3 = 0; for(j = 3; j <= nx; j++) { yj = x[j-1] - 2.0*x[1]*sin(2.0*PI*x[0]+j*PI/nx); if(j % 3 == 1) { sum1 += yj*yj; count1++; } else if(j % 3 == 2) { sum2 += yj*yj; count2++; } else { sum3 += yj*yj; count3++; } } f[0] = cos(0.5*PI*x[0])*cos(0.5*PI*x[1]) + 2.0*sum1 / (double)count1; f[1] = cos(0.5*PI*x[0])*sin(0.5*PI*x[1]) + 2.0*sum2 / (double)count2; f[2] = sin(0.5*PI*x[0]) + 2.0*sum3 / (double)count3; } static void UF9(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2, count3; double sum1, sum2, sum3, yj, E; E = 0.1; sum1 = sum2 = sum3 = 0.0; count1 = count2 = count3 = 0; for(j = 3; j <= nx; j++) { yj = x[j-1] - 2.0*x[1]*sin(2.0*PI*x[0]+j*PI/nx); if(j % 3 == 1) { sum1 += yj*yj; count1++; } else if(j % 3 == 2) { sum2 += yj*yj; count2++; } else { sum3 += yj*yj; count3++; } } yj = (1.0+E)*(1.0-4.0*(2.0*x[0]-1.0)*(2.0*x[0]-1.0)); if(yj<0.0) yj = 0.0; f[0] = 0.5*(yj + 2*x[0])*x[1] + 2.0*sum1 / (double)count1; f[1] = 0.5*(yj - 2*x[0] + 2.0)*x[1] + 2.0*sum2 / (double)count2; f[2] = 1.0 - x[1] + 2.0*sum3 / (double)count3; } static void UF10(double *x, double *f, const unsigned int nx) { unsigned int j, count1, count2, count3; double sum1, sum2, sum3, yj, hj; sum1 = sum2 = sum3 = 0.0; count1 = count2 = count3 = 0; for(j = 3; j <= nx; j++) { yj = x[j-1] - 2.0*x[1]*sin(2.0*PI*x[0]+j*PI/nx); hj = 4.0*yj*yj - cos(8.0*PI*yj) + 1.0; if(j % 3 == 1) { sum1 += hj; count1++; } else if(j % 3 == 2) { sum2 += hj; count2++; } else { sum3 += hj; count3++; } } f[0] = cos(0.5*PI*x[0])*cos(0.5*PI*x[1]) + 2.0*sum1 / (double)count1; f[1] = cos(0.5*PI*x[0])*sin(0.5*PI*x[1]) + 2.0*sum2 / (double)count2; f[2] = sin(0.5*PI*x[0]) + 2.0*sum3 / (double)count3; } #define UF_2D_WRAPPER(U) \ SEXP do_##U (SEXP s_x) { \ R_len_t i; \ SEXP s_res; \ if (!isReal(s_x) || !isVector(s_x)) \ error("Argument 's_x' is not a numeric vector."); \ UNPACK_REAL_VECTOR(s_x, x, n); \ PROTECT(s_res = allocVector(REALSXP, 2)); \ double *res = REAL(s_res); \ res[0] = res[1] = 0.0; \ if (!R_FINITE(x[0]) || x[0] < 0.0 || x[0] > 1.0) { \ res[0] = res[1] = R_NaN; \ } else { \ for (i=1; i < n; ++i) { \ if (!R_FINITE(x[i]) || x[i] < -1.0 || x[i] > 1.0) { \ res[0] = res[1] = R_NaN; \ break; \ } \ } \ } \ if (!ISNAN(res[0]) && !ISNAN(res[1])) \ U(x, res, n); \ UNPROTECT(1); /* s_res */ \ return s_res; \ } #define UF_3D_WRAPPER(U) \ SEXP do_##U (SEXP s_x) { \ R_len_t i; \ SEXP s_res; \ UNPACK_REAL_VECTOR(s_x, x, n); \ PROTECT(s_res = allocVector(REALSXP, 3)); \ double *res = REAL(s_res); \ res[0] = res[1] = res[2] = 0.0; \ if (!R_FINITE(x[0]) || x[0] < 0.0 || x[0] > 1.0) { \ res[0] = res[1] = res[2] = R_NaN; \ } else if (!R_FINITE(x[1]) || x[1] < 0.0 || x[1] > 1.0) { \ res[0] = res[1] = res[2] = R_NaN; \ } else { \ for (i=2; i < n; ++i) { \ if (!R_FINITE(x[i]) || x[i] < -2.0 || x[i] > 2.0) { \ res[0] = res[1] = res[2] = R_NaN; \ break; \ } \ } \ } \ if (!ISNAN(res[0]) && !ISNAN(res[1])) \ U(x, res, n); \ UNPROTECT(1); /* s_res */ \ return s_res; \ } UF_2D_WRAPPER(UF1) UF_2D_WRAPPER(UF2) UF_2D_WRAPPER(UF3) UF_2D_WRAPPER(UF4) UF_2D_WRAPPER(UF5) UF_2D_WRAPPER(UF6) UF_2D_WRAPPER(UF7) UF_3D_WRAPPER(UF8) UF_3D_WRAPPER(UF9) UF_3D_WRAPPER(UF10) /* OME: Other test functions currently not ported. */ #if 0 void CF1(double *x, double *f, double *c, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, yj, N, a; N = 10.0; a = 1.0; sum1 = sum2 = 0.0; count1 = count2 = 0; for(j = 2; j <= nx; j++) { yj = x[j-1]-pow(x[0],0.5*(1.0+3.0*(j-2.0)/(nx-2.0))); if (j % 2 == 1) { sum1 += yj*yj; count1++; } else { sum2 += yj*yj; count2++; } } f[0] = x[0] + 2.0*sum1 / (double)count1; f[1] = 1.0 - x[0] + 2.0*sum2 / (double)count2; c[0] = f[1] + f[0] - a*fabs(sin(N*PI*(f[0]-f[1]+1.0))) - 1.0; } void CF2(double *x, double *f, double *c, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, yj, N, a, t; N = 2.0; a = 1.0; sum1 = sum2 = 0.0; count1 = count2 = 0; for(j = 2; j <= nx; j++) { if (j % 2 == 1) { yj = x[j-1] - sin(6.0*PI*x[0] + j*PI/nx); sum1 += yj*yj; count1++; } else { yj = x[j-1] - cos(6.0*PI*x[0] + j*PI/nx); sum2 += yj*yj; count2++; } } f[0] = x[0] + 2.0*sum1 / (double)count1; f[1] = 1.0 - sqrt(x[0]) + 2.0*sum2 / (double)count2; t = f[1] + sqrt(f[0]) - a*sin(N*PI*(sqrt(f[0])-f[1]+1.0)) - 1.0; c[0] = MYSIGN(t)*fabs(t)/(1+exp(4.0*fabs(t))); } void CF3(double *x, double *f, double *c, const unsigned int nx) { unsigned int j, count1, count2; double sum1, sum2, prod1, prod2, yj, pj, N, a; N = 2.0; a = 1.0; sum1 = sum2 = 0.0; count1 = count2 = 0; prod1 = prod2 = 1.0; for(j = 2; j <= nx; j++) { yj = x[j-1]-sin(6.0*PI*x[0]+j*PI/nx); pj = cos(20.0*yj*PI/sqrt(j+0.0)); if (j % 2 == 0) { sum2 += yj*yj; prod2 *= pj; count2++; } else { sum1 += yj*yj; prod1 *= pj; count1++; } } f[0] = x[0] + 2.0*(4.0*sum1 - 2.0*prod1 + 2.0) / (double)count1; f[1] = 1.0 - x[0]*x[0] + 2.0*(4.0*sum2 - 2.0*prod2 + 2.0) / (double)count2; c[0] = f[1] + f[0]*f[0] - a*sin(N*PI*(f[0]*f[0]-f[1]+1.0)) - 1.0; } void CF4(double *x, double *f, double *c, const unsigned int nx) { unsigned int j; double sum1, sum2, yj, t; sum1 = sum2 = 0.0; for(j = 2; j <= nx; j++) { yj = x[j-1] - sin(6.0*PI*x[0] + j*PI/nx); if (j % 2 == 1) { sum1 += yj*yj; } else { if (j==2) sum2 += yj < 1.5-0.75*sqrt(2.0) ? fabs(yj) : (0.125+(yj-1)*(yj-1)); else sum2 += yj*yj; } } f[0] = x[0] + sum1; f[1] = 1.0 - x[0] + sum2; t = x[1] - sin(6.0*x[0]*PI+2.0*PI/nx) - 0.5*x[0] + 0.25; c[0] = MYSIGN(t)*fabs(t)/(1+exp(4.0*fabs(t))); } void CF5(double *x, double *f, double *c, const unsigned int nx) { unsigned int j; double sum1, sum2, yj; sum1 = sum2 = 0.0; for(j = 2; j <= nx; j++) { if (j % 2 == 1) { yj = x[j-1] - 0.8*x[0]*cos(6.0*PI*x[0] + j*PI/nx); sum1 += 2.0*yj*yj - cos(4.0*PI*yj) + 1.0; } else { yj = x[j-1] - 0.8*x[0]*sin(6.0*PI*x[0] + j*PI/nx); if (j==2) sum2 += yj < 1.5-0.75*sqrt(2.0) ? fabs(yj) : (0.125+(yj-1)*(yj-1)); else sum2 += 2.0*yj*yj - cos(4.0*PI*yj) + 1.0; } } f[0] = x[0] + sum1; f[1] = 1.0 - x[0] + sum2; c[0] = x[1] - 0.8*x[0]*sin(6.0*x[0]*PI+2.0*PI/nx) - 0.5*x[0] + 0.25; } void CF6(double *x, double *f, double *c, const unsigned int nx) { unsigned int j; double sum1, sum2, yj; sum1 = sum2 = 0.0; for(j = 2; j <= nx; j++) { if (j % 2 == 1) { yj = x[j-1] - 0.8*x[0]*cos(6.0*PI*x[0] + j*PI/nx); sum1 += yj*yj; } else { yj = x[j-1] - 0.8*x[0]*sin(6.0*PI*x[0] + j*PI/nx); sum2 += yj*yj; } } f[0] = x[0] + sum1; f[1] = (1.0 - x[0])*(1.0 - x[0]) + sum2; c[0] = x[1]-0.8*x[0]*sin(6.0*x[0]*PI+2.0*PI/nx) - MYSIGN((x[0]-0.5)*(1.0-x[0]))*sqrt(fabs((x[0]-0.5)*(1.0-x[0]))); c[1] = x[3]-0.8*x[0]*sin(6.0*x[0]*PI+4.0*PI/nx) - MYSIGN(0.25*sqrt(1-x[0])-0.5*(1.0-x[0]))*sqrt(fabs(0.25*sqrt(1-x[0])-0.5*(1.0-x[0]))); } void CF7(double *x, double *f, double *c, const unsigned int nx) { unsigned int j; double sum1, sum2, yj; sum1 = sum2 = 0.0; for(j = 2; j <= nx; j++) { if (j % 2 == 1) { yj = x[j-1] - cos(6.0*PI*x[0] + j*PI/nx); sum1 += 2.0*yj*yj-cos(4.0*PI*yj)+1.0; } else { yj = x[j-1] - sin(6.0*PI*x[0] + j*PI/nx); if (j==2 || j==4) sum2 += yj*yj; else sum2 += 2.0*yj*yj-cos(4.0*PI*yj)+1.0; } } f[0] = x[0] + sum1; f[1] = (1.0 - x[0])*(1.0 - x[0]) + sum2; c[0] = x[1]-sin(6.0*x[0]*PI+2.0*PI/nx) - MYSIGN((x[0]-0.5)*(1.0-x[0]))*sqrt(fabs((x[0]-0.5)*(1.0-x[0]))); c[1] = x[3]-sin(6.0*x[0]*PI+4.0*PI/nx) - MYSIGN(0.25*sqrt(1-x[0])-0.5*(1.0-x[0]))*sqrt(fabs(0.25*sqrt(1-x[0])-0.5*(1.0-x[0]))); } void CF8(double *x, double *f, double *c, const unsigned int nx) { unsigned int j, count1, count2, count3; double sum1, sum2, sum3, yj, N, a; N = 2.0; a = 4.0; sum1 = sum2 = sum3 = 0.0; count1 = count2 = count3 = 0; for(j = 3; j <= nx; j++) { yj = x[j-1] - 2.0*x[1]*sin(2.0*PI*x[0]+j*PI/nx); if(j % 3 == 1) { sum1 += yj*yj; count1++; } else if(j % 3 == 2) { sum2 += yj*yj; count2++; } else { sum3 += yj*yj; count3++; } } f[0] = cos(0.5*PI*x[0])*cos(0.5*PI*x[1]) + 2.0*sum1 / (double)count1; f[1] = cos(0.5*PI*x[0])*sin(0.5*PI*x[1]) + 2.0*sum2 / (double)count2; f[2] = sin(0.5*PI*x[0]) + 2.0*sum3 / (double)count3; c[0] = (f[0]*f[0]+f[1]*f[1])/(1-f[2]*f[2]) - a*fabs(sin(N*PI*((f[0]*f[0]-f[1]*f[1])/(1-f[2]*f[2])+1.0))) + 1.0; } void CF9(double *x, double *f, double *c, const unsigned int nx) { unsigned int j, count1, count2, count3; double sum1, sum2, sum3, yj, N, a; N = 2.0; a = 3.0; sum1 = sum2 = sum3 = 0.0; count1 = count2 = count3 = 0; for(j = 3; j <= nx; j++) { yj = x[j-1] - 2.0*x[1]*sin(2.0*PI*x[0]+j*PI/nx); if(j % 3 == 1) { sum1 += yj*yj; count1++; } else if(j % 3 == 2) { sum2 += yj*yj; count2++; } else { sum3 += yj*yj; count3++; } } f[0] = cos(0.5*PI*x[0])*cos(0.5*PI*x[1]) + 2.0*sum1 / (double)count1; f[1] = cos(0.5*PI*x[0])*sin(0.5*PI*x[1]) + 2.0*sum2 / (double)count2; f[2] = sin(0.5*PI*x[0]) + 2.0*sum3 / (double)count3; c[0] = (f[0]*f[0]+f[1]*f[1])/(1-f[2]*f[2]) - a*sin(N*PI*((f[0]*f[0]-f[1]*f[1])/(1-f[2]*f[2])+1.0)) + 1.0; } void CF10(double *x, double *f, double *c, const unsigned int nx) { unsigned int j, count1, count2, count3; double sum1, sum2, sum3, yj, hj, N, a; N = 2.0; a = 1.0; sum1 = sum2 = sum3 = 0.0; count1 = count2 = count3 = 0; for(j = 3; j <= nx; j++) { yj = x[j-1] - 2.0*x[1]*sin(2.0*PI*x[0]+j*PI/nx); hj = 4.0*yj*yj - cos(8.0*PI*yj) + 1.0; if(j % 3 == 1) { sum1 += hj; count1++; } else if(j % 3 == 2) { sum2 += hj; count2++; } else { sum3 += hj; count3++; } } f[0] = cos(0.5*PI*x[0])*cos(0.5*PI*x[1]) + 2.0*sum1 / (double)count1; f[1] = cos(0.5*PI*x[0])*sin(0.5*PI*x[1]) + 2.0*sum2 / (double)count2; f[2] = sin(0.5*PI*x[0]) + 2.0*sum3 / (double)count3; c[0] = (f[0]*f[0]+f[1]*f[1])/(1-f[2]*f[2]) - a*sin(N*PI*((f[0]*f[0]-f[1]*f[1])/(1-f[2]*f[2])+1.0)) + 1.0; } /* * 5-objctive test instances */ #define a 1 #define b 10 #define c 8 #define c1 (a+c/2) #define c2 (c+2*a) #define b1 (b/2) void R2_DTLZ2_M5(double *x, double *f, const unsigned int nx, const unsigned int n_obj) { int i=0,j=0; int k = nx - n_obj + 1; double g = 0; double sum = 0; /* double z[nx],zz[nx],p[nx],psum[n_obj],M[nx][nx],lamda_l[nx]; */ double *z, *zz, *p, *psum, **M, *lamda_l; double M_10D[10][10]={{0.0346, -0.7523, 0.3561, -0.2958, 0.4675,0,0,0,0,0},{0.8159, -0.0423, 0.4063, 0.3455, -0.2192,0,0,0,0,0},{-0.3499, 0.3421, 0.8227, -0.2190, -0.1889,0,0,0,0,0},{-0.0963, -0.4747, -0.0998, -0.2429, -0.8345,0,0,0,0,0},{-0.4487, -0.2998, 0.1460, 0.8283, -0.0363,0,0,0,0,0},{0,0,0,0,0,1,0,0,0,0},{0,0,0,0,0,0,1,0,0,0},{0,0,0,0,0,0,0,1,0,0},{0,0,0,0,0,0,0,0,1,0},{0,0,0,0,0,0,0,0,0,1}}; double lamda_l_10D[10]={0.313,0.312,0.321,0.316,0.456,1,1,1,1,1}; double M_30D[30][30]={{0.0128,0.2165,0.4374,-0.0800,0.0886,-0.2015,0.1071,0.2886,0.2354,0.2785,-0.1748,0.2147,0.1649,-0.3043,0.5316,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {0.4813, 0.2420, -0.3663, -0.0420, -0.0088, -0.4945, -0.3073, 0.1990, 0.0441, -0.0627, 0.0191, 0.3880, -0.0618, -0.0319, -0.1833,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {0.4816, -0.2254, 0.0663, 0.4801, 0.2009, -0.0008, -0.1501, 0.0269, -0.2037,0.4334, -0.2157, -0.3175, -0.0923, 0.1451, 0.1118,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {-0.0876, -0.2667, -0.0063, 0.2114, 0.4506, 0.0823, -0.0125, 0.2313, 0.0840,-0.2376, 0.1938, -0.0030, 0.3391, 0.0863, 0.1231,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {-0.1025, 0.4011, -0.0117, 0.2076, 0.2585, 0.1124, -0.0288, 0.3095, -0.6146,-0.2376, 0.1938, -0.0030, 0.3391, 0.0863, 0.1231,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {0.4543, -0.2761, -0.2985, -0.2837, 0.0634, 0.1070, 0.2996, -0.2690, -0.1634,-0.1452, 0.1799, -0.0014, 0.2394, -0.2745, 0.3969,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {-0.1422, -0.4364, 0.0751, -0.2235, 0.3966, -0.0252, 0.0908, 0.0477, -0.2254,0.1801, -0.0552, 0.5770, -0.0396, 0.3765, -0.0522,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {0.3542, -0.2245, 0.3497, -0.1609, -0.1107, 0.0079, 0.2241, 0.4517, 0.1309,-0.3355, -0.1123, -0.1831, 0.3000, 0.2045, -0.3191,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {0.0005, 0.0377, -0.2808, -0.0641, 0.1316, 0.2191, 0.0207, 0.3308, 0.4117,0.3839, 0.5775, -0.1219, 0.1192, 0.2435, 0.0414,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {-0.1177, -0.0001, -0.1992, -0.4533, 0.4234, -0.0191, -0.3740, 0.1325, 0.0972,-0.2042, -0.3493, -0.4018, -0.1087, 0.0918, 0.2217,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {0.1818, 0.3022, -0.1388, -0.2380, -0.0773, 0.6463, 0.0450, 0.1030, -0.0958,0.2837, -0.3969, 0.1779, -0.0251, -0.1543, -0.2452,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000,0.000}, {-0.1889, -0.4397, -0.2206, 0.0981, -0.5203, 0.1325, -0.3427, 0.4242, -0.1271,-0.0291, -0.0795, 0.1213, 0.0565, -0.1092, 0.2720,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {-0.1808, -0.0624, -0.2689, 0.2289, 0.1128, -0.0844, -0.0549, -0.2202, 0.2450,0.0825, -0.3319, 0.0513, 0.7523, 0.0043, -0.1472,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {-0.0983, 0.0611, -0.4145, 0.3017, 0.0410, -0.0703, 0.6250, 0.2449, 0.1307,-0.1714, -0.3045, 0.0218, -0.2837, 0.1408, 0.1633,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0.2026, 0.0324, 0.1496, 0.3129, 0.1437, 0.4331, -0.2629, -0.1498, 0.3746,-0.4366, 0.0163, 0.3316, -0.0697, 0.1833, 0.2412,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}}; double lamda_l_30D[30]={0.113,0.105,0.117,0.119,0.108,0.110,0.101,0.107,0.111,0.109,0.120,0.108,0.101,0.105,0.116,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000}; z = new double[nx]; zz = new double[nx]; p = new double[nx]; psum = new double[n_obj]; M = new double*[nx]; for(i=0; i=0 && z[i]<=1) { zz[i]=z[i]; p[i]=0; } else if (z[i]<0) { zz[i]=-lamda_l[i] * z[i]; p[i]=-z[i]; } else { zz[i]=1-lamda_l[i]*(z[i]-1); p[i]=z[i]-1; } } for(j=0;j= 1; j--) { ff *= cos(zz[j-1] * PI / 2.0); psum[i-1] = sqrt( pow(psum[i-1],2) + pow(p[j-1],2) ); } if (i > 1) { ff *= sin(zz[(n_obj - i + 1) - 1] * PI / 2.0); psum[i-1] = sqrt( pow(psum[i-1],2) + pow(p[(n_obj - i + 1) - 1],2) ); } f[i-1] = 2.0/(1+exp(-psum[i-1])) * (ff+1); } delete []z; delete []zz; delete []p;delete []psum; delete []lamda_l; for(i=0; i=0 && z[i]<=1) { zz[i]=z[i]; p[i]=0; } else if (z[i]<0) { zz[i]=-lamda_l[i] * z[i]; p[i]=-z[i]; } else { zz[i]=1-lamda_l[i]*(z[i]-1); p[i]=z[i]-1; } } for(j=0;j= 1; j--) { ff *= cos(zz[j-1] * PI / 2.0); psum[i-1] = sqrt( pow(psum[i-1],2) + pow(p[j-1],2) ); } if (i > 1) { ff *= sin(zz[(n_obj - i + 1) - 1] * PI / 2.0); psum[i-1] = sqrt( pow(psum[i-1],2) + pow(p[(n_obj - i + 1) - 1],2) ); } f[i-1] = 2.0/(1+exp(-psum[i-1])) * (ff+1); } delete []z; delete []zz; delete []p;delete []psum; delete []lamda_l; for(i=0; i= min_epsilon ) { return min; } else if ( aa >= max && aa <= max_epsilon ) { return max; } else { return aa; } } int vector_in_01( const double *x, int nx ) { int i; for( i = 0; i < nx; i++ ) { if( x[i] < 0.0 || x[i] > 1.0 ) { return 0; } } return 1; } /* Local functions/values. */ double linear( const double *x, const int m,int M ) { int i; double result = 1.0; for( i=1; i <= M-m; i++ ) { result *= x[i-1]; } if( m != 1 ) { result *= 1 - x[M-m]; } return correct_to_01( result, EPSILON ); } double convex( const double *x, const int m,int M ) { int i; double result = 1.0; for( i=1; i <= M-m; i++ ) { result *= 1.0 - cos( x[i-1]*PI/2.0 ); } if( m != 1 ) { result *= 1.0 - sin( x[M-m]*PI/2.0 ); } return correct_to_01( result, EPSILON ); } double concave( const double *x, const int m,int M ) { int i; double result = 1.0; for( i=1; i <= M-m; i++ ) { result *= sin( x[i-1]*PI/2.0 ); } if( m != 1 ) { result *= cos( x[M-m]*PI/2.0 ); } return correct_to_01( result, EPSILON ); } double mixed( const double *x, const int A, const double alpha ) { const double tmp = 2.0*A*PI; return correct_to_01( pow( 1.0-x[0]-cos( tmp*x[0] + PI/2.0 )/tmp, alpha ), EPSILON ); } double disc( const double *x, const int A, const double alpha, const double beta ) { const double tmp1 = A*pow( x[0], beta )*PI; return correct_to_01( 1.0 - pow( x[0], alpha )*pow( cos( tmp1 ), 2.0 ), EPSILON ); } /* Calculate the minimum of two doubles. */ static double min_double( const double aa, const double bb ) { return aa < bb ? aa : bb; } /* Implemented functions. */ double b_poly( const double y, const double alpha ) { return correct_to_01( pow( y, alpha ), EPSILON ); } double b_flat ( const double y, const double A, const double B, const double C ) { const double tmp1 = min_double( 0.0, floor( y-B ) ) * A*( B-y )/B; const double tmp2 = min_double( 0.0, floor( C-y ) ) * ( 1.0-A )*( y-C )/( 1.0-C ); return correct_to_01( A+tmp1-tmp2, EPSILON ); } double b_param ( const double y, const double u, const double A, const double B, const double C ) { const double v = A - ( 1.0-2.0*u )*fabs( floor( 0.5-u )+A ); return correct_to_01( pow( y, B + ( C-B )*v ), EPSILON ); } double s_linear( const double y, const double A ) { return correct_to_01( fabs( y-A )/fabs( floor( A-y )+A ), EPSILON ); } double s_decept(const double y, const double A, const double B, const double C ) { const double tmp1 = floor( y-A+B )*( 1.0-C+( A-B )/B )/( A-B ); const double tmp2 = floor( A+B-y )*( 1.0-C+( 1.0-A-B )/B )/( 1.0-A-B ); return correct_to_01( 1.0 + ( fabs( y-A )-B )*( tmp1 + tmp2 + 1.0/B ), EPSILON ); } double s_multi ( const double y, const int A, const double B, const double C ) { const double tmp1 = fabs( y-C )/( 2.0*( floor( C-y )+C ) ); const double tmp2 = ( 4.0*A+2.0 )*PI*( 0.5-tmp1 ); return correct_to_01( ( 1.0 + cos( tmp2 ) + 4.0*B*pow( tmp1, 2.0 ) )/( B+2.0 ), EPSILON ); } double r_sum( const double *y, const double *w, int ny) { int i; double numerator = 0.0; double denominator = 0.0; for( i = 0; i < ny; i++ ) { numerator += w[i]*y[i]; denominator += w[i]; } return correct_to_01( numerator / denominator, EPSILON ); } double r_nonsep( const double *y, const int A, int ny) { const int y_len = ny; int j; double numerator = 0.0; for( j = 0; j < y_len; j++ ) { int k; numerator += y[j]; for( k = 0; k <= A-2; k++ ) { numerator += fabs( y[j] - y[( j+k+1 ) % y_len] ); } } { const double tmp = ceil( A/2.0 ); const double denominator = y_len*tmp*( 1.0 + 2.0*A - 2.0*tmp )/A; return correct_to_01( numerator / denominator, EPSILON ); } } void WFG1_M5( double *z, double *f, const unsigned int nx, const unsigned int M) { int i,j; double y[30],t1[30],t2[30],t3[30],t4[5]; const int k=M==2?4:2*(M-1); for( i = 0; i < nx; i++ ) { y[i] = z[i] / (2.0*( i+1 )); } /*y = WFG1_t1(y, k);*/ for( i = 0; i < k; i++ ) { t1[i] = y[i]; } for( i = k; i < nx; i++ ) { t1[i] = s_linear( y[i], 0.35 ); } /*y = WFG1_t2(y, k); */ for( i = 0; i < k; i++ ) { t2[i] = t1[i]; } for( i = k; i < nx; i++ ) { t2[i] = b_flat( t1[i], 0.8, 0.75, 0.85 ); } /*y = WFG1_t3(y); */ for( i = 0; i < nx; i++ ) { t3[i] = b_poly( t2[i], 0.02 ); } /*y = WFG1_t4( y,k,M,nx); */ { double w[30]; double y_sub[30],w_sub[30]; double y_sub2[30],w_sub2[30]; for( i = 1; i <= nx; i++) { w[i-1] = 2.0*i; } for( i = 1; i <= M-1; i++ ) { const int head = ( i-1 )*k/( M-1 ); const int tail = i*k/( M-1 ); for( j = head; j < tail; j++ ) { y_sub[j-head] = t3[j]; w_sub[j-head] = w[j]; } t4[i-1] = r_sum( y_sub, w_sub,tail-head ); } for( j = k; j < nx; j++ ) { y_sub2[j-k] = t3[j]; w_sub2[j-k] = w[j]; } t4[i-1] = r_sum( y_sub2, w_sub2,nx-k ); } /*shape */ { int m; short A[5]; double x[5],h[5],S[5]; A[0] = 1; for( i = 1; i < M-1; i++ ) { A[i] = 1; } for( i = 0; i < M-1; i++ ) { double tmp1; tmp1 = t4[M-1]; if( A[i] > tmp1 ) tmp1 = A[i]; x[i] = tmp1*( t4[i] - 0.5 ) + 0.5; } x[M-1] = t4[M-1]; for( m = 1; m <= M-1; m++ ) { h[m-1] = convex( x, m,M ); } h[m-1] = mixed( x, 5, 1.0 ); for( m = 1; m <= M; m++ ) { S[m-1] = m*2.0; } for( i = 0; i < M; i++ ) { f[i] = 1.0*x[M-1] + S[i]*h[i]; } } } } #endif emoa/src/avl.c0000644000175100001440000003317612030307155012734 0ustar hornikusers/***************************************************************************** avl.c - Source code for the AVL-tree library. Copyright (C) 1998 Michael H. Buselli Copyright (C) 2000-2002 Wessel Dankers This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Augmented AVL-tree. Original by Michael H. Buselli . Modified by Wessel Dankers to add a bunch of bloat to the sourcecode, change the interface and squash a few bugs. Mail him if you find new bugs. *****************************************************************************/ #include #include #include #include "avl.h" static void avl_rebalance(avl_tree_t *, avl_node_t *); #ifdef AVL_COUNT #define NODE_COUNT(n) ((n) ? (n)->count : 0) #define L_COUNT(n) (NODE_COUNT((n)->left)) #define R_COUNT(n) (NODE_COUNT((n)->right)) #define CALC_COUNT(n) (L_COUNT(n) + R_COUNT(n) + 1) #endif #ifdef AVL_DEPTH #define NODE_DEPTH(n) ((n) ? (n)->depth : 0) #define L_DEPTH(n) (NODE_DEPTH((n)->left)) #define R_DEPTH(n) (NODE_DEPTH((n)->right)) #define CALC_DEPTH(n) ((L_DEPTH(n)>R_DEPTH(n)?L_DEPTH(n):R_DEPTH(n)) + 1) #endif #ifndef AVL_DEPTH /* Also known as ffs() (from BSD) */ static int lg(unsigned int u) { int r = 1; if(!u) return 0; if(u & 0xffff0000) { u >>= 16; r += 16; } if(u & 0x0000ff00) { u >>= 8; r += 8; } if(u & 0x000000f0) { u >>= 4; r += 4; } if(u & 0x0000000c) { u >>= 2; r += 2; } if(u & 0x00000002) r++; return r; } #endif static int avl_check_balance(avl_node_t *avlnode) { #ifdef AVL_DEPTH int d; d = R_DEPTH(avlnode) - L_DEPTH(avlnode); return d<-1?-1:d>1?1:0; #else /* int d; * d = lg(R_COUNT(avlnode)) - lg(L_COUNT(avlnode)); * d = d<-1?-1:d>1?1:0; */ #ifdef AVL_COUNT int pl, r; pl = lg(L_COUNT(avlnode)); r = R_COUNT(avlnode); if(r>>pl+1) return 1; if(pl<2 || r>>pl-2) return 0; return -1; #else #error No balancing possible. #endif #endif } #ifdef AVL_COUNT unsigned int avl_count(const avl_tree_t *avltree) { return NODE_COUNT(avltree->top); } avl_node_t *avl_at(const avl_tree_t *avltree, unsigned int index) { avl_node_t *avlnode; unsigned int c; avlnode = avltree->top; while(avlnode) { c = L_COUNT(avlnode); if(index < c) { avlnode = avlnode->left; } else if(index > c) { avlnode = avlnode->right; index -= c+1; } else { return avlnode; } } return NULL; } unsigned int avl_index(const avl_node_t *avlnode) { avl_node_t *next; unsigned int c; c = L_COUNT(avlnode); while((next = avlnode->parent)) { if(avlnode == next->right) c += L_COUNT(next) + 1; avlnode = next; } return c; } #endif int avl_search_closest(const avl_tree_t *avltree, const void *item, avl_node_t **avlnode) { avl_node_t *node; avl_compare_t cmp; int c; if(!avlnode) avlnode = &node; node = avltree->top; if(!node) return *avlnode = NULL, 0; cmp = avltree->cmp; for(;;) { c = cmp(item, node->item); if(c < 0) { if(node->left) node = node->left; else return *avlnode = node, -1; } else if(c > 0) { if(node->right) node = node->right; else return *avlnode = node, 1; } else { return *avlnode = node, 0; } } } /* * avl_search: * Return a pointer to a node with the given item in the tree. * If no such item is in the tree, then NULL is returned. */ avl_node_t *avl_search(const avl_tree_t *avltree, const void *item) { avl_node_t *node; return avl_search_closest(avltree, item, &node) ? NULL : node; } avl_tree_t *avl_init_tree(avl_tree_t *rc, avl_compare_t cmp, avl_freeitem_t freeitem) { if(rc) { rc->head = NULL; rc->tail = NULL; rc->top = NULL; rc->cmp = cmp; rc->freeitem = freeitem; } return rc; } avl_tree_t *avl_alloc_tree(avl_compare_t cmp, avl_freeitem_t freeitem) { return avl_init_tree(malloc(sizeof(avl_tree_t)), cmp, freeitem); } void avl_clear_tree(avl_tree_t *avltree) { avltree->top = avltree->head = avltree->tail = NULL; } void avl_free_nodes(avl_tree_t *avltree) { avl_node_t *node, *next; avl_freeitem_t freeitem; freeitem = avltree->freeitem; for(node = avltree->head; node; node = next) { next = node->next; if(freeitem) freeitem(node->item); free(node); } avl_clear_tree(avltree); } /* * avl_free_tree: * Free all memory used by this tree. If freeitem is not NULL, then * it is assumed to be a destructor for the items referenced in the avl_ * tree, and they are deleted as well. */ void avl_free_tree(avl_tree_t *avltree) { avl_free_nodes(avltree); free(avltree); } static void avl_clear_node(avl_node_t *newnode) { newnode->left = newnode->right = NULL; #ifdef AVL_COUNT newnode->count = 1; #endif #ifdef AVL_DEPTH newnode->depth = 1; #endif } avl_node_t *avl_init_node(avl_node_t *newnode, void *item) { if(newnode) { avl_clear_node(newnode); newnode->item = item; } return newnode; } avl_node_t *avl_insert_top(avl_tree_t *avltree, avl_node_t *newnode) { avl_clear_node(newnode); newnode->prev = newnode->next = newnode->parent = NULL; avltree->head = avltree->tail = avltree->top = newnode; return newnode; } avl_node_t *avl_insert_before(avl_tree_t *avltree, avl_node_t *node, avl_node_t *newnode) { if(!node) return avltree->tail ? avl_insert_after(avltree, avltree->tail, newnode) : avl_insert_top(avltree, newnode); if(node->left) return avl_insert_after(avltree, node->prev, newnode); avl_clear_node(newnode); newnode->next = node; newnode->parent = node; newnode->prev = node->prev; if(node->prev) node->prev->next = newnode; else avltree->head = newnode; node->prev = newnode; node->left = newnode; avl_rebalance(avltree, node); return newnode; } avl_node_t *avl_insert_after(avl_tree_t *avltree, avl_node_t *node, avl_node_t *newnode) { if(!node) return avltree->head ? avl_insert_before(avltree, avltree->head, newnode) : avl_insert_top(avltree, newnode); if(node->right) return avl_insert_before(avltree, node->next, newnode); avl_clear_node(newnode); newnode->prev = node; newnode->parent = node; newnode->next = node->next; if(node->next) node->next->prev = newnode; else avltree->tail = newnode; node->next = newnode; node->right = newnode; avl_rebalance(avltree, node); return newnode; } avl_node_t *avl_insert_node(avl_tree_t *avltree, avl_node_t *newnode) { avl_node_t *node; if(!avltree->top) return avl_insert_top(avltree, newnode); switch(avl_search_closest(avltree, newnode->item, &node)) { case -1: return avl_insert_before(avltree, node, newnode); case 1: return avl_insert_after(avltree, node, newnode); } return NULL; } /* * avl_insert: * Create a new node and insert an item there. * Returns the new node on success or NULL if no memory could be allocated. */ avl_node_t *avl_insert(avl_tree_t *avltree, void *item) { avl_node_t *newnode; newnode = avl_init_node(malloc(sizeof(avl_node_t)), item); if(newnode) { if(avl_insert_node(avltree, newnode)) return newnode; free(newnode); errno = EEXIST; } return NULL; } /* * avl_unlink_node: * Removes the given node. Does not delete the item at that node. * The item of the node may be freed before calling avl_unlink_node. * (In other words, it is not referenced by this function.) */ void avl_unlink_node(avl_tree_t *avltree, avl_node_t *avlnode) { avl_node_t *parent; avl_node_t **superparent; avl_node_t *subst, *left, *right; avl_node_t *balnode; if(avlnode->prev) avlnode->prev->next = avlnode->next; else avltree->head = avlnode->next; if(avlnode->next) avlnode->next->prev = avlnode->prev; else avltree->tail = avlnode->prev; parent = avlnode->parent; superparent = parent ? avlnode == parent->left ? &parent->left : &parent->right : &avltree->top; left = avlnode->left; right = avlnode->right; if(!left) { *superparent = right; if(right) right->parent = parent; balnode = parent; } else if(!right) { *superparent = left; left->parent = parent; balnode = parent; } else { subst = avlnode->prev; if(subst == left) { balnode = subst; } else { balnode = subst->parent; balnode->right = subst->left; if(balnode->right) balnode->right->parent = balnode; subst->left = left; left->parent = subst; } subst->right = right; subst->parent = parent; right->parent = subst; *superparent = subst; } avl_rebalance(avltree, balnode); } void *avl_delete_node(avl_tree_t *avltree, avl_node_t *avlnode) { void *item = NULL; if(avlnode) { item = avlnode->item; avl_unlink_node(avltree, avlnode); if(avltree->freeitem) avltree->freeitem(item); free(avlnode); } return item; } void *avl_delete(avl_tree_t *avltree, const void *item) { return avl_delete_node(avltree, avl_search(avltree, item)); } avl_node_t *avl_fixup_node(avl_tree_t *avltree, avl_node_t *newnode) { avl_node_t *oldnode = NULL, *node; if(!avltree || !newnode) return NULL; node = newnode->prev; if(node) { oldnode = node->next; node->next = newnode; } else { avltree->head = newnode; } node = newnode->next; if(node) { oldnode = node->prev; node->prev = newnode; } else { avltree->tail = newnode; } node = newnode->parent; if(node) { if(node->left == oldnode) node->left = newnode; else node->right = newnode; } else { oldnode = avltree->top; avltree->top = newnode; } return oldnode; } /* * avl_rebalance: * Rebalances the tree if one side becomes too heavy. This function * assumes that both subtrees are AVL-trees with consistant data. The * function has the additional side effect of recalculating the count of * the tree at this node. It should be noted that at the return of this * function, if a rebalance takes place, the top of this subtree is no * longer going to be the same node. */ void avl_rebalance(avl_tree_t *avltree, avl_node_t *avlnode) { avl_node_t *child; avl_node_t *gchild; avl_node_t *parent; avl_node_t **superparent; parent = avlnode; while(avlnode) { parent = avlnode->parent; superparent = parent ? avlnode == parent->left ? &parent->left : &parent->right : &avltree->top; switch(avl_check_balance(avlnode)) { case -1: child = avlnode->left; #ifdef AVL_DEPTH if(L_DEPTH(child) >= R_DEPTH(child)) { #else #ifdef AVL_COUNT if(L_COUNT(child) >= R_COUNT(child)) { #else #error No balancing possible. #endif #endif avlnode->left = child->right; if(avlnode->left) avlnode->left->parent = avlnode; child->right = avlnode; avlnode->parent = child; *superparent = child; child->parent = parent; #ifdef AVL_COUNT avlnode->count = CALC_COUNT(avlnode); child->count = CALC_COUNT(child); #endif #ifdef AVL_DEPTH avlnode->depth = CALC_DEPTH(avlnode); child->depth = CALC_DEPTH(child); #endif } else { gchild = child->right; avlnode->left = gchild->right; if(avlnode->left) avlnode->left->parent = avlnode; child->right = gchild->left; if(child->right) child->right->parent = child; gchild->right = avlnode; if(gchild->right) gchild->right->parent = gchild; gchild->left = child; if(gchild->left) gchild->left->parent = gchild; *superparent = gchild; gchild->parent = parent; #ifdef AVL_COUNT avlnode->count = CALC_COUNT(avlnode); child->count = CALC_COUNT(child); gchild->count = CALC_COUNT(gchild); #endif #ifdef AVL_DEPTH avlnode->depth = CALC_DEPTH(avlnode); child->depth = CALC_DEPTH(child); gchild->depth = CALC_DEPTH(gchild); #endif } break; case 1: child = avlnode->right; #ifdef AVL_DEPTH if(R_DEPTH(child) >= L_DEPTH(child)) { #else #ifdef AVL_COUNT if(R_COUNT(child) >= L_COUNT(child)) { #else #error No balancing possible. #endif #endif avlnode->right = child->left; if(avlnode->right) avlnode->right->parent = avlnode; child->left = avlnode; avlnode->parent = child; *superparent = child; child->parent = parent; #ifdef AVL_COUNT avlnode->count = CALC_COUNT(avlnode); child->count = CALC_COUNT(child); #endif #ifdef AVL_DEPTH avlnode->depth = CALC_DEPTH(avlnode); child->depth = CALC_DEPTH(child); #endif } else { gchild = child->left; avlnode->right = gchild->left; if(avlnode->right) avlnode->right->parent = avlnode; child->left = gchild->right; if(child->left) child->left->parent = child; gchild->left = avlnode; if(gchild->left) gchild->left->parent = gchild; gchild->right = child; if(gchild->right) gchild->right->parent = gchild; *superparent = gchild; gchild->parent = parent; #ifdef AVL_COUNT avlnode->count = CALC_COUNT(avlnode); child->count = CALC_COUNT(child); gchild->count = CALC_COUNT(gchild); #endif #ifdef AVL_DEPTH avlnode->depth = CALC_DEPTH(avlnode); child->depth = CALC_DEPTH(child); gchild->depth = CALC_DEPTH(gchild); #endif } break; default: #ifdef AVL_COUNT avlnode->count = CALC_COUNT(avlnode); #endif #ifdef AVL_DEPTH avlnode->depth = CALC_DEPTH(avlnode); #endif } avlnode = parent; } } emoa/src/weight_vectors.h0000644000175100001440000022722312030307155015211 0ustar hornikusers#ifndef WEIGHT_VECTORS_H unsigned int number_of_weights_500_2 = 501; double weights_500_2[] = { 0.000000, 1.000000, 0.002000, 0.998000, 0.004000, 0.996000, 0.006000, 0.994000, 0.008000, 0.992000, 0.010000, 0.990000, 0.012000, 0.988000, 0.014000, 0.986000, 0.016000, 0.984000, 0.018000, 0.982000, 0.020000, 0.980000, 0.022000, 0.978000, 0.024000, 0.976000, 0.026000, 0.974000, 0.028000, 0.972000, 0.030000, 0.970000, 0.032000, 0.968000, 0.034000, 0.966000, 0.036000, 0.964000, 0.038000, 0.962000, 0.040000, 0.960000, 0.042000, 0.958000, 0.044000, 0.956000, 0.046000, 0.954000, 0.048000, 0.952000, 0.050000, 0.950000, 0.052000, 0.948000, 0.054000, 0.946000, 0.056000, 0.944000, 0.058000, 0.942000, 0.060000, 0.940000, 0.062000, 0.938000, 0.064000, 0.936000, 0.066000, 0.934000, 0.068000, 0.932000, 0.070000, 0.930000, 0.072000, 0.928000, 0.074000, 0.926000, 0.076000, 0.924000, 0.078000, 0.922000, 0.080000, 0.920000, 0.082000, 0.918000, 0.084000, 0.916000, 0.086000, 0.914000, 0.088000, 0.912000, 0.090000, 0.910000, 0.092000, 0.908000, 0.094000, 0.906000, 0.096000, 0.904000, 0.098000, 0.902000, 0.100000, 0.900000, 0.102000, 0.898000, 0.104000, 0.896000, 0.106000, 0.894000, 0.108000, 0.892000, 0.110000, 0.890000, 0.112000, 0.888000, 0.114000, 0.886000, 0.116000, 0.884000, 0.118000, 0.882000, 0.120000, 0.880000, 0.122000, 0.878000, 0.124000, 0.876000, 0.126000, 0.874000, 0.128000, 0.872000, 0.130000, 0.870000, 0.132000, 0.868000, 0.134000, 0.866000, 0.136000, 0.864000, 0.138000, 0.862000, 0.140000, 0.860000, 0.142000, 0.858000, 0.144000, 0.856000, 0.146000, 0.854000, 0.148000, 0.852000, 0.150000, 0.850000, 0.152000, 0.848000, 0.154000, 0.846000, 0.156000, 0.844000, 0.158000, 0.842000, 0.160000, 0.840000, 0.162000, 0.838000, 0.164000, 0.836000, 0.166000, 0.834000, 0.168000, 0.832000, 0.170000, 0.830000, 0.172000, 0.828000, 0.174000, 0.826000, 0.176000, 0.824000, 0.178000, 0.822000, 0.180000, 0.820000, 0.182000, 0.818000, 0.184000, 0.816000, 0.186000, 0.814000, 0.188000, 0.812000, 0.190000, 0.810000, 0.192000, 0.808000, 0.194000, 0.806000, 0.196000, 0.804000, 0.198000, 0.802000, 0.200000, 0.800000, 0.202000, 0.798000, 0.204000, 0.796000, 0.206000, 0.794000, 0.208000, 0.792000, 0.210000, 0.790000, 0.212000, 0.788000, 0.214000, 0.786000, 0.216000, 0.784000, 0.218000, 0.782000, 0.220000, 0.780000, 0.222000, 0.778000, 0.224000, 0.776000, 0.226000, 0.774000, 0.228000, 0.772000, 0.230000, 0.770000, 0.232000, 0.768000, 0.234000, 0.766000, 0.236000, 0.764000, 0.238000, 0.762000, 0.240000, 0.760000, 0.242000, 0.758000, 0.244000, 0.756000, 0.246000, 0.754000, 0.248000, 0.752000, 0.250000, 0.750000, 0.252000, 0.748000, 0.254000, 0.746000, 0.256000, 0.744000, 0.258000, 0.742000, 0.260000, 0.740000, 0.262000, 0.738000, 0.264000, 0.736000, 0.266000, 0.734000, 0.268000, 0.732000, 0.270000, 0.730000, 0.272000, 0.728000, 0.274000, 0.726000, 0.276000, 0.724000, 0.278000, 0.722000, 0.280000, 0.720000, 0.282000, 0.718000, 0.284000, 0.716000, 0.286000, 0.714000, 0.288000, 0.712000, 0.290000, 0.710000, 0.292000, 0.708000, 0.294000, 0.706000, 0.296000, 0.704000, 0.298000, 0.702000, 0.300000, 0.700000, 0.302000, 0.698000, 0.304000, 0.696000, 0.306000, 0.694000, 0.308000, 0.692000, 0.310000, 0.690000, 0.312000, 0.688000, 0.314000, 0.686000, 0.316000, 0.684000, 0.318000, 0.682000, 0.320000, 0.680000, 0.322000, 0.678000, 0.324000, 0.676000, 0.326000, 0.674000, 0.328000, 0.672000, 0.330000, 0.670000, 0.332000, 0.668000, 0.334000, 0.666000, 0.336000, 0.664000, 0.338000, 0.662000, 0.340000, 0.660000, 0.342000, 0.658000, 0.344000, 0.656000, 0.346000, 0.654000, 0.348000, 0.652000, 0.350000, 0.650000, 0.352000, 0.648000, 0.354000, 0.646000, 0.356000, 0.644000, 0.358000, 0.642000, 0.360000, 0.640000, 0.362000, 0.638000, 0.364000, 0.636000, 0.366000, 0.634000, 0.368000, 0.632000, 0.370000, 0.630000, 0.372000, 0.628000, 0.374000, 0.626000, 0.376000, 0.624000, 0.378000, 0.622000, 0.380000, 0.620000, 0.382000, 0.618000, 0.384000, 0.616000, 0.386000, 0.614000, 0.388000, 0.612000, 0.390000, 0.610000, 0.392000, 0.608000, 0.394000, 0.606000, 0.396000, 0.604000, 0.398000, 0.602000, 0.400000, 0.600000, 0.402000, 0.598000, 0.404000, 0.596000, 0.406000, 0.594000, 0.408000, 0.592000, 0.410000, 0.590000, 0.412000, 0.588000, 0.414000, 0.586000, 0.416000, 0.584000, 0.418000, 0.582000, 0.420000, 0.580000, 0.422000, 0.578000, 0.424000, 0.576000, 0.426000, 0.574000, 0.428000, 0.572000, 0.430000, 0.570000, 0.432000, 0.568000, 0.434000, 0.566000, 0.436000, 0.564000, 0.438000, 0.562000, 0.440000, 0.560000, 0.442000, 0.558000, 0.444000, 0.556000, 0.446000, 0.554000, 0.448000, 0.552000, 0.450000, 0.550000, 0.452000, 0.548000, 0.454000, 0.546000, 0.456000, 0.544000, 0.458000, 0.542000, 0.460000, 0.540000, 0.462000, 0.538000, 0.464000, 0.536000, 0.466000, 0.534000, 0.468000, 0.532000, 0.470000, 0.530000, 0.472000, 0.528000, 0.474000, 0.526000, 0.476000, 0.524000, 0.478000, 0.522000, 0.480000, 0.520000, 0.482000, 0.518000, 0.484000, 0.516000, 0.486000, 0.514000, 0.488000, 0.512000, 0.490000, 0.510000, 0.492000, 0.508000, 0.494000, 0.506000, 0.496000, 0.504000, 0.498000, 0.502000, 0.500000, 0.500000, 0.502000, 0.498000, 0.504000, 0.496000, 0.506000, 0.494000, 0.508000, 0.492000, 0.510000, 0.490000, 0.512000, 0.488000, 0.514000, 0.486000, 0.516000, 0.484000, 0.518000, 0.482000, 0.520000, 0.480000, 0.522000, 0.478000, 0.524000, 0.476000, 0.526000, 0.474000, 0.528000, 0.472000, 0.530000, 0.470000, 0.532000, 0.468000, 0.534000, 0.466000, 0.536000, 0.464000, 0.538000, 0.462000, 0.540000, 0.460000, 0.542000, 0.458000, 0.544000, 0.456000, 0.546000, 0.454000, 0.548000, 0.452000, 0.550000, 0.450000, 0.552000, 0.448000, 0.554000, 0.446000, 0.556000, 0.444000, 0.558000, 0.442000, 0.560000, 0.440000, 0.562000, 0.438000, 0.564000, 0.436000, 0.566000, 0.434000, 0.568000, 0.432000, 0.570000, 0.430000, 0.572000, 0.428000, 0.574000, 0.426000, 0.576000, 0.424000, 0.578000, 0.422000, 0.580000, 0.420000, 0.582000, 0.418000, 0.584000, 0.416000, 0.586000, 0.414000, 0.588000, 0.412000, 0.590000, 0.410000, 0.592000, 0.408000, 0.594000, 0.406000, 0.596000, 0.404000, 0.598000, 0.402000, 0.600000, 0.400000, 0.602000, 0.398000, 0.604000, 0.396000, 0.606000, 0.394000, 0.608000, 0.392000, 0.610000, 0.390000, 0.612000, 0.388000, 0.614000, 0.386000, 0.616000, 0.384000, 0.618000, 0.382000, 0.620000, 0.380000, 0.622000, 0.378000, 0.624000, 0.376000, 0.626000, 0.374000, 0.628000, 0.372000, 0.630000, 0.370000, 0.632000, 0.368000, 0.634000, 0.366000, 0.636000, 0.364000, 0.638000, 0.362000, 0.640000, 0.360000, 0.642000, 0.358000, 0.644000, 0.356000, 0.646000, 0.354000, 0.648000, 0.352000, 0.650000, 0.350000, 0.652000, 0.348000, 0.654000, 0.346000, 0.656000, 0.344000, 0.658000, 0.342000, 0.660000, 0.340000, 0.662000, 0.338000, 0.664000, 0.336000, 0.666000, 0.334000, 0.668000, 0.332000, 0.670000, 0.330000, 0.672000, 0.328000, 0.674000, 0.326000, 0.676000, 0.324000, 0.678000, 0.322000, 0.680000, 0.320000, 0.682000, 0.318000, 0.684000, 0.316000, 0.686000, 0.314000, 0.688000, 0.312000, 0.690000, 0.310000, 0.692000, 0.308000, 0.694000, 0.306000, 0.696000, 0.304000, 0.698000, 0.302000, 0.700000, 0.300000, 0.702000, 0.298000, 0.704000, 0.296000, 0.706000, 0.294000, 0.708000, 0.292000, 0.710000, 0.290000, 0.712000, 0.288000, 0.714000, 0.286000, 0.716000, 0.284000, 0.718000, 0.282000, 0.720000, 0.280000, 0.722000, 0.278000, 0.724000, 0.276000, 0.726000, 0.274000, 0.728000, 0.272000, 0.730000, 0.270000, 0.732000, 0.268000, 0.734000, 0.266000, 0.736000, 0.264000, 0.738000, 0.262000, 0.740000, 0.260000, 0.742000, 0.258000, 0.744000, 0.256000, 0.746000, 0.254000, 0.748000, 0.252000, 0.750000, 0.250000, 0.752000, 0.248000, 0.754000, 0.246000, 0.756000, 0.244000, 0.758000, 0.242000, 0.760000, 0.240000, 0.762000, 0.238000, 0.764000, 0.236000, 0.766000, 0.234000, 0.768000, 0.232000, 0.770000, 0.230000, 0.772000, 0.228000, 0.774000, 0.226000, 0.776000, 0.224000, 0.778000, 0.222000, 0.780000, 0.220000, 0.782000, 0.218000, 0.784000, 0.216000, 0.786000, 0.214000, 0.788000, 0.212000, 0.790000, 0.210000, 0.792000, 0.208000, 0.794000, 0.206000, 0.796000, 0.204000, 0.798000, 0.202000, 0.800000, 0.200000, 0.802000, 0.198000, 0.804000, 0.196000, 0.806000, 0.194000, 0.808000, 0.192000, 0.810000, 0.190000, 0.812000, 0.188000, 0.814000, 0.186000, 0.816000, 0.184000, 0.818000, 0.182000, 0.820000, 0.180000, 0.822000, 0.178000, 0.824000, 0.176000, 0.826000, 0.174000, 0.828000, 0.172000, 0.830000, 0.170000, 0.832000, 0.168000, 0.834000, 0.166000, 0.836000, 0.164000, 0.838000, 0.162000, 0.840000, 0.160000, 0.842000, 0.158000, 0.844000, 0.156000, 0.846000, 0.154000, 0.848000, 0.152000, 0.850000, 0.150000, 0.852000, 0.148000, 0.854000, 0.146000, 0.856000, 0.144000, 0.858000, 0.142000, 0.860000, 0.140000, 0.862000, 0.138000, 0.864000, 0.136000, 0.866000, 0.134000, 0.868000, 0.132000, 0.870000, 0.130000, 0.872000, 0.128000, 0.874000, 0.126000, 0.876000, 0.124000, 0.878000, 0.122000, 0.880000, 0.120000, 0.882000, 0.118000, 0.884000, 0.116000, 0.886000, 0.114000, 0.888000, 0.112000, 0.890000, 0.110000, 0.892000, 0.108000, 0.894000, 0.106000, 0.896000, 0.104000, 0.898000, 0.102000, 0.900000, 0.100000, 0.902000, 0.098000, 0.904000, 0.096000, 0.906000, 0.094000, 0.908000, 0.092000, 0.910000, 0.090000, 0.912000, 0.088000, 0.914000, 0.086000, 0.916000, 0.084000, 0.918000, 0.082000, 0.920000, 0.080000, 0.922000, 0.078000, 0.924000, 0.076000, 0.926000, 0.074000, 0.928000, 0.072000, 0.930000, 0.070000, 0.932000, 0.068000, 0.934000, 0.066000, 0.936000, 0.064000, 0.938000, 0.062000, 0.940000, 0.060000, 0.942000, 0.058000, 0.944000, 0.056000, 0.946000, 0.054000, 0.948000, 0.052000, 0.950000, 0.050000, 0.952000, 0.048000, 0.954000, 0.046000, 0.956000, 0.044000, 0.958000, 0.042000, 0.960000, 0.040000, 0.962000, 0.038000, 0.964000, 0.036000, 0.966000, 0.034000, 0.968000, 0.032000, 0.970000, 0.030000, 0.972000, 0.028000, 0.974000, 0.026000, 0.976000, 0.024000, 0.978000, 0.022000, 0.980000, 0.020000, 0.982000, 0.018000, 0.984000, 0.016000, 0.986000, 0.014000, 0.988000, 0.012000, 0.990000, 0.010000, 0.992000, 0.008000, 0.994000, 0.006000, 0.996000, 0.004000, 0.998000, 0.002000, 1.000000, 0.000000, }; unsigned int number_of_weights_30_3 = 496; double weights_30_3[] = { 0.000000, 0.000000, 1.000000, 0.000000, 0.033333, 0.966667, 0.000000, 0.066667, 0.933333, 0.000000, 0.100000, 0.900000, 0.000000, 0.133333, 0.866667, 0.000000, 0.166667, 0.833333, 0.000000, 0.200000, 0.800000, 0.000000, 0.233333, 0.766667, 0.000000, 0.266667, 0.733333, 0.000000, 0.300000, 0.700000, 0.000000, 0.333333, 0.666667, 0.000000, 0.366667, 0.633333, 0.000000, 0.400000, 0.600000, 0.000000, 0.433333, 0.566667, 0.000000, 0.466667, 0.533333, 0.000000, 0.500000, 0.500000, 0.000000, 0.533333, 0.466667, 0.000000, 0.566667, 0.433333, 0.000000, 0.600000, 0.400000, 0.000000, 0.633333, 0.366667, 0.000000, 0.666667, 0.333333, 0.000000, 0.700000, 0.300000, 0.000000, 0.733333, 0.266667, 0.000000, 0.766667, 0.233333, 0.000000, 0.800000, 0.200000, 0.000000, 0.833333, 0.166667, 0.000000, 0.866667, 0.133333, 0.000000, 0.900000, 0.100000, 0.000000, 0.933333, 0.066667, 0.000000, 0.966667, 0.033333, 0.000000, 1.000000, 0.000000, 0.033333, 0.000000, 0.966667, 0.033333, 0.033333, 0.933333, 0.033333, 0.066667, 0.900000, 0.033333, 0.100000, 0.866667, 0.033333, 0.133333, 0.833333, 0.033333, 0.166667, 0.800000, 0.033333, 0.200000, 0.766667, 0.033333, 0.233333, 0.733333, 0.033333, 0.266667, 0.700000, 0.033333, 0.300000, 0.666667, 0.033333, 0.333333, 0.633333, 0.033333, 0.366667, 0.600000, 0.033333, 0.400000, 0.566667, 0.033333, 0.433333, 0.533333, 0.033333, 0.466667, 0.500000, 0.033333, 0.500000, 0.466667, 0.033333, 0.533333, 0.433333, 0.033333, 0.566667, 0.400000, 0.033333, 0.600000, 0.366667, 0.033333, 0.633333, 0.333333, 0.033333, 0.666667, 0.300000, 0.033333, 0.700000, 0.266667, 0.033333, 0.733333, 0.233333, 0.033333, 0.766667, 0.200000, 0.033333, 0.800000, 0.166667, 0.033333, 0.833333, 0.133333, 0.033333, 0.866667, 0.100000, 0.033333, 0.900000, 0.066667, 0.033333, 0.933333, 0.033333, 0.033333, 0.966667, 0.000000, 0.066667, 0.000000, 0.933333, 0.066667, 0.033333, 0.900000, 0.066667, 0.066667, 0.866667, 0.066667, 0.100000, 0.833333, 0.066667, 0.133333, 0.800000, 0.066667, 0.166667, 0.766667, 0.066667, 0.200000, 0.733333, 0.066667, 0.233333, 0.700000, 0.066667, 0.266667, 0.666667, 0.066667, 0.300000, 0.633333, 0.066667, 0.333333, 0.600000, 0.066667, 0.366667, 0.566667, 0.066667, 0.400000, 0.533333, 0.066667, 0.433333, 0.500000, 0.066667, 0.466667, 0.466667, 0.066667, 0.500000, 0.433333, 0.066667, 0.533333, 0.400000, 0.066667, 0.566667, 0.366667, 0.066667, 0.600000, 0.333333, 0.066667, 0.633333, 0.300000, 0.066667, 0.666667, 0.266667, 0.066667, 0.700000, 0.233333, 0.066667, 0.733333, 0.200000, 0.066667, 0.766667, 0.166667, 0.066667, 0.800000, 0.133333, 0.066667, 0.833333, 0.100000, 0.066667, 0.866667, 0.066667, 0.066667, 0.900000, 0.033333, 0.066667, 0.933333, 0.000000, 0.100000, 0.000000, 0.900000, 0.100000, 0.033333, 0.866667, 0.100000, 0.066667, 0.833333, 0.100000, 0.100000, 0.800000, 0.100000, 0.133333, 0.766667, 0.100000, 0.166667, 0.733333, 0.100000, 0.200000, 0.700000, 0.100000, 0.233333, 0.666667, 0.100000, 0.266667, 0.633333, 0.100000, 0.300000, 0.600000, 0.100000, 0.333333, 0.566667, 0.100000, 0.366667, 0.533333, 0.100000, 0.400000, 0.500000, 0.100000, 0.433333, 0.466667, 0.100000, 0.466667, 0.433333, 0.100000, 0.500000, 0.400000, 0.100000, 0.533333, 0.366667, 0.100000, 0.566667, 0.333333, 0.100000, 0.600000, 0.300000, 0.100000, 0.633333, 0.266667, 0.100000, 0.666667, 0.233333, 0.100000, 0.700000, 0.200000, 0.100000, 0.733333, 0.166667, 0.100000, 0.766667, 0.133333, 0.100000, 0.800000, 0.100000, 0.100000, 0.833333, 0.066667, 0.100000, 0.866667, 0.033333, 0.100000, 0.900000, 0.000000, 0.133333, 0.000000, 0.866667, 0.133333, 0.033333, 0.833333, 0.133333, 0.066667, 0.800000, 0.133333, 0.100000, 0.766667, 0.133333, 0.133333, 0.733333, 0.133333, 0.166667, 0.700000, 0.133333, 0.200000, 0.666667, 0.133333, 0.233333, 0.633333, 0.133333, 0.266667, 0.600000, 0.133333, 0.300000, 0.566667, 0.133333, 0.333333, 0.533333, 0.133333, 0.366667, 0.500000, 0.133333, 0.400000, 0.466667, 0.133333, 0.433333, 0.433333, 0.133333, 0.466667, 0.400000, 0.133333, 0.500000, 0.366667, 0.133333, 0.533333, 0.333333, 0.133333, 0.566667, 0.300000, 0.133333, 0.600000, 0.266667, 0.133333, 0.633333, 0.233333, 0.133333, 0.666667, 0.200000, 0.133333, 0.700000, 0.166667, 0.133333, 0.733333, 0.133333, 0.133333, 0.766667, 0.100000, 0.133333, 0.800000, 0.066667, 0.133333, 0.833333, 0.033333, 0.133333, 0.866667, 0.000000, 0.166667, 0.000000, 0.833333, 0.166667, 0.033333, 0.800000, 0.166667, 0.066667, 0.766667, 0.166667, 0.100000, 0.733333, 0.166667, 0.133333, 0.700000, 0.166667, 0.166667, 0.666667, 0.166667, 0.200000, 0.633333, 0.166667, 0.233333, 0.600000, 0.166667, 0.266667, 0.566667, 0.166667, 0.300000, 0.533333, 0.166667, 0.333333, 0.500000, 0.166667, 0.366667, 0.466667, 0.166667, 0.400000, 0.433333, 0.166667, 0.433333, 0.400000, 0.166667, 0.466667, 0.366667, 0.166667, 0.500000, 0.333333, 0.166667, 0.533333, 0.300000, 0.166667, 0.566667, 0.266667, 0.166667, 0.600000, 0.233333, 0.166667, 0.633333, 0.200000, 0.166667, 0.666667, 0.166667, 0.166667, 0.700000, 0.133333, 0.166667, 0.733333, 0.100000, 0.166667, 0.766667, 0.066667, 0.166667, 0.800000, 0.033333, 0.166667, 0.833333, 0.000000, 0.200000, 0.000000, 0.800000, 0.200000, 0.033333, 0.766667, 0.200000, 0.066667, 0.733333, 0.200000, 0.100000, 0.700000, 0.200000, 0.133333, 0.666667, 0.200000, 0.166667, 0.633333, 0.200000, 0.200000, 0.600000, 0.200000, 0.233333, 0.566667, 0.200000, 0.266667, 0.533333, 0.200000, 0.300000, 0.500000, 0.200000, 0.333333, 0.466667, 0.200000, 0.366667, 0.433333, 0.200000, 0.400000, 0.400000, 0.200000, 0.433333, 0.366667, 0.200000, 0.466667, 0.333333, 0.200000, 0.500000, 0.300000, 0.200000, 0.533333, 0.266667, 0.200000, 0.566667, 0.233333, 0.200000, 0.600000, 0.200000, 0.200000, 0.633333, 0.166667, 0.200000, 0.666667, 0.133333, 0.200000, 0.700000, 0.100000, 0.200000, 0.733333, 0.066667, 0.200000, 0.766667, 0.033333, 0.200000, 0.800000, 0.000000, 0.233333, 0.000000, 0.766667, 0.233333, 0.033333, 0.733333, 0.233333, 0.066667, 0.700000, 0.233333, 0.100000, 0.666667, 0.233333, 0.133333, 0.633333, 0.233333, 0.166667, 0.600000, 0.233333, 0.200000, 0.566667, 0.233333, 0.233333, 0.533333, 0.233333, 0.266667, 0.500000, 0.233333, 0.300000, 0.466667, 0.233333, 0.333333, 0.433333, 0.233333, 0.366667, 0.400000, 0.233333, 0.400000, 0.366667, 0.233333, 0.433333, 0.333333, 0.233333, 0.466667, 0.300000, 0.233333, 0.500000, 0.266667, 0.233333, 0.533333, 0.233333, 0.233333, 0.566667, 0.200000, 0.233333, 0.600000, 0.166667, 0.233333, 0.633333, 0.133333, 0.233333, 0.666667, 0.100000, 0.233333, 0.700000, 0.066667, 0.233333, 0.733333, 0.033333, 0.233333, 0.766667, 0.000000, 0.266667, 0.000000, 0.733333, 0.266667, 0.033333, 0.700000, 0.266667, 0.066667, 0.666667, 0.266667, 0.100000, 0.633333, 0.266667, 0.133333, 0.600000, 0.266667, 0.166667, 0.566667, 0.266667, 0.200000, 0.533333, 0.266667, 0.233333, 0.500000, 0.266667, 0.266667, 0.466667, 0.266667, 0.300000, 0.433333, 0.266667, 0.333333, 0.400000, 0.266667, 0.366667, 0.366667, 0.266667, 0.400000, 0.333333, 0.266667, 0.433333, 0.300000, 0.266667, 0.466667, 0.266667, 0.266667, 0.500000, 0.233333, 0.266667, 0.533333, 0.200000, 0.266667, 0.566667, 0.166667, 0.266667, 0.600000, 0.133333, 0.266667, 0.633333, 0.100000, 0.266667, 0.666667, 0.066667, 0.266667, 0.700000, 0.033333, 0.266667, 0.733333, 0.000000, 0.300000, 0.000000, 0.700000, 0.300000, 0.033333, 0.666667, 0.300000, 0.066667, 0.633333, 0.300000, 0.100000, 0.600000, 0.300000, 0.133333, 0.566667, 0.300000, 0.166667, 0.533333, 0.300000, 0.200000, 0.500000, 0.300000, 0.233333, 0.466667, 0.300000, 0.266667, 0.433333, 0.300000, 0.300000, 0.400000, 0.300000, 0.333333, 0.366667, 0.300000, 0.366667, 0.333333, 0.300000, 0.400000, 0.300000, 0.300000, 0.433333, 0.266667, 0.300000, 0.466667, 0.233333, 0.300000, 0.500000, 0.200000, 0.300000, 0.533333, 0.166667, 0.300000, 0.566667, 0.133333, 0.300000, 0.600000, 0.100000, 0.300000, 0.633333, 0.066667, 0.300000, 0.666667, 0.033333, 0.300000, 0.700000, 0.000000, 0.333333, 0.000000, 0.666667, 0.333333, 0.033333, 0.633333, 0.333333, 0.066667, 0.600000, 0.333333, 0.100000, 0.566667, 0.333333, 0.133333, 0.533333, 0.333333, 0.166667, 0.500000, 0.333333, 0.200000, 0.466667, 0.333333, 0.233333, 0.433333, 0.333333, 0.266667, 0.400000, 0.333333, 0.300000, 0.366667, 0.333333, 0.333333, 0.333333, 0.333333, 0.366667, 0.300000, 0.333333, 0.400000, 0.266667, 0.333333, 0.433333, 0.233333, 0.333333, 0.466667, 0.200000, 0.333333, 0.500000, 0.166667, 0.333333, 0.533333, 0.133333, 0.333333, 0.566667, 0.100000, 0.333333, 0.600000, 0.066667, 0.333333, 0.633333, 0.033333, 0.333333, 0.666667, 0.000000, 0.366667, 0.000000, 0.633333, 0.366667, 0.033333, 0.600000, 0.366667, 0.066667, 0.566667, 0.366667, 0.100000, 0.533333, 0.366667, 0.133333, 0.500000, 0.366667, 0.166667, 0.466667, 0.366667, 0.200000, 0.433333, 0.366667, 0.233333, 0.400000, 0.366667, 0.266667, 0.366667, 0.366667, 0.300000, 0.333333, 0.366667, 0.333333, 0.300000, 0.366667, 0.366667, 0.266667, 0.366667, 0.400000, 0.233333, 0.366667, 0.433333, 0.200000, 0.366667, 0.466667, 0.166667, 0.366667, 0.500000, 0.133333, 0.366667, 0.533333, 0.100000, 0.366667, 0.566667, 0.066667, 0.366667, 0.600000, 0.033333, 0.366667, 0.633333, 0.000000, 0.400000, 0.000000, 0.600000, 0.400000, 0.033333, 0.566667, 0.400000, 0.066667, 0.533333, 0.400000, 0.100000, 0.500000, 0.400000, 0.133333, 0.466667, 0.400000, 0.166667, 0.433333, 0.400000, 0.200000, 0.400000, 0.400000, 0.233333, 0.366667, 0.400000, 0.266667, 0.333333, 0.400000, 0.300000, 0.300000, 0.400000, 0.333333, 0.266667, 0.400000, 0.366667, 0.233333, 0.400000, 0.400000, 0.200000, 0.400000, 0.433333, 0.166667, 0.400000, 0.466667, 0.133333, 0.400000, 0.500000, 0.100000, 0.400000, 0.533333, 0.066667, 0.400000, 0.566667, 0.033333, 0.400000, 0.600000, 0.000000, 0.433333, 0.000000, 0.566667, 0.433333, 0.033333, 0.533333, 0.433333, 0.066667, 0.500000, 0.433333, 0.100000, 0.466667, 0.433333, 0.133333, 0.433333, 0.433333, 0.166667, 0.400000, 0.433333, 0.200000, 0.366667, 0.433333, 0.233333, 0.333333, 0.433333, 0.266667, 0.300000, 0.433333, 0.300000, 0.266667, 0.433333, 0.333333, 0.233333, 0.433333, 0.366667, 0.200000, 0.433333, 0.400000, 0.166667, 0.433333, 0.433333, 0.133333, 0.433333, 0.466667, 0.100000, 0.433333, 0.500000, 0.066667, 0.433333, 0.533333, 0.033333, 0.433333, 0.566667, 0.000000, 0.466667, 0.000000, 0.533333, 0.466667, 0.033333, 0.500000, 0.466667, 0.066667, 0.466667, 0.466667, 0.100000, 0.433333, 0.466667, 0.133333, 0.400000, 0.466667, 0.166667, 0.366667, 0.466667, 0.200000, 0.333333, 0.466667, 0.233333, 0.300000, 0.466667, 0.266667, 0.266667, 0.466667, 0.300000, 0.233333, 0.466667, 0.333333, 0.200000, 0.466667, 0.366667, 0.166667, 0.466667, 0.400000, 0.133333, 0.466667, 0.433333, 0.100000, 0.466667, 0.466667, 0.066667, 0.466667, 0.500000, 0.033333, 0.466667, 0.533333, 0.000000, 0.500000, 0.000000, 0.500000, 0.500000, 0.033333, 0.466667, 0.500000, 0.066667, 0.433333, 0.500000, 0.100000, 0.400000, 0.500000, 0.133333, 0.366667, 0.500000, 0.166667, 0.333333, 0.500000, 0.200000, 0.300000, 0.500000, 0.233333, 0.266667, 0.500000, 0.266667, 0.233333, 0.500000, 0.300000, 0.200000, 0.500000, 0.333333, 0.166667, 0.500000, 0.366667, 0.133333, 0.500000, 0.400000, 0.100000, 0.500000, 0.433333, 0.066667, 0.500000, 0.466667, 0.033333, 0.500000, 0.500000, 0.000000, 0.533333, 0.000000, 0.466667, 0.533333, 0.033333, 0.433333, 0.533333, 0.066667, 0.400000, 0.533333, 0.100000, 0.366667, 0.533333, 0.133333, 0.333333, 0.533333, 0.166667, 0.300000, 0.533333, 0.200000, 0.266667, 0.533333, 0.233333, 0.233333, 0.533333, 0.266667, 0.200000, 0.533333, 0.300000, 0.166667, 0.533333, 0.333333, 0.133333, 0.533333, 0.366667, 0.100000, 0.533333, 0.400000, 0.066667, 0.533333, 0.433333, 0.033333, 0.533333, 0.466667, 0.000000, 0.566667, 0.000000, 0.433333, 0.566667, 0.033333, 0.400000, 0.566667, 0.066667, 0.366667, 0.566667, 0.100000, 0.333333, 0.566667, 0.133333, 0.300000, 0.566667, 0.166667, 0.266667, 0.566667, 0.200000, 0.233333, 0.566667, 0.233333, 0.200000, 0.566667, 0.266667, 0.166667, 0.566667, 0.300000, 0.133333, 0.566667, 0.333333, 0.100000, 0.566667, 0.366667, 0.066667, 0.566667, 0.400000, 0.033333, 0.566667, 0.433333, 0.000000, 0.600000, 0.000000, 0.400000, 0.600000, 0.033333, 0.366667, 0.600000, 0.066667, 0.333333, 0.600000, 0.100000, 0.300000, 0.600000, 0.133333, 0.266667, 0.600000, 0.166667, 0.233333, 0.600000, 0.200000, 0.200000, 0.600000, 0.233333, 0.166667, 0.600000, 0.266667, 0.133333, 0.600000, 0.300000, 0.100000, 0.600000, 0.333333, 0.066667, 0.600000, 0.366667, 0.033333, 0.600000, 0.400000, 0.000000, 0.633333, 0.000000, 0.366667, 0.633333, 0.033333, 0.333333, 0.633333, 0.066667, 0.300000, 0.633333, 0.100000, 0.266667, 0.633333, 0.133333, 0.233333, 0.633333, 0.166667, 0.200000, 0.633333, 0.200000, 0.166667, 0.633333, 0.233333, 0.133333, 0.633333, 0.266667, 0.100000, 0.633333, 0.300000, 0.066667, 0.633333, 0.333333, 0.033333, 0.633333, 0.366667, 0.000000, 0.666667, 0.000000, 0.333333, 0.666667, 0.033333, 0.300000, 0.666667, 0.066667, 0.266667, 0.666667, 0.100000, 0.233333, 0.666667, 0.133333, 0.200000, 0.666667, 0.166667, 0.166667, 0.666667, 0.200000, 0.133333, 0.666667, 0.233333, 0.100000, 0.666667, 0.266667, 0.066667, 0.666667, 0.300000, 0.033333, 0.666667, 0.333333, 0.000000, 0.700000, 0.000000, 0.300000, 0.700000, 0.033333, 0.266667, 0.700000, 0.066667, 0.233333, 0.700000, 0.100000, 0.200000, 0.700000, 0.133333, 0.166667, 0.700000, 0.166667, 0.133333, 0.700000, 0.200000, 0.100000, 0.700000, 0.233333, 0.066667, 0.700000, 0.266667, 0.033333, 0.700000, 0.300000, 0.000000, 0.733333, 0.000000, 0.266667, 0.733333, 0.033333, 0.233333, 0.733333, 0.066667, 0.200000, 0.733333, 0.100000, 0.166667, 0.733333, 0.133333, 0.133333, 0.733333, 0.166667, 0.100000, 0.733333, 0.200000, 0.066667, 0.733333, 0.233333, 0.033333, 0.733333, 0.266667, 0.000000, 0.766667, 0.000000, 0.233333, 0.766667, 0.033333, 0.200000, 0.766667, 0.066667, 0.166667, 0.766667, 0.100000, 0.133333, 0.766667, 0.133333, 0.100000, 0.766667, 0.166667, 0.066667, 0.766667, 0.200000, 0.033333, 0.766667, 0.233333, 0.000000, 0.800000, 0.000000, 0.200000, 0.800000, 0.033333, 0.166667, 0.800000, 0.066667, 0.133333, 0.800000, 0.100000, 0.100000, 0.800000, 0.133333, 0.066667, 0.800000, 0.166667, 0.033333, 0.800000, 0.200000, 0.000000, 0.833333, 0.000000, 0.166667, 0.833333, 0.033333, 0.133333, 0.833333, 0.066667, 0.100000, 0.833333, 0.100000, 0.066667, 0.833333, 0.133333, 0.033333, 0.833333, 0.166667, 0.000000, 0.866667, 0.000000, 0.133333, 0.866667, 0.033333, 0.100000, 0.866667, 0.066667, 0.066667, 0.866667, 0.100000, 0.033333, 0.866667, 0.133333, 0.000000, 0.900000, 0.000000, 0.100000, 0.900000, 0.033333, 0.066667, 0.900000, 0.066667, 0.033333, 0.900000, 0.100000, 0.000000, 0.933333, 0.000000, 0.066667, 0.933333, 0.033333, 0.033333, 0.933333, 0.066667, 0.000000, 0.966667, 0.000000, 0.033333, 0.966667, 0.033333, 0.000000, 1.000000, 0.000000, 0.000000, }; unsigned int number_of_weights_12_4 = 455; double weights_12_4[] = { 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.083333, 0.916667, 0.000000, 0.000000, 0.166667, 0.833333, 0.000000, 0.000000, 0.250000, 0.750000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.416667, 0.583333, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 0.583333, 0.416667, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.750000, 0.250000, 0.000000, 0.000000, 0.833333, 0.166667, 0.000000, 0.000000, 0.916667, 0.083333, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.083333, 0.000000, 0.916667, 0.000000, 0.083333, 0.083333, 0.833333, 0.000000, 0.083333, 0.166667, 0.750000, 0.000000, 0.083333, 0.250000, 0.666667, 0.000000, 0.083333, 0.333333, 0.583333, 0.000000, 0.083333, 0.416667, 0.500000, 0.000000, 0.083333, 0.500000, 0.416667, 0.000000, 0.083333, 0.583333, 0.333333, 0.000000, 0.083333, 0.666667, 0.250000, 0.000000, 0.083333, 0.750000, 0.166667, 0.000000, 0.083333, 0.833333, 0.083333, 0.000000, 0.083333, 0.916667, 0.000000, 0.000000, 0.166667, 0.000000, 0.833333, 0.000000, 0.166667, 0.083333, 0.750000, 0.000000, 0.166667, 0.166667, 0.666667, 0.000000, 0.166667, 0.250000, 0.583333, 0.000000, 0.166667, 0.333333, 0.500000, 0.000000, 0.166667, 0.416667, 0.416667, 0.000000, 0.166667, 0.500000, 0.333333, 0.000000, 0.166667, 0.583333, 0.250000, 0.000000, 0.166667, 0.666667, 0.166667, 0.000000, 0.166667, 0.750000, 0.083333, 0.000000, 0.166667, 0.833333, 0.000000, 0.000000, 0.250000, 0.000000, 0.750000, 0.000000, 0.250000, 0.083333, 0.666667, 0.000000, 0.250000, 0.166667, 0.583333, 0.000000, 0.250000, 0.250000, 0.500000, 0.000000, 0.250000, 0.333333, 0.416667, 0.000000, 0.250000, 0.416667, 0.333333, 0.000000, 0.250000, 0.500000, 0.250000, 0.000000, 0.250000, 0.583333, 0.166667, 0.000000, 0.250000, 0.666667, 0.083333, 0.000000, 0.250000, 0.750000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.333333, 0.083333, 0.583333, 0.000000, 0.333333, 0.166667, 0.500000, 0.000000, 0.333333, 0.250000, 0.416667, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.333333, 0.416667, 0.250000, 0.000000, 0.333333, 0.500000, 0.166667, 0.000000, 0.333333, 0.583333, 0.083333, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.416667, 0.000000, 0.583333, 0.000000, 0.416667, 0.083333, 0.500000, 0.000000, 0.416667, 0.166667, 0.416667, 0.000000, 0.416667, 0.250000, 0.333333, 0.000000, 0.416667, 0.333333, 0.250000, 0.000000, 0.416667, 0.416667, 0.166667, 0.000000, 0.416667, 0.500000, 0.083333, 0.000000, 0.416667, 0.583333, 0.000000, 0.000000, 0.500000, 0.000000, 0.500000, 0.000000, 0.500000, 0.083333, 0.416667, 0.000000, 0.500000, 0.166667, 0.333333, 0.000000, 0.500000, 0.250000, 0.250000, 0.000000, 0.500000, 0.333333, 0.166667, 0.000000, 0.500000, 0.416667, 0.083333, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 0.583333, 0.000000, 0.416667, 0.000000, 0.583333, 0.083333, 0.333333, 0.000000, 0.583333, 0.166667, 0.250000, 0.000000, 0.583333, 0.250000, 0.166667, 0.000000, 0.583333, 0.333333, 0.083333, 0.000000, 0.583333, 0.416667, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.666667, 0.083333, 0.250000, 0.000000, 0.666667, 0.166667, 0.166667, 0.000000, 0.666667, 0.250000, 0.083333, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.750000, 0.000000, 0.250000, 0.000000, 0.750000, 0.083333, 0.166667, 0.000000, 0.750000, 0.166667, 0.083333, 0.000000, 0.750000, 0.250000, 0.000000, 0.000000, 0.833333, 0.000000, 0.166667, 0.000000, 0.833333, 0.083333, 0.083333, 0.000000, 0.833333, 0.166667, 0.000000, 0.000000, 0.916667, 0.000000, 0.083333, 0.000000, 0.916667, 0.083333, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.083333, 0.000000, 0.000000, 0.916667, 0.083333, 0.000000, 0.083333, 0.833333, 0.083333, 0.000000, 0.166667, 0.750000, 0.083333, 0.000000, 0.250000, 0.666667, 0.083333, 0.000000, 0.333333, 0.583333, 0.083333, 0.000000, 0.416667, 0.500000, 0.083333, 0.000000, 0.500000, 0.416667, 0.083333, 0.000000, 0.583333, 0.333333, 0.083333, 0.000000, 0.666667, 0.250000, 0.083333, 0.000000, 0.750000, 0.166667, 0.083333, 0.000000, 0.833333, 0.083333, 0.083333, 0.000000, 0.916667, 0.000000, 0.083333, 0.083333, 0.000000, 0.833333, 0.083333, 0.083333, 0.083333, 0.750000, 0.083333, 0.083333, 0.166667, 0.666667, 0.083333, 0.083333, 0.250000, 0.583333, 0.083333, 0.083333, 0.333333, 0.500000, 0.083333, 0.083333, 0.416667, 0.416667, 0.083333, 0.083333, 0.500000, 0.333333, 0.083333, 0.083333, 0.583333, 0.250000, 0.083333, 0.083333, 0.666667, 0.166667, 0.083333, 0.083333, 0.750000, 0.083333, 0.083333, 0.083333, 0.833333, 0.000000, 0.083333, 0.166667, 0.000000, 0.750000, 0.083333, 0.166667, 0.083333, 0.666667, 0.083333, 0.166667, 0.166667, 0.583333, 0.083333, 0.166667, 0.250000, 0.500000, 0.083333, 0.166667, 0.333333, 0.416667, 0.083333, 0.166667, 0.416667, 0.333333, 0.083333, 0.166667, 0.500000, 0.250000, 0.083333, 0.166667, 0.583333, 0.166667, 0.083333, 0.166667, 0.666667, 0.083333, 0.083333, 0.166667, 0.750000, 0.000000, 0.083333, 0.250000, 0.000000, 0.666667, 0.083333, 0.250000, 0.083333, 0.583333, 0.083333, 0.250000, 0.166667, 0.500000, 0.083333, 0.250000, 0.250000, 0.416667, 0.083333, 0.250000, 0.333333, 0.333333, 0.083333, 0.250000, 0.416667, 0.250000, 0.083333, 0.250000, 0.500000, 0.166667, 0.083333, 0.250000, 0.583333, 0.083333, 0.083333, 0.250000, 0.666667, 0.000000, 0.083333, 0.333333, 0.000000, 0.583333, 0.083333, 0.333333, 0.083333, 0.500000, 0.083333, 0.333333, 0.166667, 0.416667, 0.083333, 0.333333, 0.250000, 0.333333, 0.083333, 0.333333, 0.333333, 0.250000, 0.083333, 0.333333, 0.416667, 0.166667, 0.083333, 0.333333, 0.500000, 0.083333, 0.083333, 0.333333, 0.583333, 0.000000, 0.083333, 0.416667, 0.000000, 0.500000, 0.083333, 0.416667, 0.083333, 0.416667, 0.083333, 0.416667, 0.166667, 0.333333, 0.083333, 0.416667, 0.250000, 0.250000, 0.083333, 0.416667, 0.333333, 0.166667, 0.083333, 0.416667, 0.416667, 0.083333, 0.083333, 0.416667, 0.500000, 0.000000, 0.083333, 0.500000, 0.000000, 0.416667, 0.083333, 0.500000, 0.083333, 0.333333, 0.083333, 0.500000, 0.166667, 0.250000, 0.083333, 0.500000, 0.250000, 0.166667, 0.083333, 0.500000, 0.333333, 0.083333, 0.083333, 0.500000, 0.416667, 0.000000, 0.083333, 0.583333, 0.000000, 0.333333, 0.083333, 0.583333, 0.083333, 0.250000, 0.083333, 0.583333, 0.166667, 0.166667, 0.083333, 0.583333, 0.250000, 0.083333, 0.083333, 0.583333, 0.333333, 0.000000, 0.083333, 0.666667, 0.000000, 0.250000, 0.083333, 0.666667, 0.083333, 0.166667, 0.083333, 0.666667, 0.166667, 0.083333, 0.083333, 0.666667, 0.250000, 0.000000, 0.083333, 0.750000, 0.000000, 0.166667, 0.083333, 0.750000, 0.083333, 0.083333, 0.083333, 0.750000, 0.166667, 0.000000, 0.083333, 0.833333, 0.000000, 0.083333, 0.083333, 0.833333, 0.083333, 0.000000, 0.083333, 0.916667, 0.000000, 0.000000, 0.166667, 0.000000, 0.000000, 0.833333, 0.166667, 0.000000, 0.083333, 0.750000, 0.166667, 0.000000, 0.166667, 0.666667, 0.166667, 0.000000, 0.250000, 0.583333, 0.166667, 0.000000, 0.333333, 0.500000, 0.166667, 0.000000, 0.416667, 0.416667, 0.166667, 0.000000, 0.500000, 0.333333, 0.166667, 0.000000, 0.583333, 0.250000, 0.166667, 0.000000, 0.666667, 0.166667, 0.166667, 0.000000, 0.750000, 0.083333, 0.166667, 0.000000, 0.833333, 0.000000, 0.166667, 0.083333, 0.000000, 0.750000, 0.166667, 0.083333, 0.083333, 0.666667, 0.166667, 0.083333, 0.166667, 0.583333, 0.166667, 0.083333, 0.250000, 0.500000, 0.166667, 0.083333, 0.333333, 0.416667, 0.166667, 0.083333, 0.416667, 0.333333, 0.166667, 0.083333, 0.500000, 0.250000, 0.166667, 0.083333, 0.583333, 0.166667, 0.166667, 0.083333, 0.666667, 0.083333, 0.166667, 0.083333, 0.750000, 0.000000, 0.166667, 0.166667, 0.000000, 0.666667, 0.166667, 0.166667, 0.083333, 0.583333, 0.166667, 0.166667, 0.166667, 0.500000, 0.166667, 0.166667, 0.250000, 0.416667, 0.166667, 0.166667, 0.333333, 0.333333, 0.166667, 0.166667, 0.416667, 0.250000, 0.166667, 0.166667, 0.500000, 0.166667, 0.166667, 0.166667, 0.583333, 0.083333, 0.166667, 0.166667, 0.666667, 0.000000, 0.166667, 0.250000, 0.000000, 0.583333, 0.166667, 0.250000, 0.083333, 0.500000, 0.166667, 0.250000, 0.166667, 0.416667, 0.166667, 0.250000, 0.250000, 0.333333, 0.166667, 0.250000, 0.333333, 0.250000, 0.166667, 0.250000, 0.416667, 0.166667, 0.166667, 0.250000, 0.500000, 0.083333, 0.166667, 0.250000, 0.583333, 0.000000, 0.166667, 0.333333, 0.000000, 0.500000, 0.166667, 0.333333, 0.083333, 0.416667, 0.166667, 0.333333, 0.166667, 0.333333, 0.166667, 0.333333, 0.250000, 0.250000, 0.166667, 0.333333, 0.333333, 0.166667, 0.166667, 0.333333, 0.416667, 0.083333, 0.166667, 0.333333, 0.500000, 0.000000, 0.166667, 0.416667, 0.000000, 0.416667, 0.166667, 0.416667, 0.083333, 0.333333, 0.166667, 0.416667, 0.166667, 0.250000, 0.166667, 0.416667, 0.250000, 0.166667, 0.166667, 0.416667, 0.333333, 0.083333, 0.166667, 0.416667, 0.416667, 0.000000, 0.166667, 0.500000, 0.000000, 0.333333, 0.166667, 0.500000, 0.083333, 0.250000, 0.166667, 0.500000, 0.166667, 0.166667, 0.166667, 0.500000, 0.250000, 0.083333, 0.166667, 0.500000, 0.333333, 0.000000, 0.166667, 0.583333, 0.000000, 0.250000, 0.166667, 0.583333, 0.083333, 0.166667, 0.166667, 0.583333, 0.166667, 0.083333, 0.166667, 0.583333, 0.250000, 0.000000, 0.166667, 0.666667, 0.000000, 0.166667, 0.166667, 0.666667, 0.083333, 0.083333, 0.166667, 0.666667, 0.166667, 0.000000, 0.166667, 0.750000, 0.000000, 0.083333, 0.166667, 0.750000, 0.083333, 0.000000, 0.166667, 0.833333, 0.000000, 0.000000, 0.250000, 0.000000, 0.000000, 0.750000, 0.250000, 0.000000, 0.083333, 0.666667, 0.250000, 0.000000, 0.166667, 0.583333, 0.250000, 0.000000, 0.250000, 0.500000, 0.250000, 0.000000, 0.333333, 0.416667, 0.250000, 0.000000, 0.416667, 0.333333, 0.250000, 0.000000, 0.500000, 0.250000, 0.250000, 0.000000, 0.583333, 0.166667, 0.250000, 0.000000, 0.666667, 0.083333, 0.250000, 0.000000, 0.750000, 0.000000, 0.250000, 0.083333, 0.000000, 0.666667, 0.250000, 0.083333, 0.083333, 0.583333, 0.250000, 0.083333, 0.166667, 0.500000, 0.250000, 0.083333, 0.250000, 0.416667, 0.250000, 0.083333, 0.333333, 0.333333, 0.250000, 0.083333, 0.416667, 0.250000, 0.250000, 0.083333, 0.500000, 0.166667, 0.250000, 0.083333, 0.583333, 0.083333, 0.250000, 0.083333, 0.666667, 0.000000, 0.250000, 0.166667, 0.000000, 0.583333, 0.250000, 0.166667, 0.083333, 0.500000, 0.250000, 0.166667, 0.166667, 0.416667, 0.250000, 0.166667, 0.250000, 0.333333, 0.250000, 0.166667, 0.333333, 0.250000, 0.250000, 0.166667, 0.416667, 0.166667, 0.250000, 0.166667, 0.500000, 0.083333, 0.250000, 0.166667, 0.583333, 0.000000, 0.250000, 0.250000, 0.000000, 0.500000, 0.250000, 0.250000, 0.083333, 0.416667, 0.250000, 0.250000, 0.166667, 0.333333, 0.250000, 0.250000, 0.250000, 0.250000, 0.250000, 0.250000, 0.333333, 0.166667, 0.250000, 0.250000, 0.416667, 0.083333, 0.250000, 0.250000, 0.500000, 0.000000, 0.250000, 0.333333, 0.000000, 0.416667, 0.250000, 0.333333, 0.083333, 0.333333, 0.250000, 0.333333, 0.166667, 0.250000, 0.250000, 0.333333, 0.250000, 0.166667, 0.250000, 0.333333, 0.333333, 0.083333, 0.250000, 0.333333, 0.416667, 0.000000, 0.250000, 0.416667, 0.000000, 0.333333, 0.250000, 0.416667, 0.083333, 0.250000, 0.250000, 0.416667, 0.166667, 0.166667, 0.250000, 0.416667, 0.250000, 0.083333, 0.250000, 0.416667, 0.333333, 0.000000, 0.250000, 0.500000, 0.000000, 0.250000, 0.250000, 0.500000, 0.083333, 0.166667, 0.250000, 0.500000, 0.166667, 0.083333, 0.250000, 0.500000, 0.250000, 0.000000, 0.250000, 0.583333, 0.000000, 0.166667, 0.250000, 0.583333, 0.083333, 0.083333, 0.250000, 0.583333, 0.166667, 0.000000, 0.250000, 0.666667, 0.000000, 0.083333, 0.250000, 0.666667, 0.083333, 0.000000, 0.250000, 0.750000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.083333, 0.583333, 0.333333, 0.000000, 0.166667, 0.500000, 0.333333, 0.000000, 0.250000, 0.416667, 0.333333, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.416667, 0.250000, 0.333333, 0.000000, 0.500000, 0.166667, 0.333333, 0.000000, 0.583333, 0.083333, 0.333333, 0.000000, 0.666667, 0.000000, 0.333333, 0.083333, 0.000000, 0.583333, 0.333333, 0.083333, 0.083333, 0.500000, 0.333333, 0.083333, 0.166667, 0.416667, 0.333333, 0.083333, 0.250000, 0.333333, 0.333333, 0.083333, 0.333333, 0.250000, 0.333333, 0.083333, 0.416667, 0.166667, 0.333333, 0.083333, 0.500000, 0.083333, 0.333333, 0.083333, 0.583333, 0.000000, 0.333333, 0.166667, 0.000000, 0.500000, 0.333333, 0.166667, 0.083333, 0.416667, 0.333333, 0.166667, 0.166667, 0.333333, 0.333333, 0.166667, 0.250000, 0.250000, 0.333333, 0.166667, 0.333333, 0.166667, 0.333333, 0.166667, 0.416667, 0.083333, 0.333333, 0.166667, 0.500000, 0.000000, 0.333333, 0.250000, 0.000000, 0.416667, 0.333333, 0.250000, 0.083333, 0.333333, 0.333333, 0.250000, 0.166667, 0.250000, 0.333333, 0.250000, 0.250000, 0.166667, 0.333333, 0.250000, 0.333333, 0.083333, 0.333333, 0.250000, 0.416667, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.333333, 0.333333, 0.083333, 0.250000, 0.333333, 0.333333, 0.166667, 0.166667, 0.333333, 0.333333, 0.250000, 0.083333, 0.333333, 0.333333, 0.333333, 0.000000, 0.333333, 0.416667, 0.000000, 0.250000, 0.333333, 0.416667, 0.083333, 0.166667, 0.333333, 0.416667, 0.166667, 0.083333, 0.333333, 0.416667, 0.250000, 0.000000, 0.333333, 0.500000, 0.000000, 0.166667, 0.333333, 0.500000, 0.083333, 0.083333, 0.333333, 0.500000, 0.166667, 0.000000, 0.333333, 0.583333, 0.000000, 0.083333, 0.333333, 0.583333, 0.083333, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.416667, 0.000000, 0.000000, 0.583333, 0.416667, 0.000000, 0.083333, 0.500000, 0.416667, 0.000000, 0.166667, 0.416667, 0.416667, 0.000000, 0.250000, 0.333333, 0.416667, 0.000000, 0.333333, 0.250000, 0.416667, 0.000000, 0.416667, 0.166667, 0.416667, 0.000000, 0.500000, 0.083333, 0.416667, 0.000000, 0.583333, 0.000000, 0.416667, 0.083333, 0.000000, 0.500000, 0.416667, 0.083333, 0.083333, 0.416667, 0.416667, 0.083333, 0.166667, 0.333333, 0.416667, 0.083333, 0.250000, 0.250000, 0.416667, 0.083333, 0.333333, 0.166667, 0.416667, 0.083333, 0.416667, 0.083333, 0.416667, 0.083333, 0.500000, 0.000000, 0.416667, 0.166667, 0.000000, 0.416667, 0.416667, 0.166667, 0.083333, 0.333333, 0.416667, 0.166667, 0.166667, 0.250000, 0.416667, 0.166667, 0.250000, 0.166667, 0.416667, 0.166667, 0.333333, 0.083333, 0.416667, 0.166667, 0.416667, 0.000000, 0.416667, 0.250000, 0.000000, 0.333333, 0.416667, 0.250000, 0.083333, 0.250000, 0.416667, 0.250000, 0.166667, 0.166667, 0.416667, 0.250000, 0.250000, 0.083333, 0.416667, 0.250000, 0.333333, 0.000000, 0.416667, 0.333333, 0.000000, 0.250000, 0.416667, 0.333333, 0.083333, 0.166667, 0.416667, 0.333333, 0.166667, 0.083333, 0.416667, 0.333333, 0.250000, 0.000000, 0.416667, 0.416667, 0.000000, 0.166667, 0.416667, 0.416667, 0.083333, 0.083333, 0.416667, 0.416667, 0.166667, 0.000000, 0.416667, 0.500000, 0.000000, 0.083333, 0.416667, 0.500000, 0.083333, 0.000000, 0.416667, 0.583333, 0.000000, 0.000000, 0.500000, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.083333, 0.416667, 0.500000, 0.000000, 0.166667, 0.333333, 0.500000, 0.000000, 0.250000, 0.250000, 0.500000, 0.000000, 0.333333, 0.166667, 0.500000, 0.000000, 0.416667, 0.083333, 0.500000, 0.000000, 0.500000, 0.000000, 0.500000, 0.083333, 0.000000, 0.416667, 0.500000, 0.083333, 0.083333, 0.333333, 0.500000, 0.083333, 0.166667, 0.250000, 0.500000, 0.083333, 0.250000, 0.166667, 0.500000, 0.083333, 0.333333, 0.083333, 0.500000, 0.083333, 0.416667, 0.000000, 0.500000, 0.166667, 0.000000, 0.333333, 0.500000, 0.166667, 0.083333, 0.250000, 0.500000, 0.166667, 0.166667, 0.166667, 0.500000, 0.166667, 0.250000, 0.083333, 0.500000, 0.166667, 0.333333, 0.000000, 0.500000, 0.250000, 0.000000, 0.250000, 0.500000, 0.250000, 0.083333, 0.166667, 0.500000, 0.250000, 0.166667, 0.083333, 0.500000, 0.250000, 0.250000, 0.000000, 0.500000, 0.333333, 0.000000, 0.166667, 0.500000, 0.333333, 0.083333, 0.083333, 0.500000, 0.333333, 0.166667, 0.000000, 0.500000, 0.416667, 0.000000, 0.083333, 0.500000, 0.416667, 0.083333, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 0.583333, 0.000000, 0.000000, 0.416667, 0.583333, 0.000000, 0.083333, 0.333333, 0.583333, 0.000000, 0.166667, 0.250000, 0.583333, 0.000000, 0.250000, 0.166667, 0.583333, 0.000000, 0.333333, 0.083333, 0.583333, 0.000000, 0.416667, 0.000000, 0.583333, 0.083333, 0.000000, 0.333333, 0.583333, 0.083333, 0.083333, 0.250000, 0.583333, 0.083333, 0.166667, 0.166667, 0.583333, 0.083333, 0.250000, 0.083333, 0.583333, 0.083333, 0.333333, 0.000000, 0.583333, 0.166667, 0.000000, 0.250000, 0.583333, 0.166667, 0.083333, 0.166667, 0.583333, 0.166667, 0.166667, 0.083333, 0.583333, 0.166667, 0.250000, 0.000000, 0.583333, 0.250000, 0.000000, 0.166667, 0.583333, 0.250000, 0.083333, 0.083333, 0.583333, 0.250000, 0.166667, 0.000000, 0.583333, 0.333333, 0.000000, 0.083333, 0.583333, 0.333333, 0.083333, 0.000000, 0.583333, 0.416667, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.083333, 0.250000, 0.666667, 0.000000, 0.166667, 0.166667, 0.666667, 0.000000, 0.250000, 0.083333, 0.666667, 0.000000, 0.333333, 0.000000, 0.666667, 0.083333, 0.000000, 0.250000, 0.666667, 0.083333, 0.083333, 0.166667, 0.666667, 0.083333, 0.166667, 0.083333, 0.666667, 0.083333, 0.250000, 0.000000, 0.666667, 0.166667, 0.000000, 0.166667, 0.666667, 0.166667, 0.083333, 0.083333, 0.666667, 0.166667, 0.166667, 0.000000, 0.666667, 0.250000, 0.000000, 0.083333, 0.666667, 0.250000, 0.083333, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.750000, 0.000000, 0.000000, 0.250000, 0.750000, 0.000000, 0.083333, 0.166667, 0.750000, 0.000000, 0.166667, 0.083333, 0.750000, 0.000000, 0.250000, 0.000000, 0.750000, 0.083333, 0.000000, 0.166667, 0.750000, 0.083333, 0.083333, 0.083333, 0.750000, 0.083333, 0.166667, 0.000000, 0.750000, 0.166667, 0.000000, 0.083333, 0.750000, 0.166667, 0.083333, 0.000000, 0.750000, 0.250000, 0.000000, 0.000000, 0.833333, 0.000000, 0.000000, 0.166667, 0.833333, 0.000000, 0.083333, 0.083333, 0.833333, 0.000000, 0.166667, 0.000000, 0.833333, 0.083333, 0.000000, 0.083333, 0.833333, 0.083333, 0.083333, 0.000000, 0.833333, 0.166667, 0.000000, 0.000000, 0.916667, 0.000000, 0.000000, 0.083333, 0.916667, 0.000000, 0.083333, 0.000000, 0.916667, 0.083333, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, }; unsigned int number_of_weights_8_5 = 494; double weights_8_5[] = { 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.125000, 0.875000, 0.000000, 0.000000, 0.000000, 0.250000, 0.750000, 0.000000, 0.000000, 0.000000, 0.375000, 0.625000, 0.000000, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 0.000000, 0.625000, 0.375000, 0.000000, 0.000000, 0.000000, 0.750000, 0.250000, 0.000000, 0.000000, 0.000000, 0.875000, 0.125000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.125000, 0.000000, 0.875000, 0.000000, 0.000000, 0.125000, 0.125000, 0.750000, 0.000000, 0.000000, 0.125000, 0.250000, 0.625000, 0.000000, 0.000000, 0.125000, 0.375000, 0.500000, 0.000000, 0.000000, 0.125000, 0.500000, 0.375000, 0.000000, 0.000000, 0.125000, 0.625000, 0.250000, 0.000000, 0.000000, 0.125000, 0.750000, 0.125000, 0.000000, 0.000000, 0.125000, 0.875000, 0.000000, 0.000000, 0.000000, 0.250000, 0.000000, 0.750000, 0.000000, 0.000000, 0.250000, 0.125000, 0.625000, 0.000000, 0.000000, 0.250000, 0.250000, 0.500000, 0.000000, 0.000000, 0.250000, 0.375000, 0.375000, 0.000000, 0.000000, 0.250000, 0.500000, 0.250000, 0.000000, 0.000000, 0.250000, 0.625000, 0.125000, 0.000000, 0.000000, 0.250000, 0.750000, 0.000000, 0.000000, 0.000000, 0.375000, 0.000000, 0.625000, 0.000000, 0.000000, 0.375000, 0.125000, 0.500000, 0.000000, 0.000000, 0.375000, 0.250000, 0.375000, 0.000000, 0.000000, 0.375000, 0.375000, 0.250000, 0.000000, 0.000000, 0.375000, 0.500000, 0.125000, 0.000000, 0.000000, 0.375000, 0.625000, 0.000000, 0.000000, 0.000000, 0.500000, 0.000000, 0.500000, 0.000000, 0.000000, 0.500000, 0.125000, 0.375000, 0.000000, 0.000000, 0.500000, 0.250000, 0.250000, 0.000000, 0.000000, 0.500000, 0.375000, 0.125000, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 0.000000, 0.625000, 0.000000, 0.375000, 0.000000, 0.000000, 0.625000, 0.125000, 0.250000, 0.000000, 0.000000, 0.625000, 0.250000, 0.125000, 0.000000, 0.000000, 0.625000, 0.375000, 0.000000, 0.000000, 0.000000, 0.750000, 0.000000, 0.250000, 0.000000, 0.000000, 0.750000, 0.125000, 0.125000, 0.000000, 0.000000, 0.750000, 0.250000, 0.000000, 0.000000, 0.000000, 0.875000, 0.000000, 0.125000, 0.000000, 0.000000, 0.875000, 0.125000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.125000, 0.000000, 0.000000, 0.875000, 0.000000, 0.125000, 0.000000, 0.125000, 0.750000, 0.000000, 0.125000, 0.000000, 0.250000, 0.625000, 0.000000, 0.125000, 0.000000, 0.375000, 0.500000, 0.000000, 0.125000, 0.000000, 0.500000, 0.375000, 0.000000, 0.125000, 0.000000, 0.625000, 0.250000, 0.000000, 0.125000, 0.000000, 0.750000, 0.125000, 0.000000, 0.125000, 0.000000, 0.875000, 0.000000, 0.000000, 0.125000, 0.125000, 0.000000, 0.750000, 0.000000, 0.125000, 0.125000, 0.125000, 0.625000, 0.000000, 0.125000, 0.125000, 0.250000, 0.500000, 0.000000, 0.125000, 0.125000, 0.375000, 0.375000, 0.000000, 0.125000, 0.125000, 0.500000, 0.250000, 0.000000, 0.125000, 0.125000, 0.625000, 0.125000, 0.000000, 0.125000, 0.125000, 0.750000, 0.000000, 0.000000, 0.125000, 0.250000, 0.000000, 0.625000, 0.000000, 0.125000, 0.250000, 0.125000, 0.500000, 0.000000, 0.125000, 0.250000, 0.250000, 0.375000, 0.000000, 0.125000, 0.250000, 0.375000, 0.250000, 0.000000, 0.125000, 0.250000, 0.500000, 0.125000, 0.000000, 0.125000, 0.250000, 0.625000, 0.000000, 0.000000, 0.125000, 0.375000, 0.000000, 0.500000, 0.000000, 0.125000, 0.375000, 0.125000, 0.375000, 0.000000, 0.125000, 0.375000, 0.250000, 0.250000, 0.000000, 0.125000, 0.375000, 0.375000, 0.125000, 0.000000, 0.125000, 0.375000, 0.500000, 0.000000, 0.000000, 0.125000, 0.500000, 0.000000, 0.375000, 0.000000, 0.125000, 0.500000, 0.125000, 0.250000, 0.000000, 0.125000, 0.500000, 0.250000, 0.125000, 0.000000, 0.125000, 0.500000, 0.375000, 0.000000, 0.000000, 0.125000, 0.625000, 0.000000, 0.250000, 0.000000, 0.125000, 0.625000, 0.125000, 0.125000, 0.000000, 0.125000, 0.625000, 0.250000, 0.000000, 0.000000, 0.125000, 0.750000, 0.000000, 0.125000, 0.000000, 0.125000, 0.750000, 0.125000, 0.000000, 0.000000, 0.125000, 0.875000, 0.000000, 0.000000, 0.000000, 0.250000, 0.000000, 0.000000, 0.750000, 0.000000, 0.250000, 0.000000, 0.125000, 0.625000, 0.000000, 0.250000, 0.000000, 0.250000, 0.500000, 0.000000, 0.250000, 0.000000, 0.375000, 0.375000, 0.000000, 0.250000, 0.000000, 0.500000, 0.250000, 0.000000, 0.250000, 0.000000, 0.625000, 0.125000, 0.000000, 0.250000, 0.000000, 0.750000, 0.000000, 0.000000, 0.250000, 0.125000, 0.000000, 0.625000, 0.000000, 0.250000, 0.125000, 0.125000, 0.500000, 0.000000, 0.250000, 0.125000, 0.250000, 0.375000, 0.000000, 0.250000, 0.125000, 0.375000, 0.250000, 0.000000, 0.250000, 0.125000, 0.500000, 0.125000, 0.000000, 0.250000, 0.125000, 0.625000, 0.000000, 0.000000, 0.250000, 0.250000, 0.000000, 0.500000, 0.000000, 0.250000, 0.250000, 0.125000, 0.375000, 0.000000, 0.250000, 0.250000, 0.250000, 0.250000, 0.000000, 0.250000, 0.250000, 0.375000, 0.125000, 0.000000, 0.250000, 0.250000, 0.500000, 0.000000, 0.000000, 0.250000, 0.375000, 0.000000, 0.375000, 0.000000, 0.250000, 0.375000, 0.125000, 0.250000, 0.000000, 0.250000, 0.375000, 0.250000, 0.125000, 0.000000, 0.250000, 0.375000, 0.375000, 0.000000, 0.000000, 0.250000, 0.500000, 0.000000, 0.250000, 0.000000, 0.250000, 0.500000, 0.125000, 0.125000, 0.000000, 0.250000, 0.500000, 0.250000, 0.000000, 0.000000, 0.250000, 0.625000, 0.000000, 0.125000, 0.000000, 0.250000, 0.625000, 0.125000, 0.000000, 0.000000, 0.250000, 0.750000, 0.000000, 0.000000, 0.000000, 0.375000, 0.000000, 0.000000, 0.625000, 0.000000, 0.375000, 0.000000, 0.125000, 0.500000, 0.000000, 0.375000, 0.000000, 0.250000, 0.375000, 0.000000, 0.375000, 0.000000, 0.375000, 0.250000, 0.000000, 0.375000, 0.000000, 0.500000, 0.125000, 0.000000, 0.375000, 0.000000, 0.625000, 0.000000, 0.000000, 0.375000, 0.125000, 0.000000, 0.500000, 0.000000, 0.375000, 0.125000, 0.125000, 0.375000, 0.000000, 0.375000, 0.125000, 0.250000, 0.250000, 0.000000, 0.375000, 0.125000, 0.375000, 0.125000, 0.000000, 0.375000, 0.125000, 0.500000, 0.000000, 0.000000, 0.375000, 0.250000, 0.000000, 0.375000, 0.000000, 0.375000, 0.250000, 0.125000, 0.250000, 0.000000, 0.375000, 0.250000, 0.250000, 0.125000, 0.000000, 0.375000, 0.250000, 0.375000, 0.000000, 0.000000, 0.375000, 0.375000, 0.000000, 0.250000, 0.000000, 0.375000, 0.375000, 0.125000, 0.125000, 0.000000, 0.375000, 0.375000, 0.250000, 0.000000, 0.000000, 0.375000, 0.500000, 0.000000, 0.125000, 0.000000, 0.375000, 0.500000, 0.125000, 0.000000, 0.000000, 0.375000, 0.625000, 0.000000, 0.000000, 0.000000, 0.500000, 0.000000, 0.000000, 0.500000, 0.000000, 0.500000, 0.000000, 0.125000, 0.375000, 0.000000, 0.500000, 0.000000, 0.250000, 0.250000, 0.000000, 0.500000, 0.000000, 0.375000, 0.125000, 0.000000, 0.500000, 0.000000, 0.500000, 0.000000, 0.000000, 0.500000, 0.125000, 0.000000, 0.375000, 0.000000, 0.500000, 0.125000, 0.125000, 0.250000, 0.000000, 0.500000, 0.125000, 0.250000, 0.125000, 0.000000, 0.500000, 0.125000, 0.375000, 0.000000, 0.000000, 0.500000, 0.250000, 0.000000, 0.250000, 0.000000, 0.500000, 0.250000, 0.125000, 0.125000, 0.000000, 0.500000, 0.250000, 0.250000, 0.000000, 0.000000, 0.500000, 0.375000, 0.000000, 0.125000, 0.000000, 0.500000, 0.375000, 0.125000, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 0.000000, 0.625000, 0.000000, 0.000000, 0.375000, 0.000000, 0.625000, 0.000000, 0.125000, 0.250000, 0.000000, 0.625000, 0.000000, 0.250000, 0.125000, 0.000000, 0.625000, 0.000000, 0.375000, 0.000000, 0.000000, 0.625000, 0.125000, 0.000000, 0.250000, 0.000000, 0.625000, 0.125000, 0.125000, 0.125000, 0.000000, 0.625000, 0.125000, 0.250000, 0.000000, 0.000000, 0.625000, 0.250000, 0.000000, 0.125000, 0.000000, 0.625000, 0.250000, 0.125000, 0.000000, 0.000000, 0.625000, 0.375000, 0.000000, 0.000000, 0.000000, 0.750000, 0.000000, 0.000000, 0.250000, 0.000000, 0.750000, 0.000000, 0.125000, 0.125000, 0.000000, 0.750000, 0.000000, 0.250000, 0.000000, 0.000000, 0.750000, 0.125000, 0.000000, 0.125000, 0.000000, 0.750000, 0.125000, 0.125000, 0.000000, 0.000000, 0.750000, 0.250000, 0.000000, 0.000000, 0.000000, 0.875000, 0.000000, 0.000000, 0.125000, 0.000000, 0.875000, 0.000000, 0.125000, 0.000000, 0.000000, 0.875000, 0.125000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.125000, 0.000000, 0.000000, 0.000000, 0.875000, 0.125000, 0.000000, 0.000000, 0.125000, 0.750000, 0.125000, 0.000000, 0.000000, 0.250000, 0.625000, 0.125000, 0.000000, 0.000000, 0.375000, 0.500000, 0.125000, 0.000000, 0.000000, 0.500000, 0.375000, 0.125000, 0.000000, 0.000000, 0.625000, 0.250000, 0.125000, 0.000000, 0.000000, 0.750000, 0.125000, 0.125000, 0.000000, 0.000000, 0.875000, 0.000000, 0.125000, 0.000000, 0.125000, 0.000000, 0.750000, 0.125000, 0.000000, 0.125000, 0.125000, 0.625000, 0.125000, 0.000000, 0.125000, 0.250000, 0.500000, 0.125000, 0.000000, 0.125000, 0.375000, 0.375000, 0.125000, 0.000000, 0.125000, 0.500000, 0.250000, 0.125000, 0.000000, 0.125000, 0.625000, 0.125000, 0.125000, 0.000000, 0.125000, 0.750000, 0.000000, 0.125000, 0.000000, 0.250000, 0.000000, 0.625000, 0.125000, 0.000000, 0.250000, 0.125000, 0.500000, 0.125000, 0.000000, 0.250000, 0.250000, 0.375000, 0.125000, 0.000000, 0.250000, 0.375000, 0.250000, 0.125000, 0.000000, 0.250000, 0.500000, 0.125000, 0.125000, 0.000000, 0.250000, 0.625000, 0.000000, 0.125000, 0.000000, 0.375000, 0.000000, 0.500000, 0.125000, 0.000000, 0.375000, 0.125000, 0.375000, 0.125000, 0.000000, 0.375000, 0.250000, 0.250000, 0.125000, 0.000000, 0.375000, 0.375000, 0.125000, 0.125000, 0.000000, 0.375000, 0.500000, 0.000000, 0.125000, 0.000000, 0.500000, 0.000000, 0.375000, 0.125000, 0.000000, 0.500000, 0.125000, 0.250000, 0.125000, 0.000000, 0.500000, 0.250000, 0.125000, 0.125000, 0.000000, 0.500000, 0.375000, 0.000000, 0.125000, 0.000000, 0.625000, 0.000000, 0.250000, 0.125000, 0.000000, 0.625000, 0.125000, 0.125000, 0.125000, 0.000000, 0.625000, 0.250000, 0.000000, 0.125000, 0.000000, 0.750000, 0.000000, 0.125000, 0.125000, 0.000000, 0.750000, 0.125000, 0.000000, 0.125000, 0.000000, 0.875000, 0.000000, 0.000000, 0.125000, 0.125000, 0.000000, 0.000000, 0.750000, 0.125000, 0.125000, 0.000000, 0.125000, 0.625000, 0.125000, 0.125000, 0.000000, 0.250000, 0.500000, 0.125000, 0.125000, 0.000000, 0.375000, 0.375000, 0.125000, 0.125000, 0.000000, 0.500000, 0.250000, 0.125000, 0.125000, 0.000000, 0.625000, 0.125000, 0.125000, 0.125000, 0.000000, 0.750000, 0.000000, 0.125000, 0.125000, 0.125000, 0.000000, 0.625000, 0.125000, 0.125000, 0.125000, 0.125000, 0.500000, 0.125000, 0.125000, 0.125000, 0.250000, 0.375000, 0.125000, 0.125000, 0.125000, 0.375000, 0.250000, 0.125000, 0.125000, 0.125000, 0.500000, 0.125000, 0.125000, 0.125000, 0.125000, 0.625000, 0.000000, 0.125000, 0.125000, 0.250000, 0.000000, 0.500000, 0.125000, 0.125000, 0.250000, 0.125000, 0.375000, 0.125000, 0.125000, 0.250000, 0.250000, 0.250000, 0.125000, 0.125000, 0.250000, 0.375000, 0.125000, 0.125000, 0.125000, 0.250000, 0.500000, 0.000000, 0.125000, 0.125000, 0.375000, 0.000000, 0.375000, 0.125000, 0.125000, 0.375000, 0.125000, 0.250000, 0.125000, 0.125000, 0.375000, 0.250000, 0.125000, 0.125000, 0.125000, 0.375000, 0.375000, 0.000000, 0.125000, 0.125000, 0.500000, 0.000000, 0.250000, 0.125000, 0.125000, 0.500000, 0.125000, 0.125000, 0.125000, 0.125000, 0.500000, 0.250000, 0.000000, 0.125000, 0.125000, 0.625000, 0.000000, 0.125000, 0.125000, 0.125000, 0.625000, 0.125000, 0.000000, 0.125000, 0.125000, 0.750000, 0.000000, 0.000000, 0.125000, 0.250000, 0.000000, 0.000000, 0.625000, 0.125000, 0.250000, 0.000000, 0.125000, 0.500000, 0.125000, 0.250000, 0.000000, 0.250000, 0.375000, 0.125000, 0.250000, 0.000000, 0.375000, 0.250000, 0.125000, 0.250000, 0.000000, 0.500000, 0.125000, 0.125000, 0.250000, 0.000000, 0.625000, 0.000000, 0.125000, 0.250000, 0.125000, 0.000000, 0.500000, 0.125000, 0.250000, 0.125000, 0.125000, 0.375000, 0.125000, 0.250000, 0.125000, 0.250000, 0.250000, 0.125000, 0.250000, 0.125000, 0.375000, 0.125000, 0.125000, 0.250000, 0.125000, 0.500000, 0.000000, 0.125000, 0.250000, 0.250000, 0.000000, 0.375000, 0.125000, 0.250000, 0.250000, 0.125000, 0.250000, 0.125000, 0.250000, 0.250000, 0.250000, 0.125000, 0.125000, 0.250000, 0.250000, 0.375000, 0.000000, 0.125000, 0.250000, 0.375000, 0.000000, 0.250000, 0.125000, 0.250000, 0.375000, 0.125000, 0.125000, 0.125000, 0.250000, 0.375000, 0.250000, 0.000000, 0.125000, 0.250000, 0.500000, 0.000000, 0.125000, 0.125000, 0.250000, 0.500000, 0.125000, 0.000000, 0.125000, 0.250000, 0.625000, 0.000000, 0.000000, 0.125000, 0.375000, 0.000000, 0.000000, 0.500000, 0.125000, 0.375000, 0.000000, 0.125000, 0.375000, 0.125000, 0.375000, 0.000000, 0.250000, 0.250000, 0.125000, 0.375000, 0.000000, 0.375000, 0.125000, 0.125000, 0.375000, 0.000000, 0.500000, 0.000000, 0.125000, 0.375000, 0.125000, 0.000000, 0.375000, 0.125000, 0.375000, 0.125000, 0.125000, 0.250000, 0.125000, 0.375000, 0.125000, 0.250000, 0.125000, 0.125000, 0.375000, 0.125000, 0.375000, 0.000000, 0.125000, 0.375000, 0.250000, 0.000000, 0.250000, 0.125000, 0.375000, 0.250000, 0.125000, 0.125000, 0.125000, 0.375000, 0.250000, 0.250000, 0.000000, 0.125000, 0.375000, 0.375000, 0.000000, 0.125000, 0.125000, 0.375000, 0.375000, 0.125000, 0.000000, 0.125000, 0.375000, 0.500000, 0.000000, 0.000000, 0.125000, 0.500000, 0.000000, 0.000000, 0.375000, 0.125000, 0.500000, 0.000000, 0.125000, 0.250000, 0.125000, 0.500000, 0.000000, 0.250000, 0.125000, 0.125000, 0.500000, 0.000000, 0.375000, 0.000000, 0.125000, 0.500000, 0.125000, 0.000000, 0.250000, 0.125000, 0.500000, 0.125000, 0.125000, 0.125000, 0.125000, 0.500000, 0.125000, 0.250000, 0.000000, 0.125000, 0.500000, 0.250000, 0.000000, 0.125000, 0.125000, 0.500000, 0.250000, 0.125000, 0.000000, 0.125000, 0.500000, 0.375000, 0.000000, 0.000000, 0.125000, 0.625000, 0.000000, 0.000000, 0.250000, 0.125000, 0.625000, 0.000000, 0.125000, 0.125000, 0.125000, 0.625000, 0.000000, 0.250000, 0.000000, 0.125000, 0.625000, 0.125000, 0.000000, 0.125000, 0.125000, 0.625000, 0.125000, 0.125000, 0.000000, 0.125000, 0.625000, 0.250000, 0.000000, 0.000000, 0.125000, 0.750000, 0.000000, 0.000000, 0.125000, 0.125000, 0.750000, 0.000000, 0.125000, 0.000000, 0.125000, 0.750000, 0.125000, 0.000000, 0.000000, 0.125000, 0.875000, 0.000000, 0.000000, 0.000000, 0.250000, 0.000000, 0.000000, 0.000000, 0.750000, 0.250000, 0.000000, 0.000000, 0.125000, 0.625000, 0.250000, 0.000000, 0.000000, 0.250000, 0.500000, 0.250000, 0.000000, 0.000000, 0.375000, 0.375000, 0.250000, 0.000000, 0.000000, 0.500000, 0.250000, 0.250000, 0.000000, 0.000000, 0.625000, 0.125000, 0.250000, 0.000000, 0.000000, 0.750000, 0.000000, 0.250000, 0.000000, 0.125000, 0.000000, 0.625000, 0.250000, 0.000000, 0.125000, 0.125000, 0.500000, 0.250000, 0.000000, 0.125000, 0.250000, 0.375000, 0.250000, 0.000000, 0.125000, 0.375000, 0.250000, 0.250000, 0.000000, 0.125000, 0.500000, 0.125000, 0.250000, 0.000000, 0.125000, 0.625000, 0.000000, 0.250000, 0.000000, 0.250000, 0.000000, 0.500000, 0.250000, 0.000000, 0.250000, 0.125000, 0.375000, 0.250000, 0.000000, 0.250000, 0.250000, 0.250000, 0.250000, 0.000000, 0.250000, 0.375000, 0.125000, 0.250000, 0.000000, 0.250000, 0.500000, 0.000000, 0.250000, 0.000000, 0.375000, 0.000000, 0.375000, 0.250000, 0.000000, 0.375000, 0.125000, 0.250000, 0.250000, 0.000000, 0.375000, 0.250000, 0.125000, 0.250000, 0.000000, 0.375000, 0.375000, 0.000000, 0.250000, 0.000000, 0.500000, 0.000000, 0.250000, 0.250000, 0.000000, 0.500000, 0.125000, 0.125000, 0.250000, 0.000000, 0.500000, 0.250000, 0.000000, 0.250000, 0.000000, 0.625000, 0.000000, 0.125000, 0.250000, 0.000000, 0.625000, 0.125000, 0.000000, 0.250000, 0.000000, 0.750000, 0.000000, 0.000000, 0.250000, 0.125000, 0.000000, 0.000000, 0.625000, 0.250000, 0.125000, 0.000000, 0.125000, 0.500000, 0.250000, 0.125000, 0.000000, 0.250000, 0.375000, 0.250000, 0.125000, 0.000000, 0.375000, 0.250000, 0.250000, 0.125000, 0.000000, 0.500000, 0.125000, 0.250000, 0.125000, 0.000000, 0.625000, 0.000000, 0.250000, 0.125000, 0.125000, 0.000000, 0.500000, 0.250000, 0.125000, 0.125000, 0.125000, 0.375000, 0.250000, 0.125000, 0.125000, 0.250000, 0.250000, 0.250000, 0.125000, 0.125000, 0.375000, 0.125000, 0.250000, 0.125000, 0.125000, 0.500000, 0.000000, 0.250000, 0.125000, 0.250000, 0.000000, 0.375000, 0.250000, 0.125000, 0.250000, 0.125000, 0.250000, 0.250000, 0.125000, 0.250000, 0.250000, 0.125000, 0.250000, 0.125000, 0.250000, 0.375000, 0.000000, 0.250000, 0.125000, 0.375000, 0.000000, 0.250000, 0.250000, 0.125000, 0.375000, 0.125000, 0.125000, 0.250000, 0.125000, 0.375000, 0.250000, 0.000000, 0.250000, 0.125000, 0.500000, 0.000000, 0.125000, 0.250000, 0.125000, 0.500000, 0.125000, 0.000000, 0.250000, 0.125000, 0.625000, 0.000000, 0.000000, 0.250000, 0.250000, 0.000000, 0.000000, 0.500000, 0.250000, 0.250000, 0.000000, 0.125000, 0.375000, 0.250000, 0.250000, 0.000000, 0.250000, 0.250000, 0.250000, 0.250000, 0.000000, 0.375000, 0.125000, 0.250000, 0.250000, 0.000000, 0.500000, 0.000000, 0.250000, 0.250000, 0.125000, 0.000000, 0.375000, 0.250000, 0.250000, 0.125000, 0.125000, 0.250000, 0.250000, 0.250000, 0.125000, 0.250000, 0.125000, 0.250000, 0.250000, 0.125000, 0.375000, 0.000000, 0.250000, 0.250000, 0.250000, 0.000000, 0.250000, 0.250000, 0.250000, 0.250000, 0.125000, 0.125000, 0.250000, 0.250000, 0.250000, 0.250000, 0.000000, 0.250000, 0.250000, 0.375000, 0.000000, 0.125000, 0.250000, 0.250000, 0.375000, 0.125000, 0.000000, 0.250000, 0.250000, 0.500000, 0.000000, 0.000000, 0.250000, 0.375000, 0.000000, 0.000000, 0.375000, 0.250000, 0.375000, 0.000000, 0.125000, 0.250000, 0.250000, 0.375000, 0.000000, 0.250000, 0.125000, 0.250000, 0.375000, 0.000000, 0.375000, 0.000000, 0.250000, 0.375000, 0.125000, 0.000000, 0.250000, 0.250000, 0.375000, 0.125000, 0.125000, 0.125000, 0.250000, 0.375000, 0.125000, 0.250000, 0.000000, 0.250000, 0.375000, 0.250000, 0.000000, 0.125000, 0.250000, 0.375000, 0.250000, 0.125000, 0.000000, 0.250000, 0.375000, 0.375000, 0.000000, 0.000000, 0.250000, 0.500000, 0.000000, 0.000000, 0.250000, 0.250000, 0.500000, 0.000000, 0.125000, 0.125000, 0.250000, 0.500000, 0.000000, 0.250000, 0.000000, 0.250000, 0.500000, 0.125000, 0.000000, 0.125000, 0.250000, 0.500000, 0.125000, 0.125000, 0.000000, 0.250000, 0.500000, 0.250000, 0.000000, 0.000000, 0.250000, 0.625000, 0.000000, 0.000000, 0.125000, 0.250000, 0.625000, 0.000000, 0.125000, 0.000000, 0.250000, 0.625000, 0.125000, 0.000000, 0.000000, 0.250000, 0.750000, 0.000000, 0.000000, 0.000000, 0.375000, 0.000000, 0.000000, 0.000000, 0.625000, 0.375000, 0.000000, 0.000000, 0.125000, 0.500000, 0.375000, 0.000000, 0.000000, 0.250000, 0.375000, 0.375000, 0.000000, 0.000000, 0.375000, 0.250000, 0.375000, 0.000000, 0.000000, 0.500000, 0.125000, 0.375000, 0.000000, 0.000000, 0.625000, 0.000000, 0.375000, 0.000000, 0.125000, 0.000000, 0.500000, 0.375000, 0.000000, 0.125000, 0.125000, 0.375000, 0.375000, 0.000000, 0.125000, 0.250000, 0.250000, 0.375000, 0.000000, 0.125000, 0.375000, 0.125000, 0.375000, 0.000000, 0.125000, 0.500000, 0.000000, 0.375000, 0.000000, 0.250000, 0.000000, 0.375000, 0.375000, 0.000000, 0.250000, 0.125000, 0.250000, 0.375000, 0.000000, 0.250000, 0.250000, 0.125000, 0.375000, 0.000000, 0.250000, 0.375000, 0.000000, 0.375000, 0.000000, 0.375000, 0.000000, 0.250000, 0.375000, 0.000000, 0.375000, 0.125000, 0.125000, 0.375000, 0.000000, 0.375000, 0.250000, 0.000000, 0.375000, 0.000000, 0.500000, 0.000000, 0.125000, 0.375000, 0.000000, 0.500000, 0.125000, 0.000000, 0.375000, 0.000000, 0.625000, 0.000000, 0.000000, 0.375000, 0.125000, 0.000000, 0.000000, 0.500000, 0.375000, 0.125000, 0.000000, 0.125000, 0.375000, 0.375000, 0.125000, 0.000000, 0.250000, 0.250000, 0.375000, 0.125000, 0.000000, 0.375000, 0.125000, 0.375000, 0.125000, 0.000000, 0.500000, 0.000000, 0.375000, 0.125000, 0.125000, 0.000000, 0.375000, 0.375000, 0.125000, 0.125000, 0.125000, 0.250000, 0.375000, 0.125000, 0.125000, 0.250000, 0.125000, 0.375000, 0.125000, 0.125000, 0.375000, 0.000000, 0.375000, 0.125000, 0.250000, 0.000000, 0.250000, 0.375000, 0.125000, 0.250000, 0.125000, 0.125000, 0.375000, 0.125000, 0.250000, 0.250000, 0.000000, 0.375000, 0.125000, 0.375000, 0.000000, 0.125000, 0.375000, 0.125000, 0.375000, 0.125000, 0.000000, 0.375000, 0.125000, 0.500000, 0.000000, 0.000000, 0.375000, 0.250000, 0.000000, 0.000000, 0.375000, 0.375000, 0.250000, 0.000000, 0.125000, 0.250000, 0.375000, 0.250000, 0.000000, 0.250000, 0.125000, 0.375000, 0.250000, 0.000000, 0.375000, 0.000000, 0.375000, 0.250000, 0.125000, 0.000000, 0.250000, 0.375000, 0.250000, 0.125000, 0.125000, 0.125000, 0.375000, 0.250000, 0.125000, 0.250000, 0.000000, 0.375000, 0.250000, 0.250000, 0.000000, 0.125000, 0.375000, 0.250000, 0.250000, 0.125000, 0.000000, 0.375000, 0.250000, 0.375000, 0.000000, 0.000000, 0.375000, 0.375000, 0.000000, 0.000000, 0.250000, 0.375000, 0.375000, 0.000000, 0.125000, 0.125000, 0.375000, 0.375000, 0.000000, 0.250000, 0.000000, 0.375000, 0.375000, 0.125000, 0.000000, 0.125000, 0.375000, 0.375000, 0.125000, 0.125000, 0.000000, 0.375000, 0.375000, 0.250000, 0.000000, 0.000000, 0.375000, 0.500000, 0.000000, 0.000000, 0.125000, 0.375000, 0.500000, 0.000000, 0.125000, 0.000000, 0.375000, 0.500000, 0.125000, 0.000000, 0.000000, 0.375000, 0.625000, 0.000000, 0.000000, 0.000000, 0.500000, 0.000000, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 0.125000, 0.375000, 0.500000, 0.000000, 0.000000, 0.250000, 0.250000, 0.500000, 0.000000, 0.000000, 0.375000, 0.125000, 0.500000, 0.000000, 0.000000, 0.500000, 0.000000, 0.500000, 0.000000, 0.125000, 0.000000, 0.375000, 0.500000, 0.000000, 0.125000, 0.125000, 0.250000, 0.500000, 0.000000, 0.125000, 0.250000, 0.125000, 0.500000, 0.000000, 0.125000, 0.375000, 0.000000, 0.500000, 0.000000, 0.250000, 0.000000, 0.250000, 0.500000, 0.000000, 0.250000, 0.125000, 0.125000, 0.500000, 0.000000, 0.250000, 0.250000, 0.000000, 0.500000, 0.000000, 0.375000, 0.000000, 0.125000, 0.500000, 0.000000, 0.375000, 0.125000, 0.000000, 0.500000, 0.000000, 0.500000, 0.000000, 0.000000, 0.500000, 0.125000, 0.000000, 0.000000, 0.375000, 0.500000, 0.125000, 0.000000, 0.125000, 0.250000, 0.500000, 0.125000, 0.000000, 0.250000, 0.125000, 0.500000, 0.125000, 0.000000, 0.375000, 0.000000, 0.500000, 0.125000, 0.125000, 0.000000, 0.250000, 0.500000, 0.125000, 0.125000, 0.125000, 0.125000, 0.500000, 0.125000, 0.125000, 0.250000, 0.000000, 0.500000, 0.125000, 0.250000, 0.000000, 0.125000, 0.500000, 0.125000, 0.250000, 0.125000, 0.000000, 0.500000, 0.125000, 0.375000, 0.000000, 0.000000, 0.500000, 0.250000, 0.000000, 0.000000, 0.250000, 0.500000, 0.250000, 0.000000, 0.125000, 0.125000, 0.500000, 0.250000, 0.000000, 0.250000, 0.000000, 0.500000, 0.250000, 0.125000, 0.000000, 0.125000, 0.500000, 0.250000, 0.125000, 0.125000, 0.000000, 0.500000, 0.250000, 0.250000, 0.000000, 0.000000, 0.500000, 0.375000, 0.000000, 0.000000, 0.125000, 0.500000, 0.375000, 0.000000, 0.125000, 0.000000, 0.500000, 0.375000, 0.125000, 0.000000, 0.000000, 0.500000, 0.500000, 0.000000, 0.000000, 0.000000, 0.625000, 0.000000, 0.000000, 0.000000, 0.375000, 0.625000, 0.000000, 0.000000, 0.125000, 0.250000, 0.625000, 0.000000, 0.000000, 0.250000, 0.125000, 0.625000, 0.000000, 0.000000, 0.375000, 0.000000, 0.625000, 0.000000, 0.125000, 0.000000, 0.250000, 0.625000, 0.000000, 0.125000, 0.125000, 0.125000, 0.625000, 0.000000, 0.125000, 0.250000, 0.000000, 0.625000, 0.000000, 0.250000, 0.000000, 0.125000, 0.625000, 0.000000, 0.250000, 0.125000, 0.000000, 0.625000, 0.000000, 0.375000, 0.000000, 0.000000, 0.625000, 0.125000, 0.000000, 0.000000, 0.250000, 0.625000, 0.125000, 0.000000, 0.125000, 0.125000, 0.625000, 0.125000, 0.000000, 0.250000, 0.000000, 0.625000, 0.125000, 0.125000, 0.000000, 0.125000, 0.625000, 0.125000, 0.125000, 0.125000, 0.000000, 0.625000, 0.125000, 0.250000, 0.000000, 0.000000, 0.625000, 0.250000, 0.000000, 0.000000, 0.125000, 0.625000, 0.250000, 0.000000, 0.125000, 0.000000, 0.625000, 0.250000, 0.125000, 0.000000, 0.000000, 0.625000, 0.375000, 0.000000, 0.000000, 0.000000, 0.750000, 0.000000, 0.000000, 0.000000, 0.250000, 0.750000, 0.000000, 0.000000, 0.125000, 0.125000, 0.750000, 0.000000, 0.000000, 0.250000, 0.000000, 0.750000, 0.000000, 0.125000, 0.000000, 0.125000, 0.750000, 0.000000, 0.125000, 0.125000, 0.000000, 0.750000, 0.000000, 0.250000, 0.000000, 0.000000, 0.750000, 0.125000, 0.000000, 0.000000, 0.125000, 0.750000, 0.125000, 0.000000, 0.125000, 0.000000, 0.750000, 0.125000, 0.125000, 0.000000, 0.000000, 0.750000, 0.250000, 0.000000, 0.000000, 0.000000, 0.875000, 0.000000, 0.000000, 0.000000, 0.125000, 0.875000, 0.000000, 0.000000, 0.125000, 0.000000, 0.875000, 0.000000, 0.125000, 0.000000, 0.000000, 0.875000, 0.125000, 0.000000, 0.000000, 0.000000, }; unsigned int number_of_weights_3_6 = 56; double weights_3_6[] = { 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, }; unsigned int number_of_weights_3_7 = 83; double weights_3_7[] = { 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.333333, 0.333333, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.333333, 0.333333, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.333333, 0.333333, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.666667, 0.000000, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.666667, 0.000000, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.666667, 0.000000, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.666667, 0.000000, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.666667, 0.333333, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, }; #endif /* WEIGHT_VECTORS_H */ emoa/R/0000755000175100001440000000000012030307153011404 5ustar hornikusersemoa/R/front_edge.R0000644000175100001440000000072212030307153013644 0ustar hornikusers##' Determine which points are on the edge of a Pareto-front approximation. ##' ##' @param front Pareto-front approximation. ##' ##' @return An integer vector containing the indicies of the points ##' (columns) of \code{front} which are on the edge of the ##' Pareto-front approximation. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' ##' @export which_points_on_edge <- function(front) { which(.Call(do_which_points_on_edge, front)) } emoa/R/poly_mutation.r0000644000175100001440000000147212030307153014476 0ustar hornikusers## ## poly_mutation.r - Polynomial mutation operator ## ## Author ## Olaf Mersmann (OME) ## ##' Polynomial mutation operator ##' ##' Returns a polynomial mutation operator with the given parameters. ##' ##' @param n Distance parameter mutation distribution (\eqn{\eta}{eta}). ##' @param p Probability of one point mutation. ##' @param lower Lower bounds of parameter space. ##' @param upper Upper bounds of parameter space. ##' @export ##' @return Function which implements the specified mutation operator. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} pm_operator <- function(n, p, lower, upper) { ## Force arguments: force(n); force(p); force(lower); force(upper); mutation <- function(x) .Call(do_pm, x, lower, upper, n, p) return(mutation) } emoa/R/crowding_distance.r0000644000175100001440000000064312030307153015260 0ustar hornikusers## ## crowding_distance.r - calculate crowding distance. ## ##' Calculate crowding distances. ##' ##' @aliases crowding_distance ##' @title Crowding Distance ##' @export ##' @param front matrix of function values. ##' ##' @return crowding distance for each function value. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} crowding_distance <- function(front) .Call(do_crowding_distance, front) emoa/R/emoa.r0000644000175100001440000000256112030307153012514 0ustar hornikusers##' ##' This package provides functions to construct evolutionary ##' multiobjective optimization algorithms (EMOA). The long term goal ##' is to also provide standard implementations of the most common ##' EMOA in use today. ##' ##' Without the hard work of many researchers who have published their ##' source code under a liberal license, this package would not have ##' been possible. In alphabetical order they are ##' ##' \itemize{ ##' \item Michael H. Buselli ##' \item Wessel Dankers ##' \item Carlos Fonseca ##' \item Joshua Knowles ##' \item Huang Ling ##' \item Wudong Liu ##' \item Manuel Lopez-Ibanez ##' \item Luis Paquete ##' \item Ponnuthurai Nagaratnam Suganthany ##' \item Santosh Tiwar ##' \item Qingfu Zhang ##' \item Aimin Zhou ##' \item Shizheng Zhaoy ##' } ##' ##' @docType package ##' @name emoa-package ##' @title The EMOA package ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' @keywords package ##' @useDynLib emoa do_which_points_on_edge ##' @useDynLib emoa do_hv_contrib ##' @useDynLib emoa do_dominated_hypervolume ##' @useDynLib emoa do_crowding_distance ##' @useDynLib emoa do_is_dominated ##' @useDynLib emoa nondominated_order ##' @useDynLib emoa do_eps_ind ##' @useDynLib emoa do_r_ind ##' @useDynLib emoa do_unary_r2_ind ##' @useDynLib emoa do_pm ##' @useDynLib emoa do_sbx ##' @useDynLib emoa do_sympart NA emoa/R/selection.r0000644000175100001440000000336712030307153013565 0ustar hornikusers## ## selection.r - Selection schemes for EAs ## ## All selection methods should have the same signature: ## ## selection(values, n, ...) ## ##' Selection strategies for EMOA. ##' ##' The currently implemented strategies are nondominated sorting ##' followed by either hypervolume contribution or crowding distance ##' based ranking. Both of these implementations are currently ##' limited to selecting a single individual for replacement. ##' ##' @param values Matrix of function values. ##' @param n Number of individuals to select for replacement. ##' @param ... Optional parameters passed to ##' \code{\link{hypervolume_contribution}}. ##' ##' @title Selection strategies ##' @aliases nds_hv_selection nds_cd_selection ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' @keywords optimize nonlinear ##' @export nds_hv_selection <- function(values, n=1, ...) { #stopifnot(n == 1) sel <- which(is_maximally_dominated(values)) ## Identify individual which gets replaced: if (length(sel) == 1) { sel } else { contrib <- if (length(sel) == ncol(values)) { hypervolume_contribution(values, ...) } else { hypervolume_contribution(values[,sel], ...) } sel[which.min(contrib)] } } ##' @export ##' @rdname nds_hv_selection nds_cd_selection <- function(values, n=1, ...) { #stopifnot(n == 1) N <- ncol(values) k <- N - n ranks <- nds_rank(values) sel <- rep(FALSE, N) cr <- 0 while(sum(sel) < k) { cr <- cr + 1 sel[ranks == cr] <- TRUE } if (sum(sel) != k) { nelim <- sum(sel) - k dist <- crowding_distance(values[,ranks == cr]) cdr <- rank(dist, ties.method="random") s <- which(ranks == cr)[cdr <= nelim] sel[s] <- FALSE } which(sel == FALSE) } emoa/R/sympart.r0000644000175100001440000000100612030307153013263 0ustar hornikusers## ## sympart.r - SYM-PART test function from the CEC 2007 competition ## ## Author: ## Olaf Mersmann (OME) ## ##' Functions from the CEC 2007 EMOA competition. ##' ##' @param x Parmater vector. ##' @return Function value. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' @keywords optimize ##' @export ##' @rdname cec2007_functions sympart <- function(x) { #stopifnot(length(x) >= 2) #stopifnot(length(x) %% 2 == 0) .Call(do_sympart, as.numeric(x)) } emoa/R/cec2009.r0000644000175100001440000000335512030307153012642 0ustar hornikusers## ## cec2009.r - Test functions from the CEC2009 competition ## ## Author: ## Olaf Mersmann (OME) ## ##' Functions from the CEC 2009 EMOA competition. ##' ##' @param x Parmater vector. ##' @return Function value. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' @keywords optimize ##' @export ##' @rdname cec2009_functions UF1 <- function(x) { stopifnot(length(x) >= 3) .Call("do_UF1", as.numeric(x), PACKAGE="emoa") } ##' @export ##' @rdname cec2009_functions UF2 <- function(x) { stopifnot(length(x) >= 3) .Call("do_UF2", as.numeric(x), PACKAGE="emoa") } ##' @export ##' @rdname cec2009_functions UF3 <- function(x) { stopifnot(length(x) >= 3) .Call("do_UF3", as.numeric(x), PACKAGE="emoa") } ##' @export ##' @rdname cec2009_functions UF4 <- function(x) { stopifnot(length(x) >= 3) .Call("do_UF4", as.numeric(x), PACKAGE="emoa") } ##' @export ##' @rdname cec2009_functions UF5 <- function(x) { stopifnot(length(x) >= 3) .Call("do_UF5", as.numeric(x), PACKAGE="emoa") } ##' @export ##' @rdname cec2009_functions UF6 <- function(x) { stopifnot(length(x) >= 3) .Call("do_UF6", as.numeric(x), PACKAGE="emoa") } ##' @export ##' @rdname cec2009_functions UF7 <- function(x) { stopifnot(length(x) >= 3) .Call("do_UF7", as.numeric(x), PACKAGE="emoa") } ##' @export ##' @rdname cec2009_functions UF8 <- function(x) { stopifnot(length(x) >= 5) .Call("do_UF8", as.numeric(x), PACKAGE="emoa") } ##' @export ##' @rdname cec2009_functions UF9 <- function(x) { stopifnot(length(x) >= 5) .Call("do_UF9", as.numeric(x), PACKAGE="emoa") } ##' @export ##' @rdname cec2009_functions UF10 <- function(x) { stopifnot(length(x) >= 5) .Call("do_UF10", as.numeric(x), PACKAGE="emoa") } emoa/R/sb_crossover.r0000644000175100001440000000240212030307153014276 0ustar hornikusers## ## sb_crossover - Simulated Binary Crossover ## ## Author: ## Olaf Mersmann (OME) ## ##' Simulated binary crossover operator ##' ##' Returns a simulated binary crossover operator with the given parameters. ##' ##' @param n Distance parameter of crossover distribution (\eqn{\eta}{eta}). ##' @param p Probability of one point crossover. ##' @param lower Lower bounds of parameter space. ##' @param upper Upper bounds of parameter space. ##' @export ##' ##' @return Function with one parameter \code{x} which takes a matrix ##' containing two sets of parameters and returns a matrix of two sets of ##' parameters which resulted from the crossover operation. As with all ##' \code{emoa} functions, the parameter sets are stored in the columns ##' of \code{x}. \code{x} should therefore always have two columns and a ##' warning will be given if it has more than two columns. ##' ##' @seealso \code{\link{pm_operator}} ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} sbx_operator <- function(n, p, lower, upper) { ## Force arguments: force(n); force(p); force(lower); force(upper); crossover <- function(x) .Call(do_sbx, x, lower, upper, n, p) return(crossover) } emoa/R/utilities.r0000644000175100001440000000235312030307153013605 0ustar hornikusers## ## utilities.r - Internal utility functions ## ## Author: ## Olaf Mersmann (OME) ## ##' @useDynLib emoa do_which_points_on_edge NA rsbxbeta <- function(n, nc) { ## U ~ [0, 1] , twou := 2 * U ~ [0, 2] twou <- runif(n, 0, 2.0) e <- 1/(nc + 1) beta <- ifelse(twou < 1, twou, 1/(2 - twou))^e return(beta) } ##' Clip value to a given range ##' ##' Clip \eqn{x} to the interval \eqn{[l, u]}. This is useful to enforce ##' box constraints. ##' ##' @param x Value to clip. ##' @param l Lower limit. ##' @param u Upper limit. ##' ##' @return l if x < l, u if x > u else x. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' @export inbounds <- function(x, l, u) { ifelse(x < l, l, ifelse(x > u, u, x)) } ##' Return first non null argument. ##' ##' This function is useful when processing complex arguments with multiple ##' possible defaults based on other arguments that may or may not have been ##' provided. ##' ##' @param ... List of values. ##' @return First non null element in \code{...}. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' @export coalesce <- function(...) { l <- list(...) isnull <- sapply(l, is.null) l[[which.min(isnull)]] } emoa/R/control.R0000644000175100001440000001265412030307153013217 0ustar hornikusers## ## control.R - Preliminary control parameter framework ## ## Author: Olaf Mersmann ## ##' Basic EMOA control parameters. ##' ##' The following control parameters are recognized by \code{emoa_control}: ##' \describe{ ##' \item{logger}{\code{emoa_logger} object used to log events.} ##' \item{n}{Number of parameters, defaults to the length of the longer ##' of \code{upper} or \code{lower}.} ##' \item{d}{Number of dimensions.} ##' } ##' ##' @param f Multiobjectve optimization function. ##' @param upper Upper bounds of parameter space. ##' @param lower Lower bounds of parameter space. ##' @param ... Further arguments passed to \code{f}. ##' @param control List of control parameters. ##' @param default List of default control parameters. ##' ##' @return The \code{control} list with suitably adjusted ##' arguments. Missing control parameters are taken from ##' \code{default} or, if not present there, from an internal default. ##' ##' @export ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} emoa_control <- function(f, upper, lower, ..., control, default) { control$logger <- coalesce(control[["logger"]], default[["logger"]], emoa_console_logger()) control$n <- as.integer(coalesce(control[["n"]], default[["n"]], max(length(lower), length(upper)))) control$d <- as.integer(coalesce(control[["d"]], default[["d"]], length(f(rep(NA, control$n), ...)))) control } ##' Steady state EMOA parameters ##' ##' \code{steady_state_emoa_control} interprets the following control ##' parameters: ##' \describe{ ##' \item{mu}{Population size.} ##' \item{maxeval}{Maximum number of function evaluations to use.} ##' } ##' ##' @param f Multiobjectve optimization function. ##' @param upper Upper bounds of parameter space. ##' @param lower Lower bounds of parameter space. ##' @param ... Further arguments passed to \code{f}. ##' @param control List of control parameters. ##' @param default List of default control parameters. ##' ##' @return The \code{control} list with suitably adjusted ##' arguments. Missing control parameters are taken from ##' \code{default} or, if not present there, from an internal default. ##' ##' @export ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} steady_state_emoa_control <- function(f, upper, lower, ..., control, default=list()) { control <- emoa_control(f, upper, lower, ..., control=control, default=default) control$mu <- as.integer(coalesce(control[["mu"]], default[["mu"]], 100L)) control$maxeval <- as.integer(coalesce(control[["maxeval"]], default[["maxeval"]], control$mu * 300L)) control } ##' Simulated binary crossover (SBX) control parameters ##' ##' \code{sbx_control} interprets the following parameters used to ##' control the behaviour of the simulated binary crossover operator ##' (see \code{\link{sbx_operator}}): ##' \describe{ ##' \item{sbx.n}{Nu parameter of SBX.} ##' \item{sbx.p}{$p$ parameter of SBX.} ##' } ##' ##' @param f Multiobjectve optimization function. ##' @param upper Upper bounds of parameter space. ##' @param lower Lower bounds of parameter space. ##' @param ... Further arguments passed to \code{f}. ##' @param control List of control parameters. ##' @param default List of default control parameters. ##' ##' @return The \code{control} list with suitably adjusted ##' arguments. Missing control parameters are taken from ##' \code{default} or, if not present there, from an internal default. ##' ##' @export ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} sbx_control <- function(f, upper, lower, ..., control, default=list()) { if (!"crossover" %in% names(control)) { if (!"crossover" %in% names(default)) { control$sbx.n <- coalesce(control[["sbx.n"]], default[["sbx.n"]], 5) control$sbx.p <- coalesce(control[["sbx.p"]], default[["sbx.p"]], 1.0) control$crossover <- sbx_operator(control$sbx.n, control$sbx.p, lower, upper) } else { control$crossover <- default[["crossover"]] } } control } ##' Polynomial muation (PM) control parameters ##' ##' Control parameters: ##' \describe{ ##' \item{pm.n}{Nu parameter of PM.} ##' \item{pm.p}{p parameter of PM.} ##' } ##' ##' @param f Multiobjectve optimization function. ##' @param upper Upper bounds of parameter space. ##' @param lower Lower bounds of parameter space. ##' @param ... Further arguments passed to \code{f}. ##' @param control List of control parameters. ##' @param default List of default control parameters. ##' ##' @return The \code{control} list with suitably adjusted ##' arguments. Missing control parameters are taken from ##' \code{default} or, if not present there, from an internal default. ##' ##' @export ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} pm_control <- function(f, upper, lower, ..., control, default=list()) { if (!"mutate" %in% names(control)) { if (!"mutate" %in% names(default)) { control$pm.n <- coalesce(control[["pm.n"]], default[["pm.n"]], 10) control$pm.p <- coalesce(control[["pm.p"]], default[["pm.p"]], .2) control$mutate <- pm_operator(control$pm.n, control$pm.p, lower, upper) } else { control$mutate <- default[["mutate"]] } } control } emoa/R/hypervolume.r0000644000175100001440000000626012030307153014152 0ustar hornikusers## ## hypervolume.r - Functions for calculating the dominated hypervolume ## ## Authors: ## Olaf Mersmann ## ##' Dominated Hypervolume calculation ##' ##' \code{dominated_hypervolume} calculates the dominated hypervolume of ##' the points in \code{points}. ##' ##' \code{hypervolume_contribution} calculates the hypervolume ##' contribution of each point. ##' ##' If no reference point \code{ref} is given, one is automatically ##' calculated by determening the maximum in each coordinate. ##' ##' Currently only one general algorithm is implemented due to Fonseca ##' et.al. but work is underway to include others such as the Beume & ##' Rudolph approach as well as the approach by Bradstreet et.al. ##' ##' The 1D and 2D cases are handle seperately by efficient algorithms. ##' Calculates the exact dominated hypervolume of the points given in ##' \code{x} subject to the reference point \code{ref}. ##' ##' @param points Matrix containing the points one per column. ##' @param ref Optional reference point. If not provided the maximum ##' in each dimension is used. ##' @return For \code{dominated_hypervolume} the dominated hypervolume ##' by the points in \code{points} with respect to the reference point ##' \code{ref}. For \code{hypervolume_contribution} a vector giving ##' the hypervolume soley dominated by that point. ##' ##' @seealso \code{\link{nondominated_points}} to extract the pareto ##' front approximation from a given set of points and ##' \code{\link{nds_hv_selection}} for a selection strategy based on ##' the hypervolume contribution of each point. ##' ##' @references ##' This code uses version 1.3 of the hypervolume code available from ##' \url{http://iridia.ulb.ac.be/~manuel/hypervolume}. For a ##' description of the algorithm see ##' ##' Carlos M. Fonseca, Luis Paquete, and Manuel Lopez-Ibanez. \emph{An ##' improved dimension-sweep algorithm for the hypervolume ##' indicator}. In IEEE Congress on Evolutionary Computation, pages ##' 1157-1163, Vancouver, Canada, July 2006. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' ##' @export ##' @keywords optimize dominated_hypervolume <- function(points, ref) { ## Possibly infer reference point: if (missing(ref)) ref <- apply(points, 1, max) ## Sanity checks: if (!is.matrix(points)) stop("Pareto front must be a matrix") if (nrow(points) != length(ref)) stop("Reference point and front must have the same dimension.") if (!all(is.finite(ref))) { warning("Reference point containes non finite values.") return(NaN) } if (!all(is.finite(points))) { warning("Front includes non finite points.") return(NaN) } .Call(do_dominated_hypervolume, points, ref, PACKAGE="emoa") } ##' @export ##' @rdname dominated_hypervolume hypervolume_contribution <- function(points, ref) { ## Possibly infer reference point: if (missing(ref)) ref <- apply(points, 1, max) + 1 ## Sanity checks: if (!is.matrix(points)) stop("Pareto front must be a matrix") if (nrow(points) != length(ref)) stop("Reference point and front must have the same dimension.") ## Call C code: .Call(do_hv_contrib, points, ref, PACKAGE="emoa") } emoa/R/logger.R0000644000175100001440000000426512030307153013015 0ustar hornikusers## ## logger.R - EMOA logging routines ## ## Author: Olaf Mersmann ## ##' Basic logger object with a flexible output routine. ##' ##' @title generic logger factory ##' ##' @param output function used to display logging messages. ##' @param every number of steps of the emoa between evaluations. ##' @param ... passed to the parent logger factory. ##' ##' @return An \code{emoa_logger} object. ##' ##' @seealso \code{\link{emoa_console_logger}} and ##' \code{\link{emoa_null_logger}} for convinience wrappers around ##' \code{emoa_logger} providing useful defaults. ##' ##' @export emoa_logger <- function(output, every=10L) { force(output) force(every) alg <- NULL start_time <- NULL trace_msg <- function(msg, ...) output(sprintf(msg, ...)) logger_start <- function(algorithm, env=parent.frame()) { alg <<- algorithm start_time <<- proc.time()[3] trace_msg("Starting %s run.", alg) trace_msg("%8s %8s", "NEVAL", "HV") } logger_step <- function(env=parent.frame()) { if (env$neval %% every == 0) trace_msg("%8i %8.4f", env$neval, dominated_hypervolume(env$Y[, env$active], env$control$ref)) } logger_stop <- function(env=parent.frame()) { time_used <- proc.time()[3] - start_time trace_msg("Stopped %s run after %5.3f seconds.", alg, round(time_used, 2)) } structure(list(start = logger_start, step = logger_step, stop = logger_stop), class="emoa_logger") } ##' Logger object that outputs log messages to the console ##' ##' This is a wrapper that calls \code{emoa_logger(output=output, ##' ...)} internally and returns that logger. ##' ##' @title console logger ##' @param ... passed to \code{\link{emoa_logger}}. ##' @return An \code{emoa_logger} object. ##' @export emoa_console_logger <- function(...) emoa_logger(output=message, ...) ##' Logger object that discards all log events. ##' ##' @title null logger ##' ##' @param ... ignored. ##' ##' @return An \code{emoa_logger} object. ##' ##' @export emoa_null_logger <- function(...) { structure(list(start=function(...) {}, step=function(...) {}, stop=function(...) {}), class="emoa_logger") } emoa/R/indicators.r0000644000175100001440000001153712030307153013735 0ustar hornikusers## ## pareto_utilities.r - Operators relating to pareto optimality ## ## Author: ## Olaf Mersmann (OME) ## ##' Scale point cloud ##' ##' Rescale all points to lie in the box bounded by \code{minval} ##' and \code{maxval}. ##' ##' @param points Matrix containing points, one per column. ##' @param minval Optional lower limits for the new bounding box. ##' @param maxval Optional upper limits for the new bounding box. ##' @return Scaled points. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' @export normalize_points <- function(points, minval, maxval) { if (missing(minval)) minval <- apply(points, 1, min) if (missing(maxval)) maxval <- apply(points, 1, max) ## FIXME: This is ugly! (points - minval)/(maxval - minval) } ##' Binary quality indicators ##' ##' Calculates the quality indicator value of the set of points given in ##' \code{x} with respect to the set given in \code{o}. As with all ##' functions in \code{emoa} that deal with sets of objective values ##' these are stored by column. ##' ##' @param points Matrix of points for which to calculate the indicator ##' value stored one per column. ##' @param o Matrix of points of the reference set. ##' @param ref Reference point, if omitted, the nadir of the point sets ##' is used. ##' @param ideal Ideal point of true Pareto front. If omited the ideal ##' of both point sets is used. ##' @param nadir Nadir of the true Pareto front. If ommited the nadir ##' of both point sets is used. ##' @param lambda Number of weight vectors to use in estimating the ##' utility. ##' @param utility Name of utility function. ##' @return Value of the quality indicator. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' ##' @references ##' Zitzler, E., Thiele, L., Laumanns, M., Fonseca, C., and ##' Grunert da Fonseca, V (2003): Performance Assessment of ##' Multiobjective Optimizers: An Analysis and Review. IEEE ##' Transactions on Evolutionary Computation, 7(2), 117-132. ##' ##' @export ##' @rdname binary_indicator hypervolume_indicator <- function(points, o, ref) { if (missing(ref)) ref <- pmax(apply(points, 1, max), apply(o, 1, max)) hvx <- dominated_hypervolume(points, ref) hvo <- dominated_hypervolume(o, ref) return(hvo - hvx) } ##' @export ##' @rdname binary_indicator epsilon_indicator <- function(points, o) { stopifnot(is.matrix(points), is.numeric(points), is.matrix(o), is.numeric(o)) if (any(points < 0) || any(o < 0)) stop("The epsilon indicator is only defined for strictly positive objective values.") .Call(do_eps_ind, points, o) } ## ## R indicators: ## r_indicator <- function(points, o, ideal, nadir, lambda, utility, summary) { ## (OME): Order of utility functions is important. It translates ## into the method number in the C code! utility.functions <- c("weighted sum", "Tchebycheff", "Augmented Tchebycheff") utility <- match.arg(utility, utility.functions) method <- which(utility == utility.functions) if (missing(ideal)) ideal <- pmin(apply(points, 1, min), apply(o, 1, min)) if (missing(nadir)) nadir <- pmax(apply(points, 1, max), apply(o, 1, max)) dim <- nrow(points) if (missing(lambda)) { lambda <- if (dim == 2) { 500 } else if (dim == 3) { 30 } else if (dim == 4) { 12 } else if (dim == 5) { 8 } else { 3 } } ix <- .Call(do_r_ind, points, ideal, nadir, as.integer(lambda), as.integer(method)) io <- .Call(do_r_ind, o, ideal, nadir, as.integer(lambda), as.integer(method)) return(summary(ix, io)) } ##' @export ##' @rdname binary_indicator r1_indicator <- function(points, o, ideal, nadir, lambda, utility="Tchebycheff") r_indicator(points, o, ideal, nadir, lambda, utility, function(ua, ur) mean(ua > ur) + mean(ua == ur)/2) ##' @export ##' @rdname binary_indicator r2_indicator <- function(points, o, ideal, nadir, lambda, utility="Tchebycheff") r_indicator(points, o, ideal, nadir, lambda, utility, function(ua, ur) mean(ur - ua)) ##' @export ##' @rdname binary_indicator r3_indicator <- function(points, o, ideal, nadir, lambda, utility="Tchebycheff") r_indicator(points, o, ideal, nadir, lambda, utility, function(ua, ur) mean((ur - ua)/ur)) ##' Unary R2 indicator ##' ##' @param points Matrix of points for which to calculate the indicator ##' value stored one per column. ##' @param weights Matrix of weight vectors stored one per column. ##' @param ideal Ideal point of true Pareto front. If omited the ideal ##' of \code{points} is used. ##' @return Value of unary R2 indicator. ##' ##' @export ##' @author Olaf Mersmann \email{olafm@@p-value.net} unary_r2_indicator <- function(points, weights, ideal) { if (missing(ideal)) ideal <- apply(points, 1, min) .Call(do_unary_r2_ind, points, weights, ideal) } emoa/R/dominance.r0000644000175100001440000000512412030307153013526 0ustar hornikusers## ## domination.R - Anything to do with Pareto dominance ## ## Author: ## Olaf Mersmann (OME) ## ##' \code{is_dominated} returns which points from a set are dominated ##' by another point in the set. \code{\%dominates\%} returns true if ##' \code{x} Pareto dominates \code{y} and ##' \code{is_maximally_dominated} returns TRUE for those points which ##' do not dominate any other points. ##' ##' @param points Matrix containing points one per column. ##' ##' @return For \code{is_dominated} and \code{is_maximally_dominated} ##' a boolean vector and for \code{\%dominates\%} a single boolean. ##' ##' @title Pareto dominance checks. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' ##' @keywords optimize ##' @export ##' @rdname dom_op is_dominated <- function(points) { #stopifnot(is.matrix(points)) #stopifnot(is.numeric(points)) .Call(do_is_dominated, points) } ##' @export ##' @rdname dom_op is_maximally_dominated <- function(points) { ## We should investiate a fast C implementation for this r <- nds_rank(points) r == max(r) } ##' Nondominated points ##' ##' Return those points which are not dominated by another point in ##' \code{points}. This is the Pareto front approximation of the ##' point set. ##' ##' @param points Matrix of points, one per column. ##' @return Those points in \code{points} which are not dominated by ##' another point. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' @export ##' @keywords optimize nondominated_points <- function(points) points[,!is_dominated(points), drop=FALSE] ##' Nondominated sorting ranks ##' ##' Perform (partial) nondominated sort of the points in \code{points} and ##' return the rank of each point. ##' ##' @param points Matrix containing points one per column. ##' @param partial Optional integer specifying the number of points for ##' which the rank should be calculated. Defaults to all points. ##' ##' @return Vector containing the ranks of the first \code{partial} ##' individuals or all individuals. ##' ##' @author Olaf Mersmann \email{olafm@@statistik.tu-dortmund.de} ##' @keywords optimize ##' @export nds_rank <- function(points, partial) { #stopifnot(is.matrix(points)) #stopifnot(is.numeric(points)) if (missing(partial)) partial <- ncol(points) else if (is.numeric(partial)) partial <- as.integer(partial) else stopifnot(is.integer(partial)) .Call(nondominated_order, points, partial) } ##' @export ##' @rdname nds_rank nondominated_ordering <- function(points, partial) { .Deprecated("nds_rank") nds_rank(par, partial) } emoa/MD50000644000175100001440000000763513630504411011531 0ustar hornikusers388ae57e75e65d8563941652f743dd4f *ChangeLog 502f13cafa4797ba8e9268cf3bb90e84 *DESCRIPTION 8220b52b31e6bce24255bb4dda962047 *NAMESPACE 28d20019359493872bca36cbb3abd8c7 *R/cec2009.r 12d3e46f4e47f801bc071578554eb96c *R/control.R 4960eade70f12abca185820cbe0a7ba1 *R/crowding_distance.r 63f4f0ce80f2ba664012c6a99d300d54 *R/dominance.r 49d1700cef837fea739fe2a63abe923b *R/emoa.r 20a3591dbff7f13576ae78df7dd5b220 *R/front_edge.R 3b6d5443fdf4a4c0908b8ba5b925b804 *R/hypervolume.r 42846d1480f2f5786009b295f7bfa9ce *R/indicators.r b9b6cf45ba887a95d4987b541809c8c9 *R/logger.R 0b9181cd7c6421ec8afb99d5a68dc6da *R/poly_mutation.r 147a2a85bd7a14f7ae60f7f9a5822146 *R/sb_crossover.r 5658227865e2b601f3294356b978eec7 *R/selection.r c570d9e56c03bfd54268e66c54a8a9ae *R/sympart.r c271eb1b20393b55d5f9de7ca4daf9bd *R/utilities.r b1b190a2353b315ad215bae32adb1cd1 *data/cec2007.rda be3761bdff0095422a9eb4795c04ebc6 *inst/unittests/runit-cec2009.r b7be8e559a10cebb2e6f2a9f95104cc0 *inst/unittests/runit-ei.r edf56d70e5f3a2f8168c548a48a028dc *inst/unittests/runit-front_edge.R 835a37e5a3d3937f0cdfb397779ec33c *inst/unittests/runit-hypervolume.r 5cfae79317dc55f3a1240ac97af31314 *inst/unittests/runit-id.r 973051640c61d4f7dc8e66bf0221c851 *inst/unittests/runit-nds.r ef6ab2f4e109dcfa1d5b06b4c6726eea *inst/unittests/runit-poly.r 13dd2751a59513d9f03af36f89b4ae0b *inst/unittests/runit-sbx.r 231516c5a6d0f274a14b3098fb716471 *inst/unittests/runit-utilities.r f58564e88d40d2838a0e45d302ed89d8 *inst/unittests/runner.r 2a7833d377d7e1e949d718b286cfb6a9 *man/binary_indicator.Rd c7fd83c5f92e263ffe7582d116f0a2b8 *man/cec2007.Rd 92337b9cc92295f690bdb90d83b3dc6a *man/cec2007_functions.Rd dc20e069001ef563e84f4dce4d03d607 *man/cec2009_functions.Rd a055856ca93252b6eaad3b956387057f *man/coalesce.Rd 6d5e9958023bbc2203ac59f61c0807eb *man/crowding_distance.Rd 0cd71a805f37ce1ef42dc0175368c474 *man/dom_op.Rd a8f48d117f316814ea4efcd1313d3d3e *man/dominated_hypervolume.Rd f089c759d75dbf7873a1221d0f16026e *man/emoa-package.Rd fbcab75a2251b34eac4b197aa7c503a6 *man/emoa_console_logger.Rd 38144fee802101a273e406852ad65720 *man/emoa_control.Rd ae31e9e3d8b943cd8eb37e38486490e9 *man/emoa_logger.Rd 9f4f8df261a2574180d30992213fafca *man/emoa_null_logger.Rd 1162782f02bc9a4ece6015873ed89c9e *man/inbounds.Rd bfcda4f95e38e6d5c754e79e12fbad1a *man/nds_hv_selection.Rd 7de48c954d63945895d27a06ceb345d7 *man/nds_rank.Rd 343879e7ddabcaf5dae15407b81b944c *man/nondominated_points.Rd f01744cf1cc405420b07c46156b24acc *man/normalize_points.Rd c7a1d83ec2d603ff4880d8988e8ef647 *man/pm_control.Rd 7b868606482fc935215b8256ea1657d2 *man/pm_operator.Rd ed6c8430f2c7a09a3b1bb6b2ca84d8c8 *man/sbx_control.Rd bd8021339fe9c61ca754e12675c92f96 *man/sbx_operator.Rd c45dbc9f774a2502e6f9137986e5b0d0 *man/steady_state_emoa_control.Rd 544d9974be3ed87b548eeec3c6047bde *man/unary_r2_indicator.Rd 7876fd17bd404ca4074d5119eb0395c9 *man/which_points_on_edge.Rd 8981dd7ac2ad9eda4ecf9c9a6471194b *src/Makevars 3dbd45bc288bf345b4869decfc17a93c *src/avl.c 09b6630a58f9431847560b90c8e981e6 *src/avl.h 773b3841f34dbbce15e54b3af54c4759 *src/bitstring.h 60a817e6afe2d019aae0c906655610bf *src/cec2009.c 04247680b3bdc2d7934e09d12c496311 *src/crowding_distance.c 3873fb1433fbc69cdeaee1e00a2f518b *src/dominance.c a3c38975ccc5de46d3e4710f6628ffdc *src/eps_ind.c ab9d595470f08176a94c7e94961f822c *src/front_edge.c 33e126ed07b1bfcf3a409d26beaecd42 *src/hv.c a16a93a6a9c3cad3b414ee98c547d813 *src/hv.h a524035e5d5b4815889848d03ae2f385 *src/hypervolume.c fd9122961d4cc6a57736d3a518eef152 *src/poly_mutation.c f5a91f1230eff9149ddcbe483916e30c *src/precomputed_weight_vectors.h c73c60eac7199e2c1b2f26754f19f2d2 *src/r_ind.c cd480555f2e0f521dc996a81f0f8efcd *src/sb_crossover.c 7c8d34cbe1c7a0e2783663e7ffb9327b *src/sexp_macros.h f697d663f3e629123a72500d33465698 *src/sympart.c 8a8131c2ab0f87c1b0d565dd0ad2bc55 *src/utilities.c 9a3fb3fd2295f3ffc7b0df7f4ac8f57e *src/utilities.h 37f0883a538e159344d6b3eecff7cd7c *src/weight_vectors.h ab158f3fbc28e50ba6f239bab3873d9f *tests/RUnit.R emoa/inst/0000755000175100001440000000000012030307153012160 5ustar hornikusersemoa/inst/unittests/0000755000175100001440000000000012030307153014222 5ustar hornikusersemoa/inst/unittests/runit-poly.r0000644000175100001440000000101612030307153016525 0ustar hornikusers## ## runit-poly.r - Polynomial mutation ## ## These checks may fail sometimes! They are simply empirical checks of the ## probability of crossover. ## N <- 10000L f <- pm_operator(5, 0.8, -10, 10) x <- replicate(N, f(5)) test.polyP1 <- function() { p <- mean(x != 5) message("P1 = ", p) checkTrue(p > 0.78 && p < 0.82) } test.polyP2 <- function() { p <- mean(x < 5) message("P2 = ", p) checkTrue(p > 0.38 && p < 0.42) } test.polyInBounds <- function() { checkTrue(all(x >= -10)) checkTrue(all(x <= 10)) } emoa/inst/unittests/runit-nds.r0000644000175100001440000000365312030307153016337 0ustar hornikusers## ## runit-nds.r - Pareto dominance stuff ## points <- matrix(c(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.5, 0.6, 0.6, 0.6, 0.5, 0.8, 0.8, 0.8), ncol=8, byrow=FALSE) nd <- c(TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) no <- c(1, 1, 1, 1, 2, 2, 2, 3) test.is_dominated <- function() { k <- nrow(points) n <- ncol(points) ## Check for different permutations of the rows and columns of ## points. for (i in 1:10) { o <- sample(1:n) p <- sample(1:k) m <- points[p,o] res <- is_dominated(m) checkEquals(res, !nd[o]) } } test.is_maximally_dominated <- function() { k <- nrow(points) n <- ncol(points) ## Check for different permutations of the rows and columns of ## points. for (i in 1:10) { o <- sample(1:n) p <- sample(1:k) m <- points[p,o] res <- is_maximally_dominated(m) checkEquals(res, max(no[o]) == no[o]) } } test.nds_rank <- function() { k <- nrow(points) n <- ncol(points) ## Check for different permutations of the rows and columns of ## points. for (i in 1:10) { o <- sample(1:n) p <- sample(1:k) checkEquals(nds_rank(points[p,o]), no[o]) } } test.nds_rank.args <- function() { checkException(nds_rank("a")) checkException(nds_rank(1)) checkException(nds_rank(list(1, 2, 3))) checkException(nds_rank(data.frame(x=1:10))) checkException(nds_rank(points, partial="a")) } ## Bug fixed i test.single_nds <- function() { checkEquals(dim(nondominated_points(points[,-(1:3)])), c(3, 1)) } ##test_dominates_op <- function() { ## x <- c(1, 2, 1) ## y <- c(2, 1, 2) ## z <- c(0, 1, 0) ## checkEquals(x %dominates% y, FALSE) ## checkEquals(y %dominates% x, FALSE) ## checkEquals(z %dominates% x, FALSE) ## checkEquals(z %dominates% y, FALSE) ##} emoa/inst/unittests/runit-hypervolume.r0000644000175100001440000000530612030307153020127 0ustar hornikusers## ## runit-hypervolume.r - Hypervolume tests ## ## Predeclare some simple test fronts: simpleFront <- matrix(c(0.0, 1.0, 0.5, 1.0, 0.0, 0.5), ncol=3, byrow=TRUE) infFront <- simpleFront infFront[,2] <- Inf naFront <- simpleFront naFront[,2] <- NA nanFront <- simpleFront nanFront[,2] <- NaN test.dominated_hypervolume <- function() { checkEqualsNumeric(dominated_hypervolume(simpleFront), 0.5^2) checkEqualsNumeric(dominated_hypervolume(simpleFront, c(1.0, 1.0)), 0.5^2) ## OME: FIXME should ignore outer points? ## checkEqualsNumeric(dominated_hypervolume(simpleFront, c(0.8, 0.8)), 0.3^2) checkEqualsNumeric(dominated_hypervolume(simpleFront, c(2.0, 2.0)), 3.25) checkEqualsNumeric(dominated_hypervolume(simpleFront, c(0.0, 0.0)), 0) checkEqualsNumeric(dominated_hypervolume(simpleFront, c(0.5, 0.5)), 0) checkEqualsNumeric(dominated_hypervolume(simpleFront, c(NaN, NaN)), NaN) } test.badFront <- function() { ## OME: Should probably also return NaN instead of NA checkEquals(is.na(dominated_hypervolume(naFront)), TRUE) checkEquals(dominated_hypervolume(nanFront), NaN) } test.infFront <- function() { ## OME: These should probably be reworked to return 'saner' values. checkEquals(dominated_hypervolume(infFront), NaN) checkEquals(dominated_hypervolume(infFront, ref=c(1, 1)), NaN) checkEquals(dominated_hypervolume(simpleFront, ref=c(Inf, Inf)), NaN) } test.badInput <- function() { checkException(dominated_hypervolume(1:10)) checkException(dominated_hypervolume("abc")) checkException(dominated_hypervolume(simpleFront, 1:3)) checkException(dominated_hypervolume(simpleFront, 1)) } test.dhv3d <- function() { ## Built with Lego. Hurra! m3 <- structure(c(5, 2, 0, 4, 3, 0, 4, 2, 1, 4, 1, 2, 3, 2, 2, 2, 3, 2, 4, 0, 3, 3, 1, 3, 2, 2, 3, 3, 0, 4, 2, 1, 4, 1, 2, 4, 0, 3, 4, 0, 2, 5), .Dim = c(3L, 14L)) m3_dhv <- c(1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1) checkEqualsNumeric(hypervolume_contribution(m3, c(6, 4, 6)), m3_dhv) } ## Regression test for the permutation bug (missing duplicate()). test.regress_perm <- function() { ## Built with Lego. Hurra! m3 <- structure(c(5, 2, 0, 4, 3, 0, 4, 2, 1, 4, 1, 2, 3, 2, 2, 2, 3, 2, 4, 0, 3, 3, 1, 3, 2, 2, 3, 3, 0, 4, 2, 1, 4, 1, 2, 4, 0, 3, 4, 0, 2, 5), .Dim = c(3L, 14L)) o3 <- structure(c(5, 2, 0, 4, 3, 0, 4, 2, 1, 4, 1, 2, 3, 2, 2, 2, 3, 2, 4, 0, 3, 3, 1, 3, 2, 2, 3, 3, 0, 4, 2, 1, 4, 1, 2, 4, 0, 3, 4, 0, 2, 5), .Dim = c(3L, 14L)) hypervolume_contribution(m3) checkEqualsNumeric(m3, o3) } emoa/inst/unittests/runit-sbx.r0000644000175100001440000000071012030307153016336 0ustar hornikusers## ## runit-sbx.r - SBX crossover ## ## These checks may fail sometimes! They are simply empirical checks of the ## probability of crossover. ## N <- 10000L f <- sbx_operator(2, 0.8, -2, 2) parents <- matrix(c(0, 1), ncol=2) x <- replicate(N, c(f(parents)))[1,] test.sbxP1 <- function() { p <- mean(x != 0) message("P1 = ", p) checkTrue(p > 0.78 && p < 0.82) } test.sbxInBounds <- function() { checkTrue(all(x >= -2)) checkTrue(all(x <= 2)) } emoa/inst/unittests/runit-cec2009.r0000644000175100001440000000630312030307153016613 0ustar hornikusers## ## cec2009 unit test ## ## Source to generate test point checks: ## ## f <- function(n, x=c(0.2, 0.2, 0.2, 0.2)) { ## fn <- get(n) ## r <- fn(x) ## message("checkEqualsNumeric(", n, "(", ## "c(", paste(x, collapse=", "), "), ", ## "c(", paste(r, collapse=", "), ")))") ## } ## ## for (n in paste("UF", 1:10, sep="")) ## f(n) test.UF1 <- function() { checkEqualsNumeric(UF1(c(0.2, 0.2, 0.2, 0.2)), c(0.454091055737032, 1.72127910133303)) checkEqualsNumeric(UF1(c(1.0, 0.0, 0.0)), c(1.0, 1.5)) checkEqualsNumeric(UF1(c(1.0, 2.0, 2.0)), c(NaN, NaN)) checkEqualsNumeric(UF1(c(-1.0, 0.0, 0.0)), c(NaN, NaN)) checkEqualsNumeric(UF1(c(0.2, 0.2, "a")), c(NaN, NaN)) checkException(UF1(c(1.0, 2.0))) } test.UF2 <- function() { checkEqualsNumeric(UF2(c(0.2, 0.2, 0.2, 0.2)), c(0.210335975924134, 0.654710703252405)) checkEqualsNumeric(UF2(c(1.0, 1.0, 1.0)), c(8.2199999999999989, 0.7449042731880116)) checkEqualsNumeric(UF2(c(1.0, 2.0, 2.0)), c(NaN, NaN)) checkEqualsNumeric(UF2(c(-1.0, 0.0, 0.0)), c(NaN, NaN)) checkEqualsNumeric(UF2(c(0.2, 0.2, "a")), c(NaN, NaN)) checkException(UF2(c(1.0, 2.0))) } test.UF3 <- function() { checkEqualsNumeric(UF3(c(0.2, 0.2, 0.2, 0.2)), c(7.1937361619286, 2.90716200450771)) checkEqualsNumeric(UF3(c(1.0, 2.0, 2.0)), c(NaN, NaN)) checkEqualsNumeric(UF3(c(-1.0, 0.0, 0.0)), c(NaN, NaN)) checkEqualsNumeric(UF3(c(0.2, 0.2, "a")), c(NaN, NaN)) checkException(UF3(c(1.0, 2.0))) } test.UF4 <- function() { checkEqualsNumeric(UF4(c(0.2, 0.2, 0.2, 0.2)), c(0.434509085633295, 1.20063945204195)) checkEqualsNumeric(UF4(c(1.0, 2.0, 2.0)), c(NaN, NaN)) checkEqualsNumeric(UF4(c(-1.0, 0.0, 0.0)), c(NaN, NaN)) checkEqualsNumeric(UF4(c(0.2, 0.2, "a")), c(NaN, NaN)) checkException(UF4(c(1.0, 2.0))) } test.UF5 <- function() { checkEqualsNumeric(UF5(c(0.2, 0.2, 0.2, 0.2)), c(3.17056357285719, 3.98342430089429)) } test.UF6 <- function() { checkEqualsNumeric(UF6(c(0.2, 0.2, 0.2, 0.2)), c(1.88938265125039, 6.65748253841339)) } test.UF7 <- function() { checkEqualsNumeric(UF7(c(0.2, 0.2, 0.2, 0.2)), c(0.978870719414727, 1.44371303315529)) } test.UF8 <- function() { checkEqualsNumeric(UF8(c(2.0, 0.2, 0.2, 0.2, 0.2)), c(NaN, NaN, NaN)) checkEqualsNumeric(UF8(c(0.2, 2.0, 0.2, 0.2, 0.2)), c(NaN, NaN, NaN)) checkEqualsNumeric(UF8(c(0.2, 0.2, 3.0, 0.2, 0.2)), c(NaN, NaN, NaN)) checkEqualsNumeric(UF8(c(0.2, 0.2, 0.2, 0.2, "a")), c(NaN, NaN, NaN)) for (i in 1:4) checkException(UF8(rep(0.2, i))) } test.UF9 <- function() { checkEqualsNumeric(UF9(c(2.0, 0.2, 0.2, 0.2, 0.2)), c(NaN, NaN, NaN)) checkEqualsNumeric(UF9(c(0.2, 2.0, 0.2, 0.2, 0.2)), c(NaN, NaN, NaN)) checkEqualsNumeric(UF9(c(0.2, 0.2, 3.0, 0.2, 0.2)), c(NaN, NaN, NaN)) checkEqualsNumeric(UF9(c(0.2, 0.2, 0.2, 0.2, "a")), c(NaN, NaN, NaN)) for (i in 1:4) checkException(UF9(rep(0.2, i))) } test.UF10 <- function() { checkEqualsNumeric(UF10(c(2.0, 0.2, 0.2, 0.2, 0.2)), c(NaN, NaN, NaN)) checkEqualsNumeric(UF10(c(0.2, 2.0, 0.2, 0.2, 0.2)), c(NaN, NaN, NaN)) checkEqualsNumeric(UF10(c(0.2, 0.2, 3.0, 0.2, 0.2)), c(NaN, NaN, NaN)) checkEqualsNumeric(UF10(c(0.2, 0.2, 0.2, 0.2, "a")), c(NaN, NaN, NaN)) for (i in 1:4) checkException(UF10(rep(0.2, i))) } emoa/inst/unittests/runit-id.r0000644000175100001440000000324312030307153016142 0ustar hornikusers## ## runit-pu.r - Pareto utility test ## points <- matrix(c(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.5, 0.6, 0.6, 0.6, 0.5, 0.8, 0.8, 0.8), ncol=8, byrow=FALSE) nd <- c(TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) no <- c(1, 1, 1, 1, 2, 2, 2, 3) test.hv_indicators <- function() { p1 <- points[, no==1] p2 <- points[, no==2] I12 <- hypervolume_indicator(p1, p2, ref=c(1, 1, 1)) I21 <- hypervolume_indicator(p2, p1, ref=c(1, 1, 1)) checkEquals(I21, 0.013) checkEquals(I12, -I21) I21p <- hypervolume_indicator(p2, p1, ref=c(10, 10, 10)) checkTrue(I21 < I21p) } test.r_indicators <- function() { p1 <- points[, no==1] p2 <- points[, no==2] ## Basic sanity: checkEquals(r1_indicator(p1, p1), 0.5) checkEquals(r2_indicator(p1, p1), 0) checkEquals(r3_indicator(p1, p1), 0) checkEquals(r1_indicator(p2, p2), 0.5) checkEquals(r2_indicator(p2, p2), 0) checkEquals(r3_indicator(p2, p2), 0) ## Precalculate values: r112 <- r1_indicator(p1, p2) r121 <- r1_indicator(p2, p1) r212 <- r2_indicator(p1, p2) r221 <- r2_indicator(p2, p1) r312 <- r3_indicator(p1, p2) r321 <- r3_indicator(p2, p1) ## Symmetry properties: checkEquals(r112 + r121, 1) checkEquals(r212, -r221) ## Known 'better': checkTrue(r112 > r121) checkTrue(r212 < r221) checkTrue(r312 < r321) } test.eps_indicator <- function() { p1 <- points[, no==1] p2 <- points[, no==2] checkEquals(epsilon_indicator(p1, p2), 0) checkEquals(epsilon_indicator(p2, p1), 0.6) } emoa/inst/unittests/runit-utilities.r0000644000175100001440000000074012030307153017560 0ustar hornikusers## ## runit-utilities.r - check internal utility functions ## test.inbounds <- function() { x <- c(0, 1, 2) checkEquals(emoa:::inbounds(x, 0, 1), c(0, 1, 1)) checkEquals(emoa:::inbounds(x, 1, 2), c(1, 1, 2)) checkEquals(emoa:::inbounds(x, 1, 1), c(1, 1, 1)) checkEquals(emoa:::inbounds(x, c(0, 0, 1), c(1, 1, 2)), c(0, 1, 2)) checkEquals(emoa:::inbounds(x, c(1, 0, 1), c(1, 1, 2)), c(1, 1, 2)) checkEquals(emoa:::inbounds(x, c(0, 0, 1), c(1, 1, 1)), c(0, 1, 1)) } emoa/inst/unittests/runit-front_edge.R0000644000175100001440000000124012030307153017615 0ustar hornikusers## ## runit-front_edge.R - Edge point tests ## ## Predeclare some simple test fronts: front_2d <- matrix(c(0.0, 1.0, 0.5, 1.0, 0.0, 0.5), nrow=2, byrow=TRUE) front_3d <- matrix(c(0.0, 1.0, 0.0, 0.5, 0.7, 1.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.5, 0.5, 1.0, 0.5, 1.0, 1.0, 0.0, 0.0, 0.5, 0.3, 0.5, 1.0, 1.0), nrow=3, byrow=TRUE) which_points_on_edge(front_3d) test.which_points_on_edge_2d <- function() { checkEquals(which_points_on_edge(front_2d), c(1, 2)) } test.which_points_on_edge_3d <- function() { checkEquals(which_points_on_edge(front_3d), c(1, 2, 3, 6, 7, 8)) } emoa/inst/unittests/runit-ei.r0000644000175100001440000000204012030307153016135 0ustar hornikusers## ## runit-ei.r - Epsilon Indicator tests ## x <- matrix(c(1.0, 0.5, 0.0, 0.0, 0.5, 1.0), ncol=3, byrow=TRUE) runit.epsilon_indicator <- function() { k <- nrow(x) n <- ncol(x) ## Check for different permutations of the rows and columns of ## points. for (i in 1:10) { o <- sample(1:n) p <- sample(1:k) m <- x[p,o] for (delta in seq(0, 1, by=0.2)) { checkEqualsNumeric(epsilon_indicator(m, m + delta), -delta) checkEqualsNumeric(epsilon_indicator(m + delta, m), delta) } } ## Check different sized matrices: checkEqualsNumeric(epsilon_indicator(x, x[,-2] + 0.2), -0.2) ## Negative values: checkException(epsilon_indicator(x, x-10)) checkException(epsilon_indicator(x-10, x)) } ruint.epsilon_indicator_differently_sized_fronts <- function() { front1 <- matrix(runif(100), nrow=2) front2 <- matrix(runif(150), nrow=3) checkException(checkepsilon_indicator(nondominated_points(front1), nondominated_points(front2))) } emoa/inst/unittests/runner.r0000644000175100001440000000346112030307153015722 0ustar hornikusers## ## runner.r - run RUnit tests included in package ## ## Based on code taken from the fBasics package. ## pkg <- "emoa" if (require("RUnit", quietly = TRUE)) { library(package=pkg, character.only = TRUE) if (!(exists("path") && file.exists(path))) path <- system.file("unitTests", package = pkg) ## --- Testing --- ## Define tests testSuite <- defineTestSuite(name = paste(pkg, "unit testing"), dirs = path) if (interactive()) { cat("Now have RUnit Test Suite 'testSuite' for package '", pkg, "' :\n", sep='') str(testSuite) cat('', "Consider doing", "\t tests <- runTestSuite(testSuite)", "\nand later", "\t printTextProtocol(tests)", '', sep = "\n") } else { tests <- runTestSuite(testSuite) if (file.access(path, 02) != 0) { tdir <- tempfile(paste(pkg, "unitTests", sep="_")) dir.create(tdir) pathReport <- file.path(tdir, "report") cat("RUnit reports saved to ", tdir, "/report.(txt|html)", sep = "") } else { pathReport <- file.path(path, "report") } ## Print Results: printTextProtocol(tests, showDetails = FALSE) printTextProtocol(tests, showDetails = FALSE, fileName = paste(pathReport, "Summary.txt", sep = "")) printTextProtocol(tests, showDetails = TRUE, fileName = paste(pathReport, ".txt", sep = "")) ## stop() if there are any failures i.e. FALSE to unit test. ## This will cause R CMD check to return error and stop tmp <- getErrors(tests) if (tmp$nFail > 0 | tmp$nErr > 0) { stop(paste("\n\nunit testing failed (#test failures: ", tmp$nFail, ", R errors: ", tmp$nErr, ")\n\n", sep="")) } } } else { message("Unable to load R package 'RUnit'. No unit tests run.") }