From e60c072870ee428720dce1f22890f1ce075325e4 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 24 Oct 2014 20:00:05 +1100 Subject: Added timout option for lp_solve --- Math/LinProg/LPSolve/FFI.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Math/LinProg/LPSolve') 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) -- cgit v1.2.3