search for: rosenbrock

Displaying 20 results from an estimated 27 matches for "rosenbrock".

Did you mean: dasenbrock
2005 Dec 04
1
Understanding nonlinear optimization and Rosenbrock's banana valley function?
...is and Its Applications (Wiley), especially for its key insights regarding parameter effects vs. intrinsic curvature. Before I spent time and money on several of the refences cited on the help pages for "optim", "nlm", etc., I thought I'd ask you all for your thoughts. ROSENBROCK'S BANANA VALLEY FUNCTION? Beyond this, I wonder if someone help me understand the lessons one should take from Rosenbrock's banana valley function: banana <- function(x){ 100*(x[2]-x[1]^2)^2+(1-x[1])^2 } This a quartic x[1] and a parabola in x[2] with a unique minimum at x[...
2011 Jun 24
4
How to capture console output in a numeric format
...ke to know how to capture the console output from running an algorithm for further analysis. I can capture this using capture.output() but that yields a character vector. I would like to extract the actual numeric values. Here is an example of what I am trying to do. fr <- function(x) { ## Rosenbrock Banana function on.exit(print(f)) x1 <- x[1] x2 <- x[2] f <- 100 * (x2 - x1 * x1)^2 + (1 - x1)^2 f } fvals <- capture.output(ans <- optim(c(-1.2,1), fr)) Now, `fvals' contains character elements, but I would like to obtain the actual numerical values. How c...
2003 Oct 29
1
constrOptim doesn´t send arguments to optim!(?)
...ith the 'constrOptim' max/minimization function because she doesn?t send extra arguments to 'optim' call. Fact: When I use optim in a f(x,theta)-like function, everything goes ok. But using constrOptim with the same function leads to error... Proof: Make a small change in the 'Rosenbrock Banana function' (taken from the Examples section of those help pages) adding extra (useless) parameters: fr <- function(x,extra1,extra2) { ## Rosenbrock Banana function x1 <- x[1] x2 <- x[2] extra1*extra2*100 * (x2 - x1 * x1)^2 + (1 - x1)^2 } grr <- function(x,extra1...
2008 Oct 22
1
optim bug/help?
In the documentation for 'optim' it gives the following function: fr <- function(x) { ## Rosenbrock Banana function x1 <- x[1] x2 <- x[2] 100 * (x2 - x1 * x1)^2 + (1 - x1)^2 } optim(c(-1.2,1), fr) When I run this code I get: $par [1] 1.000260 1.000506 I am sure I am missing something but why isn't 1,1 a better answer? If I plug 1,1 in the function it seems that the functi...
2004 Jul 14
2
constrOptim and function with additional parameters?
How can I use a function with some additional input parameters in constrOptim? For example, something like fr <- function(x,a) { ## Rosenbrock Banana function x1 <- x[1] x2 <- x[2] a * (x2 - x1 * x1)^2 + (1 - x1)^2 } where the optimum is to be found w.r.t. x. Calling optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail to provide the a=100 in the constrained case: > constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind...
2023 Aug 05
1
feature request: optim() iteration of functions that return multiple values
...require any change to the original function being optimized, the following one-liner could be used, which converts existing functions to functions that return only the first element: returnFirst <- function(fun) function(...) do.call(fun,list(...))[[1]] Example: fr <- function(x) { ## Rosenbrock Banana function x1 <- x[1] x2 <- x[2] ans <- 100 * (x2 - x1 * x1)^2 + (1 - x1)^2 list(ans=ans, extra1 = 1:10, extra2 = letters) } fr2 <- returnFirst(fr) tmp <- optim(c(-1.2,1), fr2) fr(tmp$par) Am 03.08.23 um 22:21 schrieb Sami Tuomivaara: > Dear all, > > I h...
2009 Nov 18
1
bug in '...' of constrOptim (PR#14071)
...ld)) < outer.eps) break theta <- a$par obj <- f(theta, ...)##this one's NOT okay if (obj > obj.old) break } ###Here is an example modified from the examples of the help page of constrOptim: > fr <- function(x) { ## Rosenbrock Banana function + x1 <- x[1] + x2 <- x[2] + 100 * (x2 - x1 * x1)^2 + (1 - x1)^2 + } > grr <- function(x) { ## Gradient of 'fr' + x1 <- x[1] + x2 <- x[2] + c(-400 * x1 * (x2 - x1 * x1) - 2 * (1 - x1), + 200 * (x2 - x1 * x1)) + } > co...
2023 Aug 03
3
feature request: optim() iteration of functions that return multiple values
Dear all, I have used optim a lot in contexts where it would useful to be able to iterate function myfun that, in addition to the primary objective to be minimized ('minimize.me'), could return other values such as alternative metrics of the minimization, informative intermediate values from the calculations, etc. myfun <- function() { ... return(list(minimize.me = minimize.me, R2 =
2000 Mar 17
1
optim: problem with additional arguments (PR#493)
The R function "optim" fails when a function requires additional arguments, if the option "hessian=T" is specified. I am using R Version 1.0.0 on Windows 98. Here is an example of the Rosenbrock Banana function from the optim help example, with the function and gradient modified to take an additonal argument. Note that the call to optim works fine unless a hessian is requested. ## Rosenbrock Banana function, modified to take an additional argument fra <- function(x,a) {...
2009 Oct 20
1
Buglet in optim() SANN
I think SANN method in optim() is failing to report that it has not converged. Here is an example genrose.f<- function(x, gs=NULL){ # objective function ## One generalization of the Rosenbrock banana valley function (n parameters) n <- length(x) if(is.null(gs)) { gs=100.0 } fval<-1.0 + sum (gs*(x[1:(n-1)]^2 - x[2:n])^2 + (x[2:n] - 1)^2) return(fval) } xx<-rep(pi,10) test<-optim(xx,genrose.f,method="SANN",control=list(maxit=1000,trace=1)) print(...
2023 Aug 13
4
Noisy objective functions
While working on 'random walk' applications, I got interested in optimizing noisy objective functions. As an (artificial) example, the following is the Rosenbrock function, where Gaussian noise of standard deviation `sd = 0.01` is added to the function value. fn <- function(x) (1+rnorm(1, sd=0.01)) * adagio::fnRosenbrock(x) To smooth out the noise, define another function `fnk(x, k = 1)` that calls `fn` k times and returns the mean val...
2009 Aug 02
1
Inaccurate complex arithmetic of R (Matlab is accurate)
...It gives "exact" derivatives with only a minimal effort (same as that involved in computing first-order forward-difference derivative). Unfortunately, we cannot implement this in R as the "complex arithmetic" in R appears to be inaccurate. Here is an example: #-- Classical Rosenbrock function in n variables rosen <- function(x) { n <- length(x) x1 <- x[2:n] x2 <- x[1:(n-1)] sum(100*(x1-x2^2)^2 + (1-x2)^2) } x0 <- c(0.0094, 0.7146, 0.2179, 0.6883, 0.5757, 0.9549, 0.7136, 0.0849, 0.4147, 0.4540) h <- c(1.e-15*1i, 0, 0, 0, 0, 0, 0, 0, 0, 0) xh <- x0 + h rx...
2007 Aug 04
7
Optimization in R
...! beale brown-scaled freudenstein-roth gaussian * helical-valley * * jennrich-sampson * meyer * powell-scaled * rosenbrock * The table indiciates that all three implementations of BFGS failed to compute the right answer in most cases. I suppose this means they are all quite deficient. Of course, this doesn't imply that they perform badly on real statistics problems -- but in my limit...
2009 Apr 22
3
Help using spg optimization in BB package
i'm trying to use the BB package to minimize the sum of the squared deviations for 2 vectors. The only thing am having trouble with is defining the project constraint. I got the upper and lower bounds to work but i am not sure how to create a constraint that the sum of x must be 1. Any help would be greatly appreciated. -- View this message in context:
2010 Sep 17
0
question on OPTIMX with installing and using
...ollowing example, the error message shows: Error: package 'tools' does not have a name space any suggestions for the question on the upper two parts? any suggestion are apprecitated Nan from Montreal Example code from optimx manual: require(graphics) fr <- function(x) { ## Rosenbrock Banana function x1 <- x[1] x2 <- x[2] 100 * (x2 - x1 * x1)^2 + (1 - x1)^2 } grr <- function(x) { ## Gradient of 'fr' x1 <- x[1] x2 <- x[2] c(-400 * x1 * (x2 - x1 * x1) - 2 * (1 - x1), 200 * (x2 - x1 * x1)) } ans1<-optimx(c(-1.2,1), fr)
2011 Jan 12
1
extracting more information from optim in R?
Dear All, I am in the process of translating some of my functions into C and one such function sometimes get stuck when I applied optim. The pure R codes work fine but the translated C codes occasionally get stuck and I like to find out why. Is it possible to extract the parameters of function calculated in each step of the Nelder-Simplex algorithm, the trace option only produce the value of
2009 Apr 21
0
what is R best for? Evidence please.
...optimization one may want to use some other software. As I've been working (with Ravi Varadhan mainly) to try to improve what is now called optim(), I needed to test some new methods, including a variant of CG. Coding only in R on a pretty vanilla 3Ghz PC, I was surprised that a generalized Rosenbrock function in n=50000 parameters solved in less than 2 minutes. It seems a lot of my experiences in building routines that appear in optim() -- which were written on a machine with 8K (that's K) bytes for program AND data -- are really not valid any more. This has prompted us to try (and it...
2012 Feb 28
2
Valor Max Fun
Buenos días.Soy más bien nuevo en R, necesito saber ¿cómo encuentro el valor que maximiza una función? Existe alguna función de R que hace eso.Muchas gracias [[alternative HTML version deleted]]
2009 Aug 20
2
optimization free software
Hi i´m starting to work with free software (with free as in freedom) i've been working with GAMS (General Algebraic Modeling System) to solve static and dynamic optimization problems and non-linear large systems of equations i'm wondering if there is any free software and documentation on the subject, wether in R, Maxima, or something else i will appreciate any help and any references
2004 Jul 14
0
Re: [R] constrOptim and function with additional parameters? (PR#7088)
...:01 +0200 (MEST), "Marlene Mueller" >> <Marlene.Mueller@gmx.de> wrote : >> >> >>>How can I use a function with some additional input parameters >>>in constrOptim? For example, something like >>> >>>fr <- function(x,a) { ## Rosenbrock Banana function >>> x1 <- x[1] >>> x2 <- x[2] >>> a * (x2 - x1 * x1)^2 + (1 - x1)^2 >>>} >>> >>>where the optimum is to be found w.r.t. x. Calling >>>optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail >>>to...