In this task, you've amassed a crew of c pirates, ready to set sail and make...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this task, you've amassed a crew of c pirates, ready to set sail and make as much money as possible (with no regard for your crewmates)! For every island, containing m marines and holding s money, you can decide to send over c; pirates. The money you'll earn from this is equal to: min m 8 3 s), But the pirates you send will perish in the process (As well as an equal amount of marines). Essentially you can take the ratio of pirates to marines, and multiply the available money by that amount, maxing out at the total pool of money. i There will only be no marines present on an island if the island has been previously plundered (and therefore has no money). Every day, you can decide to which islands you'd like to send pirates, and how many to each of these islands, so that you maximise the money earned (ignoring that you might end up with no crew at the end of the day). Activate Wi Every day, you can decide to which islands you'd like to send pirates, and how many to each of these islands, so that you maximise the money earned (ignoring that you might end up with no crew at the end of the day). Your task is to implement the ModelNavigator class, and the following methods: • __init__(self, islands: list [Island], crew: int): Initialise, with the initial state of the islands and the number of crew you'll be taking on your journey. • select_islands (self) -> list [tuple [Island, int]]: Select the islands you wish to attack, returning a list containing pairs, each pair containing the island itself, as well as how many crewmates you'll be sending to each island. • select_islands_from_crew_numbers (self, crew_numbers: list[int]) -> list [float]: Similar to the last method, except rather than simply making the optimal choices for your crew numbers, you want to calculate the most money you can make with different crew configurations. You should return a list containing the amount of money you could make with the respective crew size in the input list. update_island (self, island: Island, new_money: float, new_marines: int) -> None: Called whenever an Island updates its money or marine value. island has attributes money and marines which store the original values before update. . i For this task, you may assume that all islands have a unique name, and that the ratio of marines to gold for each island remains unique throughout execution. A For this task, both select_tasks do not alter the internal state of the islands. For example, if select_islands is called, and your plan of attack is to ransack Island A for all of its money, then: * Your crew number doesn't change * Island A still has all of its marines and money. So if you call select_islands again, the return value should be the same. Intended Complexities A For this task, both select_tasks do not alter the internal state of the islands. For example, if select_islands is called, and your plan of attack is to ransack Island A for all of its money, then: . whenever an Island updates its money or marine value. island has attributes money and marines which store the original values before update. . For this task, you may assume that all islands have a unique name, and that the ratio of marines to gold for each island remains unique throughout execution. Intended Complexities Let N be the length of islands in initialisation. __init___ should have worst case complexity O(N log(N)) or less select_ islands should have worst case complexity O(N) or less, and a best case complexity of O(log(N)) or less. select_islands_for_crew_numbers has a different intended complexity for 1008/2085 and 1054 tudents. • 1008/2085: worst case complexity of O(C x N), where C' is the length of crew_numbers. • 1054: worst case complexity of O(N+Clog(C)), where C' is the length of crew_numbers. update_island should have worst case complexity O(log(N)) or less . * Your crew number doesn't change * Island A still has all of its marines and money. So if you call select_islands again, the return value should be the same. In this task, you've amassed a crew of c pirates, ready to set sail and make as much money as possible (with no regard for your crewmates)! For every island, containing m marines and holding s money, you can decide to send over c; pirates. The money you'll earn from this is equal to: min m 8 3 s), But the pirates you send will perish in the process (As well as an equal amount of marines). Essentially you can take the ratio of pirates to marines, and multiply the available money by that amount, maxing out at the total pool of money. i There will only be no marines present on an island if the island has been previously plundered (and therefore has no money). Every day, you can decide to which islands you'd like to send pirates, and how many to each of these islands, so that you maximise the money earned (ignoring that you might end up with no crew at the end of the day). Activate Wi Every day, you can decide to which islands you'd like to send pirates, and how many to each of these islands, so that you maximise the money earned (ignoring that you might end up with no crew at the end of the day). Your task is to implement the ModelNavigator class, and the following methods: • __init__(self, islands: list [Island], crew: int): Initialise, with the initial state of the islands and the number of crew you'll be taking on your journey. • select_islands (self) -> list [tuple [Island, int]]: Select the islands you wish to attack, returning a list containing pairs, each pair containing the island itself, as well as how many crewmates you'll be sending to each island. • select_islands_from_crew_numbers (self, crew_numbers: list[int]) -> list [float]: Similar to the last method, except rather than simply making the optimal choices for your crew numbers, you want to calculate the most money you can make with different crew configurations. You should return a list containing the amount of money you could make with the respective crew size in the input list. update_island (self, island: Island, new_money: float, new_marines: int) -> None: Called whenever an Island updates its money or marine value. island has attributes money and marines which store the original values before update. . i For this task, you may assume that all islands have a unique name, and that the ratio of marines to gold for each island remains unique throughout execution. A For this task, both select_tasks do not alter the internal state of the islands. For example, if select_islands is called, and your plan of attack is to ransack Island A for all of its money, then: * Your crew number doesn't change * Island A still has all of its marines and money. So if you call select_islands again, the return value should be the same. Intended Complexities A For this task, both select_tasks do not alter the internal state of the islands. For example, if select_islands is called, and your plan of attack is to ransack Island A for all of its money, then: . whenever an Island updates its money or marine value. island has attributes money and marines which store the original values before update. . For this task, you may assume that all islands have a unique name, and that the ratio of marines to gold for each island remains unique throughout execution. Intended Complexities Let N be the length of islands in initialisation. __init___ should have worst case complexity O(N log(N)) or less select_ islands should have worst case complexity O(N) or less, and a best case complexity of O(log(N)) or less. select_islands_for_crew_numbers has a different intended complexity for 1008/2085 and 1054 tudents. • 1008/2085: worst case complexity of O(C x N), where C' is the length of crew_numbers. • 1054: worst case complexity of O(N+Clog(C)), where C' is the length of crew_numbers. update_island should have worst case complexity O(log(N)) or less . * Your crew number doesn't change * Island A still has all of its marines and money. So if you call select_islands again, the return value should be the same.
Expert Answer:
Related Book For
Operations Management Processes And Supply Chains
ISBN: 9781292409863
13th Global Edition
Authors: Lee Krajewski, Naresh Malhotra, Larry Ritzman
Posted Date:
Students also viewed these programming questions
-
Done 3:20 5G Assignments > Assignment 1 - Chapter 3 (Flowchart) Assignment 1 - Chapter 3 (Flowchart) Hide Assignment Information Instructions Please complete a document flowchart in Excel that...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
11. Which one is not a source for collecting references? Ans : O Proquest Ebscohost O Scopus Safe assign
-
1. Demand and Revenue Suppose that the quantity q of a certain brand of mountain bike sold each week depends on price according to the equation q = 800 - 4p. What is the total weekly revenue if a...
-
Harriet Moore is an accountant for New World Pharmaceuticals. Her duties include tracking research and development spending in the new product development division. Over the course of the past six...
-
Find the natural frequencies of a fixed-fixed bar undergoing longitudinal vibration, using three mesh points in the range \(0
-
Define a system and simplify the open-system energy balance (Equation 7.4-15) for each of the following cases. State when possible whether nonzero heat and shaft work terms are positive or negative....
-
The system call sbrk (0) returns program crash, if it does? 1 2 3 4 6 7 8 } T-W21-DPe current value of brk. When will the f #include int main() { char *c; c = sbrk (0) - 1; *C= k'; c = sbrk (0) + 1;...
-
Berkshire Controllers usually finances its engineering projects with a combination of debt and equity capital. The resulting MARR ranges from a low of 4% per year, if business is slow, to a high of...
-
Determine your personal computer's IPv4 address, subnet mask, and default gateway using the ip config command. Study thetracertcommand...
-
An analyst gathered the following information about a company and the market: Using the capital asset pricing model (CAPM) approach, the cost of retained earnings for the company is closest to: A....
-
Using the capital asset pricing model, Kruspas cost of equity capital for its typical project is closest to: A. 7.62%. B. 10.52%. C. 12.40%. Jurgen Knudsen has been hired to provide industry...
-
An analyst gathered the following information about a private company and its publicly traded competitor: Using the pure-play method, the estimated equity beta for the private company is closest to:...
-
Sandell is performing a sensitivity analysis of the effect of the new project on the companys cost of capital. If the China project has the same asset risk as Kruspa, the estimated project beta for...
-
As part of the sensitivity analysis of the effect of the new project on the companys cost of capital, Sandell is estimating the cost of equity of the China project considering that the China project...
-
Your company, Healthy Gyms Limited, owns and manages a number of gyms and fitness centers around the state. Your boss has asked for your help with the following: Customers have unlimited use of the...
-
The polar coordinates of a point are given. Find the rectangular coordinates of the point. (-1, - /3)
-
Remarkable and Co. manufactures and assembles bicycles using six distinct work elements. Each workstation is managed by one employee. Remarkable would like to assemble eight bikes in each 10-hour...
-
Red Baron Airlines serves hundreds of cities each day, but competition is increasing from smaller companies affiliated with major carriers. One of the key competitive priorities is on-time arrivals...
-
Rain Shower is an international supplier of umbrellas. Currently, the company uses a logistical provider to provide warehouse services and handle packages destined for ground delivery. The contract...
-
What is the pressure drop associated with water at \(27^{\circ} \mathrm{C}\) flowing with a mean velocity of \(0.1 \mathrm{~m} / \mathrm{s}\) through an \(800-\mathrm{m}-\) long cast iron pipe of...
-
Fully developed conditions are known to exist for water flowing through a \(50-\mathrm{mm}\)-diameter tube at \(0.02 \mathrm{~kg} / \mathrm{s}\) and \(27^{\circ} \mathrm{C}\). What is the maximum...
-
Water at \(35^{\circ} \mathrm{C}\) is pumped through a horizontal, \(200-\mathrm{m}\)-long, \(30-\mathrm{mm}\)-diameter tube at \(0.25 \mathrm{~kg} / \mathrm{s}\). Over time, a 2-mm-thick layer of...
Study smarter with the SolutionInn App