{-# OPTIONS_GHC -Wall #-}
{-# OPTIONS_HADDOCK show-extensions #-}
{-# LANGUAGE FunctionalDependencies #-}
module Numeric.Optimization.MIP.Solver.Base
( SolveOptions (..)
, Default (..)
, IsSolver (..)
) where
import Data.Default.Class
import Data.Scientific (Scientific)
import Numeric.Optimization.MIP.Base as MIP
data SolveOptions
= SolveOptions
{ SolveOptions -> Maybe Double
solveTimeLimit :: Maybe Double
, SolveOptions -> String -> IO ()
solveLogger :: String -> IO ()
, SolveOptions -> String -> IO ()
solveErrorLogger :: String -> IO ()
}
instance Default SolveOptions where
def :: SolveOptions
def =
SolveOptions :: Maybe Double
-> (String -> IO ()) -> (String -> IO ()) -> SolveOptions
SolveOptions
{ solveTimeLimit :: Maybe Double
solveTimeLimit = Maybe Double
forall a. Maybe a
Nothing
, solveLogger :: String -> IO ()
solveLogger = IO () -> String -> IO ()
forall a b. a -> b -> a
const (IO () -> String -> IO ()) -> IO () -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
, solveErrorLogger :: String -> IO ()
solveErrorLogger = IO () -> String -> IO ()
forall a b. a -> b -> a
const (IO () -> String -> IO ()) -> IO () -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
}
class Monad m => IsSolver s m | s -> m where
solve :: s -> SolveOptions -> MIP.Problem Scientific -> m (MIP.Solution Scientific)