summaryrefslogtreecommitdiff
path: root/packages/glpk/examples/simplex1.hs
blob: ec72bdc8a8f335ccda2592de6203fb1ac6784d0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- first example in glpk manual

import Numeric.LinearProgramming

objFun = Maximize [10, 6, 4]

constr = Dense [ [1,1,1]  :<: 100
               , [10,4,5] :<: 600
               , [2,2,6]  :<: 300 ]

-- default bounds
bnds = [ 1 :>: 0
       , 2 :>: 0
       , 3 :>: 0 ]

main = do
    print $ simplex objFun constr []
    print $ simplex objFun constr bnds
    print $ simplex objFun constr [Free 3]
    print $ simplex objFun constr [ 2 :<: 50 ]