jyp / glpk-hs

Haskell bindings to glpk
Other
13 stars 18 forks source link

example1.hs does not compile #2

Closed Bodigrim closed 7 years ago

Bodigrim commented 8 years ago

example1.hs does not compile with glpk-hs 0.3.5 and ghc 7.10.

I've managed to fix it in the following way:

@@ -1,16 +1,15 @@
-
-import Data.LinearProgram.LPMonad
+import Control.Monad.LPMonad
 import Data.LinearProgram
 import Data.LinearProgram.GLPK

 objFun :: LinFunc String Int
-objFun = linCombination [(10, "x1"), (6, "x2"), (4, "x3")]
+objFun = linCombination [(10 :: Int, "x1"), (6, "x2"), (4, "x3")]

 lp :: LP String Int
 lp = execLPM $ do      setDirection Max
                        setObjective objFun
                        leqTo (varSum ["x1", "x2", "x3"]) 100
-                       leqTo (10 *^ var "x1" ^+^ 4 *& "x2" ^+^ 5 *^ var "x3") 600
+                       leqTo ((10 :: Int) *^ var "x1" ^+^ 4 *& "x2" ^+^ (5 :: Int) *^ var "x3") 600
                        leqTo (linCombination [(2, "x1"), (2, "x2"), (6, "x3")]) 300
                        varGeq "x1" 0
                        varBds "x2" 0 50