-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Error? in OptimizationPackage/Optimization.md Documentation #837
Comments
What versions are you using, can you show |
Status |
I am unable to recreate your issue
I would confirm by restarting julia, maybe you had older versions that are being used even though your |
Thanks for the review. After a full VS Code reboot, it is indeed working. I had created a new environment to ensure updated package versions but some old settings must have been lingering. Hopefully it was not too much of your time. Navigating the options in Optimization and Jump environments has been quite a bit to process initially. |
No worries at all! It happens, and we also need to make this all a bit easier. Getting better every day. |
The code provided in the document examples below does not run successfully for me in Julia 1.10.
Instead the following is returned in both the unconstrained and constrained cases:
ERROR: UndefVarError:
LBFGS
not definedIn the unconstrained problem, if Optimization.LBFGS() is changed to just LBFGS(), it finds the solution. However, the constrained problem still returns the following:
ERROR: The algorithm LBFGS{Nothing, LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Optim.var"#19#21"} does not support constraints. Either remove the
cons
function passed toOptimizationFunction
or use a different algorithm.Is there something else needed to get this to run successfully?
Unconstrained rosenbrock problem
using Optimization, Zygote
rosenbrock(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
x0 = zeros(2)
p = [1.0, 100.0]
optf = OptimizationFunction(rosenbrock, AutoZygote())
prob = Optimization.OptimizationProblem(optf, x0, p)
sol = solve(prob, Optimization.LBFGS())
With nonlinear and bounds constraints
function con2_c(res, x, p)
res .= [x[1]^2 + x[2]^2, (x[2] * sin(x[1]) + x[1]) - 5]
end
optf = OptimizationFunction(rosenbrock, AutoZygote(), cons = con2_c)
prob = OptimizationProblem(optf, x0, p, lcons = [1.0, -Inf],
ucons = [1.0, 0.0], lb = [-1.0, -1.0],
ub = [1.0, 1.0])
res = solve(prob, Optimization.LBFGS(), maxiters = 100)
The text was updated successfully, but these errors were encountered: