Jump to content

Knapsack problem/Unbounded: Difference between revisions

m
added a ;Task: (bold) header, changed task query to a directive, added other whitespace to the task's preamble.
m (added a ;Task: (bold) header, changed task query to a directive, added other whitespace to the task's preamble.)
Line 1:
{{task|Classic CS problems and programs}}
See also: [[Knapsack problem/Bounded]], [[Knapsack problem/0-1]]
 
A travellertraveler gets diverted and has to make an unscheduled stop in what turns out to be Shangri La.   Opting to leave, he is allowed to take as much as he likes of the following items, so long as it will fit in his knapsack, and he can carry it.
He knows that he can carry no more than 25 'weights' in total; and that the capacity of his knapsack is 0.25 'cubic lengths'.
 
He knows that he can carry no more than   25   'weights' in total;   and that the capacity of his knapsack is   0.25   'cubic lengths'.
Looking just above the bar codes on the items he finds their weights and volumes. He digs out his recent copy of a financial paper and gets the value of each item.
 
Looking just above the bar codes on the items he finds their weights and volumes.   He digs out his recent copy of a financial paper and gets the value of each item.
<table
style="text-align: left; width: 80%;" border="4"
Line 46:
nowrap="nowrap" valign="middle">&lt;=25</td><td
style="background-color: rgb(255, 204, 255);" align="left"
nowrap="nowrap" valign="middle">&lt;=0.25&nbsp;</td></tr></table>
</table>
 
<br>
He can only take whole units of any item, but there is much more of any item than he could ever carry
 
'''How many of each item does he take to maximise the value of items he is carrying away with him?'''
 
;Task:
Note:
'''HowShow how many of each item does he take to maximisemaximize the value of items he is carrying away with him?'''.
# There are four solutions that maximise the value taken. Only one ''need'' be given.
 
 
;Note:
#* &nbsp; There are four solutions that maximisemaximize the value taken. &nbsp; Only one ''need'' be given.
 
 
<!-- All solutions
Line 65 ⟶ 71:
# (9, 0, 11) also minimizes weight and volume within the limits of calculation
-->
 
;Related tasks:
See* also:&nbsp; [[Knapsack problem/Bounded]], [[Knapsack problem/0-1]]
* &nbsp; [[Knapsack problem/0-1]]
<br><br>
 
=={{header|Ada}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.