Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You're contracted to work with a trucking freight company We Like to Move it , Move it ! . The hourly rates for drivers are

You're contracted to work with a trucking freight company We Like to Move it, Move it!. The
hourly rates for drivers are $14 per hour and $15 per hour. The operating cost of the truck is, in
cents per mile,
truck(d,s)=(60+s2)d
where d,s are distance and speed, respectively. The total cost is then:
c(s,d,h)=driver(h,t)+truck(d,s)
where h is the hourly rate and t is the time for which the driver drove the truck. You inform the
company that this is an optimization problem, given a fixed salary and distance. In particular, you
say that since the speed must be from 40mph to 60mph, there is an optimal speed that reduces
cost. Implement the functions that allow you to determine for a fixed distance and salary (we'll
look at both), the speed that reduces cost. The following code:
1s-a,s-b=40,60
2 hr_rate =14
3 distance =100
4 print(min_cost(distance, hr_rate, (s_a,s_b)))
5hr_rate =15
6 print(min_cost (distance, hr_rate, (s_a,s_b)))
produces:
1(82.92,53)
2(84.77,55)
One aspect of the problem you must pay attention to is the different units: dollars and cents.
These cannot be added together, since they're different units, e.g.,1 dollar plus 1 cent 2.
Either you have 100+1 or 1+.01.
Deliverables Problem 7
Complete the functions following the algorithm described above.
The return type of min_cost is a tuple (x,y) where x is the cost and y the speed.
Round cost to 2 decimal places.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions