Skip to content

Commit 199ae7f

Browse files
committed
Updates
1 parent ca55db1 commit 199ae7f

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

docs/src/submodules/Nonlinear/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ MathOptInterface instead passes an [`NLPBlockData`](@ref), which wraps an
248248
bounds and whether the evaluator has a nonlinear objective. Create an
249249
`NLPBlockData`](@ref) as follows:
250250
```jldoctest nonlinear_developer
251-
julia> MOI.NLPBlockData(data)
251+
julia> MOI.NLPBlockData(data);
252252
```
253253

254254
## Expression-graph representation

src/Nonlinear/Nonlinear.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,28 @@ function of `data`.
4242
4343
`obj` must be a type that is supported by [`parse_expression`](@ref).
4444
45+
To remove the objective, pass `nothing`.
46+
4547
## Examples
4648
4749
```julia
4850
data = NonlinearData()
4951
x = MOI.VariableIndex(1)
5052
set_objective(data, :(\$x^2 + 1))
5153
set_objective(data, x)
54+
set_objective(data, nothing)
5255
```
5356
"""
5457
function set_objective(data::NonlinearData, obj)
5558
data.objective = parse_expression(data, obj)
5659
return
5760
end
5861

62+
function set_objective(data::NonlinearData, ::Nothing)
63+
data.objective = nothing
64+
return
65+
end
66+
5967
"""
6068
add_expression(data::NonlinearData, expr)::ExpressionIndex
6169

src/Nonlinear/types.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,3 @@ function set_differentiation_backend(
241241
data.inner = nothing
242242
return
243243
end
244-

0 commit comments

Comments
 (0)