comfort-glpk: Linear Programming using GLPK and comfort-array

[ bsd3, library, math ] [ Propose Tags ]

Simple interface to linear programming functions provided by GLPK using the flexible Array shape framework from comfort-array.

E.g. you can use Shape.Tuple to convert safely between nested tuples and arrays with the same number of elements.

type X = Shape.Element
type PairShape = Shape.NestedTuple Shape.TupleIndex (X,X)

case Shape.indexTupleFromShape (Shape.static :: PairShape) of
  (posIx,negIx) ->
    case mapSnd (mapSnd Array.toTuple) <$>
         LP.simplex [] [[1.*posIx, (-1).*negIx] ==. 314]
            Array.fromTuple (23,42) :: Array PairShape Double)
        (Right (LP.Optimal, (absol, (pos, neg)))) ->
          printf "absol %f,  pos %f, neg %f\n" absol pos neg
        _ -> fail "GLPK solver failed"

Alternatives: coinor-clp, hmatrix-glpk, glpk-hs


Manual Flags


Enable debug output


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 0.0,, 0.0.1, 0.1 (info)
Dependencies base (>=4.5 && <5), comfort-array (>=0.4 && <0.6), deepseq (>=1.3 && <1.6), glpk-headers (>=0.4.1 && <0.6), linear-programming (>=0.0 && <0.1), non-empty (>=0.3.2 && <0.4), transformers (>=0.3 && <0.7), utility-ht (>=0.0.16 && <0.1) [details]
License BSD-3-Clause
Author Henning Thielemann <>
Maintainer Henning Thielemann <>
Revised Revision 1 made by HenningThielemann at 2023-12-26T20:24:44Z
Category Math
Source repo this: darcs get --tag 0.1
head: darcs get
Uploaded by HenningThielemann at 2023-05-11T11:09:19Z
Distributions LTSHaskell:0.1, NixOS:0.1, Stackage:0.1
Downloads 259 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]