Hello, I've got to compute a minimization equation under an equality constraint (Min g(x1,x2,x3) with x1+x2=const). The Constroptim function does not authorize an equality condition but only inequality conditions. Which function can I use instead? Thank you very much for your help. Gael Robert - +33 1 42 14 27 96 ****************************************************************** This message and any attachments (the "message") are confide...{{dropped}}
On Friday 20 May 2005 17:32, gael.robert at socgen.com wrote:> Hello, > I've got to compute a minimization equation under an equality constraint > (Min g(x1,x2,x3) with x1+x2=const). The Constroptim function does not > authorize an equality condition but only inequality conditions. Which > function can I use instead? > Thank you very much for your help. > Gael Robert - +33 1 42 14 27 96You do not need constraints if you minimize g( x1, const - x1, x3 ) with respect to x1 and x3. After that you can calculate x2 by x2 = const - x1 HTH, Arne> ****************************************************************** > This message and any attachments (the "message") are confide...{{dropped}} > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html-- Arne Henningsen Department of Agricultural Economics University of Kiel Olshausenstr. 40 D-24098 Kiel (Germany) Tel: +49-431-880 4445 Fax: +49-431-880 1397 ahenningsen at agric-econ.uni-kiel.de http://www.uni-kiel.de/agrarpol/ahenningsen/
Why can't you just solve x1 in terms of x2 and plug it in.. ie. min g(const-x2, x2, x3) Jean On Fri, 20 May 2005 gael.robert at socgen.com wrote:> Hello, > I've got to compute a minimization equation under an equality constraint > (Min g(x1,x2,x3) with x1+x2=const). The Constroptim function does not > authorize an equality condition but only inequality conditions. Which > function can I use instead? > Thank you very much for your help. > Gael Robert - +33 1 42 14 27 96 > > > > ****************************************************************** > This message and any attachments (the "message") are confide...{{dropped}} > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
gael.robert at socgen.com wrote:>Hello, >I've got to compute a minimization equation under an equality constraint >(Min g(x1,x2,x3) with x1+x2=const). The Constroptim function does not >authorize an equality condition but only inequality conditions. Which >function can I use instead? > >Hi, What about trying to minimize, g(x1, const-x1, x3), by defining a new function like: g.new <- function(para, const) g(para[1], const-para[1], para[2]) where para would be an array with 2 components, the first corresponding to x1 and the second to x3. Then optim(par = my.para, fn = g.new, const = my.const) should do the job, where my.para is the vector of initial guesses for x1 and x3 and my.const is the value of x1+x2. Does that help? Xtof. Christophe Pouzat Laboratoire de Physiologie Cerebrale CNRS UMR 8118 UFR biomedicale de l'Universite Paris V 45, rue des Saints Peres 75006 PARIS France tel: +33 (0)1 42 86 38 28 fax: +33 (0)1 42 86 38 30 web: www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html