-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using multi objective from Jump for NLS #165
Comments
We discussed about that during JuMP-dev 2024 with @blegat. |
We converged to the following suggestion. NLPModelsJuMP.jl/src/moi_nls_model.jl Line 26 in 9b8128c
and the MOI wrapper won't set this F .If this argument F is not given, it can be recovered from the objective if it is a ScalarNonlinearFunction if the root node is + and the node of each children is ^ with second argument being 2 .If the objective is not nonlinear or if it's not of that form then a nice error message will explain what's the issue and recommend using JuMP.@force_nonlinear .See examples below: julia> @objective(model, Min, (x^2 + 1)^2 + (x^3 + 1)^2)
((x² + 1) ^ 2.0) + (((x ^ 3) + 1.0) ^ 2.0)
julia> @objective(model, Min, (x + 1)^2 + (x + 1)^2) # Not what we want
2 x² + 4 x + 2
julia> @objective(model, Min, @force_nonlinear((x + 1)^2 + (x + 1)^2)) # `@force_nonlinear` saves the day
((x + 1) ^ 2) + ((x + 1) ^ 2)
julia> y = [x + 1, x - 1]
2-element Vector{AffExpr}:
x + 1
x - 1
julia> @objective(model, Min, sum(y[i]^2 for i in eachindex(y))) # Note what we want
2 x² + 0 x + 2
julia> @objective(model, Min, sum(@force_nonlinear(y[i]^2) for i in eachindex(y))) # `@force_nonlinear` saves the day
((x + 1) ^ 2) + ((x - 1) ^ 2) What do you think ? |
The issue of multiple objective is that this wouldn't solver-independent: If you want to compare with a solver that's not least-square, you will need to use the sum of squares and if you want to use a least square solver you need a multiple objective. |
I like your idea @blegat, it will be easy recover the term For example, one special application of If MOI pre-digests the objective, we will only be able to recover |
See package MultiObjectiveAlgorithms.jl
The text was updated successfully, but these errors were encountered: