Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I just need help setting the algorithm up, for part a I don't need code, I need an algorithm, a pseudo code if you please.
I just need help setting the algorithm up, for part a I don't need code, I need an algorithm, a pseudo code if you please. Or at least some explaination so I can get to that myself. There are other parts to this question but I just need this one I am pretty sure I can figure the other parts by myself.
Consider that you are living on a planet that may be under attack by swarms of alien drones. A swarm of drones arrive over the course of n seconds: x, drones arrive in the i-th second. Using telescopes you are aware of the sequence x, x2, ..., x, in advance. Your planet can defend using a particular laser device, which can make the drones harmless as they arrive. The laser's power depends on the time it has been charging since its last use. You have knowledge of a function f(), that indicates the following: if j seconds have elapsed since the laser was last used, then it can render f) drones harmless. In particular, if the laser was used in second k, and j seconds have passed since it was previously used, then it will render min(xk, fi)) drones harmless. After this use it will be fully drained, so it would have to wait at least until the following second to be usable (as given by the functionf) The goal of the problem is the following: given a sequence of drone arrivals xi, x2, ..., X, and the f function, choose the points in time when you would use the laser, in order to maximize the number of drones that are made harmless. For example, given the data from rd (which allows it to rend harmless min (10,4) 4 drones) and in the 4h second (when it rends harmless min(1,1) 1 drones) Develop a dvnamic programming algorithm that finds the value of an optimal plan using the steps outlined above. (a) [20 points] Write a recursive formula of an optimal solution (i.e., define the variable that you wish to optimize and explain how a solution to computing it can be obtained from solutions to subproblems) Consider that you are living on a planet that may be under attack by swarms of alien drones. A swarm of drones arrive over the course of n seconds: x, drones arrive in the i-th second. Using telescopes you are aware of the sequence x, x2, ..., x, in advance. Your planet can defend using a particular laser device, which can make the drones harmless as they arrive. The laser's power depends on the time it has been charging since its last use. You have knowledge of a function f(), that indicates the following: if j seconds have elapsed since the laser was last used, then it can render f) drones harmless. In particular, if the laser was used in second k, and j seconds have passed since it was previously used, then it will render min(xk, fi)) drones harmless. After this use it will be fully drained, so it would have to wait at least until the following second to be usable (as given by the functionf) The goal of the problem is the following: given a sequence of drone arrivals xi, x2, ..., X, and the f function, choose the points in time when you would use the laser, in order to maximize the number of drones that are made harmless. For example, given the data from rd (which allows it to rend harmless min (10,4) 4 drones) and in the 4h second (when it rends harmless min(1,1) 1 drones) Develop a dvnamic programming algorithm that finds the value of an optimal plan using the steps outlined above. (a) [20 points] Write a recursive formula of an optimal solution (i.e., define the variable that you wish to optimize and explain how a solution to computing it can be obtained from solutions to subproblems)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started