Try adding a penalty term, e,g,
lambda <- 1e3
f <- function(x) crossprod(x-a) + lambda * (crossprod(x, b) - 50)^2
optim(a, f)
On Jan 30, 2008 12:01 PM, Attiglah, Mama <[EMAIL PROTECTED]> wrote:
>
>
>
> Hi room,
> Is there any R package that solves a non linear objective pb, with
> linear equalit
Hi room,
Is there any R package that solves a non linear objective pb, with
linear equality constraint?
A simple example
a =c (2, 5, 6, 7, 2)
b = c (7, 1, 4, 5, 6)
a and b are vectors of length 5
minimise f(x, a) = sum( (x-a)^2) such that sum( x*b) = 50.
where x is the control var
2 matches
Mail list logo