-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A library for formulating and solving math programs. -- -- Please see the README on GitHub at -- https://github.com/prsteele/math-programming#readme @package math-programming @version 0.4.0 module Math.Programming.Types -- | A convient shorthand for the type of linear expressions used in a -- given model. type Expr m = LinearExpression (Numeric m) (Variable m) -- | A monad for formulating and solving linear programs. -- -- We manipulate linear programs and their settings using the -- Mutable typeclass. class (Monad m, Show (Numeric m), RealFrac (Numeric m)) => LPMonad m where { -- | The numeric type used in the model. type family Numeric m :: *; -- | The type of variables in the model. LPMonad treats these as -- opaque values, but instances may expose more details. data family Variable m :: *; -- | The type of constraints in the model. LPMonad treats these as -- opaque values, but instances may expose more details. data family Constraint m :: *; -- | The type of objectives in the model. LPMonad treats these as -- opaque values, but instances may expose more details. data family Objective m :: *; } -- | Create a new decision variable in the model. -- -- This variable will be initialized to be a non-negative continuous -- variable. addVariable :: LPMonad m => m (Variable m) -- | Remove a decision variable from the model. -- -- The variable cannot be used after being deleted. removeVariable :: LPMonad m => Variable m -> m () -- | Get the name of the variable. getVariableName :: LPMonad m => Variable m -> m String -- | Set the name of the variable. setVariableName :: LPMonad m => Variable m -> String -> m () -- | Get the allowed values of a variable. getVariableBounds :: LPMonad m => Variable m -> m (Bounds (Numeric m)) -- | Constrain a variable to take on certain values. setVariableBounds :: LPMonad m => Variable m -> Bounds (Numeric m) -> m () -- | Get the value of a variable in the current solution. getVariableValue :: LPMonad m => Variable m -> m (Numeric m) -- | Add a constraint to the model represented by an inequality. addConstraint :: LPMonad m => Inequality (LinearExpression (Numeric m) (Variable m)) -> m (Constraint m) -- | Remove a constraint from the model. -- -- The constraint cannot used after being deleted. removeConstraint :: LPMonad m => Constraint m -> m () -- | Get the name of the constraint. getConstraintName :: LPMonad m => Constraint m -> m String -- | Set the name of the constraint. setConstraintName :: LPMonad m => Constraint m -> String -> m () -- | Get the value of the dual variable associated with the constraint in -- the current solution. -- -- This value has no meaning if the current solution is not an LP -- solution. getDualValue :: LPMonad m => Constraint m -> m (Numeric m) -- | Add a constraint to the model represented by an inequality. addObjective :: LPMonad m => LinearExpression (Numeric m) (Variable m) -> m (Objective m) -- | Get the name of the objective. getObjectiveName :: LPMonad m => Objective m -> m String -- | Set the name of the objective. setObjectiveName :: LPMonad m => Objective m -> String -> m () -- | Whether the objective is to be minimized or maximized. getObjectiveSense :: LPMonad m => Objective m -> m Sense -- | Set whether the objective is to be minimized or maximized. setObjectiveSense :: LPMonad m => Objective m -> Sense -> m () -- | Get the value of the objective in the current solution. getObjectiveValue :: LPMonad m => Objective m -> m (Numeric m) -- | Get the number of seconds the solver is allowed to run before halting. getTimeout :: LPMonad m => m Double -- | Set the number of seconds the solver is allowed to run before halting. setTimeout :: LPMonad m => Double -> m () -- | Optimize the continuous relaxation of the model. optimizeLP :: LPMonad m => m SolutionStatus -- | A (mixed) integer program. -- -- In addition to the methods of the LPMonad class, this monad -- supports constraining variables to be either continuous or discrete. class (LPMonad m) => IPMonad m -- | Optimize the mixed-integer program. optimizeIP :: IPMonad m => m SolutionStatus -- | Get the domain of a variable. getVariableDomain :: IPMonad m => Variable m -> m Domain -- | Set the domain of a variable. setVariableDomain :: IPMonad m => Variable m -> Domain -> m () -- | Get the allowed relative gap between LP and IP solutions. getRelativeMIPGap :: IPMonad m => m Double -- | Set the allowed relative gap between LP and IP solutions. setRelativeMIPGap :: IPMonad m => Double -> m () -- | Whether a math program is minimizing or maximizing its objective. data Sense Minimization :: Sense Maximization :: Sense -- | The outcome of an optimization. data SolutionStatus -- | An optimal solution has been found. Optimal :: SolutionStatus -- | A feasible solution has been found. The result may or may not be -- optimal. Feasible :: SolutionStatus -- | The model has been proven to be infeasible. Infeasible :: SolutionStatus -- | The model has been proven to be unbounded. Unbounded :: SolutionStatus -- | An error was encountered during the solve. Instance-specific methods -- should be used to determine what occurred. Error :: SolutionStatus -- | An interval of the real numbers. data Bounds b -- | The non-negative reals. NonNegativeReals :: Bounds b -- | The non-positive reals. NonPositiveReals :: Bounds b -- | Any closed interval of the reals. Interval :: b -> b -> Bounds b -- | Any real number. Free :: Bounds b -- | 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 :: Domain -- | The variable lies in the integers Integer :: Domain -- | The variable lies in the set {0, 1}. Binary :: Domain class Nameable m a getName :: Nameable m a => a -> m String setName :: Nameable m a => a -> String -> m () -- | A linear expression containing symbolic variables of type b -- and numeric coefficients of type a. -- -- Using Strings to denote variables and Doubles as our -- numeric type, we could express 3 x + 2 y + 1 as -- --
--   LinearExpression [(3, "x"), (2, "y")] 1
--   
data LinearExpression a b LinearExpression :: [(a, b)] -> a -> LinearExpression a b -- | Non-strict inequalities. data Inequality a Inequality :: Ordering -> a -> a -> Inequality a instance GHC.Show.Show a => GHC.Show.Show (Math.Programming.Types.Inequality a) instance GHC.Read.Read a => GHC.Read.Read (Math.Programming.Types.Inequality a) instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Math.Programming.Types.LinearExpression a b) instance (GHC.Read.Read a, GHC.Read.Read b) => GHC.Read.Read (Math.Programming.Types.LinearExpression a b) instance GHC.Show.Show Math.Programming.Types.Domain instance GHC.Read.Read Math.Programming.Types.Domain instance GHC.Show.Show b => GHC.Show.Show (Math.Programming.Types.Bounds b) instance GHC.Read.Read b => GHC.Read.Read (Math.Programming.Types.Bounds b) instance GHC.Show.Show Math.Programming.Types.SolutionStatus instance GHC.Read.Read Math.Programming.Types.SolutionStatus instance GHC.Classes.Ord Math.Programming.Types.SolutionStatus instance GHC.Classes.Eq Math.Programming.Types.SolutionStatus instance GHC.Show.Show Math.Programming.Types.Sense instance GHC.Read.Read Math.Programming.Types.Sense instance GHC.Classes.Ord Math.Programming.Types.Sense instance GHC.Classes.Eq Math.Programming.Types.Sense instance Math.Programming.Types.LPMonad m => Math.Programming.Types.Nameable m (Math.Programming.Types.Variable m) instance Math.Programming.Types.LPMonad m => Math.Programming.Types.Nameable m (Math.Programming.Types.Constraint m) instance Math.Programming.Types.LPMonad m => Math.Programming.Types.Nameable m (Math.Programming.Types.Objective m) instance GHC.Base.Functor Math.Programming.Types.Inequality instance Data.Foldable.Foldable Math.Programming.Types.Inequality instance Data.Traversable.Traversable Math.Programming.Types.Inequality instance GHC.Num.Num a => GHC.Base.Semigroup (Math.Programming.Types.LinearExpression a b) instance GHC.Num.Num a => GHC.Base.Monoid (Math.Programming.Types.LinearExpression a b) instance GHC.Base.Functor (Math.Programming.Types.LinearExpression a) instance Data.Bifunctor.Bifunctor Math.Programming.Types.LinearExpression instance Data.Foldable.Foldable (Math.Programming.Types.LinearExpression a) instance Data.Traversable.Traversable (Math.Programming.Types.LinearExpression a) module Math.Programming.Dsl -- | Create an objective to be minimized. minimize :: LPMonad m => Expr m -> m (Objective m) -- | Create an objective to be maximized. maximize :: LPMonad m => Expr m -> m (Objective m) -- | Get the value of a linear expression in the current solution. evalExpr :: LPMonad m => Expr m -> m (Numeric m) -- | Create a new free variable. free :: LPMonad m => m (Variable m) -- | Create a new non-negative variable. nonNeg :: LPMonad m => m (Variable m) -- | Create a new non-positive variable. nonPos :: LPMonad m => m (Variable m) -- | Create a new variable bounded between two values. bounded :: LPMonad m => Numeric m -> Numeric m -> m (Variable m) -- | Constrain a variable to take on certain values. -- -- This function is designed to be used as an infix operator, e.g. -- --
--   addVariable `within` NonNegativeReals
--   
within :: LPMonad m => m (Variable m) -> Bounds (Numeric m) -> m (Variable m) -- | Create an integer-valued variable. integer :: IPMonad m => m (Variable m) -- | Create a binary variable. binary :: IPMonad m => m (Variable m) -- | Create an integer-value variable that takes on non-negative values. nonNegInteger :: IPMonad m => m (Variable m) -- | Create an integer-value variable that takes on non-positive values. nonPosInteger :: IPMonad m => m (Variable m) -- | Set the type of a variable. -- -- This function is designed to be used as an infix operator, e.g. -- --
--   addVariable `asKind` Binary
--   
asKind :: IPMonad m => m (Variable m) -> Domain -> m (Variable m) -- | Name a variable, constraint, or objective. -- -- This function is designed to be used as an infix operator, e.g. -- --
--   free `named` X_1
--   
named :: (Monad m, Nameable m a) => m a -> String -> m a -- | Retrieve the name of a variable, constraint, or objective. nameOf :: (Monad m, Nameable m a) => a -> m String (#+@) :: Num a => a -> b -> LinearExpression a b infixl 6 #+@ (#+.) :: Num a => a -> LinearExpression a b -> LinearExpression a b infixl 6 #+. (@+#) :: Num a => b -> a -> LinearExpression a b infixl 6 @+# (@+@) :: Num a => b -> b -> LinearExpression a b infixl 6 @+@ (@+.) :: Num a => b -> LinearExpression a b -> LinearExpression a b infixl 6 @+. (.+#) :: Num a => LinearExpression a b -> a -> LinearExpression a b infixl 6 .+# (.+@) :: Num a => LinearExpression a b -> b -> LinearExpression a b infixl 6 .+@ (.+.) :: Num a => LinearExpression a b -> LinearExpression a b -> LinearExpression a b infixl 6 .+. (#-@) :: Num a => a -> b -> LinearExpression a b infixl 6 #-@ (#-.) :: Num a => a -> LinearExpression a b -> LinearExpression a b infixl 6 #-. (@-#) :: Num a => b -> a -> LinearExpression a b infixl 6 @-# (@-@) :: Num a => b -> b -> LinearExpression a b infixl 6 @-@ (@-.) :: Num a => b -> LinearExpression a b -> LinearExpression a b infixl 6 @-. (.-#) :: Num a => LinearExpression a b -> a -> LinearExpression a b infixl 6 .-# (.-@) :: Num a => LinearExpression a b -> b -> LinearExpression a b infixl 6 .-@ (.-.) :: Num a => LinearExpression a b -> LinearExpression a b -> LinearExpression a b infixl 6 .-. (#*.) :: Num a => a -> LinearExpression a b -> LinearExpression a b infixl 7 #*. (.*#) :: Num a => LinearExpression a b -> a -> LinearExpression a b infixl 7 .*# (#*@) :: Num a => a -> b -> LinearExpression a b infixl 7 #*@ (@*#) :: Num a => b -> a -> LinearExpression a b infixl 7 @*# (@/#) :: Fractional a => b -> a -> LinearExpression a b infixl 7 @/# (./#) :: Fractional a => LinearExpression a b -> a -> LinearExpression a b infixl 7 ./# -- | Combine equivalent terms by summing their coefficients. simplify :: (Ord b, Num a) => LinearExpression a b -> LinearExpression a b -- | Reduce an expression to its value. eval :: Num a => LinearExpression a a -> a -- | Construct an expression representing a variable. var :: Num a => b -> LinearExpression a b -- | Construct an expression representing a constant. con :: Num a => a -> LinearExpression a b -- | Construct an expression by summing expressions. exprSum :: Num a => [LinearExpression a b] -> LinearExpression a b -- | Construct an expression by summing variables. varSum :: Num a => [b] -> LinearExpression a b (#<=@) :: LPMonad m => Numeric m -> Variable m -> m (Constraint m) infix 4 #<=@ (#<=.) :: LPMonad m => Numeric m -> Expr m -> m (Constraint m) infix 4 #<=. (@<=#) :: LPMonad m => Variable m -> Numeric m -> m (Constraint m) infix 4 @<=# (@<=@) :: LPMonad m => Variable m -> Variable m -> m (Constraint m) infix 4 @<=@ (@<=.) :: LPMonad m => Variable m -> Expr m -> m (Constraint m) infix 4 @<=. (.<=#) :: LPMonad m => Expr m -> Numeric m -> m (Constraint m) infix 4 .<=# (.<=@) :: LPMonad m => Expr m -> Variable m -> m (Constraint m) infix 4 .<=@ (.<=.) :: LPMonad m => Expr m -> Expr m -> m (Constraint m) infix 4 .<=. (#>=@) :: LPMonad m => Numeric m -> Variable m -> m (Constraint m) infix 4 #>=@ (#>=.) :: LPMonad m => Numeric m -> Expr m -> m (Constraint m) infix 4 #>=. (@>=#) :: LPMonad m => Variable m -> Numeric m -> m (Constraint m) infix 4 @>=# (@>=@) :: LPMonad m => Variable m -> Variable m -> m (Constraint m) infix 4 @>=@ (@>=.) :: LPMonad m => Variable m -> Expr m -> m (Constraint m) infix 4 @>=. (.>=#) :: LPMonad m => Expr m -> Numeric m -> m (Constraint m) infix 4 .>=# (.>=@) :: LPMonad m => Expr m -> Variable m -> m (Constraint m) infix 4 .>=@ (.>=.) :: LPMonad m => Expr m -> Expr m -> m (Constraint m) infix 4 .>=. (#==@) :: LPMonad m => Numeric m -> Variable m -> m (Constraint m) infix 4 #==@ (#==.) :: LPMonad m => Numeric m -> Expr m -> m (Constraint m) infix 4 #==. (@==#) :: LPMonad m => Variable m -> Numeric m -> m (Constraint m) infix 4 @==# (@==@) :: LPMonad m => Variable m -> Variable m -> m (Constraint m) infix 4 @==@ (@==.) :: LPMonad m => Variable m -> Expr m -> m (Constraint m) infix 4 @==. (.==#) :: LPMonad m => Expr m -> Numeric m -> m (Constraint m) infix 4 .==# (.==@) :: LPMonad m => Expr m -> Variable m -> m (Constraint m) infix 4 .==@ (.==.) :: LPMonad m => Expr m -> Expr m -> m (Constraint m) infix 4 .==. -- | A library for modeling and solving linear and integer programs. -- -- This library is merely a frontend to various solver backends. At the -- time this was written, the only known supported backend is -- GLPK. module Math.Programming -- | A monad for formulating and solving linear programs. -- -- We manipulate linear programs and their settings using the -- Mutable typeclass. class (Monad m, Show (Numeric m), RealFrac (Numeric m)) => LPMonad m where { -- | The numeric type used in the model. type family Numeric m :: *; -- | The type of variables in the model. LPMonad treats these as -- opaque values, but instances may expose more details. data family Variable m :: *; -- | The type of constraints in the model. LPMonad treats these as -- opaque values, but instances may expose more details. data family Constraint m :: *; -- | The type of objectives in the model. LPMonad treats these as -- opaque values, but instances may expose more details. data family Objective m :: *; } -- | Create a new decision variable in the model. -- -- This variable will be initialized to be a non-negative continuous -- variable. addVariable :: LPMonad m => m (Variable m) -- | Remove a decision variable from the model. -- -- The variable cannot be used after being deleted. removeVariable :: LPMonad m => Variable m -> m () -- | Get the name of the variable. getVariableName :: LPMonad m => Variable m -> m String -- | Set the name of the variable. setVariableName :: LPMonad m => Variable m -> String -> m () -- | Get the allowed values of a variable. getVariableBounds :: LPMonad m => Variable m -> m (Bounds (Numeric m)) -- | Constrain a variable to take on certain values. setVariableBounds :: LPMonad m => Variable m -> Bounds (Numeric m) -> m () -- | Get the value of a variable in the current solution. getVariableValue :: LPMonad m => Variable m -> m (Numeric m) -- | Add a constraint to the model represented by an inequality. addConstraint :: LPMonad m => Inequality (LinearExpression (Numeric m) (Variable m)) -> m (Constraint m) -- | Remove a constraint from the model. -- -- The constraint cannot used after being deleted. removeConstraint :: LPMonad m => Constraint m -> m () -- | Get the name of the constraint. getConstraintName :: LPMonad m => Constraint m -> m String -- | Set the name of the constraint. setConstraintName :: LPMonad m => Constraint m -> String -> m () -- | Get the value of the dual variable associated with the constraint in -- the current solution. -- -- This value has no meaning if the current solution is not an LP -- solution. getDualValue :: LPMonad m => Constraint m -> m (Numeric m) -- | Add a constraint to the model represented by an inequality. addObjective :: LPMonad m => LinearExpression (Numeric m) (Variable m) -> m (Objective m) -- | Get the name of the objective. getObjectiveName :: LPMonad m => Objective m -> m String -- | Set the name of the objective. setObjectiveName :: LPMonad m => Objective m -> String -> m () -- | Whether the objective is to be minimized or maximized. getObjectiveSense :: LPMonad m => Objective m -> m Sense -- | Set whether the objective is to be minimized or maximized. setObjectiveSense :: LPMonad m => Objective m -> Sense -> m () -- | Get the value of the objective in the current solution. getObjectiveValue :: LPMonad m => Objective m -> m (Numeric m) -- | Get the number of seconds the solver is allowed to run before halting. getTimeout :: LPMonad m => m Double -- | Set the number of seconds the solver is allowed to run before halting. setTimeout :: LPMonad m => Double -> m () -- | Optimize the continuous relaxation of the model. optimizeLP :: LPMonad m => m SolutionStatus -- | A convient shorthand for the type of linear expressions used in a -- given model. type Expr m = LinearExpression (Numeric m) (Variable m) -- | An interval of the real numbers. data Bounds b -- | The non-negative reals. NonNegativeReals :: Bounds b -- | The non-positive reals. NonPositiveReals :: Bounds b -- | Any closed interval of the reals. Interval :: b -> b -> Bounds b -- | Any real number. Free :: Bounds b -- | The outcome of an optimization. data SolutionStatus -- | An optimal solution has been found. Optimal :: SolutionStatus -- | A feasible solution has been found. The result may or may not be -- optimal. Feasible :: SolutionStatus -- | The model has been proven to be infeasible. Infeasible :: SolutionStatus -- | The model has been proven to be unbounded. Unbounded :: SolutionStatus -- | An error was encountered during the solve. Instance-specific methods -- should be used to determine what occurred. Error :: SolutionStatus -- | Whether a math program is minimizing or maximizing its objective. data Sense Minimization :: Sense Maximization :: Sense -- | A (mixed) integer program. -- -- In addition to the methods of the LPMonad class, this monad -- supports constraining variables to be either continuous or discrete. class (LPMonad m) => IPMonad m -- | Optimize the mixed-integer program. optimizeIP :: IPMonad m => m SolutionStatus -- | Get the domain of a variable. getVariableDomain :: IPMonad m => Variable m -> m Domain -- | Set the domain of a variable. setVariableDomain :: IPMonad m => Variable m -> Domain -> m () -- | Get the allowed relative gap between LP and IP solutions. getRelativeMIPGap :: IPMonad m => m Double -- | Set the allowed relative gap between LP and IP solutions. setRelativeMIPGap :: IPMonad m => Double -> m () -- | 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 :: Domain -- | The variable lies in the integers Integer :: Domain -- | The variable lies in the set {0, 1}. Binary :: Domain -- | Create a new free variable. free :: LPMonad m => m (Variable m) -- | Create a new non-negative variable. nonNeg :: LPMonad m => m (Variable m) -- | Create a new non-positive variable. nonPos :: LPMonad m => m (Variable m) -- | Create a new variable bounded between two values. bounded :: LPMonad m => Numeric m -> Numeric m -> m (Variable m) -- | Constrain a variable to take on certain values. -- -- This function is designed to be used as an infix operator, e.g. -- --
--   addVariable `within` NonNegativeReals
--   
within :: LPMonad m => m (Variable m) -> Bounds (Numeric m) -> m (Variable m) -- | Create an integer-valued variable. integer :: IPMonad m => m (Variable m) -- | Create a binary variable. binary :: IPMonad m => m (Variable m) -- | Create an integer-value variable that takes on non-negative values. nonNegInteger :: IPMonad m => m (Variable m) -- | Create an integer-value variable that takes on non-positive values. nonPosInteger :: IPMonad m => m (Variable m) -- | Set the type of a variable. -- -- This function is designed to be used as an infix operator, e.g. -- --
--   addVariable `asKind` Binary
--   
asKind :: IPMonad m => m (Variable m) -> Domain -> m (Variable m) -- | A linear expression containing symbolic variables of type b -- and numeric coefficients of type a. -- -- Using Strings to denote variables and Doubles as our -- numeric type, we could express 3 x + 2 y + 1 as -- --
--   LinearExpression [(3, "x"), (2, "y")] 1
--   
data LinearExpression a b LinearExpression :: [(a, b)] -> a -> LinearExpression a b -- | Reduce an expression to its value. eval :: Num a => LinearExpression a a -> a -- | Combine equivalent terms by summing their coefficients. simplify :: (Ord b, Num a) => LinearExpression a b -> LinearExpression a b -- | Construct an expression representing a variable. var :: Num a => b -> LinearExpression a b -- | Construct an expression representing a constant. con :: Num a => a -> LinearExpression a b -- | Construct an expression by summing expressions. exprSum :: Num a => [LinearExpression a b] -> LinearExpression a b -- | Construct an expression by summing variables. varSum :: Num a => [b] -> LinearExpression a b (.+.) :: Num a => LinearExpression a b -> LinearExpression a b -> LinearExpression a b infixl 6 .+. (@+@) :: Num a => b -> b -> LinearExpression a b infixl 6 @+@ (.+@) :: Num a => LinearExpression a b -> b -> LinearExpression a b infixl 6 .+@ (@+.) :: Num a => b -> LinearExpression a b -> LinearExpression a b infixl 6 @+. (@+#) :: Num a => b -> a -> LinearExpression a b infixl 6 @+# (#+@) :: Num a => a -> b -> LinearExpression a b infixl 6 #+@ (#+.) :: Num a => a -> LinearExpression a b -> LinearExpression a b infixl 6 #+. (.+#) :: Num a => LinearExpression a b -> a -> LinearExpression a b infixl 6 .+# (.-.) :: Num a => LinearExpression a b -> LinearExpression a b -> LinearExpression a b infixl 6 .-. (@-@) :: Num a => b -> b -> LinearExpression a b infixl 6 @-@ (.-@) :: Num a => LinearExpression a b -> b -> LinearExpression a b infixl 6 .-@ (@-.) :: Num a => b -> LinearExpression a b -> LinearExpression a b infixl 6 @-. (@-#) :: Num a => b -> a -> LinearExpression a b infixl 6 @-# (#-@) :: Num a => a -> b -> LinearExpression a b infixl 6 #-@ (#-.) :: Num a => a -> LinearExpression a b -> LinearExpression a b infixl 6 #-. (.-#) :: Num a => LinearExpression a b -> a -> LinearExpression a b infixl 6 .-# (#*@) :: Num a => a -> b -> LinearExpression a b infixl 7 #*@ (@*#) :: Num a => b -> a -> LinearExpression a b infixl 7 @*# (#*.) :: Num a => a -> LinearExpression a b -> LinearExpression a b infixl 7 #*. (.*#) :: Num a => LinearExpression a b -> a -> LinearExpression a b infixl 7 .*# (@/#) :: Fractional a => b -> a -> LinearExpression a b infixl 7 @/# (./#) :: Fractional a => LinearExpression a b -> a -> LinearExpression a b infixl 7 ./# -- | Non-strict inequalities. data Inequality a Inequality :: Ordering -> a -> a -> Inequality a (#<=@) :: LPMonad m => Numeric m -> Variable m -> m (Constraint m) infix 4 #<=@ (#<=.) :: LPMonad m => Numeric m -> Expr m -> m (Constraint m) infix 4 #<=. (@<=#) :: LPMonad m => Variable m -> Numeric m -> m (Constraint m) infix 4 @<=# (@<=@) :: LPMonad m => Variable m -> Variable m -> m (Constraint m) infix 4 @<=@ (@<=.) :: LPMonad m => Variable m -> Expr m -> m (Constraint m) infix 4 @<=. (.<=#) :: LPMonad m => Expr m -> Numeric m -> m (Constraint m) infix 4 .<=# (.<=@) :: LPMonad m => Expr m -> Variable m -> m (Constraint m) infix 4 .<=@ (.<=.) :: LPMonad m => Expr m -> Expr m -> m (Constraint m) infix 4 .<=. (#>=@) :: LPMonad m => Numeric m -> Variable m -> m (Constraint m) infix 4 #>=@ (#>=.) :: LPMonad m => Numeric m -> Expr m -> m (Constraint m) infix 4 #>=. (@>=#) :: LPMonad m => Variable m -> Numeric m -> m (Constraint m) infix 4 @>=# (@>=@) :: LPMonad m => Variable m -> Variable m -> m (Constraint m) infix 4 @>=@ (@>=.) :: LPMonad m => Variable m -> Expr m -> m (Constraint m) infix 4 @>=. (.>=#) :: LPMonad m => Expr m -> Numeric m -> m (Constraint m) infix 4 .>=# (.>=@) :: LPMonad m => Expr m -> Variable m -> m (Constraint m) infix 4 .>=@ (.>=.) :: LPMonad m => Expr m -> Expr m -> m (Constraint m) infix 4 .>=. (#==@) :: LPMonad m => Numeric m -> Variable m -> m (Constraint m) infix 4 #==@ (#==.) :: LPMonad m => Numeric m -> Expr m -> m (Constraint m) infix 4 #==. (@==#) :: LPMonad m => Variable m -> Numeric m -> m (Constraint m) infix 4 @==# (@==@) :: LPMonad m => Variable m -> Variable m -> m (Constraint m) infix 4 @==@ (@==.) :: LPMonad m => Variable m -> Expr m -> m (Constraint m) infix 4 @==. (.==#) :: LPMonad m => Expr m -> Numeric m -> m (Constraint m) infix 4 .==# (.==@) :: LPMonad m => Expr m -> Variable m -> m (Constraint m) infix 4 .==@ (.==.) :: LPMonad m => Expr m -> Expr m -> m (Constraint m) infix 4 .==. -- | Create an objective to be minimized. minimize :: LPMonad m => Expr m -> m (Objective m) -- | Create an objective to be maximized. maximize :: LPMonad m => Expr m -> m (Objective m) -- | Get the value of a linear expression in the current solution. evalExpr :: LPMonad m => Expr m -> m (Numeric m) -- | Name a variable, constraint, or objective. -- -- This function is designed to be used as an infix operator, e.g. -- --
--   free `named` X_1
--   
named :: (Monad m, Nameable m a) => m a -> String -> m a -- | Retrieve the name of a variable, constraint, or objective. nameOf :: (Monad m, Nameable m a) => a -> m String