Notes on participation in the development
We are always happy to receive help from people who are not usually involved in creating a package. However, in order for the process to go in the best possible way, it is recommended that you read this page before creating a pull request. This way there will be a better chance that your changes will be taken into account, and in the end it means less work for everyone.
Important points
When proposing changes to Optim.jl
, there are several points to consider. If in doubt, do not hesitate to contact us. The easiest way to do this is by joining our https://gitter.im/JuliaNLSolvers/Optim .jl[to the channel on the Gitter service].
Before sending a pull request, pay attention to the following points.
-
Have you provided tests for your changes? If not, then do it or ask for help.
-
Did your change add new functionality? Do not forget to add a section to the documentation.
-
Have you significantly changed the existing code? Be sure to use Julia’s decommissioning tools to help users switch to the new syntax.
-
Add a note to the file NEWS.md so that we can track changes between versions.
Adding a solver
If you are creating a new solver, you do not need to touch the code in src/optimize.jl'. You should add a file with the name (`solver
— the name of the solver) solver.jl
in src
and make sure that you have defined the subtype Optimizer
struct Solver <: Optimizer end
with the appropriate fields, the by default constructor with a keyword for each field, the state type that contains all the variables that are (re)used during the iterative procedure, the function initial_state
, which initializes such a state, and the update!
, which does the actual work. Let’s say you want to participate in the development of the Minim
solver, then your src/minim.jl
file will look something like this
struct Minim{IF, F<:Function, T} <: Optimizer alphaguess!::IF linesearch!::F minim_parameter::T end Minim(; alphaguess = LineSearches.InitialStatic(), linesearch = LineSearches.HagerZhang(), minim_parameter = 1.0) = Minim(linesearch, minim_parameter) type MinimState{T,N,G} x::AbstractArray{T,N} x_previous::AbstractArray{T,N} f_x_previous::T s::AbstractArray{T,N} @add_linesearch_fields() end function initial_state(method::Minim, options, d, initial_x) # подготовка переменных кэша и т. д. здесь end function update!{T}(d, state::MinimState{T}, method::Minim) # код для Minim здесь false # нужно ли принудительно прекращать процедуру? end