summaryrefslogtreecommitdiff
path: root/packages/glpk/examples/simplex3.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-02-21 18:26:23 +0000
committerAlberto Ruiz <aruiz@um.es>2010-02-21 18:26:23 +0000
commitf38b4a3076cfae023559ce61cb2a443c809b7a6f (patch)
tree022c127181fb65c34705cdcf44221b4ac89ba50b /packages/glpk/examples/simplex3.hs
parenta3d1bb34ae7b1f97b7e9900fc38f145094fe4777 (diff)
simple glpk interface
Diffstat (limited to 'packages/glpk/examples/simplex3.hs')
-rw-r--r--packages/glpk/examples/simplex3.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/glpk/examples/simplex3.hs b/packages/glpk/examples/simplex3.hs
new file mode 100644
index 0000000..0f787cb
--- /dev/null
+++ b/packages/glpk/examples/simplex3.hs
@@ -0,0 +1,24 @@
1import Numeric.LinearProgramming
2
3-- $ glpsol --cpxlp /usr/share/doc/glpk-utils/examples/plan.lp -o result.txt
4
5prob = Minimize [0.03, 0.08, 0.17, 0.12, 0.15, 0.21, 0.38]
6
7constr = Dense
8 [ [1,1,1,1,1,1,1] :==: 2000
9 , [0.15, 0.04, 0.02, 0.04, 0.2,0.01, 0.03] :<: 60
10 , [0.03, 0.05, 0.08, 0.02, 0.06, 0.01, 0] :<: 100
11 , [0.02, 0.04, 0.01, 0.02, 0.02, 0, 0] :<: 40
12 , [0.02, 0.03, 0, 0, 0.01, 0, 0] :<: 30
13 , [0.7, 0.75, 0.8, 0.75, 0.8, 0.97, 0] :>: 1500
14 , [0.02, 0.06, 0.08, 0.12, 0.02, 0.01, 0.97] :&: (250,300)
15 ]
16
17bounds = [ 1 :&: (0,200)
18 , 2 :&: (0,2500)
19 , 3 :&: (400,800)
20 , 4 :&: (100,700)
21 , 5 :&: (0,1500) ]
22
23main = print $ simplex prob constr bounds
24