limp-0.3.2.3: representation of Integer Linear Programs

Safe HaskellNone
LanguageHaskell2010

Numeric.Limp.Canon.Convert

Description

Convert from Numeric.Limp.Program representation to simpler, so-called canonical representation.

Synopsis

Documentation

linear :: (Rep c, Ord z, Ord r) => Linear z r c k -> (Linear z r c, R c) Source #

Convert a Frontend Linear into a Canon Linear. Returns the constant summand as well, as Canon Linear do not have these.

Should satisfy that forall a l. P.evalR a l == evalR a (fst $ linear l) + (snd $ linear l)

constraint :: (Rep c, Ord z, Ord r) => Constraint z r c -> Constraint z r c Source #

Convert a Frontend Constraint into a Canon Constraint.

Should satisfy that forall a c. P.check a c == check a (constraint c)

program :: (Rep c, Ord z, Ord r) => Program z r c -> Program z r c Source #

Convert a Frontend Program into a Canon Program.

If we had a solve function that worked on either, it would ideally satisfy forall p. P.solve p == solve (program p)

However, due to potential non-determinism in solving functions, it could be possible to get a different, but still optimal, solution:

forall p. let aP = P.solve p
               p' = program p
               a  =   solve p'
           in P.eval aP (P._objective p) == eval a (_objective p')
           &&  check a (P._constraints p) && check ...