diff --git a/docs/src/index.md b/docs/src/index.md index 0e381e99..4bb228fe 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -83,6 +83,19 @@ finalize(nlp) Check the [NLPModels API](https://JuliaSmoothOptimizers.github.io/NLPModels.jl/stable/api/) for details. +You can pass parameters to sifdecoder by giving additional arguments to `CUTEstModel`. +For instance, to change `NH` from model `CHAIN`, use + +```@example +using CUTEst + +for nh = 50:50:200 + nlp = CUTEstModel("CHAIN", "-param", "NH=$nh") + println("nh = $nh, nnzh = $(nlp.meta.nnzh)") + finalize(nlp) +end +``` + ## Working with CUTEst directly We also have implemented function to allow access to the CUTEst functions directly: diff --git a/src/CUTEst.jl b/src/CUTEst.jl index df984391..888f0fb1 100644 --- a/src/CUTEst.jl +++ b/src/CUTEst.jl @@ -226,7 +226,41 @@ function sifdecoder( nothing end -# Initialize problem. +""" + nlp = CUTEstModel(name, args...; kwargs...) + +Creates a CUTEst model following the NLPModels API. +This model needs to be finalized before a new one is created (e.g., calling `finalize(nlp)`). + +## Optional arguments + +Any extra arguments will be passed to `sifdecoder`. +You can, for instance, change parameters of the model: + +```jldoctest +using CUTEst + +nlp = CUTEstModel("CHAIN", "-param", "NH=50") +println(nlp.meta.nnzh) +finalize(nlp) +nlp = CUTEstModel("CHAIN", "-param", "NH=100") +println(nlp.meta.nnzh) +finalize(nlp) + +# output + +153 +303 +``` + +## Keyword arguments + +- `decode::Bool = true`: Whether to call sifdecoder. +- `verbose::Bool = false`: Passed to sifdecoder. +- `efirst`::Bool = true`: Equalities first? +- `lfirst`::Bool = true`: Linear (or affine) constraints first? +- `lvfirst::Bool = true`: Nonlinear variables should appear first? +""" function CUTEstModel( name::AbstractString, args...;