packages feed

glpk-hs 0.2.2 → 0.2.3

raw patch · 5 files changed

+12/−7 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.LinearProgram.LPMonad: data Var
+ Data.LinearProgram.LPMonad: Var :: Int -> Var
+ Data.LinearProgram.LPMonad: newtype Var
- Data.LinearProgram.GLPK.IO: readLP :: (Ord v, Read v, Ord c, Fractional c, Group c) => FilePath -> IO (LP v c)
+ Data.LinearProgram.GLPK.IO: readLP :: (Ord v, Read v, Fractional c) => FilePath -> IO (LP v c)
- Data.LinearProgram.LPMonad: readLPFromFile :: (Ord v, Read v, Ord c, Fractional c, Group c, MonadState (LP v c) m, MonadIO m) => FilePath -> m ()
+ Data.LinearProgram.LPMonad: readLPFromFile :: (Ord v, Read v, Fractional c, MonadState (LP v c) m, MonadIO m) => FilePath -> m ()

Files

Data/LinearProgram/GLPK/IO.hs view
@@ -9,8 +9,8 @@ {-# SPECIALIZE readLP :: (Ord v, Read v) => FilePath -> IO (LP v Double) #-} -- | Read a linear program from a file in CPLEX LP format.  Warning: this will not necessarily succeed -- on all files generated by 'writeLP', as variable names may be changed.-readLP :: (Ord v, Read v, Ord c, Fractional c, Group c) => FilePath -> IO (LP v c)-readLP = fmap (mapVars read . mapVals realToFrac) . readLP'+readLP :: (Ord v, Read v, Fractional c) => FilePath -> IO (LP v c)+readLP = fmap (mapVals realToFrac . mapVars read) . readLP'  -- | Read a linear program from a file in CPLEX LP format. readLP' :: FilePath -> IO (LP String Double)
Data/LinearProgram/LPMonad.hs view
@@ -6,6 +6,8 @@ -- for example separating different families of constraints in the problem specification. --  -- Many of these functions should be executed in either the @'LPM' v c@ or the @'LPT' v c 'IO'@ monad.+-- If you wish to generate new variables on an ad-hoc basis, rather than supplying your own variable type, use the+-- 'VarSource' or 'VarSourceT' monads in your transformer stack. module Data.LinearProgram.LPMonad ( 	module Data.LinearProgram.LPMonad.Internal, 	module Data.LinearProgram.LPMonad.VarSource,@@ -76,13 +78,13 @@ 	FilePath -> m () writeLPToFile file = get >>= liftIO . writeLP file  -{-# SPECIALIZE readLPFromFile :: (Ord v, Read v, Ord c, Fractional c, Module r c) => FilePath -> LPT v c IO () #-}+{-# SPECIALIZE readLPFromFile :: (Ord v, Read v, Fractional c) => FilePath -> LPT v c IO () #-} -- | Reads a linear program from the specified file in CPLEX LP format, overwriting -- the current linear program.  Uses 'read' and 'realToFrac' to translate to the specified type. -- Warning: this may not work on all files written using 'writeLPToFile', since variable names -- may be changed. -- (This is a binding to GLPK, not a Haskell implementation of CPLEX.)-readLPFromFile :: (Ord v, Read v, Ord c, Fractional c, Group c, MonadState (LP v c) m, MonadIO m) =>+readLPFromFile :: (Ord v, Read v, Fractional c, MonadState (LP v c) m, MonadIO m) => 	FilePath -> m () readLPFromFile = put <=< liftIO . readLP 
Data/LinearProgram/LPMonad/VarSource.hs view
@@ -1,7 +1,8 @@ {-# LANGUAGE UndecidableInstances, FlexibleInstances, GeneralizedNewtypeDeriving, FunctionalDependencies, MultiParamTypeClasses #-} module Data.LinearProgram.LPMonad.VarSource (-	-- * Types for automatically generating distinct variables-	VarSource, VarSourceT, Var, MonadSource(..), evalVarSource, evalVarSourceT) where+	-- * Variable generation monad+	VarSource, evalVarSource, VarSourceT, evalVarSourceT, Var(..),+	MonadSource(..)) where  import Control.Monad import Control.Monad.State.Strict@@ -36,6 +37,7 @@  instance Read Var where 	readsPrec _ ('x':'_':xs) = [(Var x, s') | (x, s') <- readsPrec 0 xs]+	readsPrec _ _ = []  instance MonadState s m => MonadState s (VarSourceT m) where 	put x = VarSourceT (lift (put x))
Data/LinearProgram/Spec.hs view
@@ -114,6 +114,7 @@ 			char '=' >> return EQ, 			char '>' >> optional (char '=') >> return GT] +{-# SPECIALIZE mapVars :: Ord v' => (v -> v') -> LP v Double -> LP v' Double #-} -- | 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.
glpk-hs.cabal view
@@ -1,5 +1,5 @@ Name:           glpk-hs-Version:        0.2.2+Version:        0.2.3 Author:         Louis Wasserman License:        GPL License-file:   LICENSE