From 19803b013f924dcd291d119844bbae89db575867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Wed, 8 Apr 2026 22:12:16 +0200 Subject: [PATCH] Add nonlinear_model function --- src/Nonlinear/model.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Nonlinear/model.jl b/src/Nonlinear/model.jl index b570a0dcc3..023640625e 100644 --- a/src/Nonlinear/model.jl +++ b/src/Nonlinear/model.jl @@ -77,6 +77,16 @@ function set_objective(model::Model, ::Nothing) return end +""" + nonlinear_model(backend::AbstractAutomaticDifferentiation) + +Return a new nonlinear model appropriate for the given AD `backend`. + +The default returns `Model()`. Custom AD backends can override this +to return their own model type. +""" +nonlinear_model(::AbstractAutomaticDifferentiation) = Model() + """ add_expression(model::Model, expr)::ExpressionIndex