计算机代写 • clarity of the presentation; • originality.

• clarity of the presentation; • originality.
Your work must be written up independently. The model and report must be your own work. You are reminded of the University policy on plagiarism. Your report must acknowledge clearly all people with whom you have dis- cussed any part of the coursework, as well as any references you might have used.
Shooting Rockets
Elon Musk has a problem. His launch vehicle, designed to carry humans into space, does not reach the height necessary for successful operations. Preliminary analysis has indicated that the issue stems from an underperforming first stage, more precisely from a suboptimal flow of fuel into the combustion chamber of the rocket engine. You are tasked with optimising the fuel flow in order to maximise the height of the rocket at the end of the first stage burn.

Copyright By PowCoder代写 加微信 powcoder

Figure 1: The at launch. Malfunctioning rockets are known to spontaneously disassemble. Especially if the Maths isn’t right.
The underlying dynamics of the flight can be described as follows. Launch time is set to t0 := 0. Let tfinal be the time when the rocket finishes firing (e. g. because all fuel has been used.). This will be one of many decision variables. We consider the following functions
h : [t0, tfinal] −→ R,
v : [t0, tfinal] −→ R, m : [t0, tfinal] −→ R,

θ : [t0, tfinal] −→ R.
At any time t ∈ [t0, tfinal], we have that h(t) is the height of the rocket above ground, v(t) is the speed of the rocket, m(t) is the mass of the rocket, and θ(t) is the thrust of the rocket. The thrust is proportional to how much fuel is pumped into the reaction chamber, so we will use θ as one of the functions we need to determine.
Now, the following equations describe the behaviour of the rocket for all times t ∈ [t0, tfinal]:
h′(t) = v(t), (1) ′ θ(t)−D(h(t),v(t)) 􏰀h(0)􏰁2
m′(t) = −2θ(t)
− h(t) , (2) (3)
􏰀 h(t) − h(0)􏰁
−h0 h(0) , (4)
with the auxiliary function
D(h(t), v(t)) := D0 × (v(t))2 × exp
(You do not need to understand all the details of these equations. However, it helps debugging your code if you have a rough understanding of what is going on here. For example, suppose that the time t is measured in seconds and the height h(t) in meters. Then clearly the first derivative of h(t) has dimensions m/s, i. e. h′(t) measures a velocity. Equation (1) simply tells us that the rocket is moving away from the surface of the earth, as fast as v(t) prescribes. Equation (3) tells us that the change in mass, m′(t) is proportional to what what fuel is pumped into the rocket engine, i. e. how much exhaust leaves the rocket. Equation (2) tells us about the rate of change in velocity, v′(t), i. e. the acceleration of the rocket. The acceleration is negatively effected by the gravitational effect of the earth at height h(t), measured in −(h(0)/h(t))2. Apart from gravitational effects, the acceleration is inverse proportional to the mass m(t) and proportional to the term θ(t)−D(h(t), v(t)). The first part of this is the fuel flow again, the second part given by the function D describes friction with the atmosphere, which decays exponentially with the height h(t) and is otherwise proportional to the velocity v(t). The constants D0 and h0 are defined below.)
We also have “boundary conditions”
h(0) m(0) m(tfinal )
= 0, (5) = 1, (6) = 1, (7) = 0.6, (8)
that is, the rocket starts at rest (v(0) = 0),
and overall 40% of the mass of the rocket is fuel. Furthermore, there are the simple
we normalised height and mass to one unit,

v(t) ≥ 0, (9) h(t) ≥ h(0), (10) m(tfinal) ≤ m(t) ≤ m(0), (11) 0 ≤ θ(t) ≤ θmax (12)
that need to hold for all t ∈ [t0, tfinal]. Finally, constant parameters are defined as
θmax := 3.5, h0 := 500, v0 := 620,
D0 := v0/2. With this, the overall problem becomes
max h(tfinal ) tfinal,h,v,m,θ
subject to (1)–(12).
However, this is not a problem we can readily solve, as some of the decision variables are functions h,v,m,θ. We would need to determine the function values at all times t ∈ [t0, tfinal]. In a sense, the above is an optimisation problem with an infinite number of variables.
To get around that difficulty, we will discretize the time interval [t0,tfinal] into a pre- scribed number of subintervals of same size. Let N be the number of these subintervals, i. e. we have as their boundary points
t0 =0= N0tfinal, t1 = N1tfinal, t2 = N2tfinal, …, tk = Nktfinal, …, tN = Ntfinal =tfinal and from now on we are only interested in the function values h(tk), v(tk), m(tk), θ(tk) at
all of these grid points. Collecting these decision variables into vectors v ̄:=(v(t0),v(t1),…,v(tfinal))⊤ ∈RN+1
and similarly for h,m,θ, gives us the unknowns tfinal ∈ R, h ̄,v ̄,m ̄,θ ̄∈ RN+1.
The only problem now is the system (1)–(3). For this, we use the same trick as in the section on numerical differentiation: replace the slope h′(t) of the tangent of the graph ofhatt=tk bytheslopeofasecantandreplace(1)by
h(t1) − h(t0) tfinal/N
h(tk+1) − h(tk−1) 2tfinal/N
h(tN)−h(tN−1) tfinal/N
= v(t0), = v(tk) = v(tN),
(13) (k=1,…,N−1), (14) (15)

i. e. in terms of our new variables, and slightly simplified
N(h ̄1−h ̄0) = tfinal×v ̄0,
N(h ̄k+1−h ̄k−1) = tfinal×2v ̄k (k=1,…,N−1),
N(h ̄N−h ̄N−1) = tfinal×v ̄N.
The equations (2) and (3) can be replaced in the same fashion. We end up with a nonlinear optimisation problem of the form
tfinal∈R,h ̄,v ̄,m ̄,θ ̄∈RN+1 s.t.
N(h ̄1 − h ̄0) = tfinal × v ̄0, N(h ̄k+1 −h ̄k−1)=2tfinal ×v ̄k N(h ̄N −h ̄N−1)=tfinal ×v ̄N, …,
Typical starting points use t = 1, h ̄ = 1 and θ ̄ = θ final k k max
/2 for all k, and values deduced from the functions v(t) = (t/tfinal)(1−(t/tfinal)) and m(t) = 1+(t/tfinal)(0.6−1).
1. Write out the full mathematical model for the flight maximisation problem, For given parameter N, how many variables do you have in total? How many constraints? How many of the constraints are nonlinear?
2. Is the problem convex? Justify your findings.
3. Write up in detail the derivation of the mathematical optimisation model, starting with the dynamics (1)–(4). When replacing (1) with (13)–(15), we obviously intro- duce an error. Can you derive a bound for the size of the error? What happens with this error when you increase N −→ ∞?
4. Write an AMPL model formulation for the flight maximisation prob- lem, where the discretisation number N is a parameter.
5. For parameter settings N = 50, 100, 200 and N = 400, find an optimal fuel flow by running the AMPL model through an appropriate solver. Try different solvers like LOQO, MINOS, KNITRO, SNOPT, etc.
6. Describe your observations. Visualise your findings, for example with graphs for the functions v(t), h(t), m(t) over t.
7. Can you find a better starting point than the one described above?
8. Report back to Elon with your best solution found, and your most important find- ings.
(k=1,…,N−1),

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com