• Home
  • Blog
  • Need help with computer science to Find a pseudo-code to optimize this problem.

Need help with computer science to Find a pseudo-code to optimize this problem.

0 comments

(Tools Rental) A customer working on a home project needs to rent n tools from a tool supply company.  All tools arrive together at the same time. He only uses one tool at a time, and each tool i is needed for a certain time duration ti(depending on the tool). He cannot switch to another tool before he finishes using one tool. When he finishes with one tool, he then checks in the tool on the rental company’s website, the company has shuttle cars to pick up any checked-in tools at any time. The customer only pays for each tool for the duration from the arrive time to the check-in time, and each tool i has a rental rate ri.

Find out in what order the customer should use these tools, so as to minimize the total rental cost. Assume that these tools may be used in any order.

Example: rent 2 tools, tool 1 is needed for 2 hours and rental rate is 10, tool 2 is needed for 3 hours and rental rate is 5. Using tool 1 first and then tool 2 yields a minimized rental cost: 10*2 +5*(2+3) = 45; while using tool 2 first and then tool 1 has the total cost as: 5*3 + 10*(3+2) = 65

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}