{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE UndecidableInstances #-}

-- | Data and class definitions for the core math programming
-- interface.
module Math.Programming.Types where

import Control.Monad.Trans.Class
import Control.Monad.Trans.RWS
import Control.Monad.Trans.Reader
import Control.Monad.Trans.State
import Control.Monad.Trans.Writer
import qualified Data.Text as T
import Math.Programming.LinExpr

-- | A linear program.
--
-- This is a monadic context for formulating and solving linear
-- programs. The types @v@, @c@, and @o@ refer to the types of
-- variables, constraints, and objectives, respectively, used by a
-- particular solver backend.
class Monad m => MonadLP v c o m | m -> v c o where
  -- | Add a new (free) variable to the model.
  --
  -- See 'Math.Programming.Dsl.free', 'Math.Programming.Dsl.bounded',
  -- 'Math.Programming.Dsl.nonNeg', and 'Math.Programming.Dsl.nonPos'
  -- as higher-level alternatives.
  addVariable :: m v

  -- | Remove a variable from the model.
  deleteVariable :: v -> m ()

  -- | Get the name of a variable.
  getVariableName :: v -> m T.Text

  -- | Set a name for a variable.
  setVariableName :: v -> T.Text -> m ()

  -- | Retrieve the current bounds associated with a variable.
  getVariableBounds :: v -> m Bounds

  -- | Apply bounds to a variable.
  --
  -- See 'Math.Programming.Dsl.within' as a higher-level alternative.
  setVariableBounds :: v -> Bounds -> m ()

  -- | Get the value of a variable in the current solution.
  --
  -- This value could be arbitrary if no solve has been completed, or
  -- a solve produced an infeasible or unbounded solution.
  getVariableValue :: v -> m Double

  -- | Add a constraint representing the given inequality to the model.
  --
  -- See the 'Math.Programming.Dsl..==.', 'Math.Programming.Dsl..==#',
  -- 'Math.Programming.Dsl.==.', 'Math.Programming.Dsl..>=.',
  -- 'Math.Programming.Dsl..>=', 'Math.Programming.Dsl.>=.',
  -- 'Math.Programming.Dsl..<=.', 'Math.Programming.Dsl..<=', and
  -- 'Math.Programming.Dsl.<=.' functions as higher-level
  -- alternatives.
  addConstraint :: Inequality (Expr v) -> m c

  -- | Remove a constraint from the model.
  deleteConstraint :: c -> m ()

  -- | Get the name of a constraint.
  getConstraintName :: c -> m T.Text

  -- | Set a name for a constraint.
  setConstraintName :: c -> T.Text -> m ()

  -- | Get the dual value associated with a constraint.
  getConstraintValue :: c -> m Double

  -- | Add an objective to the problem.
  --
  -- Depending on the solver backend, this might replace an existing objective.
  addObjective :: Expr v -> m o

  -- | Remove an objective from the model.
  deleteObjective :: o -> m ()

  -- | Get the name of a objective.
  getObjectiveName :: o -> m T.Text

  -- | Set a name for a objective.
  setObjectiveName :: o -> T.Text -> m ()

  -- | Get the sense of an objective.
  getObjectiveSense :: o -> m Sense

  -- | Set the sense of an objective.
  setObjectiveSense :: o -> Sense -> m ()

  -- | Get the value of an objective.
  getObjectiveValue :: o -> m Double

  -- | Get the timeout associated with a problem.
  getTimeout :: m Double

  -- | Set the timeout associated with a problem.
  setTimeout :: Double -> m ()

  -- | Compute an LP-optimal solution.
  optimizeLP :: m SolutionStatus

-- | Function composition involving a 2-argument function.
compose2 :: (c -> d) -> (a -> b -> c) -> (a -> b -> d)
compose2 :: forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
compose2 = (((b -> c) -> b -> d) -> (a -> b -> c) -> a -> b -> d)
-> ((c -> d) -> (b -> c) -> b -> d)
-> (c -> d)
-> (a -> b -> c)
-> a
-> b
-> d
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((b -> c) -> b -> d) -> (a -> b -> c) -> a -> b -> d
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (c -> d) -> (b -> c) -> b -> d
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap

-- | Monadic lifting  involving a 2-argument function.
lift2 :: (MonadTrans t, Monad m) => (a -> b -> m c) -> (a -> b -> t m c)
lift2 :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 = (m c -> t m c) -> (a -> b -> m c) -> a -> b -> t m c
forall c d a b. (c -> d) -> (a -> b -> c) -> a -> b -> d
compose2 m c -> t m c
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift

instance (MonadLP v c o m) => MonadLP v c o (ReaderT r m) where
  addVariable :: ReaderT r m v
addVariable = m v -> ReaderT r m v
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m v
forall v c o (m :: * -> *). MonadLP v c o m => m v
addVariable
  deleteVariable :: v -> ReaderT r m ()
deleteVariable = m () -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> ReaderT r m ()) -> (v -> m ()) -> v -> ReaderT r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> m ()
deleteVariable
  getVariableName :: v -> ReaderT r m Text
getVariableName = m Text -> ReaderT r m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> ReaderT r m Text)
-> (v -> m Text) -> v -> ReaderT r m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Text
getVariableName
  setVariableName :: v -> Text -> ReaderT r m ()
setVariableName = (v -> Text -> m ()) -> v -> Text -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> Text -> m ()
setVariableName
  getVariableValue :: v -> ReaderT r m Double
getVariableValue = m Double -> ReaderT r m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> ReaderT r m Double)
-> (v -> m Double) -> v -> ReaderT r m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Double
getVariableValue
  getVariableBounds :: v -> ReaderT r m Bounds
getVariableBounds = m Bounds -> ReaderT r m Bounds
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bounds -> ReaderT r m Bounds)
-> (v -> m Bounds) -> v -> ReaderT r m Bounds
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Bounds
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Bounds
getVariableBounds
  setVariableBounds :: v -> Bounds -> ReaderT r m ()
setVariableBounds = (v -> Bounds -> m ()) -> v -> Bounds -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Bounds -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> Bounds -> m ()
setVariableBounds
  addConstraint :: Inequality (Expr v) -> ReaderT r m c
addConstraint = m c -> ReaderT r m c
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m c -> ReaderT r m c)
-> (Inequality (Expr v) -> m c)
-> Inequality (Expr v)
-> ReaderT r m c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inequality (Expr v) -> m c
forall v c o (m :: * -> *).
MonadLP v c o m =>
Inequality (Expr v) -> m c
addConstraint
  deleteConstraint :: c -> ReaderT r m ()
deleteConstraint = m () -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> ReaderT r m ()) -> (c -> m ()) -> c -> ReaderT r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => c -> m ()
deleteConstraint
  getConstraintName :: c -> ReaderT r m Text
getConstraintName = m Text -> ReaderT r m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> ReaderT r m Text)
-> (c -> m Text) -> c -> ReaderT r m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => c -> m Text
getConstraintName
  setConstraintName :: c -> Text -> ReaderT r m ()
setConstraintName = (c -> Text -> m ()) -> c -> Text -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 c -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => c -> Text -> m ()
setConstraintName
  getConstraintValue :: c -> ReaderT r m Double
getConstraintValue = m Double -> ReaderT r m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> ReaderT r m Double)
-> (c -> m Double) -> c -> ReaderT r m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => c -> m Double
getConstraintValue
  addObjective :: Expr v -> ReaderT r m o
addObjective = m o -> ReaderT r m o
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m o -> ReaderT r m o)
-> (Expr v -> m o) -> Expr v -> ReaderT r m o
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expr v -> m o
forall v c o (m :: * -> *). MonadLP v c o m => Expr v -> m o
addObjective
  deleteObjective :: o -> ReaderT r m ()
deleteObjective = m () -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> ReaderT r m ()) -> (o -> m ()) -> o -> ReaderT r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> m ()
deleteObjective
  getObjectiveName :: o -> ReaderT r m Text
getObjectiveName = m Text -> ReaderT r m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> ReaderT r m Text)
-> (o -> m Text) -> o -> ReaderT r m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Text
getObjectiveName
  setObjectiveName :: o -> Text -> ReaderT r m ()
setObjectiveName = (o -> Text -> m ()) -> o -> Text -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 o -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> Text -> m ()
setObjectiveName
  getObjectiveValue :: o -> ReaderT r m Double
getObjectiveValue = m Double -> ReaderT r m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> ReaderT r m Double)
-> (o -> m Double) -> o -> ReaderT r m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Double
getObjectiveValue
  getObjectiveSense :: o -> ReaderT r m Sense
getObjectiveSense = m Sense -> ReaderT r m Sense
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Sense -> ReaderT r m Sense)
-> (o -> m Sense) -> o -> ReaderT r m Sense
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Sense
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Sense
getObjectiveSense
  setObjectiveSense :: o -> Sense -> ReaderT r m ()
setObjectiveSense = (o -> Sense -> m ()) -> o -> Sense -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 o -> Sense -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> Sense -> m ()
setObjectiveSense
  getTimeout :: ReaderT r m Double
getTimeout = m Double -> ReaderT r m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Double
forall v c o (m :: * -> *). MonadLP v c o m => m Double
getTimeout
  setTimeout :: Double -> ReaderT r m ()
setTimeout = m () -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> ReaderT r m ())
-> (Double -> m ()) -> Double -> ReaderT r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => Double -> m ()
setTimeout
  optimizeLP :: ReaderT r m SolutionStatus
optimizeLP = m SolutionStatus -> ReaderT r m SolutionStatus
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m SolutionStatus
forall v c o (m :: * -> *). MonadLP v c o m => m SolutionStatus
optimizeLP

instance (MonadLP v c o m, Monoid w) => MonadLP v c o (WriterT w m) where
  addVariable :: WriterT w m v
addVariable = m v -> WriterT w m v
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m v
forall v c o (m :: * -> *). MonadLP v c o m => m v
addVariable
  deleteVariable :: v -> WriterT w m ()
deleteVariable = m () -> WriterT w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> WriterT w m ()) -> (v -> m ()) -> v -> WriterT w m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> m ()
deleteVariable
  getVariableName :: v -> WriterT w m Text
getVariableName = m Text -> WriterT w m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> WriterT w m Text)
-> (v -> m Text) -> v -> WriterT w m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Text
getVariableName
  setVariableName :: v -> Text -> WriterT w m ()
setVariableName = (v -> Text -> m ()) -> v -> Text -> WriterT w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> Text -> m ()
setVariableName
  getVariableValue :: v -> WriterT w m Double
getVariableValue = m Double -> WriterT w m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> WriterT w m Double)
-> (v -> m Double) -> v -> WriterT w m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Double
getVariableValue
  getVariableBounds :: v -> WriterT w m Bounds
getVariableBounds = m Bounds -> WriterT w m Bounds
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bounds -> WriterT w m Bounds)
-> (v -> m Bounds) -> v -> WriterT w m Bounds
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Bounds
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Bounds
getVariableBounds
  setVariableBounds :: v -> Bounds -> WriterT w m ()
setVariableBounds = (v -> Bounds -> m ()) -> v -> Bounds -> WriterT w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Bounds -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> Bounds -> m ()
setVariableBounds
  addConstraint :: Inequality (Expr v) -> WriterT w m c
addConstraint = m c -> WriterT w m c
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m c -> WriterT w m c)
-> (Inequality (Expr v) -> m c)
-> Inequality (Expr v)
-> WriterT w m c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inequality (Expr v) -> m c
forall v c o (m :: * -> *).
MonadLP v c o m =>
Inequality (Expr v) -> m c
addConstraint
  deleteConstraint :: c -> WriterT w m ()
deleteConstraint = m () -> WriterT w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> WriterT w m ()) -> (c -> m ()) -> c -> WriterT w m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => c -> m ()
deleteConstraint
  getConstraintName :: c -> WriterT w m Text
getConstraintName = m Text -> WriterT w m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> WriterT w m Text)
-> (c -> m Text) -> c -> WriterT w m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => c -> m Text
getConstraintName
  setConstraintName :: c -> Text -> WriterT w m ()
setConstraintName = (c -> Text -> m ()) -> c -> Text -> WriterT w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 c -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => c -> Text -> m ()
setConstraintName
  getConstraintValue :: c -> WriterT w m Double
getConstraintValue = m Double -> WriterT w m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> WriterT w m Double)
-> (c -> m Double) -> c -> WriterT w m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => c -> m Double
getConstraintValue
  addObjective :: Expr v -> WriterT w m o
addObjective = m o -> WriterT w m o
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m o -> WriterT w m o)
-> (Expr v -> m o) -> Expr v -> WriterT w m o
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expr v -> m o
forall v c o (m :: * -> *). MonadLP v c o m => Expr v -> m o
addObjective
  deleteObjective :: o -> WriterT w m ()
deleteObjective = m () -> WriterT w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> WriterT w m ()) -> (o -> m ()) -> o -> WriterT w m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> m ()
deleteObjective
  getObjectiveName :: o -> WriterT w m Text
getObjectiveName = m Text -> WriterT w m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> WriterT w m Text)
-> (o -> m Text) -> o -> WriterT w m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Text
getObjectiveName
  setObjectiveName :: o -> Text -> WriterT w m ()
setObjectiveName = (o -> Text -> m ()) -> o -> Text -> WriterT w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 o -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> Text -> m ()
setObjectiveName
  getObjectiveValue :: o -> WriterT w m Double
getObjectiveValue = m Double -> WriterT w m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> WriterT w m Double)
-> (o -> m Double) -> o -> WriterT w m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Double
getObjectiveValue
  getObjectiveSense :: o -> WriterT w m Sense
getObjectiveSense = m Sense -> WriterT w m Sense
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Sense -> WriterT w m Sense)
-> (o -> m Sense) -> o -> WriterT w m Sense
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Sense
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Sense
getObjectiveSense
  setObjectiveSense :: o -> Sense -> WriterT w m ()
setObjectiveSense = (o -> Sense -> m ()) -> o -> Sense -> WriterT w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 o -> Sense -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> Sense -> m ()
setObjectiveSense
  getTimeout :: WriterT w m Double
getTimeout = m Double -> WriterT w m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Double
forall v c o (m :: * -> *). MonadLP v c o m => m Double
getTimeout
  setTimeout :: Double -> WriterT w m ()
setTimeout = m () -> WriterT w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> WriterT w m ())
-> (Double -> m ()) -> Double -> WriterT w m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => Double -> m ()
setTimeout
  optimizeLP :: WriterT w m SolutionStatus
optimizeLP = m SolutionStatus -> WriterT w m SolutionStatus
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m SolutionStatus
forall v c o (m :: * -> *). MonadLP v c o m => m SolutionStatus
optimizeLP

instance (MonadLP v c o m, Monoid w) => MonadLP v c o (RWST r w s m) where
  addVariable :: RWST r w s m v
addVariable = m v -> RWST r w s m v
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m v
forall v c o (m :: * -> *). MonadLP v c o m => m v
addVariable
  deleteVariable :: v -> RWST r w s m ()
deleteVariable = m () -> RWST r w s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> RWST r w s m ()) -> (v -> m ()) -> v -> RWST r w s m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> m ()
deleteVariable
  getVariableName :: v -> RWST r w s m Text
getVariableName = m Text -> RWST r w s m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> RWST r w s m Text)
-> (v -> m Text) -> v -> RWST r w s m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Text
getVariableName
  setVariableName :: v -> Text -> RWST r w s m ()
setVariableName = (v -> Text -> m ()) -> v -> Text -> RWST r w s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> Text -> m ()
setVariableName
  getVariableValue :: v -> RWST r w s m Double
getVariableValue = m Double -> RWST r w s m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> RWST r w s m Double)
-> (v -> m Double) -> v -> RWST r w s m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Double
getVariableValue
  getVariableBounds :: v -> RWST r w s m Bounds
getVariableBounds = m Bounds -> RWST r w s m Bounds
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bounds -> RWST r w s m Bounds)
-> (v -> m Bounds) -> v -> RWST r w s m Bounds
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Bounds
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Bounds
getVariableBounds
  setVariableBounds :: v -> Bounds -> RWST r w s m ()
setVariableBounds = (v -> Bounds -> m ()) -> v -> Bounds -> RWST r w s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Bounds -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> Bounds -> m ()
setVariableBounds
  addConstraint :: Inequality (Expr v) -> RWST r w s m c
addConstraint = m c -> RWST r w s m c
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m c -> RWST r w s m c)
-> (Inequality (Expr v) -> m c)
-> Inequality (Expr v)
-> RWST r w s m c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inequality (Expr v) -> m c
forall v c o (m :: * -> *).
MonadLP v c o m =>
Inequality (Expr v) -> m c
addConstraint
  deleteConstraint :: c -> RWST r w s m ()
deleteConstraint = m () -> RWST r w s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> RWST r w s m ()) -> (c -> m ()) -> c -> RWST r w s m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => c -> m ()
deleteConstraint
  getConstraintName :: c -> RWST r w s m Text
getConstraintName = m Text -> RWST r w s m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> RWST r w s m Text)
-> (c -> m Text) -> c -> RWST r w s m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => c -> m Text
getConstraintName
  setConstraintName :: c -> Text -> RWST r w s m ()
setConstraintName = (c -> Text -> m ()) -> c -> Text -> RWST r w s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 c -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => c -> Text -> m ()
setConstraintName
  getConstraintValue :: c -> RWST r w s m Double
getConstraintValue = m Double -> RWST r w s m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> RWST r w s m Double)
-> (c -> m Double) -> c -> RWST r w s m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => c -> m Double
getConstraintValue
  addObjective :: Expr v -> RWST r w s m o
addObjective = m o -> RWST r w s m o
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m o -> RWST r w s m o)
-> (Expr v -> m o) -> Expr v -> RWST r w s m o
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expr v -> m o
forall v c o (m :: * -> *). MonadLP v c o m => Expr v -> m o
addObjective
  deleteObjective :: o -> RWST r w s m ()
deleteObjective = m () -> RWST r w s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> RWST r w s m ()) -> (o -> m ()) -> o -> RWST r w s m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> m ()
deleteObjective
  getObjectiveName :: o -> RWST r w s m Text
getObjectiveName = m Text -> RWST r w s m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> RWST r w s m Text)
-> (o -> m Text) -> o -> RWST r w s m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Text
getObjectiveName
  setObjectiveName :: o -> Text -> RWST r w s m ()
setObjectiveName = (o -> Text -> m ()) -> o -> Text -> RWST r w s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 o -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> Text -> m ()
setObjectiveName
  getObjectiveValue :: o -> RWST r w s m Double
getObjectiveValue = m Double -> RWST r w s m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> RWST r w s m Double)
-> (o -> m Double) -> o -> RWST r w s m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Double
getObjectiveValue
  getObjectiveSense :: o -> RWST r w s m Sense
getObjectiveSense = m Sense -> RWST r w s m Sense
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Sense -> RWST r w s m Sense)
-> (o -> m Sense) -> o -> RWST r w s m Sense
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Sense
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Sense
getObjectiveSense
  setObjectiveSense :: o -> Sense -> RWST r w s m ()
setObjectiveSense = (o -> Sense -> m ()) -> o -> Sense -> RWST r w s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 o -> Sense -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> Sense -> m ()
setObjectiveSense
  getTimeout :: RWST r w s m Double
getTimeout = m Double -> RWST r w s m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Double
forall v c o (m :: * -> *). MonadLP v c o m => m Double
getTimeout
  setTimeout :: Double -> RWST r w s m ()
setTimeout = m () -> RWST r w s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> RWST r w s m ())
-> (Double -> m ()) -> Double -> RWST r w s m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => Double -> m ()
setTimeout
  optimizeLP :: RWST r w s m SolutionStatus
optimizeLP = m SolutionStatus -> RWST r w s m SolutionStatus
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m SolutionStatus
forall v c o (m :: * -> *). MonadLP v c o m => m SolutionStatus
optimizeLP

instance MonadLP v c o m => MonadLP v c o (StateT s m) where
  addVariable :: StateT s m v
addVariable = m v -> StateT s m v
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m v
forall v c o (m :: * -> *). MonadLP v c o m => m v
addVariable
  deleteVariable :: v -> StateT s m ()
deleteVariable = m () -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> StateT s m ()) -> (v -> m ()) -> v -> StateT s m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> m ()
deleteVariable
  getVariableValue :: v -> StateT s m Double
getVariableValue = m Double -> StateT s m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> StateT s m Double)
-> (v -> m Double) -> v -> StateT s m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Double
getVariableValue
  getVariableName :: v -> StateT s m Text
getVariableName = m Text -> StateT s m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> StateT s m Text)
-> (v -> m Text) -> v -> StateT s m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Text
getVariableName
  setVariableName :: v -> Text -> StateT s m ()
setVariableName = (v -> Text -> m ()) -> v -> Text -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> Text -> m ()
setVariableName
  getVariableBounds :: v -> StateT s m Bounds
getVariableBounds = m Bounds -> StateT s m Bounds
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Bounds -> StateT s m Bounds)
-> (v -> m Bounds) -> v -> StateT s m Bounds
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Bounds
forall v c o (m :: * -> *). MonadLP v c o m => v -> m Bounds
getVariableBounds
  setVariableBounds :: v -> Bounds -> StateT s m ()
setVariableBounds = (v -> Bounds -> m ()) -> v -> Bounds -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Bounds -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => v -> Bounds -> m ()
setVariableBounds
  addConstraint :: Inequality (Expr v) -> StateT s m c
addConstraint = m c -> StateT s m c
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m c -> StateT s m c)
-> (Inequality (Expr v) -> m c)
-> Inequality (Expr v)
-> StateT s m c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inequality (Expr v) -> m c
forall v c o (m :: * -> *).
MonadLP v c o m =>
Inequality (Expr v) -> m c
addConstraint
  deleteConstraint :: c -> StateT s m ()
deleteConstraint = m () -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> StateT s m ()) -> (c -> m ()) -> c -> StateT s m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => c -> m ()
deleteConstraint
  getConstraintName :: c -> StateT s m Text
getConstraintName = m Text -> StateT s m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> StateT s m Text)
-> (c -> m Text) -> c -> StateT s m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => c -> m Text
getConstraintName
  setConstraintName :: c -> Text -> StateT s m ()
setConstraintName = (c -> Text -> m ()) -> c -> Text -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 c -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => c -> Text -> m ()
setConstraintName
  getConstraintValue :: c -> StateT s m Double
getConstraintValue = m Double -> StateT s m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> StateT s m Double)
-> (c -> m Double) -> c -> StateT s m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => c -> m Double
getConstraintValue
  addObjective :: Expr v -> StateT s m o
addObjective = m o -> StateT s m o
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m o -> StateT s m o) -> (Expr v -> m o) -> Expr v -> StateT s m o
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expr v -> m o
forall v c o (m :: * -> *). MonadLP v c o m => Expr v -> m o
addObjective
  deleteObjective :: o -> StateT s m ()
deleteObjective = m () -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> StateT s m ()) -> (o -> m ()) -> o -> StateT s m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> m ()
deleteObjective
  getObjectiveName :: o -> StateT s m Text
getObjectiveName = m Text -> StateT s m Text
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Text -> StateT s m Text)
-> (o -> m Text) -> o -> StateT s m Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Text
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Text
getObjectiveName
  setObjectiveName :: o -> Text -> StateT s m ()
setObjectiveName = (o -> Text -> m ()) -> o -> Text -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 o -> Text -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> Text -> m ()
setObjectiveName
  getObjectiveValue :: o -> StateT s m Double
getObjectiveValue = m Double -> StateT s m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Double -> StateT s m Double)
-> (o -> m Double) -> o -> StateT s m Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Double
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Double
getObjectiveValue
  getObjectiveSense :: o -> StateT s m Sense
getObjectiveSense = m Sense -> StateT s m Sense
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Sense -> StateT s m Sense)
-> (o -> m Sense) -> o -> StateT s m Sense
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> m Sense
forall v c o (m :: * -> *). MonadLP v c o m => o -> m Sense
getObjectiveSense
  setObjectiveSense :: o -> Sense -> StateT s m ()
setObjectiveSense = (o -> Sense -> m ()) -> o -> Sense -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 o -> Sense -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => o -> Sense -> m ()
setObjectiveSense
  getTimeout :: StateT s m Double
getTimeout = m Double -> StateT s m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Double
forall v c o (m :: * -> *). MonadLP v c o m => m Double
getTimeout
  setTimeout :: Double -> StateT s m ()
setTimeout = m () -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> StateT s m ())
-> (Double -> m ()) -> Double -> StateT s m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> m ()
forall v c o (m :: * -> *). MonadLP v c o m => Double -> m ()
setTimeout
  optimizeLP :: StateT s m SolutionStatus
optimizeLP = m SolutionStatus -> StateT s m SolutionStatus
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m SolutionStatus
forall v c o (m :: * -> *). MonadLP v c o m => m SolutionStatus
optimizeLP

-- | A (mixed) integer program.
--
-- In addition to the methods of the 'MonadLP' class, this monad
-- supports constraining variables to be either continuous or
-- discrete.
class MonadLP v c o m => MonadIP v c o m | m -> v c o where
  getVariableDomain :: v -> m Domain
  setVariableDomain :: v -> Domain -> m ()

  getRelativeMIPGap :: m Double
  setRelativeMIPGap :: Double -> m ()

  optimizeIP :: m SolutionStatus

instance MonadIP v c o m => MonadIP v c o (ReaderT r m) where
  getVariableDomain :: v -> ReaderT r m Domain
getVariableDomain = m Domain -> ReaderT r m Domain
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Domain -> ReaderT r m Domain)
-> (v -> m Domain) -> v -> ReaderT r m Domain
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Domain
forall v c o (m :: * -> *). MonadIP v c o m => v -> m Domain
getVariableDomain
  setVariableDomain :: v -> Domain -> ReaderT r m ()
setVariableDomain = (v -> Domain -> m ()) -> v -> Domain -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Domain -> m ()
forall v c o (m :: * -> *). MonadIP v c o m => v -> Domain -> m ()
setVariableDomain
  getRelativeMIPGap :: ReaderT r m Double
getRelativeMIPGap = m Double -> ReaderT r m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Double
forall v c o (m :: * -> *). MonadIP v c o m => m Double
getRelativeMIPGap
  setRelativeMIPGap :: Double -> ReaderT r m ()
setRelativeMIPGap = m () -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> ReaderT r m ())
-> (Double -> m ()) -> Double -> ReaderT r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> m ()
forall v c o (m :: * -> *). MonadIP v c o m => Double -> m ()
setRelativeMIPGap
  optimizeIP :: ReaderT r m SolutionStatus
optimizeIP = m SolutionStatus -> ReaderT r m SolutionStatus
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m SolutionStatus
forall v c o (m :: * -> *). MonadIP v c o m => m SolutionStatus
optimizeIP

instance MonadIP v c o m => MonadIP v c o (StateT s m) where
  getVariableDomain :: v -> StateT s m Domain
getVariableDomain = m Domain -> StateT s m Domain
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m Domain -> StateT s m Domain)
-> (v -> m Domain) -> v -> StateT s m Domain
forall b c a. (b -> c) -> (a -> b) -> a -> c
. v -> m Domain
forall v c o (m :: * -> *). MonadIP v c o m => v -> m Domain
getVariableDomain
  setVariableDomain :: v -> Domain -> StateT s m ()
setVariableDomain = (v -> Domain -> m ()) -> v -> Domain -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b c.
(MonadTrans t, Monad m) =>
(a -> b -> m c) -> a -> b -> t m c
lift2 v -> Domain -> m ()
forall v c o (m :: * -> *). MonadIP v c o m => v -> Domain -> m ()
setVariableDomain
  getRelativeMIPGap :: StateT s m Double
getRelativeMIPGap = m Double -> StateT s m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Double
forall v c o (m :: * -> *). MonadIP v c o m => m Double
getRelativeMIPGap
  setRelativeMIPGap :: Double -> StateT s m ()
setRelativeMIPGap = m () -> StateT s m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> StateT s m ())
-> (Double -> m ()) -> Double -> StateT s m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> m ()
forall v c o (m :: * -> *). MonadIP v c o m => Double -> m ()
setRelativeMIPGap
  optimizeIP :: StateT s m SolutionStatus
optimizeIP = m SolutionStatus -> StateT s m SolutionStatus
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m SolutionStatus
forall v c o (m :: * -> *). MonadIP v c o m => m SolutionStatus
optimizeIP

-- | Whether a math program is minimizing or maximizing its objective.
data Sense = Minimization | Maximization
  deriving
    ( Sense -> Sense -> Bool
(Sense -> Sense -> Bool) -> (Sense -> Sense -> Bool) -> Eq Sense
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Sense -> Sense -> Bool
$c/= :: Sense -> Sense -> Bool
== :: Sense -> Sense -> Bool
$c== :: Sense -> Sense -> Bool
Eq,
      Eq Sense
Eq Sense
-> (Sense -> Sense -> Ordering)
-> (Sense -> Sense -> Bool)
-> (Sense -> Sense -> Bool)
-> (Sense -> Sense -> Bool)
-> (Sense -> Sense -> Bool)
-> (Sense -> Sense -> Sense)
-> (Sense -> Sense -> Sense)
-> Ord Sense
Sense -> Sense -> Bool
Sense -> Sense -> Ordering
Sense -> Sense -> Sense
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Sense -> Sense -> Sense
$cmin :: Sense -> Sense -> Sense
max :: Sense -> Sense -> Sense
$cmax :: Sense -> Sense -> Sense
>= :: Sense -> Sense -> Bool
$c>= :: Sense -> Sense -> Bool
> :: Sense -> Sense -> Bool
$c> :: Sense -> Sense -> Bool
<= :: Sense -> Sense -> Bool
$c<= :: Sense -> Sense -> Bool
< :: Sense -> Sense -> Bool
$c< :: Sense -> Sense -> Bool
compare :: Sense -> Sense -> Ordering
$ccompare :: Sense -> Sense -> Ordering
Ord,
      ReadPrec [Sense]
ReadPrec Sense
Int -> ReadS Sense
ReadS [Sense]
(Int -> ReadS Sense)
-> ReadS [Sense]
-> ReadPrec Sense
-> ReadPrec [Sense]
-> Read Sense
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Sense]
$creadListPrec :: ReadPrec [Sense]
readPrec :: ReadPrec Sense
$creadPrec :: ReadPrec Sense
readList :: ReadS [Sense]
$creadList :: ReadS [Sense]
readsPrec :: Int -> ReadS Sense
$creadsPrec :: Int -> ReadS Sense
Read,
      Int -> Sense -> ShowS
[Sense] -> ShowS
Sense -> String
(Int -> Sense -> ShowS)
-> (Sense -> String) -> ([Sense] -> ShowS) -> Show Sense
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Sense] -> ShowS
$cshowList :: [Sense] -> ShowS
show :: Sense -> String
$cshow :: Sense -> String
showsPrec :: Int -> Sense -> ShowS
$cshowsPrec :: Int -> Sense -> ShowS
Show
    )

-- | The outcome of an optimization.
data SolutionStatus
  = -- | An optimal solution has been found.
    Optimal
  | -- | A feasible solution has been found. The result may or may not
    -- be optimal.
    Feasible
  | -- | The model has been proven to be infeasible.
    Infeasible
  | -- | The model has been proven to be unbounded.
    Unbounded
  | -- | An error was encountered during the solve. Instance-specific
    -- methods should be used to determine what occurred.
    Error
  deriving
    ( SolutionStatus -> SolutionStatus -> Bool
(SolutionStatus -> SolutionStatus -> Bool)
-> (SolutionStatus -> SolutionStatus -> Bool) -> Eq SolutionStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SolutionStatus -> SolutionStatus -> Bool
$c/= :: SolutionStatus -> SolutionStatus -> Bool
== :: SolutionStatus -> SolutionStatus -> Bool
$c== :: SolutionStatus -> SolutionStatus -> Bool
Eq,
      Eq SolutionStatus
Eq SolutionStatus
-> (SolutionStatus -> SolutionStatus -> Ordering)
-> (SolutionStatus -> SolutionStatus -> Bool)
-> (SolutionStatus -> SolutionStatus -> Bool)
-> (SolutionStatus -> SolutionStatus -> Bool)
-> (SolutionStatus -> SolutionStatus -> Bool)
-> (SolutionStatus -> SolutionStatus -> SolutionStatus)
-> (SolutionStatus -> SolutionStatus -> SolutionStatus)
-> Ord SolutionStatus
SolutionStatus -> SolutionStatus -> Bool
SolutionStatus -> SolutionStatus -> Ordering
SolutionStatus -> SolutionStatus -> SolutionStatus
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SolutionStatus -> SolutionStatus -> SolutionStatus
$cmin :: SolutionStatus -> SolutionStatus -> SolutionStatus
max :: SolutionStatus -> SolutionStatus -> SolutionStatus
$cmax :: SolutionStatus -> SolutionStatus -> SolutionStatus
>= :: SolutionStatus -> SolutionStatus -> Bool
$c>= :: SolutionStatus -> SolutionStatus -> Bool
> :: SolutionStatus -> SolutionStatus -> Bool
$c> :: SolutionStatus -> SolutionStatus -> Bool
<= :: SolutionStatus -> SolutionStatus -> Bool
$c<= :: SolutionStatus -> SolutionStatus -> Bool
< :: SolutionStatus -> SolutionStatus -> Bool
$c< :: SolutionStatus -> SolutionStatus -> Bool
compare :: SolutionStatus -> SolutionStatus -> Ordering
$ccompare :: SolutionStatus -> SolutionStatus -> Ordering
Ord,
      ReadPrec [SolutionStatus]
ReadPrec SolutionStatus
Int -> ReadS SolutionStatus
ReadS [SolutionStatus]
(Int -> ReadS SolutionStatus)
-> ReadS [SolutionStatus]
-> ReadPrec SolutionStatus
-> ReadPrec [SolutionStatus]
-> Read SolutionStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SolutionStatus]
$creadListPrec :: ReadPrec [SolutionStatus]
readPrec :: ReadPrec SolutionStatus
$creadPrec :: ReadPrec SolutionStatus
readList :: ReadS [SolutionStatus]
$creadList :: ReadS [SolutionStatus]
readsPrec :: Int -> ReadS SolutionStatus
$creadsPrec :: Int -> ReadS SolutionStatus
Read,
      Int -> SolutionStatus -> ShowS
[SolutionStatus] -> ShowS
SolutionStatus -> String
(Int -> SolutionStatus -> ShowS)
-> (SolutionStatus -> String)
-> ([SolutionStatus] -> ShowS)
-> Show SolutionStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SolutionStatus] -> ShowS
$cshowList :: [SolutionStatus] -> ShowS
show :: SolutionStatus -> String
$cshow :: SolutionStatus -> String
showsPrec :: Int -> SolutionStatus -> ShowS
$cshowsPrec :: Int -> SolutionStatus -> ShowS
Show
    )

-- | An interval of the real numbers.
data Bounds
  = -- | The non-negative reals.
    NonNegativeReals
  | -- | The non-positive reals.
    NonPositiveReals
  | -- | Any closed interval of the reals.
    Interval Double Double
  | -- | Any real number.
    Free
  deriving
    ( ReadPrec [Bounds]
ReadPrec Bounds
Int -> ReadS Bounds
ReadS [Bounds]
(Int -> ReadS Bounds)
-> ReadS [Bounds]
-> ReadPrec Bounds
-> ReadPrec [Bounds]
-> Read Bounds
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Bounds]
$creadListPrec :: ReadPrec [Bounds]
readPrec :: ReadPrec Bounds
$creadPrec :: ReadPrec Bounds
readList :: ReadS [Bounds]
$creadList :: ReadS [Bounds]
readsPrec :: Int -> ReadS Bounds
$creadsPrec :: Int -> ReadS Bounds
Read,
      Int -> Bounds -> ShowS
[Bounds] -> ShowS
Bounds -> String
(Int -> Bounds -> ShowS)
-> (Bounds -> String) -> ([Bounds] -> ShowS) -> Show Bounds
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Bounds] -> ShowS
$cshowList :: [Bounds] -> ShowS
show :: Bounds -> String
$cshow :: Bounds -> String
showsPrec :: Int -> Bounds -> ShowS
$cshowsPrec :: Int -> Bounds -> ShowS
Show
    )

-- | The type of values that a variable can take on.
--
-- Note that the @Integer@ constructor does not interfere with the
-- @Integer@ type, as the @Integer@ type does not define a constuctor
-- of the same name. The ambiguity is unfortunate, but other natural
-- nomenclature such as @Integral@ are similarly conflicted.
data Domain
  = -- | The variable lies in the real numbers
    Continuous
  | -- | The variable lies in the integers
    Integer
  | -- | The variable lies in the set @{0, 1}@.
    Binary
  deriving
    ( ReadPrec [Domain]
ReadPrec Domain
Int -> ReadS Domain
ReadS [Domain]
(Int -> ReadS Domain)
-> ReadS [Domain]
-> ReadPrec Domain
-> ReadPrec [Domain]
-> Read Domain
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Domain]
$creadListPrec :: ReadPrec [Domain]
readPrec :: ReadPrec Domain
$creadPrec :: ReadPrec Domain
readList :: ReadS [Domain]
$creadList :: ReadS [Domain]
readsPrec :: Int -> ReadS Domain
$creadsPrec :: Int -> ReadS Domain
Read,
      Int -> Domain -> ShowS
[Domain] -> ShowS
Domain -> String
(Int -> Domain -> ShowS)
-> (Domain -> String) -> ([Domain] -> ShowS) -> Show Domain
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Domain] -> ShowS
$cshowList :: [Domain] -> ShowS
show :: Domain -> String
$cshow :: Domain -> String
showsPrec :: Int -> Domain -> ShowS
$cshowsPrec :: Int -> Domain -> ShowS
Show
    )

-- | Non-strict inequalities.
data Inequality a
  = Inequality Ordering a a
  deriving
    ( ReadPrec [Inequality a]
ReadPrec (Inequality a)
Int -> ReadS (Inequality a)
ReadS [Inequality a]
(Int -> ReadS (Inequality a))
-> ReadS [Inequality a]
-> ReadPrec (Inequality a)
-> ReadPrec [Inequality a]
-> Read (Inequality a)
forall a. Read a => ReadPrec [Inequality a]
forall a. Read a => ReadPrec (Inequality a)
forall a. Read a => Int -> ReadS (Inequality a)
forall a. Read a => ReadS [Inequality a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Inequality a]
$creadListPrec :: forall a. Read a => ReadPrec [Inequality a]
readPrec :: ReadPrec (Inequality a)
$creadPrec :: forall a. Read a => ReadPrec (Inequality a)
readList :: ReadS [Inequality a]
$creadList :: forall a. Read a => ReadS [Inequality a]
readsPrec :: Int -> ReadS (Inequality a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Inequality a)
Read,
      Int -> Inequality a -> ShowS
[Inequality a] -> ShowS
Inequality a -> String
(Int -> Inequality a -> ShowS)
-> (Inequality a -> String)
-> ([Inequality a] -> ShowS)
-> Show (Inequality a)
forall a. Show a => Int -> Inequality a -> ShowS
forall a. Show a => [Inequality a] -> ShowS
forall a. Show a => Inequality a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Inequality a] -> ShowS
$cshowList :: forall a. Show a => [Inequality a] -> ShowS
show :: Inequality a -> String
$cshow :: forall a. Show a => Inequality a -> String
showsPrec :: Int -> Inequality a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Inequality a -> ShowS
Show,
      (forall a b. (a -> b) -> Inequality a -> Inequality b)
-> (forall a b. a -> Inequality b -> Inequality a)
-> Functor Inequality
forall a b. a -> Inequality b -> Inequality a
forall a b. (a -> b) -> Inequality a -> Inequality b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Inequality b -> Inequality a
$c<$ :: forall a b. a -> Inequality b -> Inequality a
fmap :: forall a b. (a -> b) -> Inequality a -> Inequality b
$cfmap :: forall a b. (a -> b) -> Inequality a -> Inequality b
Functor,
      (forall m. Monoid m => Inequality m -> m)
-> (forall m a. Monoid m => (a -> m) -> Inequality a -> m)
-> (forall m a. Monoid m => (a -> m) -> Inequality a -> m)
-> (forall a b. (a -> b -> b) -> b -> Inequality a -> b)
-> (forall a b. (a -> b -> b) -> b -> Inequality a -> b)
-> (forall b a. (b -> a -> b) -> b -> Inequality a -> b)
-> (forall b a. (b -> a -> b) -> b -> Inequality a -> b)
-> (forall a. (a -> a -> a) -> Inequality a -> a)
-> (forall a. (a -> a -> a) -> Inequality a -> a)
-> (forall a. Inequality a -> [a])
-> (forall a. Inequality a -> Bool)
-> (forall a. Inequality a -> Int)
-> (forall a. Eq a => a -> Inequality a -> Bool)
-> (forall a. Ord a => Inequality a -> a)
-> (forall a. Ord a => Inequality a -> a)
-> (forall a. Num a => Inequality a -> a)
-> (forall a. Num a => Inequality a -> a)
-> Foldable Inequality
forall a. Eq a => a -> Inequality a -> Bool
forall a. Num a => Inequality a -> a
forall a. Ord a => Inequality a -> a
forall m. Monoid m => Inequality m -> m
forall a. Inequality a -> Bool
forall a. Inequality a -> Int
forall a. Inequality a -> [a]
forall a. (a -> a -> a) -> Inequality a -> a
forall m a. Monoid m => (a -> m) -> Inequality a -> m
forall b a. (b -> a -> b) -> b -> Inequality a -> b
forall a b. (a -> b -> b) -> b -> Inequality a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => Inequality a -> a
$cproduct :: forall a. Num a => Inequality a -> a
sum :: forall a. Num a => Inequality a -> a
$csum :: forall a. Num a => Inequality a -> a
minimum :: forall a. Ord a => Inequality a -> a
$cminimum :: forall a. Ord a => Inequality a -> a
maximum :: forall a. Ord a => Inequality a -> a
$cmaximum :: forall a. Ord a => Inequality a -> a
elem :: forall a. Eq a => a -> Inequality a -> Bool
$celem :: forall a. Eq a => a -> Inequality a -> Bool
length :: forall a. Inequality a -> Int
$clength :: forall a. Inequality a -> Int
null :: forall a. Inequality a -> Bool
$cnull :: forall a. Inequality a -> Bool
toList :: forall a. Inequality a -> [a]
$ctoList :: forall a. Inequality a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Inequality a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Inequality a -> a
foldr1 :: forall a. (a -> a -> a) -> Inequality a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Inequality a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Inequality a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Inequality a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Inequality a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Inequality a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Inequality a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Inequality a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Inequality a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Inequality a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Inequality a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Inequality a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Inequality a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Inequality a -> m
fold :: forall m. Monoid m => Inequality m -> m
$cfold :: forall m. Monoid m => Inequality m -> m
Foldable,
      Functor Inequality
Foldable Inequality
Functor Inequality
-> Foldable Inequality
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Inequality a -> f (Inequality b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Inequality (f a) -> f (Inequality a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Inequality a -> m (Inequality b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Inequality (m a) -> m (Inequality a))
-> Traversable Inequality
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
Inequality (m a) -> m (Inequality a)
forall (f :: * -> *) a.
Applicative f =>
Inequality (f a) -> f (Inequality a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Inequality a -> m (Inequality b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Inequality a -> f (Inequality b)
sequence :: forall (m :: * -> *) a.
Monad m =>
Inequality (m a) -> m (Inequality a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
Inequality (m a) -> m (Inequality a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Inequality a -> m (Inequality b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Inequality a -> m (Inequality b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Inequality (f a) -> f (Inequality a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Inequality (f a) -> f (Inequality a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Inequality a -> f (Inequality b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Inequality a -> f (Inequality b)
Traversable
    )

-- | A convient shorthand for the type of linear expressions used in
-- models.
type Expr = LinExpr Double