-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LBFGS with constraints on x #357
Comments
Apologies for the very very late reply! I have been very busy over the last couple of months and my access to the internet is currently limited (#360). Thanks for this detailed and helpful report. Unfortunately I wasn't able to test this myself yet. As a first guess I think that the problem is that you set the gradient 0 whenever the solver it outside of the feasible range. Could you try to change your setup such that the gradient increases the further away it is from the feasible range? |
First of all I want to say thanks to all the contributors of this crate, you've done an amazing job.
I'm getting started with argmin running some basic examples. I wanted to run a simple constrained optimization problem finding the minimum of a halfine (
y=x
withx>=0
) starting from the origin using LBFGS as solver. Of course the solution to this problem is x=0 and the minimum is zero. I've implemented the CostFunction and Gradient traits as follows:Where
Floating
is a type alias forf64
.I've tried to incorporate the constraint
x>=0
returning100.0
in casex>0
(I tried returningf64::INFINITY
but the code used to panic with errorMoreThuenteLineSearch: NaN or Inf encountered during iteration
).This is the code for solving the problem:
By setting a number of iterations equal to 1, it solves the problem as follows:
And of course the solution is close to zero if not exactly zero. However, by setting a number of iterations
>1
, the code loops endlessly reamaining stuck atx=NaN
,objective=NaN
andgradient=1
Any thoughts?
The text was updated successfully, but these errors were encountered: