diff options
Diffstat (limited to 'packages/glpk/examples/simplex2.hs')
-rw-r--r-- | packages/glpk/examples/simplex2.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/glpk/examples/simplex2.hs b/packages/glpk/examples/simplex2.hs new file mode 100644 index 0000000..76a53df --- /dev/null +++ b/packages/glpk/examples/simplex2.hs | |||
@@ -0,0 +1,16 @@ | |||
1 | import Numeric.LinearProgramming | ||
2 | |||
3 | prob = Maximize [1,2,3,4] | ||
4 | |||
5 | constr1 = Sparse [ [1#1, 1#2] :<: 10 | ||
6 | , [1#3, 1#4] :<: 10 | ||
7 | ] | ||
8 | |||
9 | constr2 = Dense [ [1,1,0,0] :<: 10 | ||
10 | , [0,0,1,1] :<: 10 | ||
11 | ] | ||
12 | |||
13 | main = do | ||
14 | print $ simplex prob constr1 [] | ||
15 | print $ simplex prob constr2 [] | ||
16 | |||