Skip to content

Commit 114515a

Browse files
committed
Improve contributing.md: clarify requirements for adding new problems, including constraints, compatibility, meta fields, allocation, and scalability
1 parent 1cee776 commit 114515a

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

docs/src/contributing.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Contributing to OptimizationProblems.jl
2-
32
First off, thanks for taking the time to contribute!
43

54
## Bug reports and discussions
@@ -19,12 +18,12 @@ Here is a to-do list, to help you add new problems:
1918
- `src/ADNLPProblems/problem_name.jl`
2019
- `src/PureJuMP/problem_name.jl`
2120
- `src/Meta/problem_name.jl`
22-
In both cases, the function must have the same name `problem_name` as the file.
21+
In both cases, the function must have the same name `problem_name` as the file and the objective must be callable at the starting point and should not return NaN unless expected.
2322
* When submitting a problem, please pay particular attention to the documentation. We would like to gather as much information as possible on the provenance of problems, other problem sets where the problems are present, and general information on the problem.
2423
The documentation should be added to the file in the `PureJuMP` folder.
2524
* New problems can be scalable, see [ADNLPProblems/arglina.jl](https://github.com/JuliaSmoothOptimizers/OptimizationProblems.jl/blob/main/src/ADNLPProblems/arglina.jl) and [PureJuMP/arglina.jl](https://github.com/JuliaSmoothOptimizers/OptimizationProblems.jl/blob/main/src/PureJuMP/arglina.jl) for examples. In that case, the first keyword parameter should be the number of variables `n::Int` and have the default value `default_nvar` (constant predefined in the module). If your problem has restrictions on the number of variables, e.g., `n` should be odd, or `n` should have the form `4k + 3`, then, instead of throwing errors when the restrictions are not satisfied, you should instead use the number of variables to be as close to `n` as possible. For example, if you want `n` odd and `n = 100` is passed, you can internally convert to `n = 99`. If you want `n = 4k + 3`, and `n = 100` is passed, then compute `k = round(Int, (n - 3) / 4)` and update `n`.
26-
* A first version of the `meta` can be generated using `generate_meta`. A `String` is returned that can be copy-pasted into the `Meta` folder, and then edited.
27-
25+
* A first version of the `meta` can be generated using `generate_meta`. A `String` is returned that can be copy-pasted into the `Meta` folder, and then edited. Ensure all meta fields are accurate and complete including `nvar`, `ncon`, linear/nonlinear counts, feasibility, origin, objtype, contype and best-known bounds.
26+
* For problem implementation in both ADNLP and PureJuMP, use the same initial point, variable bounds, constraint bounds and ensure objective and constraint values match within a relative tolerance.
2827
```julia
2928
using ADNLPModels, Distributed, NLPModels, NLPModelsJuMP, OptimizationProblems, Test
3029
include("test/utils.jl")
@@ -33,7 +32,10 @@ The documentation should be added to the file in the `PureJuMP` folder.
3332
create_meta_files(String["catmix", "gasoil", "glider", "methanol", "pinene", "rocket", "steering"])
3433
```
3534

36-
* Problems modeled with `ADNLPModels` should be type-stable, i.e. they should all have keyword argument `type::Type{T} = Float64` where `T` is the type of the initial guess and the type used by the `NLPModel` API.
35+
* Problems modeled with `ADNLPModels` should be type-stable, i.e. they should all have keyword argument `type::Type{T} = Float64` where `T` is the type of the initial guess and the type used by the `NLPModel` API
36+
and should support the `nls=true/false` keyword to allow both `ADNLPModel` and `ADNLSModel` instantiation from the same problem.
37+
* For least-squares problems, instantiate both `ADNLPModel` and `ADNLSModel` and ensure `residual!(nls, x, Fx)` is allocation-free with the objectives agree (or differ by a factor of 2 for LS).
38+
* For variable-size problems, verify that different values of `n` produce correct `nvar`, meta formulas predict actual values and instantiation works at various sizes.
3739

3840
## Templates for the new functions
3941

0 commit comments

Comments
 (0)