Safe Haskell | None |
---|
Contains sufficient tools to represent linear programming problems in Haskell. In the future, if linkings to other linear programming libraries are made, this will be common to them all.
- data Constraint v c = Constr (Maybe String) (LinFunc v c) (Bounds c)
- type VarTypes v = Map v VarKind
- type ObjectiveFunc = LinFunc
- type VarBounds v c = Map v (Bounds c)
- data LP v c = LP {
- direction :: Direction
- objective :: ObjectiveFunc v c
- constraints :: [Constraint v c]
- varBounds :: VarBounds v c
- varTypes :: VarTypes v
- mapVars :: (Ord v', Ord c, Group c) => (v -> v') -> LP v c -> LP v' c
- mapVals :: (c -> c') -> LP v c -> LP v c'
- allVars :: Ord v => LP v c -> Map v ()
- module Data.Algebra
- data VarKind
- data Direction
- data Bounds a
Documentation
data Constraint v c Source
Representation of a linear constraint on the variables, possibly labeled. The function may be bounded both above and below.
Functor (Constraint v) | |
(Read v, Ord v, Read c, Ord c, Num c) => Read (Constraint v c) | |
(Show v, Num c, Ord c, Show c) => Show (Constraint v c) | |
(NFData v, NFData c) => NFData (Constraint v c) |
type VarTypes v = Map v VarKindSource
A mapping from variables to their types. Variables not mentioned are assumed to be continuous,
type ObjectiveFunc = LinFuncSource
An objective function for a linear program.
type VarBounds v c = Map v (Bounds c)Source
A mapping from variables to their boundaries. Variables not mentioned are assumed to be free.
The specification of a linear programming problem with variables in v
and coefficients/constants in c
.
Note: the Read
and Show
implementations do not correspond to any particular linear program specification format.
LP | |
|
mapVars :: (Ord v', Ord c, Group c) => (v -> v') -> LP v c -> LP v' cSource
Applies the specified function to the variables in the linear program. If multiple variables in the original program are mapped to the same variable in the new program, in general, we set those variables to all be equal, as follows.
- In linear functions, including the objective function and the constraints,
coefficients will be added together. For instance, if
v1,v2
are mapped to the same variablev'
, then a linear function of the formc1 *& v1 ^+^ c2 *& v2
will be mapped to(c1 ^+^ c2) *& v'
. - In variable bounds, bounds will be combined. An error will be thrown if the bounds are mutually contradictory.
- In variable kinds, the most restrictive kind will be retained.
mapVals :: (c -> c') -> LP v c -> LP v c'Source
Applies the specified function to the constants in the linear program. This is only safe for a monotonic function.
module Data.Algebra