diff --git a/src/ADNLPProblems/aircrfta.jl b/src/ADNLPProblems/aircrfta.jl index 744888ef..da0b03ca 100644 --- a/src/ADNLPProblems/aircrfta.jl +++ b/src/ADNLPProblems/aircrfta.jl @@ -4,7 +4,7 @@ function aircrfta(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) w function f(x) return zero(eltype(x)) end - x0 = T[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] + x0 = T[0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0] lvar = T[-Inf, -Inf, -Inf, -Inf, -Inf, 0.1, 0.0, 0.0] uvar = T[Inf, Inf, Inf, Inf, Inf, 0.1, 0.0, 0.0] diff --git a/src/ADNLPProblems/aircrfta2.jl b/src/ADNLPProblems/aircrfta2.jl new file mode 100644 index 00000000..9cbe2807 --- /dev/null +++ b/src/ADNLPProblems/aircrfta2.jl @@ -0,0 +1,44 @@ +export aircrfta2 + +function aircrfta2(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T} + function f(x) + return zero(eltype(x)) + end + x0 = T[0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0] + lvar = T[-Inf, -Inf, -Inf, -Inf, -Inf, 0.1, 0.0, 0.0] + uvar = T[Inf, Inf, Inf, Inf, Inf, 0.1, 0.0, 0.0] + + function c!(cx, x) + rollrate, pitchrat, yawrate, attckang, sslipang, elevator, aileron, rudderdf = + x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8] + cx[1] = + -(3933 // 1000) * rollrate + (107 // 1000) * pitchrat + (126 // 1000) * yawrate - + (999 // 100) * sslipang - (4583 // 100) * aileron - (764 // 100) * rudderdf - + (727 // 1000) * pitchrat * yawrate + (839 // 100) * yawrate * attckang - + (6844 // 10) * attckang * sslipang + (635 // 10) * aileron * attckang + cx[2] = + -(987 // 1000) * pitchrat - (2295 // 100) * attckang - (2837 // 100) * elevator + + (949 // 1000) * rollrate * yawrate + + (173 // 1000) * rollrate * sslipang + cx[3] = + (2 // 1000) * rollrate - (235 // 1000) * yawrate + (567 // 100) * sslipang - + (921 // 1000) * aileron - (651 // 100) * rudderdf - (716 // 1000) * rollrate * pitchrat - + (1578 // 1000) * rollrate * attckang + (1132 // 1000) * aileron * attckang + cx[4] = pitchrat - attckang - (168 // 1000) * elevator - rollrate * sslipang + cx[5] = -yawrate - (196 // 1000) * sslipang - (71 // 10000) * aileron + rollrate * attckang + return cx + end + + return ADNLPModels.ADNLPModel!( + f, + x0, + lvar, + uvar, + c!, + zeros(T, 5), + zeros(T, 5), + name = "aircrfta2", + minimize = true; + kwargs..., + ) +end diff --git a/src/Meta/aircrfta.jl b/src/Meta/aircrfta.jl index 8ce21d3b..c9eb407d 100644 --- a/src/Meta/aircrfta.jl +++ b/src/Meta/aircrfta.jl @@ -22,6 +22,8 @@ aircrfta_meta = Dict( The aircraft stability problem by Rheinboldt, as a function of the elevator, aileron and rudder deflection controls. +See aircrfta2 for the corrected version (CUTEst's AIRCRFTA2). + classification NOR2-RN-8-5 """, :origin_notes => raw""" diff --git a/src/Meta/aircrfta2.jl b/src/Meta/aircrfta2.jl new file mode 100644 index 00000000..df435467 --- /dev/null +++ b/src/Meta/aircrfta2.jl @@ -0,0 +1,62 @@ +aircrfta2_meta = Dict( + :nvar => 8, + :variable_nvar => false, + :ncon => 5, + :variable_ncon => false, + :minimize => true, + :name => "aircrfta2", + :has_equalities_only => true, + :has_inequalities_only => false, + :has_bounds => true, + :has_fixed_variables => true, + :objtype => :constant, + :contype => :general, + :best_known_lower_bound => -Inf, + :best_known_upper_bound => 0, + :is_feasible => true, + :defined_everywhere => missing, + :origin => :unknown, + :implementation => :both, + :url => "https://www.osti.gov/biblio/6449249, https://github.com/ralna/SIF/blob/master/AIRCRFTA2.SIF", + :notes => raw""" +The aircraft stability problem by Rheinboldt, as a function +of the elevator, aileron and rudder deflection controls. + +This is CUTEst's AIRCRFTA2. In the fourth equation the coefficient of +the elevator is -0.168, and the bilinear term with coefficients 63.5 +(first equation) and 1.132 (third equation) is the product of the +aileron and the angle of attack. aircrfta is the same problem with +-1.168 and the product of the pitch rate and the angle of attack, as in +CUTEst's AIRCRFTA. + +classification NOR2-RN-8-5 +""", + :origin_notes => raw""" +Problem 9 in +J.J. More',"A collection of nonlinear model problems" +Proceedings of the AMS-SIAM Summer Seminar on the Computational +Solution of Nonlinear Systems of Equations, Colorado, 1988. +Argonne National Laboratory MCS-P60-0289, 1989. + +SIF input: Ph. Toint, Dec 1989. + Corrected version of AIRCRFTA by Tim Holy, Oct 2026. +""", + :reference => raw""" +@article{More1990, + title = {A collection of nonlinear model problems. Computational Solution of Nonlinear Systems of Equations}, + author = {Mor{\'e}, Jorge J.}, + journal = {Lectures in Applied Mathematics}, + volume = {26}, + pages = {723--762}, + year = {1990}, + publisher = {American Mathematical Society} +} +""", + :lib => "CUTEst:AIRCRFTA2", +) +get_aircrfta2_nvar(; n::Int = default_nvar, kwargs...) = 8 +get_aircrfta2_ncon(; n::Int = default_nvar, kwargs...) = 5 +get_aircrfta2_nlin(; n::Int = default_nvar, kwargs...) = 0 +get_aircrfta2_nnln(; n::Int = default_nvar, kwargs...) = 5 +get_aircrfta2_nequ(; n::Int = default_nvar, kwargs...) = 5 +get_aircrfta2_nineq(; n::Int = default_nvar, kwargs...) = 0 diff --git a/src/PureJuMP/aircrfta.jl b/src/PureJuMP/aircrfta.jl index dec061cf..8224afae 100644 --- a/src/PureJuMP/aircrfta.jl +++ b/src/PureJuMP/aircrfta.jl @@ -22,7 +22,7 @@ function aircrfta(; n::Int = default_nvar, kwargs...) @variable(nlp, -Inf <= yawrate <= Inf, start = 0.0) @variable(nlp, -Inf <= attckang <= Inf, start = 0.0) @variable(nlp, -Inf <= sslipang <= Inf, start = 0.0) - @variable(nlp, 0.1 <= elevator <= 0.1, start = 0.0) + @variable(nlp, 0.1 <= elevator <= 0.1, start = 0.1) @variable(nlp, 0.0 <= aileron <= 0.0, start = 0.0) @variable(nlp, 0.0 <= rudderdf <= 0.0, start = 0.0) diff --git a/src/PureJuMP/aircrfta2.jl b/src/PureJuMP/aircrfta2.jl new file mode 100644 index 00000000..59ba867c --- /dev/null +++ b/src/PureJuMP/aircrfta2.jl @@ -0,0 +1,50 @@ +export aircrfta2 + +function aircrfta2(; n::Int = default_nvar, kwargs...) + nlp = Model() + + @variable(nlp, -Inf <= rollrate <= Inf, start = 0.0) + @variable(nlp, -Inf <= pitchrat <= Inf, start = 0.0) + @variable(nlp, -Inf <= yawrate <= Inf, start = 0.0) + @variable(nlp, -Inf <= attckang <= Inf, start = 0.0) + @variable(nlp, -Inf <= sslipang <= Inf, start = 0.0) + @variable(nlp, 0.1 <= elevator <= 0.1, start = 0.1) + @variable(nlp, 0.0 <= aileron <= 0.0, start = 0.0) + @variable(nlp, 0.0 <= rudderdf <= 0.0, start = 0.0) + + @objective(nlp, Min, 0) + @constraint( + nlp, + cons1, + ( + -3.933 * rollrate + 0.107 * pitchrat + 0.126 * yawrate - 9.99 * sslipang - 45.83 * aileron - + 7.64 * rudderdf - 0.727 * pitchrat * yawrate + 8.39 * yawrate * attckang - + 684.4 * attckang * sslipang + 63.5 * aileron * attckang + ) == 0 + ) + @constraint( + nlp, + cons2, + ( + -0.987 * pitchrat - 22.95 * attckang - 28.37 * elevator + + 0.949 * rollrate * yawrate + + 0.173 * rollrate * sslipang + ) == 0 + ) + @constraint( + nlp, + cons3, + ( + 0.002 * rollrate - 0.235 * yawrate + 5.67 * sslipang - 0.921 * aileron - 6.51 * rudderdf - + 0.716 * rollrate * pitchrat - 1.578 * rollrate * attckang + 1.132 * aileron * attckang + ) == 0 + ) + @constraint(nlp, cons4, (pitchrat - attckang - 0.168 * elevator - rollrate * sslipang) == 0) + @constraint( + nlp, + cons5, + (-yawrate - 0.196 * sslipang - 0.0071 * aileron + rollrate * attckang) == 0 + ) + + return nlp +end