Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
%Knapsack problem/Unbounded. Nigel Galloway, August 13th., 2021
|
||||
enum Items ={panacea,ichor,gold};
|
||||
array[Items] of float: weight =[0.3,0.2,2.0]; constraint sum(n in Items)(take[n]*weight[n])<=25.0;
|
||||
array[Items] of int: value =[3000,1800,2500];
|
||||
array[Items] of float: volume =[0.025,0.015,0.002]; constraint sum(n in Items)(take[n]*volume[n])<=0.25;
|
||||
array[Items] of var 0..floor(25.0/min(weight)): take;
|
||||
solve maximize sum(n in Items)(value[n]*take[n]);
|
||||
output(["Take "++show(take[panacea])++" vials of panacea\nTake "++show(take[ichor])++" ampules of ichor\nTake "++ show(take[gold])++" bars of gold\n"])
|
||||
Loading…
Add table
Add a link
Reference in a new issue