Apologies if this shows up a second time with uninformative header (apparently it got filtered, but ...), as I forgot to replace the subject line.

As a first try, use a bounds constrained method (L-BFGS-B or one from the r-forge Optimizer project http://r-forge.r-project.org/R/?group_id=395) and then add a penalty or barrier function to your objective function to take care of the
x1+x2 < 1  (the other end is implicit in the lower bounds on x1 and x2).

e.g.,   - const * log(1-x1-x2)

You should provide a feasible starting point. const scales the penalty.

Cheers, JN



> Message: 27
> Date: Sat, 17 Oct 2009 13:50:10 -0700 (PDT)
> From: kathie <kathryn.lord2...@gmail.com>
> Subject: [R]  optimization problem with constraints...
> To: r-help@r-project.org
> Message-ID: <25941686.p...@talk.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> Dear R users,
> I need some advises on how to use R to optimize a nonlinear function with
> the following constraints.
>
> f(x1,x2,x3,x4,x5,x6)
> s.t
> 0 < x1 < 1
> 0 < x2 < 1
> 0 < x1+x2 < 1
> -inf < x3 < inf
> -inf < x4 < inf
> 0 < x5 < inf
> 0 < x6 < inf
>
> Is there any built-in function or something for these constraint??
>
> Any suggestion will be greatly appreciated.
>
> Regards,
>
> Kathryn Lord -- View this message in context: http://www.nabble.com/optimization-problem-with-constraints...-tp25941686p25941686.html Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to