[R] constrained optimization
Christophe Pouzat
christophe.pouzat at univ-paris5.fr
Fri May 20 18:27:26 CEST 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?
>
>
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
More information about the R-help
mailing list