limp-0.3.2.2: representation of Integer Linear Programs

Safe HaskellNone
LanguageHaskell2010

Numeric.Limp.Program.Linear

Description

Representation, constructors and limited arithmetic on linear functions.

The linear function is indexed by its result type: either purely integer (KZ) or mixed/real (KR). This index is used to allow strictly-less-than constraints only on integer functions, and to allow retrieving integer values from purely integer functions.

Synopsis

Documentation

data Linear z r c k where Source #

Representation of either integral of real linear functions: a list of variables with coefficients, plus a constant summand.

Constructors

LZ :: [(z, Z c)] -> Z c -> Linear z r c KZ 
LR :: [(Either z r, R c)] -> R c -> Linear z r c KR 

Instances

(Show z, Show r, Show (Z c), Show (R c)) => Show (Linear z r c k) Source # 

Methods

showsPrec :: Int -> Linear z r c k -> ShowS #

show :: Linear z r c k -> String #

showList :: [Linear z r c k] -> ShowS #

toR :: Rep c => Linear z r c k -> Linear z r c KR Source #

Any linear function can be converted into a real linear function.

z :: Rep c => z -> Z c -> Linear z r c KZ Source #

Integral variable

z1 :: Rep c => z -> Linear z r c KZ Source #

Integral variable with coefficient 1

r :: Rep c => r -> R c -> Linear z r c KR Source #

Real variable

r1 :: Rep c => r -> Linear z r c KR Source #

Real variable with coefficient 1

con :: Rep c => Z c -> Linear z r c KZ Source #

An integral constant summand

conZ :: Rep c => Z c -> Linear z r c KZ Source #

An integral constant summand

conR :: Rep c => R c -> Linear z r c KR Source #

A real constant

c0 :: Rep c => Linear z r c KZ Source #

Constant 0

c1 :: Rep c => Linear z r c KZ Source #

Constant 1

neg :: Rep c => Linear z r c k -> Linear z r c k Source #

Negate a linear function. Negation does not change the kind.

(.*) :: Rep c => Linear z r c k -> KRep k c -> Linear z r c k infix 7 Source #

Multiply a linear function by some constant.

Note that you cannot multiply a linear function by another linear function, as the result would likely be non-linear!

(*.) :: Rep c => KRep k c -> Linear z r c k -> Linear z r c k infix 7 Source #

Multiply a linear function by some constant.

(.+.) :: Rep c => Linear z r c k1 -> Linear z r c k2 -> Linear z r c (KMerge k1 k2) infixl 6 Source #

Add two linear functions together. They can have different result types.

(.-.) :: Rep c => Linear z r c k1 -> Linear z r c k2 -> Linear z r c (KMerge k1 k2) infixl 6 Source #

Subtract one linear function from another. They can have different result types.