Copyright | (c) Andrew Lelechenko, 2014-2015 |
---|---|
License | GPL-3 |
Maintainer | andrew.lelechenko@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
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
- 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 = RationalForm (LinearForm t) (LinearForm t)
- evalRF :: (Real t, Num 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 Source
Define an affine linear form of two 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 Source | |
Foldable LinearForm Source | |
Eq t => Eq (LinearForm t) Source | |
Num t => Num (LinearForm t) Source | |
Show t => Show (LinearForm t) Source | |
Generic (LinearForm t) Source | |
Num t => Monoid (LinearForm t) Source | |
NFData t => NFData (LinearForm t) Source | |
(Num t, Eq t, Pretty t) => Pretty (LinearForm t) Source | |
type Rep (LinearForm t) Source |
evalLF :: Num t => (t, t, t) -> LinearForm t -> t Source
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 Source
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 Source
Define a rational form of two variables, equal to the ratio of two LinearForm
.
Constructors
RationalForm (LinearForm t) (LinearForm t) |
Instances
Functor RationalForm Source | |
Foldable RationalForm Source | |
Eq t => Eq (RationalForm t) Source | |
Num t => Fractional (RationalForm t) Source | |
Num t => Num (RationalForm t) Source | |
Show t => Show (RationalForm t) Source | |
Generic (RationalForm t) Source | |
NFData t => NFData (RationalForm t) Source | |
(Num t, Eq t, Pretty t) => Pretty (RationalForm t) Source | |
type Rep (RationalForm t) Source |
evalRF :: (Real t, Num t) => (Integer, Integer, Integer) -> RationalForm t -> RationalInf Source
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 Source
A linear constraint of two variables.
Constructors
Constraint !(LinearForm t) !IneqType |
Instances
Functor Constraint Source | |
Foldable Constraint Source | |
Eq t => Eq (Constraint t) Source | |
Show t => Show (Constraint t) Source | |
Generic (Constraint t) Source | |
NFData t => NFData (Constraint t) Source | |
(Num t, Eq t, Pretty t) => Pretty (Constraint t) Source | |
type Rep (Constraint t) Source |
checkConstraint :: (Num t, Ord t) => (Integer, Integer, Integer) -> Constraint t -> Bool Source
Evaluate a rational form of constraint and compare
its value with 0. Strictness depends on the given IneqType
.