[R] Fine tunning rgenoud

Paul Smith phhs80 at gmail.com
Wed Jul 4 16:22:38 CEST 2007


On 7/4/07, Paul Smith <phhs80 at gmail.com> wrote:
> On 7/4/07, RAVI VARADHAN <rvaradhan at jhmi.edu> wrote:
> > My point is that it might be better to try multiple (feasible) starting values for constrOptim to ensure that you have a good local minimum, since it appears that constrOptim converges to a boundary solution where the gradient is non-zero.  That is why my code could be useful.
>
> Thanks, Ravi. I have used your function, which works pretty fine.
> However, constrOptim returns solutions markedly different, depending
> on the starting values. That is true that I am expecting a solution in
> the boundary, but should not constrOptim find boundary solutions
> correctly? The set of solution that I got is below.

Unless, there are many local optimal solutions...

Paul


> --------------------------------
>
> 2.67682495728743e-08    0.676401684216637       5.18627076390355e-09    0.00206463986063195     0.87185968612836        4.32039325909089e-11    0.999999999996234
> 3.71711020733097e-08    0.539853580957444       1.82592937615235e-08    0.00206941041763503     0.93305250393447        2.08076621230984e-11    0.999999999995774
> 1.55648443014316e-08    0.356047772992972       8.61341165816411e-09    0.00207149128044574     0.939531540703735       2.55211186629222e-12    0.999999999999424
> 2.20685747493755e-07    0.575689534431218       5.30976753476747e-08    0.00210500604605837     0.588947341576757       3.1310360048386e-10     0.999999999998789
> 1.92961662926727e-08    0.773588030510204       1.04841835042200e-08    0.00206723852358352     0.816755014708394       3.89478290348532e-11    0.999999999997794
> 0.000279824051289082    0.000310992385522886    1.01467522935252e-06    3.11645639181419e-05    0.00249801538651552     3.0978819115532e-05     7.11821104872585e-06
> 2.81901448690893e-07    0.381718731525906       4.72860507882539e-08    0.00206807672109157     0.769178513763055       1.39278079797628e-09    0.999999999967123
> 5.58938545019597e-05    0.00171253668169328     4.54005998518212e-09    0.00165663757292733     0.00247994862102590     6.20992250482468e-06    0.419169641865998
> 1.03300938985890e-08    0.438357835603591       6.89854079723234e-09    0.00206693286138396     0.977554885433201       1.17209206267609e-10    0.99999999996921
> 7.63336821363444e-05    0.00177141538041517     1.88050423143828e-10    0.00169507950991094     0.00249739505142207     8.4814984916537e-06     0.470929220605509
> 9.16005846107533e-09    0.682179815036755       1.63255733785783e-09    0.00206922107327189     0.919323193130209       5.71436138398897e-11    0.99999999999629
> 1.40968913167328e-08    0.343606628343661       1.33227447885302e-08    0.00206789984370423     0.343671264496824       1.11679312116211e-11    0.999999999999822
> 4.76054734844857e-09    0.593022549313178       2.28102966623129e-09    0.00206625165098398     0.947562121256448       8.9437610753173e-11     0.999999999999992
> 1.96950784184139e-07    0.579488113726155       1.61915231214025e-07    0.00208000350528798     1.00891340595040        1.22248906754713e-10    0.999999999996493
> 8.1448937742933e-09     0.441088618716555       4.54846390087941e-09    0.00207634940425852     0.446155700100820       4.81439647816238e-12    0.99999999999939
> 4.82439218405912e-08    0.557771049256698       3.53737879481732e-08    0.0020663035737319      0.588137767965923       2.6568947800491e-11     0.999999999988615
> 2.43086751126363e-08    0.522927598354163       2.26886829089137e-08    0.00206533531066324     0.611696593543814       4.51226610050184e-11    0.999999999999087
> 3.05498959434100e-08    0.465522202845817       1.09246302124670e-08    0.00207004066920179     0.465583376966915       3.24213847202457e-11    0.999999999997366
> 1.88687179088788e-07    0.783614197203923       4.51346471059839e-08    0.00222403775221293     0.786422171740329       8.17865794171933e-10    0.999999999986103
> 1.0154423824979e-08     0.302657777579883       9.06923080122203e-09    0.00206615353968094     0.359722316646974       8.27866320956902e-12    0.99999999998461
> 8.91008717665837e-08    0.0020661526864997      3.08619455858999e-09    0.00206579199039568     0.00275523149199496     9.55650084108725e-09    0.985185595958656
> 1.25320647920029e-07    0.635217955401437       7.44627883600107e-08    0.00206656250455391     0.855937507707323       3.70326032870889e-10    0.999999999998375
> 2.57618374406559e-08    0.636499151952225       1.09822023878715e-08    0.00206677354204888     0.772636071860102       8.99370944431481e-11    0.999999999978744
> 1.09474196877990e-08    0.501469973722704       1.19992915868609e-10    0.00206117941606503     0.501594064757161       1.34320044786225e-11    0.999999999991232
> 5.24203710193977e-05    0.000127998340144109    3.33258623630601e-09    7.55779680724378e-05    0.00248898574263025     5.82411313482383e-06    0.0221497278110802
> 3.80217498132259e-07    0.57664568703189        1.01755510162620e-08    0.00207232950382402     0.944031557945531       5.30703662426069e-10    0.999999999995957
> 1.45159816281038e-09    0.391742001993341       1.13492553980291e-09    0.00206615324883312     0.73041632635671        2.05351961803669e-11    0.99999999997684
> 8.74006318627465e-05    0.00176059707830211     1.94489765002966e-09    0.00167319599216734     0.00234472182706612     9.710963192258e-06      0.358282221037878
> 0.000238275046444342    0.000264776586825777    4.40904795740029e-10    2.64911355650347e-05    0.00259858019547791     2.64749446522330e-05    1.83580740341509e-07
> 7.39730651399581e-10    0.00908091738218919     2.48425610406978e-10    0.00206667909063917     0.00928420674840742     5.18131986840764e-11    0.99999875366957
> 6.76489417503509e-08    0.66948409231674        3.03852881114497e-08    0.00207327594614506     0.82038550137061        2.64031575134214e-11    0.999999999984622
> 2.47578596556463e-05    0.00192273935278028     1.23710433232059e-10    0.00189797520967688     0.00249714264227544     2.75085723641778e-06    0.654395200885401
> 1.89137722020867e-08    0.611106915103611       3.89703191870382e-09    0.00210184590871973     0.624411027730728       8.5135512646264e-11     0.99999999999684
> 0.00019176743398086     0.000561608946531094    3.86469382998825e-10    0.000369840972771214    0.00250444089363261     2.13074457599853e-05    0.0571352017772342
> 0.000185606084629350    0.000206269128591342    1.56795453162326e-11    2.06627190417154e-05    0.00249993097016385     2.06228887085015e-05    1.71605199821395e-06
> 6.07957336199056e-08    0.483682520205442       5.5863930138716e-09     0.00206322767692575     0.483682695616455       5.34362969147144e-11    0.999999999999643
> 2.32535804244419e-08    0.479995736120651       1.71422519965926e-08    0.00207338945556393     0.510141538832558       1.48964674702430e-11    0.999999999993732
> 8.9183702782689e-06     0.00206653282852738     1.75762003328053e-10    0.00205761314408722     0.00252353219843752     9.9090949737504e-07     0.833268509557228
> 1.98549228223182e-06    0.251617257564206       1.05359270191879e-06    0.0022260243792503      0.251624161164046       9.60072596752024e-08    0.99999999999983
> 3.98028438135354e-08    0.547004412551238       3.46420325883517e-08    0.00206593124574590     0.780233389945956       4.31912137883551e-11    0.999999999999248
> 7.415833973742e-09      0.411955745727431       6.63826778226352e-09    0.00206692655795474     0.422974654599724       6.0360458732987e-12     0.999999999999735
> 2.31198818168677e-09    0.00651214491263961     1.32346818065092e-09    0.00206600061742381     0.0308298577099849      1.09702273280814e-10    0.99987783901442
> 4.17312889043775e-08    0.535841994679291       2.16650907799191e-08    0.00206804295529002     0.59999577506709        1.18576996500002e-10    0.999999999999237
> 3.06571185479614e-08    0.210504230265054       2.05714086443132e-08    0.00206707615217700     0.218748559037881       2.15131848511398e-14    0.999999999993557
> 2.75615889053932e-09    0.410462493146348       1.61078464820130e-09    0.00206420001019636     0.410565659594555       9.40738331890563e-11    0.999999999999952
> 4.56613193593397e-09    0.408415058997493       2.33397373332447e-09    0.00206711241339086     0.532349316444773       6.74887208834456e-11    0.99999999999929
> 7.18189347926295e-08    0.456169544603848       5.38996419605601e-08    0.00206990174706466     1.10900729793115        1.09308927282691e-13    0.999999999990783
> 0.000188732057072893    0.000209745553735604    2.65570357321341e-11    2.10123232762018e-05    0.00249946399527847     2.09702247828353e-05    7.56804739408697e-07
> 5.85086685972612e-08    0.586106422015639       3.34740271798516e-08    0.00207017375045705     1.02476378656892        7.7586558103274e-11     0.999999999999751
> 0.000110963331385117    0.000134315151780862    1.07242866306447e-06    2.33497881113803e-05    0.00255535434807175     1.22100977811675e-05    0.0100715104652649
> 6.74756547544261e-05    0.00181277651670570     2.06882429964314e-10    0.0017453002881811      0.00248364499775618     7.49727080120661e-06    0.477865304416143
> 2.12169576142447e-09    0.258696699048681       3.83834275215625e-10    0.00206572907235368     0.593016720449582       2.47234004478185e-11    0.999999999976093
> 4.90290042793427e-08    0.845133894257049       4.26659941495083e-08    0.00206573635916222     0.846607006638287       2.63753283209851e-10    0.999999999994938
> 1.82215438136793e-08    0.80366504831158        1.78340820866931e-08    0.00225471081235068     0.805133180734986       2.65837229120276e-12    0.999999999992972
> 4.73449331282602e-08    0.284890209400889       3.18447541813436e-08    0.00206840481685483     0.808166776706798       4.05949074947464e-10    0.999999999996061
> 1.09692979675704e-08    0.504203767689845       1.91188777015599e-09    0.00206788476221373     0.706912076703946       4.06894266747559e-11    0.99999999999973
> 4.34112012988195e-08    0.458125660334097       6.46770375936903e-09    0.00207007623328698     0.625303714142111       1.01347377674089e-10    0.999999999992636
> 1.16509068624767e-07    0.598772124413396       1.83783072861908e-08    0.00207311616484422     0.649412674861061       1.72090788969858e-10    0.999999999982887
> 1.72904399298124e-08    0.58859841513479        5.56864060572789e-09    0.00206902943325815     0.834770114923498       4.44826394221343e-11    0.999999999998404
> 1.95167889112074e-07    0.680051903362475       4.07870548730064e-08    0.0021048787521164      0.758987053084469       3.35901569072651e-10    0.999999999999464
> 1.06657670445553e-08    0.705185947467634       5.468246700687e-09      0.00206717328235464     0.852353580488024       9.79781097317382e-11    0.999999999997673
> 3.38906655480421e-08    0.675066389889348       5.7356420037523e-09     0.00206939927716748     0.864714866878808       3.50701456652884e-10    0.999999999999926
> 4.72130896241037e-09    0.193480077858215       4.09642232386814e-09    0.00206639690357456     0.193772609031377       2.22379321541448e-11    0.999999999992884
> 3.55665252909232e-08    0.620669750121032       1.90641809388101e-08    0.00206864461846135     0.622207402604423       3.55684392133601e-11    0.999999999999635
> 3.43643575170166e-08    0.508032144170851       3.05576064051123e-08    0.0020666442030495      0.537473527046566       5.41317633959989e-12    0.999999999991207
> 2.07413577081273e-08    0.517006009937055       1.78794895322523e-08    0.00206609160101216     0.723546217083115       4.25770563404542e-11    0.999999999977351
> 2.9634111809255e-08     0.678167734702809       2.87136255305397e-08    0.00207005922065176     0.680058941948453       4.86294997869349e-11    0.999999999997674
> 2.70007729246723e-08    0.777109777637737       2.23198659183296e-08    0.00211784135373727     0.821904778895813       2.72480529179635e-10    0.999999999999417
> 1.21638582096581e-05    0.685066257234478       3.90995182181942e-06    0.00201558375343728     0.685516429216796       4.73765370536012e-08    0.999999999999993
> 6.21341332802845e-08    0.45153366532873        4.28836207599489e-08    0.00205228864113157     0.630886659065685       2.01031448944481e-10    0.999999999976095
> 1.19446880731148e-06    0.00204849378641721     5.41758686583886e-10    0.00204660358124349     0.00250002927315376     1.32657483581135e-07    0.926358671695374
> 4.23724996341138e-07    0.76589882078562        1.07976473375288e-07    0.00231084075578484     0.772123021534594       4.222800306051e-09      0.99999999999554
> 9.76490929801592e-09    0.611133237912937       3.40654501481527e-09    0.00206753317060016     0.624278286034974       1.35688861199835e-11    0.999999999991987
> 0.000185800168507657    0.000206604414024173    1.51257663200075e-10    2.08040548465085e-05    0.00249987187225613     2.06444402710859e-05    1.00090667437022e-05
> 4.87431144092831e-09    0.486985270937825       1.01147265793908e-09    0.00206873578985202     0.494229783529316       2.1163667211661e-12     0.999999999999217
> 1.58678140422157e-08    0.458475824861338       3.728478508397e-09      0.00206665340523142     0.822538576890515       6.73647051811321e-11    0.999999999992949
> 7.78797943133767e-07    0.00201714819466376     1.00271036821046e-09    0.00201517307886584     0.00243247068677390     8.6420943116519e-08     0.946415585057681
> 1.79734244345473e-07    0.618114350664356       8.41196223101054e-08    0.00209424634015987     1.09808725088463        1.36311179064841e-09    0.999999999999325
> 4.04750622932535e-06    0.00202435649740235     9.55231839434103e-11    0.00202030658534268     0.00249780762721203     4.49711157881299e-07    0.878051982789172
> 3.27944009298396e-08    0.710329613922295       2.02989735589882e-08    0.00206702754480486     0.713789321637634       4.43500632164969e-12    0.99999999998325
> 3.6211203640154e-08     0.486990872484964       2.23029819494578e-08    0.00206834819984283     0.925447188571729       1.43913590315638e-10    0.999999999999852
> 1.52117049757253e-08    0.499368102973816       5.70289700988348e-09    0.00206632041653347     0.688163413575525       6.86450078797379e-11    0.99999999998881
> 2.14084286484963e-08    0.669902287842233       1.64604388157258e-08    0.00206787121557579     0.675669448264383       3.05725070183645e-11    0.99999999999783
> 4.64383080200508e-05    0.00188125145190771     2.92580309919556e-10    0.00183481310287054     0.00250971056566956     5.15977640139516e-06    0.571340025768215
> 3.11099577796555e-08    0.319299482089934       8.84023352637676e-09    0.00206855023112842     0.441077204370492       1.10446087116967e-09    0.999999999995467
> 0.000102965203269986    0.0016493488546921      2.58445958349384e-10    0.00154638327053218     0.00250288634336625     1.14405481683120e-05    0.342341363715383
> 5.87912519479874e-09    0.00301357388024528     2.75211293457077e-10    0.00206603126487256     0.00686204622812863     6.1682829968701e-10     0.999931564740833
> 8.28694064868836e-08    0.673413934917665       5.55691871872657e-08    0.00206648968616976     0.690994737517309       8.53762213679993e-11    0.99999999999553
> 2.78964308878308e-08    0.631906605077265       1.87081150212841e-08    0.00206682302780812     1.04912853459322        1.19798263785958e-10    0.999999999998404
> 0.000186009655330342    0.000206938973112988    1.18525336022574e-09    2.09286186935030e-05    0.00249989443096258     2.06676012144089e-05    2.57319855839169e-06
> 5.79914576203232e-05    0.00181271191072469     1.15884908131972e-09    0.00175471081855071     0.0024812702174432      6.44334507197721e-06    0.509698530097913
> 2.0503183260964e-08     0.546450460261978       1.27059638843222e-08    0.00206791702172114     1.14082199649402        8.5751965370755e-12     0.99999999999683
> 3.66836690280629e-08    0.481874078118496       3.13611734401948e-08    0.00207354422550728     0.990376379663234       2.13707863395726e-10    0.999999999975761
> 1.77224405556878e-08    0.493128575789259       8.63845133717168e-09    0.00207307974398005     0.493553411995952       3.19150428367562e-11    0.999999999999902
> 0.000119234853016321    0.00194143059603129     2.65621637099599e-10    0.00182214114564480     0.00258385562559042     1.32482776896270e-05    0.564809333872708
> 1.91321783130778e-07    0.00205131977291163     2.45737561775750e-10    0.00205112100576657     0.00251498989989795     2.12303674145017e-08    0.981038377325434
> 2.04970869809e-09       0.61540968024267        1.80692316850342e-10    0.00206758160218205     0.616881623876956       9.88879753424694e-11    0.999999999998682
> 2.28380664111838e-07    0.495196927735637       2.03520983522517e-07    0.00206484911183903     0.495729865740038       3.10063601627842e-10    0.999999999998029
> 0.000142663207352814    0.00136226156979156     2.47224893929883e-11    0.00121959537442013     0.00249964872330666     1.58514632925203e-05    0.213308634647407
>
>
>
> > ----- Original Message -----
> > From: Paul Smith <phhs80 at gmail.com>
> > Date: Wednesday, July 4, 2007 6:00 am
> > Subject: Re: [R] Fine tunning rgenoud
> > To: R-help <r-help at stat.math.ethz.ch>
> >
> >
> > > On 7/4/07, RAVI VARADHAN <rvaradhan at jhmi.edu> wrote:
> > >  > Here is another approach: I wrote an R function that would generate
> > > interior points as starting values for constrOptim.  This might work
> > > better than the LP approach, since the LP approach gives you a
> > > starting value that is on the boundary of the feasible region, i.e a
> > > vertex of the polyhedron, whereas this new approach gives you points
> > > on the interior.  You can generate as many points as you wish, but the
> > > approach is brute-force and is very inefficient - it takes on the
> > > order of a 1000 tries to find one feasible point.
> > >
> > >  Thanks again, Ravi. Actually, the LP approach also works here. Let
> > >  g(X) >= k be the constraints. Then, by solving a LP problem with the
> > >  constraints
> > >
> > >  g(X) >= (k+0.2)
> > >
> > >  returns an interior starting value for constrOptim. I am aware that
> > >  the new set of constraints may correspond to an impossible linear
> > >  system, but it works in many cases.
> > >
> > >  Paul
> > >
> > >  > ----- Original Message -----
> > >  > From: Paul Smith <phhs80 at gmail.com>
> > >  > Date: Tuesday, July 3, 2007 7:32 pm
> > >  > Subject: Re: [R] Fine tunning rgenoud
> > >  > To: R-help <r-help at stat.math.ethz.ch>
> > >  >
> > >  >
> > >  > > On 7/4/07, Ravi Varadhan <rvaradhan at jhmi.edu> wrote:
> > >  > >  > It should be easy enough to check that your solution is valid
> > > (i.e.
> > >  > > a local
> > >  > >  > minimum):  first, check to see if the solution satisfies all the
> > >  > >  > constraints; secondly, check to see if it is an interior point
> > >  > > (i.e. none of
> > >  > >  > the constraints become equality); and finally, if the solution
> > > is an
> > >  > >  > interior point, check to see whether the gradient there is
> > > close to
> > >  > > zero.
> > >  > >  > Note that if the solution is one of the vertices of the polyhedron,
> > >  > > then the
> > >  > >  > gradient may not be zero.
> > >  > >
> > >  > >  I am having bad luck: all constraints are satisfied, but the solution
> > >  > >  given by constrOptim is not interior; the gradient is not equal
> > > to
> > >  > >  zero.
> > >  > >
> > >  > >  Paul
> > >  > >
> > >  > >
> > >  > >  > -----Original Message-----
> > >  > >  > From: r-help-bounces at stat.math.ethz.ch
> > >  > >  > [ On Behalf Of Paul Smith
> > >  > >  > Sent: Tuesday, July 03, 2007 5:10 PM
> > >  > >  > To: R-help
> > >  > >  > Subject: Re: [R] Fine tunning rgenoud
> > >  > >  >
> > >  > >  > On 7/3/07, Ravi Varadhan <rvaradhan at jhmi.edu> wrote:
> > >  > >  > > You had indicated in your previous email that you are having
> > > trouble
> > >  > >  > finding
> > >  > >  > > a feasible starting value for constrOptim().  So, you basically
> > >  > > need to
> > >  > >  > > solve a system of linear inequalities to obtain a starting point.
> > >  > >  Have
> > >  > >  > you
> > >  > >  > > considered using linear programming? Either simplex() in the
> > > "boot"
> > >  > >  > package
> > >  > >  > > or solveLP() in "linprog" would work.  It seems to me that you
> > >  > > could use
> > >  > >  > any
> > >  > >  > > linear objective function in solveLP to obtain a feasible
> > >  > > starting point.
> > >  > >  > > This is not the most efficient solution, but it might be
> > > worth a
> > >  > > try.
> > >  > >  > >
> > >  > >  > > I am aware of other methods for generating n-tuples that satisfy
> > >  > > linear
> > >  > >  > > inequality constraints, but AFAIK those are not available in
> > > R.
> > >  > >  >
> > >  > >  > Thanks, Ravi. I had already conceived the solution that you suggest,
> > >  > >  > actually using "lpSolve". I am able to get a solution for my problem
> > >  > >  > with constrOptim, but I am not enough confident that the
> > > solution is
> > >  > >  > right. That is why I am trying to get a solution with rgenoud,
> > > but
> > >  > >  > unsuccessfully until now.
> > >  > >  >
> > >  > >  > Paul
> > >  > >  >
> > >  > >  >
> > >  > >  >
> > >  > >  > > -----Original Message-----
> > >  > >  > > From: r-help-bounces at stat.math.ethz.ch
> > >  > >  > > [ On Behalf Of Paul Smith
> > >  > >  > > Sent: Tuesday, July 03, 2007 4:10 PM
> > >  > >  > > To: R-help
> > >  > >  > > Subject: [R] Fine tunning rgenoud
> > >  > >  > >
> > >  > >  > > Dear All,
> > >  > >  > >
> > >  > >  > > I am trying to solve the following maximization problem, but
> > > I cannot
> > >  > >  > > have rgenoud giving me a reliable solution.
> > >  > >  > >
> > >  > >  > > Any ideas?
> > >  > >  > >
> > >  > >  > > Thanks in advance,
> > >  > >  > >
> > >  > >  > > Paul
> > >  > >  > >
> > >  > >  > > ----------------------------
> > >  > >  > > library(rgenoud)
> > >  > >  > >
> > >  > >  > > v <- 0.90
> > >  > >  > > O1 <- 10
> > >  > >  > > O2 <- 20
> > >  > >  > > O0 <- v*O1+(1-v)*O2
> > >  > >  > >
> > >  > >  > > myfunc <- function(x) {
> > >  > >  > >   U0 <- x[1]
> > >  > >  > >   U1 <- x[2]
> > >  > >  > >   U2 <- x[3]
> > >  > >  > >   q0 <- x[4]
> > >  > >  > >   q1 <- x[5]
> > >  > >  > >   q2 <- x[6]
> > >  > >  > >   p <- x[7]
> > >  > >  > >
> > >  > >  > >   if (U0 < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if (U1 < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if (U2 < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if ((U0-(U1+(O1-O0)*q1)) < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if ((U0-(U2+(O2-O0)*q2)) < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if ((U1-(U0+(O0-O1)*q0)) < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if ((U1-(U2+(O2-O1)*q2)) < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if((U2-(U0+(O0-O2)*q0)) < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if((U2-(U1+(O1-O2)*q1)) < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if(p < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if(p > 1)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if(q0 < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if(q1 < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else if(q2 < 0)
> > >  > >  > >     return(-1e+200)
> > >  > >  > >   else
> > >  > >  > >
> > >  > >  > return(p*(sqrt(q0)-(O0*q0+U0))+(1-p)*(v*(sqrt(q1)-(O1*q1+U1))+(1-v)*(sqrt(q2
> > >  > >  > > )-(O2*q2+U2))))
> > >  > >  > >
> > >  > >  > > }
> > >  > >  > >
> > >  > >  > genoud(myfunc,nvars=7,max=T,pop.size=6000,starting.values=runif(7),wait.gene
> > >  > >  > > rations=150,max.generations=300,boundary.enforcement=2)
> > >  > >  > >
> > >  > >  > > ______________________________________________
> > >  > >  > > R-help at stat.math.ethz.ch mailing list
> > >  > >  > >
> > >  > >  > > PLEASE do read the posting guide
> > >  > >  >
> > >  > >  > > and provide commented, minimal, self-contained, reproducible
> > > code.
> > >  > >  > >
> > >  > >  >
> > >  > >  > ______________________________________________
> > >  > >  > R-help at stat.math.ethz.ch mailing list
> > >  > >  >
> > >  > >  > PLEASE do read the posting guide
> > >  > >  > and provide commented, minimal, self-contained, reproducible code.
> > >  > >  >
> > >  > >
> > >  > >  ______________________________________________
> > >  > >  R-help at stat.math.ethz.ch mailing list
> > >  > >
> > >  > >  PLEASE do read the posting guide
> > >  > >  and provide commented, minimal, self-contained, reproducible code.
> > >  >
> > >  >
> > >
> > >  ______________________________________________
> > >  R-help at stat.math.ethz.ch mailing list
> > >
> > >  PLEASE do read the posting guide
> > >  and provide commented, minimal, self-contained, reproducible code.
> >
>



More information about the R-help mailing list