diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-02-23 18:22:57 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-02-23 18:22:57 +0000 |
commit | e0605467b60f65478d0f5cc8f82ba14a99168f7b (patch) | |
tree | 876e81ae0ee77f4cd01f5729ab35902ec9980789 /packages/glpk/examples/simplex2.hs | |
parent | 5587a094afa3e24698cd38301c805e6ee5876c73 (diff) |
error checking for simplex
Diffstat (limited to 'packages/glpk/examples/simplex2.hs')
-rw-r--r-- | packages/glpk/examples/simplex2.hs | 15 |
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 @@ | |||
1 | import Numeric.LinearProgramming | 1 | import Numeric.LinearProgramming |
2 | 2 | ||
3 | prob = Maximize [4, 3, -2, 7] | 3 | prob = Maximize [4, -3, 2] |
4 | 4 | ||
5 | constr1 = Sparse [ [1#1, 1#2] :<: 10 | 5 | constr1 = Sparse [ [2#1, 1#2] :<: 10 |
6 | , [1#3, 1#4] :<: 10 | 6 | , [1#2, 5#3] :<: 20 |
7 | ] | 7 | ] |
8 | 8 | ||
9 | constr2 = Dense [ [1,1,0,0] :<: 10 | 9 | constr2 = Dense [ [2,1,0] :<: 10 |
10 | , [0,0,1,1] :<: 10 | 10 | , [0,1,5] :<: 20 |
11 | ] | 11 | ] |
12 | 12 | ||
13 | main = do | 13 | main = 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 | ||