[R] Most appropriate function for the following optimisation issue?

Paul Smith phhs80 at gmail.com
Tue Oct 20 19:00:37 CEST 2015


On Tue, Oct 20, 2015 at 11:58 AM, Andy Yuan <yuan007 at gmail.com> wrote:
>
> Please could you help me to select the most appropriate/fastest function to use for the following constraint optimisation issue?
>
> Objective function:
>
> Min: Sum( (X[i] - S[i] )^2)
>
> Subject to constraint :
>
> Sum (B[i] x X[i]) =0
>
> where i=1…n and S[i] and B[i] are real numbers
>
> Need to solve for X
>
> Example:
>
> Assume n=3
>
> S <- c(-0.5, 7.8, 2.3)
> B <- c(0.42, 1.12, 0.78)
>
> Many thanks

I believe you can solve *analytically* your optimization problem, with
the Lagrange multipliers method, Andy. By doing so, you can derive
clean and closed-form expression for the optimal solution.

Paul



More information about the R-help mailing list