diff options
author | Justin Bedo <cu@cua0.org> | 2014-10-24 20:00:05 +1100 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2014-10-24 20:00:05 +1100 |
commit | e60c072870ee428720dce1f22890f1ce075325e4 (patch) | |
tree | 9014102c3c300d24006f1add4757fe9c0dc26ed2 /Math/LinProg/LPSolve | |
parent | ac50e991e7b0c2c00d9ac169a5ddcb06821df172 (diff) |
Added timout option for lp_solve
Diffstat (limited to 'Math/LinProg/LPSolve')
-rw-r--r-- | Math/LinProg/LPSolve/FFI.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Math/LinProg/LPSolve/FFI.hs b/Math/LinProg/LPSolve/FFI.hs index 45b0a30..ddc7798 100644 --- a/Math/LinProg/LPSolve/FFI.hs +++ b/Math/LinProg/LPSolve/FFI.hs @@ -4,6 +4,7 @@ module Math.LinProg.LPSolve.FFI ( ,ConstraintType(..) ,LPRec ,setConstrType + ,setTimeout ,makeLP ,freeLP ,setMat @@ -50,6 +51,10 @@ foreign import ccall "set_rh" c_set_rh :: LPRec -> CInt -> CDouble -> IO CChar foreign import ccall "solve" c_solve :: LPRec -> IO CInt foreign import ccall "get_variables" c_get_variables :: LPRec -> Ptr CDouble -> IO CChar foreign import ccall "set_constr_type" c_set_constr_type :: LPRec -> CInt -> CInt -> IO CChar +foreign import ccall "set_timeout" c_set_timeout :: LPRec -> CLong -> IO () + +setTimeout :: LPRec -> Integer -> IO () +setTimeout lp x = c_set_timeout lp (fromIntegral x) setConstrType :: LPRec -> Int -> ConstraintType -> IO Word8 setConstrType lp i t = fromIntegral <$> c_set_constr_type lp (fromIntegral i) (fromIntegral $ fromEnum t) |