Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/src/manual/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ The following attributes are available:
* [`ObjectiveFunction`](@ref)
* [`ObjectiveFunctionType`](@ref)
* [`ObjectiveSense`](@ref)

## AbstractOptimizer API

The following attributes are available:
Expand All @@ -104,3 +105,4 @@ The following attributes are available:
* [`TimeLimitSec`](@ref)
* [`ObjectiveLimit`](@ref)
* [`SolutionLimit`](@ref)
* [`AutomaticDifferentiationBackend`](@ref)
1 change: 1 addition & 0 deletions docs/src/reference/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ NumberOfThreads
RawSolver
AbsoluteGapTolerance
RelativeGapTolerance
AutomaticDifferentiationBackend
```

List of attributes useful for optimizers
Expand Down
14 changes: 14 additions & 0 deletions src/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2119,6 +2119,20 @@ struct ListOfSupportedNonlinearOperators <: AbstractOptimizerAttribute end
OTHER_ERROR,
)

"""
AutomaticDifferentiationBackend() <: AbstractOptimizerAttribute

An [`AbstractOptimizerAttribute`](@ref) for setting the automatic differentiation
backend used by the solver.

The value must be a subtype of [`Nonlinear.AbstractAutomaticDifferentiation`](@ref).
"""
struct AutomaticDifferentiationBackend <: AbstractOptimizerAttribute end

function attribute_value_type(::AutomaticDifferentiationBackend)
return Nonlinear.AbstractAutomaticDifferentiation
end

"""
TerminationStatus()

Expand Down
6 changes: 6 additions & 0 deletions test/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ function test_scalar_nonlinear_function_set_objective()
return
end

function test_attributes_AutomaticDifferentiationBackend()
@test MOI.attribute_value_type(MOI.AutomaticDifferentiationBackend()) ==
MOI.Nonlinear.AbstractAutomaticDifferentiation
return
end

function runtests()
for name in names(@__MODULE__; all = true)
if startswith("$name", "test_")
Expand Down