Error using the Rdonlp2‏ Package

View: New views
3 Messages — Rating Filter:   Alert me  

Error using the Rdonlp2‏ Package

by Lars Bishop-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
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.

Re: Error using the Rdonlp2‏ Package

by Ravi Varadhan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: Error using the Rdonlp2‏ Package

by Ryuichi Tamura :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thank you for using Rdonlp2.

2009/7/4 Lars Bishop <lars52r@...>:

> Error in tryCatchList(expr, classes, parentenv, handlers) :
>  SET_VECTOR_ELT() can only be applied to a 'list', not a 'character'

I guess you are using an older version of Rdonlp2 that is incompatible
to R-2.9.0. I have fixed the "SET_VECTOR_ELT" issue and packed the
archive as Rdonlp2-0.4 which is available at:
http://arumat.net/Rdonlp2/Rdonlp2_0.4-1.zip ; windows
http://arumat.net/Rdonlp2/Rdonlp2_0.4_i386-apple-darwin8.11.1.tar.gz ; mac
http://arumat.net/Rdonlp2/Rdonlp2_0.4.tar.gz  ; source

I'm sorry for inconvenience.

# Those using R version < 2.9.0 need not update it.

Regards,

Ryuichi TAMURA,

Doctoral Program in International Public Policy,
University of Tsukuba

______________________________________________
R-help@... 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.