glpk-hs-0.0.3: Comprehensive GLPK linear programming bindings

Data.LinearProgram.Common

Synopsis

# Documentation

data Constraint v c Source

Constructors

 Constr (Maybe String) (LinFunc v c) (Bounds c)

Instances

 (Ord v, Read v, Read c) => Read (Constraint v c) (Show v, Show c) => Show (Constraint v c)

type VarBounds v c = Map v (Bounds c)Source

data LP v c Source

Constructors

 LP Fieldsdirection :: Direction objective :: ObjectiveFunc v c constraints :: [Constraint v c] varBounds :: VarBounds v c varTypes :: VarTypes v

Instances

 (Ord v, Read v, Read c) => Read (LP v c) (Show v, Show c) => Show (LP v c)

type LinFunc = MapSource

LinFunc v c is a linear combination of variables of type v with coefficients from c. Formally, this is the free c-module on v.

class Module r m | m -> r whereSource

In algebra, if r is a ring, an r-module is an additive group with a scalar multiplication operation. When r is a field, this is equivalent to a vector space.

Methods

(*^) :: r -> m -> mSource

zero :: mSource

(^+^) :: m -> m -> mSource

(^-^) :: m -> m -> mSource

neg :: m -> mSource

Instances

 Module Double Double Module Int Int Module Integer Integer Module r m => Module r (IntMap m) (IArray UArray m, Module r m) => Module r (UArray Int m) Module r m => Module r (Array Int m) (Ord k, Module r m) => Module r (Map k m) Module r m => Module r (a -> m) Integral a => Module (Ratio a) (Ratio a)

var :: (Ord v, Num c) => v -> LinFunc v cSource

Given a variable v, returns the function equivalent to v.

varSum :: (Ord v, Num c) => [v] -> LinFunc v cSource

Equivalent to vsum . map var.

(*&) :: (Ord v, Num c) => c -> v -> LinFunc v cSource

c *& v is equivalent to c *^ var v.

vsum :: Module r v => [v] -> vSource

Returns a vector sum.

combination :: Module r m => [(r, m)] -> mSource

Given a collection of vectors and scaling coefficients, returns this linear combination.

linCombination :: (Ord v, Num r) => [(r, v)] -> LinFunc v rSource

Given a set of basic variables and coefficients, returns the linear combination obtained by summing.

data VarKind Source

Constructors

 ContVar IntVar BinVar

Instances

 Enum VarKind Eq VarKind Ord VarKind Read VarKind Show VarKind Monoid VarKind

data Direction Source

Constructors

 Min Max

Instances

 Enum Direction Eq Direction Ord Direction Read Direction Show Direction

data Bounds a Source

Constructors

 Free LBound a UBound a Equ a Bound a a

Instances

 Eq a => Eq (Bounds a) Read a => Read (Bounds a) Show a => Show (Bounds a) Ord a => Monoid (Bounds a)