Skip to content
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

Add-goddardrocket #183

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

indyalardjane
Copy link

No description provided.

Copy link
Member

@tmigot tmigot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @indyalardjane for the PR!

Here is a first batch of comments.

src/ADNLPProblems/goddardrocket.jl Outdated Show resolved Hide resolved
src/ADNLPProblems/goddardrocket.jl Outdated Show resolved Hide resolved
src/Meta/goddardrocket.jl Outdated Show resolved Hide resolved
src/ADNLPProblems/goddardrocket.jl Outdated Show resolved Hide resolved
return constraints

end
Δt = T(1/(n-1)) # Indya, ce n'est pas 1/(n-1) à la place ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Δt = T(1/(n-1))


end

function constraints(X :: Vector{S}) where {S}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function constraints(x)
S = eltype(x)

will give more flexibility

T_max = T(3.5 * g_0 * m_0) # maximal rocket thrust
D_c = T(1/2 * v_c * (m_0/g_0)) # Drag scaling

function Objective(X :: Vector{S}) where {S}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function f(x)
S = eltype(x)

will give more flexibility

@@ -0,0 +1,82 @@
using ADNLPModels, NLPModels, NLPModelsIpopt, DataFrames, LinearAlgebra, Distances, SolverCore, Plots
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the using for the PR.

Copy link
Member

@tmigot tmigot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of additional comments. Could you remove the two minimalsurface.jl files?

lcon = zeros(T, 3 * n)
ucon = T[i ≤ 2n ? T(Inf) : ( T(m_0 - m_f)) for i=1:3n]

return ADNLPModel(f, X0, lvar, uvar, constraints, lcon, ucon)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest you use a lowercase x and x0 everywhere.

Suggested change
return ADNLPModel(f, X0, lvar, uvar, constraints, lcon, ucon)
return ADNLPModels.ADNLPModel(f, x0, lvar, uvar, constraints, lcon, ucon)

Comment on lines +45 to +49
m[k] = S(m[k - 1] - Δt * X[k - 1] / c) # update mass vector
v[k] = S(v[k - 1] + Δt *((X[k - 1] - D[k - 1]) / m[k - 1] - g[k - 1])) # update speed vector
h[k] = S(h[k - 1] + Δt * v[k - 1]) # update height vector
D[k] = S(D_c*(v[k]^2)*exp(-h_c*(h[k]-h_0)/h_0)) # update drag vector
g[k] = S(g_0*(h_0/h[k])^2) # update gravity vector
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the S( as we should not convert the variable X within a constraint or objective function

Comment on lines +71 to +76
for k=2:n
m[k] = S(m[k - 1] - Δt * X[k - 1] / c)
v[k] = S(v[k - 1] + Δt *((X[k - 1] - D[k - 1]) / m[k - 1] - g[k - 1]))
h[k] = S(h[k - 1] + Δt * v[k - 1])
D[k] = S(D_c*(v[k]^2)*exp(-h_c*(h[k]-h_0)/h_0))
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above. If it is exactly the same lines of code, maybe you should have it in a function?

@dpo
Copy link
Member

dpo commented Jul 9, 2022

@indyalardjane It looks like there are still a few comments to address here, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants