Knapsack problem/Continuous: Difference between revisions

m
→‎{{header|Ursala}}: simplified a little
m (changed a comment)
m (→‎{{header|Ursala}}: simplified a little)
Line 380:
[http://en.wikipedia.org/wiki/Linear_programming linear programming] problem and handing it off to an external library (which will be either [http://sourceforge.net/projects/lpsolve lpsolve] or
[http://www.gnu.org/software/glpk/glpk.html glpk] depending on the run-time system configuration).
<lang Ursala>#import stdflo
 
<lang Ursala>#import std
#import flo
#import lin
 
Line 388 ⟶ 386:
 
<
'beef': ': (3.8,36.0),
'pork': ': (5.4,43.0),
'ham': ': (3.6,90.0),
'greaves': (2.4,45.0),
'flitch ': (4.0,30.0),
'brawn': ': (2.5,56.0),
'welt': ': (3.7,67.0),
'salami ': (3.0,95.0),
'sausage': (5.9,98.0)>
 
Line 408 ⟶ 406:
#cast %em
 
main = ^p(pad` @nS,~&mS) solution system items</lang>
output:
<pre><
<
'brawn ': 2.500000e+00,
'greaves': 2.400000e+00,
Anonymous user