Anonymous user
Knapsack problem/Continuous: Difference between revisions
m
corrected word choice (thief instead of robber), added whitespace in the task's preamble, added a ;Task; and ;Related task; (bold) headers, changed the task to a directive instead of a query.
m (corrected word choice (thief instead of robber), added whitespace in the task's preamble, added a ;Task; and ;Related task; (bold) headers, changed the task to a directive instead of a query.) |
|||
Line 1:
{{task|Classic CS problems and programs}}
<!-- a thief (or burglar) steals, a robber robs (confronts a person while stealing). Not exactly a perfect definition, but close enough. -- Gerard Schildberger. -->
See also: [[Knapsack problem]] and [[wp:Continuous_knapsack_problem|Wikipedia]].▼
A thief burgles a butcher's shop, where he can select from some items.
A robber burgles a butcher's shop, where he can select from some items. He knows the weights and prices of each items. Because he has a knapsack with 15 kg maximal capacity, he wants to select the items such that he would have his profit maximized. He may cut the items; the item has a reduced price after cutting that is proportional to the original price by the ratio of masses. That means: half of an item has half the price of the original.▼
▲
This is the item list in the butcher's:▼
▲This is the item list in the butcher's shop:
{| style="text-align: left; width: 80%;" border="4" cellpadding="2" cellspacing="2"
Line 33 ⟶ 36:
|}
'''Which items does the robber carry in his knapsack so that their total weight does not exceed 15 kg, and their total value is maximised?'''▼
<br>
;Task:
▲
;Related task:
* [[Knapsack problem]]
;See also:
▲
<br><br>
=={{header|Ada}}==
|