What will be the result of running the burgler's algorithm with Metric 2?
A. The algorithm runs and returns the optimal solution.
B. The algorithm runs and returns a non-optimal solution.
C. The algorithm does not run.
查看答案
Metric 2:def metric2(item): return -item.getWeight()Which heuristic does Metric 2 employ?
A. Choose the lightest object first.
B. Choose the most valuable object first.
Choose the item with the best value to weight ratio first.
What will be the result of running the burgler's algorithm with Metric 1?
A. The algorithm runs and returns the optimal solution.
B. The algorithm runs and returns a non-optimal solution.
C. The algorithm does not run.
As a burgler robs a house, she finds the following items:Dirt - Weight: 4, Value: 0Computer - Weight: 10, Value: 30Fork - Weight: 5, Value: 1Problem Set - Weight: 0, Value: -10This time, she can only carry a weight of 14, and wishes to maximize the value to weight ratio of the things she carries. She employs three different metrics in an attempt to do this, and writes an algorithm in Python to determine which loot to take.The algorithm works as follows:Evaluate the metric of each item. Each metric returns a numerical value for each item.For each item, from highest metric value to lowest, add the item if there is room in the bag.Describe the heuristic that each of the following 3 metrics uses, and choose the result of running the algorithm with each metric.Metric 1:def metric1(item): return item.getValue() / float(item.getWeight()) # We want exact values!Which heuristic does Metric 1 employ?
A. Choose the lightest object first.
B. Choose the most valuable object first.
Choose the item with the best value to weight ratio first.
Of the four delay values tested, which has the lowest variance?
A. delay of 2nd drug = 300
B. delay of 2nd drug = 150
C. delay of 2nd drug = 75
D. delay of 2nd drug = 0