Copyright | (c) Andrew Lelechenko 2014-2015 |
---|---|
License | GPL-3 |
Maintainer | andrew.lelechenko@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
Math.ExpPairs.LinearForm
Description
Provides types for rational forms (to hold objective functions in Math.ExpPairs) and linear contraints (to hold constraints of optimization). Both of them are built atop of projective linear forms.
- data LinearForm t = LinearForm !t !t !t
- scaleLF :: (Num t, Eq t) => t -> LinearForm t -> LinearForm t
- evalLF :: Num t => (t, t, t) -> LinearForm t -> t
- substituteLF :: (Eq t, Num t) => (LinearForm t, LinearForm t, LinearForm t) -> LinearForm t -> LinearForm t
- data RationalForm t = (LinearForm t) :/: (LinearForm t)
- evalRF :: Real t => (Integer, Integer, Integer) -> RationalForm t -> RationalInf
- data IneqType
- data Constraint t = Constraint !(LinearForm t) !IneqType
- checkConstraint :: (Num t, Ord t) => (Integer, Integer, Integer) -> Constraint t -> Bool
Documentation
data LinearForm t #
Define an affine linear form of three variables: a*k + b*l + c*m.
First argument of LinearForm
stands for a, second for b
and third for c. Linear forms form a monoid by addition.
Constructors
LinearForm !t !t !t |
Instances
Functor LinearForm # | |
Foldable LinearForm # | |
Eq t => Eq (LinearForm t) # | |
Num t => Num (LinearForm t) # | |
Show t => Show (LinearForm t) # | |
Generic (LinearForm t) # | |
Num t => Monoid (LinearForm t) # | |
NFData t => NFData (LinearForm t) # | |
(Num t, Eq t, Pretty t) => Pretty (LinearForm t) # | |
type Rep (LinearForm t) # | |
scaleLF :: (Num t, Eq t) => t -> LinearForm t -> LinearForm t #
Multiply a linear form by a given coefficient.
evalLF :: Num t => (t, t, t) -> LinearForm t -> t #
Evaluate a linear form a*k + b*l + c*m for given k, l and m.
substituteLF :: (Eq t, Num t) => (LinearForm t, LinearForm t, LinearForm t) -> LinearForm t -> LinearForm t #
Substitute linear forms k, l and m into a given linear form a*k + b*l + c*m to obtain a new linear form.
data RationalForm t #
Define a rational form of two variables, equal to the ratio of two LinearForm
.
Constructors
(LinearForm t) :/: (LinearForm t) infix 5 |
Instances
Functor RationalForm # | |
Foldable RationalForm # | |
Eq t => Eq (RationalForm t) # | |
Num t => Fractional (RationalForm t) # | |
Num t => Num (RationalForm t) # | |
Show t => Show (RationalForm t) # | |
Generic (RationalForm t) # | |
NFData t => NFData (RationalForm t) # | |
(Num t, Eq t, Pretty t) => Pretty (RationalForm t) # | |
type Rep (RationalForm t) # | |
evalRF :: Real t => (Integer, Integer, Integer) -> RationalForm t -> RationalInf #
Evaluate a rational form (a*k + b*l + c*m) / (a'*k + b'*l + c'*m) for given k, l and m.
Constants to specify the strictness of Constraint
.
data Constraint t #
A linear constraint of two variables.
Constructors
Constraint !(LinearForm t) !IneqType |
Instances
Functor Constraint # | |
Foldable Constraint # | |
Eq t => Eq (Constraint t) # | |
Show t => Show (Constraint t) # | |
Generic (Constraint t) # | |
NFData t => NFData (Constraint t) # | |
(Num t, Eq t, Pretty t) => Pretty (Constraint t) # | |
type Rep (Constraint t) # | |
checkConstraint :: (Num t, Ord t) => (Integer, Integer, Integer) -> Constraint t -> Bool #
Evaluate a rational form of constraint and compare
its value with 0. Strictness depends on the given IneqType
.