summaryrefslogtreecommitdiff
path: root/packages/glpk/examples/simplex1.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/glpk/examples/simplex1.hs')
-rw-r--r--packages/glpk/examples/simplex1.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/glpk/examples/simplex1.hs b/packages/glpk/examples/simplex1.hs
new file mode 100644
index 0000000..4609524
--- /dev/null
+++ b/packages/glpk/examples/simplex1.hs
@@ -0,0 +1,21 @@
1-- first example in glpk manual
2
3import Numeric.LinearProgramming
4
5objFun = Maximize [10, 6, 4]
6
7constr = Dense [ [1,1,1] :<: 100
8 , [10,4,5] :<: 600
9 , [2,2,6] :<: 300 ]
10
11-- default bounds
12bnds = [ 1 :>: 0
13 , 2 :>: 0
14 , 3 :>: 0 ]
15
16main = do
17 print $ simplex objFun constr []
18 print $ simplex objFun constr bnds
19 print $ simplex objFun constr [Free 3]
20 print $ simplex objFun constr [ 2 :<: 50 ]
21