Displaying 20 results from an estimated 6000 matches similar to: "L-BFGS-B needs finite values of 'fn'"
2008 Mar 31
2
L-BFGS-B needs finite values of 'fn'
Dear All,
I am trying to solve the optimization problem below, but I am always
getting the following error:
Error in optim(rep(20, nvar), f, gr, method = "L-BFGS-B", lower = rep(0,  :
  L-BFGS-B needs finite values of 'fn'
Any ideas?
Thanks in advance,
Paul
-----------------------------------------------
k <- 10000
b <- 0.3
f <- function(x) {
  n <- length(x)
2007 Jul 30
1
stop criteria when "L-BFGS-B needs finite values of 'fn' " in optim
Hi all!
I'm running some simulations and I need to estimate some paramaters with
optim( ),
 in some cases optim stops with the next message:
                               "L-BFGS-B needs finite values of 'fn' "
I would like to know how to include and "if" condition when this happen,
could it be something like:
myfun <- optim(....)         #   run my function
2000 Sep 26
2
bounds violations, infinite loops in optim/L-BFGS-B (PR#671)
I'm having some trouble with optim(method="L-BFGS-B"),
and I'm not sure I have the ability to track down and fix
what seem to be bugs within optim().
  I'm bootstrapping an original data set and fitting a model
to each bootstrapped data set.  For some bootstrapped samples,
optim() sets negative parameter values (despite the fact that
I have explicitly set non-zero lower
2004 Jan 05
3
optim function : "BFGS" vs "L-BFGS-B"
Dear kind R-experts.
Does anybody have an experience to use optim function?
If yes, what is the main difference between two method "BFGS" vs
"L-BFGS-B"?
I used "BFGS" method and got what I wanted. But when I used "L-BFGS-B"
the error message said that "L-BFGS-B needs finite values of fn". So
that means
"BFGS" method can handle even if fn
2011 Feb 25
2
BFGS versus L-BFGS-B
Hi all,
I'm trying to figure out the effective differences between BFGS and L-BFGS-B
are, besides the obvious that L-BFGS-B should be using a lot less memory,
and the user can provide box constraints.
1) Why would you ever want to use BFGS, if L-BFGS-B does the same thing but
use less memory?
2) If i'm optimizing with respect to a variable x that must be non-negative,
a common approach
2008 Apr 15
1
disturbing seed dependence in optim L-BFGS-B method
The the use of optim with the L-BFGS-B method for the following simple 
function gives erroneous results.  Any help appreciated!
Best,
Bob Reilly
# Code:
V=function(p){
p1=p[1];p2=p[2]
y=p1*p2-.4*(p1+p2)
return(-y)}
p=c(.2,.2) # p=c(.8,.8)
max=optim(p,V,method = "L-BFGS-B",lower=c(0,0),upper=c(1,1))
max1=optim(max$par,V,method = "L-BFGS-B",lower=c(0,0),upper=c(1,1))
2007 Jul 29
1
behavior of L-BFGS-B with trivial function triggers bug in stats4::mle
With the exception of "L-BFGS-B", all of the
other optim() methods return the value of the function
when they are given a trivial function (i.e., one with no
variable arguments) to optimize.  I don't think this
is a "bug" in L-BFGS-B (more like a response to
an undefined condition), but it leads to a bug in stats4::mle --
 a spurious error saying that a better fit
has been
2013 Oct 09
1
Version of L-BFGS-B used in optim etc
Hi.
I just noticed the paper by Morales and Nocedal
Remark on "Algorithm 778: L-BFGS-B: Fortran Subroutines for Large-Scale 
Bound Constrained Optimization". TOMS 2011; 38(1): 7
http://www.ece.northwestern.edu/~morales/PSfiles/acm-remark.pdf
which describes a couple of improvements (speed and accuracy) to the 
original Netlib code which AFAICT is that still used by optim() 
via f2c. 
2011 May 25
1
L-BFGS-B and parscale in optim()
Hi,
When using method L-BFGS-B along with a parscale argument, should the
lower and upper bounds provided be on the scaled or unscaled values?
Thanks.
Cheers,
-- 
Seb
2007 Apr 05
2
Likelihood returning inf values to optim(L-BFGS-B) other options?
Dear R-help list,
I am working on an optimization with R by evaluating a likelihood  
function that contains lots of Gamma calculations (BGNBD: Hardie Fader  
Lee 2005 Management Science). Since I am forced to implement lower  
bounds for the four parameters included in the model, I chose the  
optim() function mith L-BFGS-B as method. But the likelihood often  
returns inf-values which L-BFGS-B
2019 May 02
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
Dear all,
when using optim() for a function that uses the parent environment, I
see the following unexpected behavior:
makeFn <- function(){
??? xx <- ret <- NA
??? fn <- function(x){
?????? if(!is.na(xx) && x==xx){
?????????? cat("x=", xx, ", ret=", ret, " (memory)", fill=TRUE, sep="")
?????????? return(ret)
?????? }
?????? xx
2009 Apr 15
2
issue with L-BFGS-B in optim (optim just hangs)
Dear R-Help List,
I am using optim, with method=L-BFGS-B, to maximize a likelihood inside 
a large simulation exercise. This runs fine for most simulated data 
sets, but for some reason, about 1 out of 100 times, optim will just hang.
Using a dumb approach to the problem (i.e. printing the parameter values 
each time the function being maximized is evaluated), I tracked down 
when this happens,
2016 Oct 08
4
optim(…, method=‘L-BFGS-B’) stops with an error message while violating the lower bound
Hello:
       The development version of Ecdat on R-Forge contains a vignette 
in which optim(?, method=?L-BFGS-B?) stops with an error message while 
violating the lower bound.
       To see all the details, try the following:
install.packages("Ecdat", repos="http://R-Forge.R-project.org")
       Then do "help(pac=Ecdat)" -> "User guides, package
2003 Aug 20
2
Method of L-BFGS-B of optim evaluate function outside of box constraints
Hi, R guys:
I'm using L-BFGS-B method of optim for minimization problem. My function
called besselI function which need non-negative parameter and the besselI
will overflow if the parameter is too large. So I set the constraint box
which is reasonable for my problem. But the point outside the box was
test, and I got error. My program and the error follows. This program
depends on CircStats
2006 Aug 09
1
scaling constant in optim("L-BFGS-B")
Hi all,
 
I am trying to find estimates for 7 parameters of a model which should fit
real data. I have a function for the negative log likelihood (NLL) of the
data. With optim(method="L-BFGS-B",lower=0) I am now minimizing the NLL to
find the best fitting parameters. 
 
My problem is that the algorithm does not converge for certain data sets. I
have read that one should scale the fn
2001 Nov 08
3
Problem with optim (method L-BFGS-B)
Hello,
I've just a little problem using the function optim.
Here is the function I want to optimize :
test_function(x){(exp(-0.06751 + 0.25473*((x[1]-350)/150) +
0.04455*((x[2]-40)/20) + 0.09399*((x[3]-400)/100) -
0.17238*((x[4]-250)/50)-
0.45984*((x[5]-550)/150)-0.39508*((x[1]-350)/150)* ((x[1]-350)/150) -
0.05116*((x[2]-40)/20)* ((x[2]-40)/20) -
0.27735*((x[3]-400)/100)*((x[3]-400)/100) -
2004 Jun 23
1
How to define stopping criterium for Optim with L-BFGS-B
Hi,
I am using optim with a L-BFGS-B method to minimize a function. As I've
understood, the way to specify a tolerance for stopping optimization is
through "factr" argument.
My function, is by construction, minimal when equal to 1. I wonder if there
is any way to pass this info to "optim". If not, how "factr" argument works
(I am quite confused about the
2002 Jun 28
1
Problem in optim(method="L-BFGS-B") (PR#1717)
Full_Name: Jörg Polzehl
Version: 1.5.1 
OS: Windows 2000
Submission from: (NULL) (193.175.148.198)
When calculating MLE's in a variance component model using constrained
optimization, i.e. optim(...,method="L-BFGS-B",...) I observed an inproper
behaviour in cases where
the likelihood function was evalueted at the constraint. Parameters and value of
the
function at the constraint
2008 Jun 17
2
constrOptim with method = "L-BFGS-B"
Hi, 
i need to minimize a quadratic function with boundary condidtions and one
equality condition. 
In order to do that i converted the equality constraint into 2 inequality
constaints and passed everything cia constrOptim, as the manual said:
everything included in the ... will be passed to Optim that will pass it
back to fn in case it does not need it.
My code is the following:
mat <-
2004 Jul 26
1
choosing constraints for function optim method="L-BFGS-B" when they are in terms of other parameter values
I have a function of several variables which I wish to minimise over four
variables, two of the upper bounds for which are defined in terms of other
variables in the model over which minimisation will take place. I cannot
work out how to code this in such a way as to avoid getting an error message
when I run the code.
If anyone can provide any assistance I will be most grateful.
Best Regards