1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
-- compare with
-- $ glpsol --cpxlp /usr/share/doc/glpk-utils/examples/plan.lp -o result.txt
import Numeric.LinearProgramming
prob = Minimize [0.03, 0.08, 0.17, 0.12, 0.15, 0.21, 0.38]
constr = Sparse
[ [1#1,1#2,1#3,1#4,1#5,1#6,1#7] :==: 2000
, [0.15#1, 0.04#2, 0.02#3, 0.04#4, 0.2#5,0.01#6, 0.03#7] :<=: 60
, [0.03#1, 0.05#2, 0.08#3, 0.02#4, 0.06#5, 0.01#6] :<=: 100
, [0.02#1, 0.04#2, 0.01#3, 0.02#4, 0.02#5] :<=: 40
, [0.02#1, 0.03#2, 0.01#5] :<=: 30
, [0.7#1, 0.75#2, 0.8#3, 0.75#4, 0.8#5, 0.97#6] :=>: 1500
, [0.02#1, 0.06#2, 0.08#3, 0.12#4, 0.02#5, 0.01#6, 0.97#7] :&: (250,300)
]
bounds = [ 1 :&: (0,200)
, 2 :&: (0,2500)
, 3 :&: (400,800)
, 4 :&: (100,700)
, 5 :&: (0,1500) ]
main = print $ simplex prob constr bounds
|