summaryrefslogtreecommitdiff
path: root/packages/glpk/examples
diff options
context:
space:
mode:
Diffstat (limited to 'packages/glpk/examples')
-rw-r--r--packages/glpk/examples/simplex1.hs4
-rw-r--r--packages/glpk/examples/simplex2.hs5
-rw-r--r--packages/glpk/examples/simplex3.hs5
-rw-r--r--packages/glpk/examples/simplex4.hs5
4 files changed, 11 insertions, 8 deletions
diff --git a/packages/glpk/examples/simplex1.hs b/packages/glpk/examples/simplex1.hs
index 4609524..9639f37 100644
--- a/packages/glpk/examples/simplex1.hs
+++ b/packages/glpk/examples/simplex1.hs
@@ -5,8 +5,8 @@ import Numeric.LinearProgramming
5objFun = Maximize [10, 6, 4] 5objFun = Maximize [10, 6, 4]
6 6
7constr = Dense [ [1,1,1] :<: 100 7constr = Dense [ [1,1,1] :<: 100
8 , [10,4,5] :<: 600 8 , [10,4,5] :<: 600
9 , [2,2,6] :<: 300 ] 9 , [2,2,6] :<: 300 ]
10 10
11-- default bounds 11-- default bounds
12bnds = [ 1 :>: 0 12bnds = [ 1 :>: 0
diff --git a/packages/glpk/examples/simplex2.hs b/packages/glpk/examples/simplex2.hs
index 76a53df..40e4bbd 100644
--- a/packages/glpk/examples/simplex2.hs
+++ b/packages/glpk/examples/simplex2.hs
@@ -1,6 +1,6 @@
1import Numeric.LinearProgramming 1import Numeric.LinearProgramming
2 2
3prob = Maximize [1,2,3,4] 3prob = Maximize [4, 3, -2, 7]
4 4
5constr1 = Sparse [ [1#1, 1#2] :<: 10 5constr1 = Sparse [ [1#1, 1#2] :<: 10
6 , [1#3, 1#4] :<: 10 6 , [1#3, 1#4] :<: 10
@@ -12,5 +12,6 @@ constr2 = Dense [ [1,1,0,0] :<: 10
12 12
13main = do 13main = do
14 print $ simplex prob constr1 [] 14 print $ simplex prob constr1 []
15 print $ simplex prob constr2 [] 15 print $ simplex prob constr2 [ 2 :>: 1, 4 :&: (2,7)]
16 print $ simplex prob constr2 [ Free 3 ]
16 17
diff --git a/packages/glpk/examples/simplex3.hs b/packages/glpk/examples/simplex3.hs
index 0f787cb..3a7e8e8 100644
--- a/packages/glpk/examples/simplex3.hs
+++ b/packages/glpk/examples/simplex3.hs
@@ -1,7 +1,8 @@
1import Numeric.LinearProgramming 1-- compare with
2
3-- $ glpsol --cpxlp /usr/share/doc/glpk-utils/examples/plan.lp -o result.txt 2-- $ glpsol --cpxlp /usr/share/doc/glpk-utils/examples/plan.lp -o result.txt
4 3
4import Numeric.LinearProgramming
5
5prob = Minimize [0.03, 0.08, 0.17, 0.12, 0.15, 0.21, 0.38] 6prob = Minimize [0.03, 0.08, 0.17, 0.12, 0.15, 0.21, 0.38]
6 7
7constr = Dense 8constr = Dense
diff --git a/packages/glpk/examples/simplex4.hs b/packages/glpk/examples/simplex4.hs
index 3b9c060..8496f6d 100644
--- a/packages/glpk/examples/simplex4.hs
+++ b/packages/glpk/examples/simplex4.hs
@@ -1,7 +1,8 @@
1import Numeric.LinearProgramming 1-- compare with
2
3-- $ glpsol --cpxlp /usr/share/doc/glpk-utils/examples/plan.lp -o result.txt 2-- $ glpsol --cpxlp /usr/share/doc/glpk-utils/examples/plan.lp -o result.txt
4 3
4import Numeric.LinearProgramming
5
5prob = Minimize [0.03, 0.08, 0.17, 0.12, 0.15, 0.21, 0.38] 6prob = Minimize [0.03, 0.08, 0.17, 0.12, 0.15, 0.21, 0.38]
6 7
7constr = Sparse 8constr = Sparse