A large apple farm distributes their apples in boxes that they can source from any one of a number of nearby box manufacturers. Each box manufacturer makes only one box type that holds a specific number of apples - so a box from one manufacturer might hold 24 apples, while a box from another might hold 13. The apple farm can only choose one box supplier each year (a decision they make each year based on price), but they can then order an unlimited number of boxes of that type. The farm likes to be prepared, and creates large batches of apples to pack before the decision about which box type to use has been made. The farm also likes to limit waste, and tries to set the number of apples in these large batches such that they can fill an integer number of boxes perfectly with no apples left over. In creating these batches, although the farm doesn't yet know the exact capacity of the boxes they will buy, they know a list of possible values the box capacity will take. For example, if the list of possible box capacities is [13,24,25,32], then a batch size of 31200 apples will completely fill an integer number of any of these boxes. As a further example, a batch size of 18810 apples would completely fill an integer number of boxes chosen from the list: [5,9,33,57,66]. Write a function called Q10 that takes a row vector of positive integers (corresponding to the possible box capacities) as an input argument, and returns a single output argument (either a double or uint64 data type) corresponding to the smallest batch size that would completely fill an integer number of any of the boxes selected from the input list. You may assume that the input vector contains between 1 and 15 integers (sorted in ascending order), with values between 1 and 99. Your code should only take a few seconds (at most) to run, even for larger input vectors. Submissions that take too long to run will be marked as incorrect.
A large apple farm distributes their apples in boxes that they can source from any one of a number of nearby box manufacturers. Each box manufacturer makes only one box type that holds a specific number of apples - so a box from one manufacturer might hold 24 apples, while a box from another might hold 13. The apple farm can only choose one box supplier each year (a decision they make each year based on price), but they can then order an unlimited number of boxes of that type. The farm likes to be prepared, and creates large batches of apples to pack before the decision about which box type to use has been made. The farm also likes to limit waste, and tries to set the number of apples in these large batches such that they can fill an integer number of boxes perfectly with no apples left over. In creating these batches, although the farm doesn't yet know the exact capacity of the boxes they will buy, they know a list of possible values the box capacity will take. For example, if the list of possible box capacities is [13,24,25,32], then a batch size of 31200 apples will completely fill an integer number of any of these boxes. As a further example, a batch size of 18810 apples would completely fill an integer number of boxes chosen from the list: [5,9,33,57,66]. Write a function called Q10 that takes a row vector of positive integers (corresponding to the possible box capacities) as an input argument, and returns a single output argument (either a double or uint64 data type) corresponding to the smallest batch size that would completely fill an integer number of any of the boxes selected from the input list. You may assume that the input vector contains between 1 and 15 integers (sorted in ascending order), with values between 1 and 99. Your code should only take a few seconds (at most) to run, even for larger input vectors. Submissions that take too long to run will be marked as incorrect.
Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter20: Queuing Theory
Section20.9: Finite Source Models: The Machine Repair Model
Problem 4P
Related questions
Question
.....
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole