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 1/2] 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 From d548652fa22d91f6547a154fbf18f12089c2fd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Tue, 21 Apr 2026 10:34:35 +0200 Subject: [PATCH 2/2] Renam --- src/Nonlinear/model.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Nonlinear/model.jl b/src/Nonlinear/model.jl index 023640625e..8577de2f34 100644 --- a/src/Nonlinear/model.jl +++ b/src/Nonlinear/model.jl @@ -78,14 +78,14 @@ function set_objective(model::Model, ::Nothing) end """ - nonlinear_model(backend::AbstractAutomaticDifferentiation) + 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() +model(::AbstractAutomaticDifferentiation) = Model() """ add_expression(model::Model, expr)::ExpressionIndex