Hi,
What type of constraints do you have? If they are inequality constraints, you do not need to impose them using the lagrangian. You can specify them separately.
The help page does not say anything about equality constraints. The documentation on
http://arumat.net/Rdonlp2 recommenda that you set the upper and lower limits to be equal to impose this.
IN any case, you do not need to specify the lagrangian.
Hope this helps,
Ravi.
____________________________________________________________________
Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email:
rvaradhan@...
----- Original Message -----
From: Lars Bishop <
lars52r@...>
Date: Friday, July 3, 2009 6:49 pm
Subject: [R] Error using the Rdonlp2 Package
To:
r-help@...
> Dear experts,
>
> I'm attempting to solve a constrained optimization problem using the
> Rdonlp2
> package.
>
> I created a Lagrange function (L=f(x)-lambda(g(x)-c)), where x is a vector
> of 16 parameters. This is what I'm using as objective function in the
> code
> below. In addition, I set bounds on these parameters (par.u and
> par.l). When
> I run the code, I get the error message shown below. Any idea why or
> what
> does it mean?
>
> Thanks in advance for your help!
>
> ans <- donlp2(par=rate0, fn=L,par.u=par.u, par.l=par.l)
>
> 1 fx= 2.869234e+08 upsi= 0.0e+00 b2n= 5.0e+08 umi= 0.0e+00 nr
> 0
> si-1
> 2 fx= -2.111002e+09 upsi= 0.0e+00 b2n= 5.1e+08 umi= 0.0e+00 nr
> 14
> si-1
> 3 fx= -5.961701e+09 upsi= 0.0e+00 b2n= 4.1e+08 umi= 0.0e+00 nr
> 16
> si-1
>
> *Error Message:*
>
> Error in tryCatchList(expr, classes, parentenv, handlers) :
> SET_VECTOR_ELT() can only be applied to a 'list', not a 'character'
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
>
R-help@... mailing list
>
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.