Copyright | (c) Andrew Lelechenko 2014-2020 |
---|---|
License | GPL-3 |
Maintainer | [email protected] |
Safe Haskell | None |
Language | Haskell2010 |
Math.ExpPairs
Description
Linear programming over exponent pairs
Package implements an algorithm to minimize the maximum of a list of rational objective functions over the set of exponent pairs. See full description in A. V. Lelechenko, Linear programming over exponent pairs. Acta Univ. Sapientiae, Inform. 5, No. 2, 271-287 (2013). http://www.acta.sapientia.ro/acta-info/C5-2/info52-7.pdf
A set of useful applications can be found in Math.ExpPairs.Ivic, Math.ExpPairs.Kratzel and Math.ExpPairs.MenzerNowak.
Synopsis
- optimize :: [RationalForm Rational] -> [Constraint Rational] -> OptimizeResult
- data OptimizeResult
- optimalValue :: OptimizeResult -> RationalInf
- optimalPair :: OptimizeResult -> InitPair
- optimalPath :: OptimizeResult -> Path
- simulateOptimize :: Rational -> OptimizeResult
- simulateOptimize' :: RationalInf -> OptimizeResult
- data LinearForm t
- data RationalForm t = (LinearForm t) :/: (LinearForm t)
- data IneqType
- data Constraint t
- type InitPair = InitPair' Rational
- data Path
- data RatioInf t
- type RationalInf = RatioInf Integer
- pattern K :: (Eq a, Num a) => a -> LinearForm a
- pattern L :: (Eq a, Num a) => a -> LinearForm a
- pattern M :: (Eq a, Num a) => a -> LinearForm a
- (>.) :: Num t => LinearForm t -> LinearForm t -> Constraint t
- (>=.) :: Num t => LinearForm t -> LinearForm t -> Constraint t
- (<.) :: Num t => LinearForm t -> LinearForm t -> Constraint t
- (<=.) :: Num t => LinearForm t -> LinearForm t -> Constraint t
- scaleLF :: (Num t, Eq t) => t -> LinearForm t -> LinearForm t
Documentation
optimize :: [RationalForm Rational] -> [Constraint Rational] -> OptimizeResult Source #
This function takes a list of rational forms and a list of constraints and returns an exponent pair, which satisfies all constraints and minimizes the maximum of all rational forms.
data OptimizeResult Source #
Container for the result of optimization.
Instances
Show OptimizeResult Source # | |
Defined in Math.ExpPairs Methods showsPrec :: Int -> OptimizeResult -> ShowS # show :: OptimizeResult -> String # showList :: [OptimizeResult] -> ShowS # | |
Eq OptimizeResult Source # | |
Defined in Math.ExpPairs Methods (==) :: OptimizeResult -> OptimizeResult -> Bool # (/=) :: OptimizeResult -> OptimizeResult -> Bool # | |
Ord OptimizeResult Source # | |
Defined in Math.ExpPairs Methods compare :: OptimizeResult -> OptimizeResult -> Ordering # (<) :: OptimizeResult -> OptimizeResult -> Bool # (<=) :: OptimizeResult -> OptimizeResult -> Bool # (>) :: OptimizeResult -> OptimizeResult -> Bool # (>=) :: OptimizeResult -> OptimizeResult -> Bool # max :: OptimizeResult -> OptimizeResult -> OptimizeResult # min :: OptimizeResult -> OptimizeResult -> OptimizeResult # | |
Pretty OptimizeResult Source # | |
Defined in Math.ExpPairs |
optimalValue :: OptimizeResult -> RationalInf Source #
The minimal value of objective function.
optimalPair :: OptimizeResult -> InitPair Source #
The initial exponent pair, on which minimal value was achieved.
optimalPath :: OptimizeResult -> Path Source #
The sequence of processes, after which minimal value was achieved.
simulateOptimize :: Rational -> OptimizeResult Source #
Wrap Rational
into OptimizeResult
.
simulateOptimize' :: RationalInf -> OptimizeResult Source #
Wrap RationalInf
into OptimizeResult
.
data LinearForm t Source #
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.
Instances
data RationalForm t Source #
Define a rational form of two variables, equal to the ratio of two LinearForm
.
Constructors
(LinearForm t) :/: (LinearForm t) infix 5 |
Instances
Functor RationalForm Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods fmap :: (a -> b) -> RationalForm a -> RationalForm b # (<$) :: a -> RationalForm b -> RationalForm a # | |||||
Foldable RationalForm Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods fold :: Monoid m => RationalForm m -> m # foldMap :: Monoid m => (a -> m) -> RationalForm a -> m # foldMap' :: Monoid m => (a -> m) -> RationalForm a -> m # foldr :: (a -> b -> b) -> b -> RationalForm a -> b # foldr' :: (a -> b -> b) -> b -> RationalForm a -> b # foldl :: (b -> a -> b) -> b -> RationalForm a -> b # foldl' :: (b -> a -> b) -> b -> RationalForm a -> b # foldr1 :: (a -> a -> a) -> RationalForm a -> a # foldl1 :: (a -> a -> a) -> RationalForm a -> a # toList :: RationalForm a -> [a] # null :: RationalForm a -> Bool # length :: RationalForm a -> Int # elem :: Eq a => a -> RationalForm a -> Bool # maximum :: Ord a => RationalForm a -> a # minimum :: Ord a => RationalForm a -> a # sum :: Num a => RationalForm a -> a # product :: Num a => RationalForm a -> a # | |||||
Traversable RationalForm Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods traverse :: Applicative f => (a -> f b) -> RationalForm a -> f (RationalForm b) # sequenceA :: Applicative f => RationalForm (f a) -> f (RationalForm a) # mapM :: Monad m => (a -> m b) -> RationalForm a -> m (RationalForm b) # sequence :: Monad m => RationalForm (m a) -> m (RationalForm a) # | |||||
NFData t => NFData (RationalForm t) Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods rnf :: RationalForm t -> () # | |||||
Generic (RationalForm t) Source # | |||||
Defined in Math.ExpPairs.LinearForm Associated Types
Methods from :: RationalForm t -> Rep (RationalForm t) x # to :: Rep (RationalForm t) x -> RationalForm t # | |||||
Num t => Num (RationalForm t) Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods (+) :: RationalForm t -> RationalForm t -> RationalForm t # (-) :: RationalForm t -> RationalForm t -> RationalForm t # (*) :: RationalForm t -> RationalForm t -> RationalForm t # negate :: RationalForm t -> RationalForm t # abs :: RationalForm t -> RationalForm t # signum :: RationalForm t -> RationalForm t # fromInteger :: Integer -> RationalForm t # | |||||
Num t => Fractional (RationalForm t) Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods (/) :: RationalForm t -> RationalForm t -> RationalForm t # recip :: RationalForm t -> RationalForm t # fromRational :: Rational -> RationalForm t # | |||||
Show t => Show (RationalForm t) Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods showsPrec :: Int -> RationalForm t -> ShowS # show :: RationalForm t -> String # showList :: [RationalForm t] -> ShowS # | |||||
Eq t => Eq (RationalForm t) Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods (==) :: RationalForm t -> RationalForm t -> Bool # (/=) :: RationalForm t -> RationalForm t -> Bool # | |||||
(Num t, Eq t, Pretty t) => Pretty (RationalForm t) Source # | |||||
Defined in Math.ExpPairs.LinearForm | |||||
type Rep (RationalForm t) Source # | |||||
Defined in Math.ExpPairs.LinearForm type Rep (RationalForm t) = D1 ('MetaData "RationalForm" "Math.ExpPairs.LinearForm" "exp-pairs-0.2.1.1-8aKt8rv8T1n1FePA6SuwRk" 'False) (C1 ('MetaCons ":/:" ('InfixI 'NotAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (LinearForm t)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (LinearForm t)))) |
Constants to specify the strictness of Constraint
.
Instances
Bounded IneqType Source # | |
Enum IneqType Source # | |
Defined in Math.ExpPairs.LinearForm | |
Generic IneqType Source # | |
Defined in Math.ExpPairs.LinearForm | |
Show IneqType Source # | |
Eq IneqType Source # | |
Ord IneqType Source # | |
Defined in Math.ExpPairs.LinearForm | |
Pretty IneqType Source # | |
Defined in Math.ExpPairs.LinearForm | |
type Rep IneqType Source # | |
data Constraint t Source #
A linear constraint of two variables.
Instances
Functor Constraint Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods fmap :: (a -> b) -> Constraint a -> Constraint b # (<$) :: a -> Constraint b -> Constraint a # | |||||
Foldable Constraint Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods fold :: Monoid m => Constraint m -> m # foldMap :: Monoid m => (a -> m) -> Constraint a -> m # foldMap' :: Monoid m => (a -> m) -> Constraint a -> m # foldr :: (a -> b -> b) -> b -> Constraint a -> b # foldr' :: (a -> b -> b) -> b -> Constraint a -> b # foldl :: (b -> a -> b) -> b -> Constraint a -> b # foldl' :: (b -> a -> b) -> b -> Constraint a -> b # foldr1 :: (a -> a -> a) -> Constraint a -> a # foldl1 :: (a -> a -> a) -> Constraint a -> a # toList :: Constraint a -> [a] # null :: Constraint a -> Bool # length :: Constraint a -> Int # elem :: Eq a => a -> Constraint a -> Bool # maximum :: Ord a => Constraint a -> a # minimum :: Ord a => Constraint a -> a # sum :: Num a => Constraint a -> a # product :: Num a => Constraint a -> a # | |||||
Traversable Constraint Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods traverse :: Applicative f => (a -> f b) -> Constraint a -> f (Constraint b) # sequenceA :: Applicative f => Constraint (f a) -> f (Constraint a) # mapM :: Monad m => (a -> m b) -> Constraint a -> m (Constraint b) # sequence :: Monad m => Constraint (m a) -> m (Constraint a) # | |||||
NFData t => NFData (Constraint t) Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods rnf :: Constraint t -> () # | |||||
Generic (Constraint t) Source # | |||||
Defined in Math.ExpPairs.LinearForm Associated Types
| |||||
Show t => Show (Constraint t) Source # | |||||
Defined in Math.ExpPairs.LinearForm Methods showsPrec :: Int -> Constraint t -> ShowS # show :: Constraint t -> String # showList :: [Constraint t] -> ShowS # | |||||
Eq t => Eq (Constraint t) Source # | |||||
Defined in Math.ExpPairs.LinearForm | |||||
(Num t, Eq t, Pretty t) => Pretty (Constraint t) Source # | |||||
Defined in Math.ExpPairs.LinearForm | |||||
type Rep (Constraint t) Source # | |||||
Defined in Math.ExpPairs.LinearForm type Rep (Constraint t) = D1 ('MetaData "Constraint" "Math.ExpPairs.LinearForm" "exp-pairs-0.2.1.1-8aKt8rv8T1n1FePA6SuwRk" 'False) (C1 ('MetaCons "Constraint" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (LinearForm t)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IneqType))) |
Holds a list of Process
and a matrix of projective
transformation, which they define.
Instances
Monoid Path Source # | |||||
Semigroup Path Source # | |||||
Generic Path Source # | |||||
Defined in Math.ExpPairs.Process Associated Types
| |||||
Read Path Source # | |||||
Show Path Source # | |||||
Eq Path Source # | |||||
Ord Path Source # | |||||
Pretty Path Source # | |||||
Defined in Math.ExpPairs.Process | |||||
type Rep Path Source # | |||||
Defined in Math.ExpPairs.Process type Rep Path = D1 ('MetaData "Path" "Math.ExpPairs.Process" "exp-pairs-0.2.1.1-8aKt8rv8T1n1FePA6SuwRk" 'False) (C1 ('MetaCons "Path" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ProcessMatrix) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Process]))) |
Extend Ratio
t
with \( \pm \infty \) positive and negative
infinities.
Instances
Integral t => Num (RatioInf t) Source # | |
Defined in Math.ExpPairs.RatioInf | |
Integral t => Fractional (RatioInf t) Source # | |
Integral t => Real (RatioInf t) Source # | |
Defined in Math.ExpPairs.RatioInf Methods toRational :: RatioInf t -> Rational # | |
Show t => Show (RatioInf t) Source # | |
Eq t => Eq (RatioInf t) Source # | |
Integral t => Ord (RatioInf t) Source # | |
Defined in Math.ExpPairs.RatioInf | |
(Integral t, Pretty t) => Pretty (RatioInf t) Source # | |
Defined in Math.ExpPairs.RatioInf |
type RationalInf = RatioInf Integer Source #
Arbitrary-precision rational numbers with positive and negative infinities.
(>.) :: Num t => LinearForm t -> LinearForm t -> Constraint t infix 5 Source #
Build a constraint, which states that the value of the first linear form is greater than the value of the second one.
(>=.) :: Num t => LinearForm t -> LinearForm t -> Constraint t infix 5 Source #
Build a constraint, which states that the value of the first linear form is greater or equal to the value of the second one.
(<.) :: Num t => LinearForm t -> LinearForm t -> Constraint t infix 5 Source #
Build a constraint, which states that the value of the first linear form is less than the value of the second one.
(<=.) :: Num t => LinearForm t -> LinearForm t -> Constraint t infix 5 Source #
Build a constraint, which states that the value of the first linear form is less or equal to the value of the second one.
scaleLF :: (Num t, Eq t) => t -> LinearForm t -> LinearForm t Source #
Multiply a linear form by a given coefficient.