You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix interpretation of nonlinear system overdetermined defaults
```julia
using ModelingToolkit, NonlinearSolve
# Define the nonlinear system
@variables x=1.0 y z=0.0
@parameters σ=10.0 ρ=26.0 β=8 / 3
eqs = [0 ~ σ * (y - x),
0 ~ x * (ρ - z) - y,
0 ~ x * y - β * z]
@mtkbuild ns = NonlinearSystem(eqs, [x, y, z], [σ, ρ, β])
# Convert the symbolic system into a numerical system
prob = NonlinearProblem(ns, [])
# Solve the numerical problem
sol = solve(prob, NewtonRaphson())
```
This failed because of an initialization failure. This is because those conditions cannot be satisfied with the nonlinear system. But that doesn't make sense: the purpose of a nonlinear system is to find the set of values that satisfies the system. So this case should not be building initialization problems, there is no reason to assume that the user's initial guess satisfies the system, and in fact, you should assume if basically never does as the point is to solve the system.
There can be an argument to have the initialization specifically for the parameters, but that can be added in the future. For now, this is fixing a major regression and adding a test to make sure this doesn't regress again.
OptimizationSystem should be similarly checked as its initial conditions should be handled similarly.
@@ -568,7 +568,7 @@ function DiffEqBase.NonlinearLeastSquaresProblem{iip}(sys::NonlinearSystem, u0ma
568
568
error("A completed `NonlinearSystem` is required. Call `complete` or `structural_simplify` on the system before creating a `NonlinearLeastSquaresProblem`")
569
569
end
570
570
f, u0, p =process_SciMLProblem(NonlinearFunction{iip}, sys, u0map, parammap;
0 commit comments