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

Support FixArgs? #4

Open
jariji opened this issue Aug 2, 2024 · 2 comments
Open

Support FixArgs? #4

jariji opened this issue Aug 2, 2024 · 2 comments

Comments

@jariji
Copy link

jariji commented Aug 2, 2024

It only supports Fix2 but sometimes I have extra arguments.

OptProblemSpec((@o optfunc(_, c, tab)), MVector, θ₀, vars,)
ERROR: MethodError: no method matching OptProblemSpec(::AccessorsExtra.FixArgs{…}, ::Type{…}, ::@NamedTuple{}, ::OptArgs{…})

Closest candidates are:
  OptProblemSpec(::F, ::D, ::U, ::X0, ::VS, ::CS) where {F, D, U, X0, VS<:OptArgs, CS<:Union{Nothing, OptCons}}
   @ AccessibleOptimization ~/.julia/packages/AccessibleOptimization/VZ9ve/src/AccessibleOptimization.jl:103
  OptProblemSpec(::Base.Fix2, ::Type, ::Any, ::OptArgs, ::OptCons)
   @ AccessibleOptimization ~/.julia/packages/AccessibleOptimization/VZ9ve/src/AccessibleOptimization.jl:111
  OptProblemSpec(::Base.Fix2, ::Union{Nothing, Type}, ::Any, ::OptArgs, ::Union{Nothing, OptCons})
   @ AccessibleOptimization ~/.julia/packages/AccessibleOptimization/VZ9ve/src/AccessibleOptimization.jl:115
  ...
@aplavin
Copy link
Member

aplavin commented Aug 2, 2024

As I understand, this limitation is due to Optimization.jl: they specifically support two-arg f that is called as f(x, p) for x being the optimization variables vector, and p an arbitrary value user passes to OptimizationProblem – https://docs.sciml.ai/Optimization/stable/API/optimization_problem/.
Here, I take Fix2 and extract its fields to pass to Optimization.

@aplavin
Copy link
Member

aplavin commented Aug 3, 2024

I guess it can convert any function to a two-arg function to pass to Optimization.jl though...

@jariji jariji mentioned this issue Oct 29, 2024
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

2 participants