math-programming-0.5.0: A library for formulating and solving math programs.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.Programming.LinExpr

Description

Linear expressions of variables.

Synopsis

Documentation

data LinExpr a b Source #

A linear expression.

Linear expressions contain symbolic variables of type b and numeric coefficients of type a. Often a will be Double, and b will be whatever variable type your linear program uses.

Constructors

LinExpr ![(a, b)] !a 

Instances

Instances details
Foldable (LinExpr a) Source # 
Instance details

Defined in Math.Programming.LinExpr

Methods

fold :: Monoid m => LinExpr a m -> m #

foldMap :: Monoid m => (a0 -> m) -> LinExpr a a0 -> m #

foldMap' :: Monoid m => (a0 -> m) -> LinExpr a a0 -> m #

foldr :: (a0 -> b -> b) -> b -> LinExpr a a0 -> b #

foldr' :: (a0 -> b -> b) -> b -> LinExpr a a0 -> b #

foldl :: (b -> a0 -> b) -> b -> LinExpr a a0 -> b #

foldl' :: (b -> a0 -> b) -> b -> LinExpr a a0 -> b #

foldr1 :: (a0 -> a0 -> a0) -> LinExpr a a0 -> a0 #

foldl1 :: (a0 -> a0 -> a0) -> LinExpr a a0 -> a0 #

toList :: LinExpr a a0 -> [a0] #

null :: LinExpr a a0 -> Bool #

length :: LinExpr a a0 -> Int #

elem :: Eq a0 => a0 -> LinExpr a a0 -> Bool #

maximum :: Ord a0 => LinExpr a a0 -> a0 #

minimum :: Ord a0 => LinExpr a a0 -> a0 #

sum :: Num a0 => LinExpr a a0 -> a0 #

product :: Num a0 => LinExpr a a0 -> a0 #

Traversable (LinExpr a) Source # 
Instance details

Defined in Math.Programming.LinExpr

Methods

traverse :: Applicative f => (a0 -> f b) -> LinExpr a a0 -> f (LinExpr a b) #

sequenceA :: Applicative f => LinExpr a (f a0) -> f (LinExpr a a0) #

mapM :: Monad m => (a0 -> m b) -> LinExpr a a0 -> m (LinExpr a b) #

sequence :: Monad m => LinExpr a (m a0) -> m (LinExpr a a0) #

Functor (LinExpr a) Source # 
Instance details

Defined in Math.Programming.LinExpr

Methods

fmap :: (a0 -> b) -> LinExpr a a0 -> LinExpr a b #

(<$) :: a0 -> LinExpr a b -> LinExpr a a0 #

Num a => Monoid (LinExpr a b) Source # 
Instance details

Defined in Math.Programming.LinExpr

Methods

mempty :: LinExpr a b #

mappend :: LinExpr a b -> LinExpr a b -> LinExpr a b #

mconcat :: [LinExpr a b] -> LinExpr a b #

Num a => Semigroup (LinExpr a b) Source # 
Instance details

Defined in Math.Programming.LinExpr

Methods

(<>) :: LinExpr a b -> LinExpr a b -> LinExpr a b #

sconcat :: NonEmpty (LinExpr a b) -> LinExpr a b #

stimes :: Integral b0 => b0 -> LinExpr a b -> LinExpr a b #

(Read a, Read b) => Read (LinExpr a b) Source # 
Instance details

Defined in Math.Programming.LinExpr

(Show a, Show b) => Show (LinExpr a b) Source # 
Instance details

Defined in Math.Programming.LinExpr

Methods

showsPrec :: Int -> LinExpr a b -> ShowS #

show :: LinExpr a b -> String #

showList :: [LinExpr a b] -> ShowS #

(Eq a, Eq b) => Eq (LinExpr a b) Source # 
Instance details

Defined in Math.Programming.LinExpr

Methods

(==) :: LinExpr a b -> LinExpr a b -> Bool #

(/=) :: LinExpr a b -> LinExpr a b -> Bool #

(*.) :: Num a => a -> b -> LinExpr a b infixl 7 Source #

Construct a term in a linear expression by multiplying a constant by a variable.

(.*) :: Num a => b -> a -> LinExpr a b infixl 7 Source #

Construct a term in a linear expression by multiplying a variable by a constant.

(./) :: Fractional a => b -> a -> LinExpr a b infixl 7 Source #

Construct a term in a linear expression by dividing a variable by a constant.

scale :: Num a => a -> LinExpr a b -> LinExpr a b Source #

Multiplication of linear expressions by a constant.

(.+.) :: Num a => LinExpr a b -> LinExpr a b -> LinExpr a b infixl 6 Source #

Addition of linear expressions.

(.-.) :: Num a => LinExpr a b -> LinExpr a b -> LinExpr a b infixl 6 Source #

The difference of linear expressions.

var :: Num a => b -> LinExpr a b Source #

A linear expression with a single variable term.

con :: a -> LinExpr a b Source #

A linear expression with only a constant term.

vsum :: Num a => [b] -> LinExpr a b Source #

The sum of variable terms with coefficients of unity.

esum :: Num a => Foldable t => t (LinExpr a b) -> LinExpr a b Source #

The sum of linear expressions.

eval :: Num a => LinExpr a a -> a Source #

Reduce an expression to its value.

simplify :: (Num a, Ord b) => LinExpr a b -> LinExpr a b Source #

Simplify an expression by grouping like terms.