summaryrefslogtreecommitdiff
path: root/packages/glpk/examples/simplex2.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-02-23 18:22:57 +0000
committerAlberto Ruiz <aruiz@um.es>2010-02-23 18:22:57 +0000
commite0605467b60f65478d0f5cc8f82ba14a99168f7b (patch)
tree876e81ae0ee77f4cd01f5729ab35902ec9980789 /packages/glpk/examples/simplex2.hs
parent5587a094afa3e24698cd38301c805e6ee5876c73 (diff)
error checking for simplex
Diffstat (limited to 'packages/glpk/examples/simplex2.hs')
-rw-r--r--packages/glpk/examples/simplex2.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/packages/glpk/examples/simplex2.hs b/packages/glpk/examples/simplex2.hs
index 40e4bbd..0b865a6 100644
--- a/packages/glpk/examples/simplex2.hs
+++ b/packages/glpk/examples/simplex2.hs
@@ -1,17 +1,18 @@
1import Numeric.LinearProgramming 1import Numeric.LinearProgramming
2 2
3prob = Maximize [4, 3, -2, 7] 3prob = Maximize [4, -3, 2]
4 4
5constr1 = Sparse [ [1#1, 1#2] :<: 10 5constr1 = Sparse [ [2#1, 1#2] :<: 10
6 , [1#3, 1#4] :<: 10 6 , [1#2, 5#3] :<: 20
7 ] 7 ]
8 8
9constr2 = Dense [ [1,1,0,0] :<: 10 9constr2 = Dense [ [2,1,0] :<: 10
10 , [0,0,1,1] :<: 10 10 , [0,1,5] :<: 20
11 ] 11 ]
12 12
13main = do 13main = do
14 print $ simplex prob constr1 [] 14 print $ simplex prob constr1 []
15 print $ simplex prob constr2 [ 2 :>: 1, 4 :&: (2,7)] 15 print $ simplex prob constr2 []
16 print $ simplex prob constr2 [ Free 3 ] 16 print $ simplex prob constr2 [ 2 :>: 1, 3 :&: (2,7)]
17 print $ simplex prob constr2 [ Free 2 ]
17 18