Skip to content
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

LoadError: MethodError: no method matching Optim.BarrierLineSearchGrad #1020

Closed
dhathri-auburn opened this issue Nov 10, 2022 · 1 comment
Closed

Comments

@dhathri-auburn
Copy link

Hello, I am new to Julia and Optim.jl. I am trying to figure out how to make my constrained NLP problem work within this package. I am getting the following error:

`ERROR: LoadError: MethodError: no method matching Optim.BarrierLineSearchGrad(::Vector{Float64}, ::Matrix{Float64}, ::Optim.BarrierStateVars{Real}, ::Optim.BarrierStateVars{Real})
Closest candidates are:
Optim.BarrierLineSearchGrad(::Vector{T}, ::Matrix{T}, ::Optim.BarrierStateVars{T}, ::Optim.BarrierStateVars{T}) where T at C:\Users\dhs0020.julia\packages\Optim\Zq1jM\src\multivariate\solvers\constrained\ipnewton\interior.jl:153

function optimizer(X0, params, lb, ub)
objective = OptimizationFunction(cost, Optimization.AutoForwardDiff(), cons = constraints)
collocation_params = create_common_parameters_for_collocation()
merge!(params, collocation_params)
lcons, ucons = get_constraint_bounds(params)
problem = OptimizationProblem(objective, X0, params, lb = lb, ub = ub, lcons = lcons, ucons = ucons, sense = Optimization.MinSense)

sol = solve(problem, IPNewton(); maxiters = 1, show_trace = true, show_every = 1)
return sol

end
`

my constraints function is setting the constraints vector to a Vector{Real} element, so I am not sure why IPNewton method is thinking that the constraints vector type is Vector{Float64}, which is what is I believe the cause of this error is.

I am absolutely stuck and I would appreciate any help provided to get over this issue.

Thanks,
Dhathri

@dhathri-auburn
Copy link
Author

I was able to resolve this by myself. Once I resolved the data types for X, lower and upper bounds for X and constraints, this started working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant