exp-pairs-0.1.1.0: Linear programming over exponent pairs

Copyright(c) Andrew Lelechenko, 2014-2015
LicenseGPL-3
Maintainerandrew.lelechenko@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell98

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.

Synopsis

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

Eq t => Eq (LinearForm t) 
Num t => Num (LinearForm t) 
(Num t, Eq t, Show t) => Show (LinearForm t) 
Num t => Monoid (LinearForm t) 

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

Num t => Fractional (RationalForm t) 
Num t => Num (RationalForm t) 
(Eq t, Num t, Show t) => Show (RationalForm t) 

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.

data IneqType Source

Constants to specify the strictness of Constraint.

Constructors

Strict

Strict inequality (>0).

NonStrict

Non-strict inequality (≥0).

Instances

data Constraint t Source

A linear constraint of two variables.

Constructors

Constraint (LinearForm t) IneqType 

Instances

(Eq t, Num t, Show t) => Show (Constraint t) 

checkConstraint :: (Num t, Eq 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.