辅导讲解bonus java assignment、讲解 java Homework 、辅导java Homework
- 首页 >> Java编程CS/ECE/ISyE 524 Homework #6 Due: 11:59pm, Aug 8
Upload a single .pdf file for all non-coding questions and a separate .jl file for each coding question.
Any filename requirements are specified in the questions. Note: We will not look for answers to written
questions in your code, so unless otherwise stated respond to all questions in the .pdf document. In
addition, you must name your models “m” in your code to receive credit on coding problems.
1 Avengers, Assemble!
Thanos is here! Once again, Earth is relying on the Avengers for protection. For convenience, the
United Nations has divided up the world into 8 different zones: North America (NA), South America
(SA), Eurasia (EU), North Africa (NF), South Africa (SF), East Asia (EA), South/West Asia (WA),
and Oceania (OC). The number of hours required to get from each zone to each other zone by Quinjet
is given in the following table:
Zone NA SA EU NF SF EA WA OC
NA 0 5 7 8 10 15 11 16
SA 5 0 11 10 9 15 12 13
EU 7 11 0 4 7 9 5 19
NF 8 10 4 0 3 8 3 18
SF 10 9 7 3 0 10 4 16
EA 15 15 9 8 10 0 3 7
WA 11 12 5 3 4 3 0 15
OC 16 13 19 18 16 7 15 0
A rough estimate of the population in each district (in millions) as follows: NA: 580, SA: 420, EU:
900, NF: 250, SF: 200, EA: 1700, WA: 400, OC: 40. The UN have declared there are going to be
n Avenger locations. The problem is, the UN isn’t sure how many of the Avengers will be available
during the defense against Thanos. Their goal is to maximize the number of people that live within
3 hours of an Avenger. We have been asked to assist the UN by determining where to place the
Avengers for different values of n. Solve the problem for n = 1, 2, 3, 4. Upload your code as ’hw6-1.jl’.
2 Tom Sawyer’s Paint Business – BONUS PROBLEM
Note: This is a bonus problem. If you do not complete it, you can still get 4/4 on this
assignment. If, however, you choose to complete this problem you can gain 0.5 points
extra credit for a correct solution.
After the booming success of his fence-painting adventures, Tom Sawyer has decided to open a painting
business. Every week, Tom makes the same 5 batches of paint for some customers that always have
the same demand. To produce a batch of paint, Tom uses a blender that must be cleaned before
blending the next batch (e.g., the workflow is “blend batch 1, clean, blend batch 2, clean,...”). The
durations of blending paint batches 1 to 5 are 40, 32, 50, 28 and 47 minutes respectively. The cleaning
times depend on the colors and the paint types. For example, a long cleaning period is required if an
oil-based paint is produced after a water-based paint, or to produce white paint after a dark color.
The times are given in minutes in the following table. Each (i, j) pair is the cleaning time required if
batch j is blended after batch i.
Batch 1 2 3 4 5
1 0 10 6 15 9
2 4 0 6 17 8
3 10 11 0 20 14
4 7 15 6 0 2
5 5 8 7 7 0
Tom is a busy guy and wants to spend as little time as possible blending and cleaning. What order
should Tom produce the paint batches in? The order is the same every week, so the cleaning time
between the last batch of one week and the first of the following week needs to be accounted for in
the total duration of cleaning. Give the correct order of paint production and upload your code as
’hw6-bonus.jl’.
Note: Exhaustively looping through all possible orderings is not an acceptable solution!