diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-02-21 18:26:23 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-02-21 18:26:23 +0000 |
commit | f38b4a3076cfae023559ce61cb2a443c809b7a6f (patch) | |
tree | 022c127181fb65c34705cdcf44221b4ac89ba50b /packages/glpk/examples/simplex1.hs | |
parent | a3d1bb34ae7b1f97b7e9900fc38f145094fe4777 (diff) |
simple glpk interface
Diffstat (limited to 'packages/glpk/examples/simplex1.hs')
-rw-r--r-- | packages/glpk/examples/simplex1.hs | 21 |
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 | |||
3 | import Numeric.LinearProgramming | ||
4 | |||
5 | objFun = Maximize [10, 6, 4] | ||
6 | |||
7 | constr = Dense [ [1,1,1] :<: 100 | ||
8 | , [10,4,5] :<: 600 | ||
9 | , [2,2,6] :<: 300 ] | ||
10 | |||
11 | -- default bounds | ||
12 | bnds = [ 1 :>: 0 | ||
13 | , 2 :>: 0 | ||
14 | , 3 :>: 0 ] | ||
15 | |||
16 | main = 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 | |||