Copyright | (c) Masahiro Sakai 2011-2014 |
---|---|
License | BSD-style |
Maintainer | masahiro.sakai@gmail.com |
Stability | provisional |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Mixed-Integer Programming Problems with some commmonly used extensions
- module ToySolver.Data.MIP.Base
- readFile :: FileOptions -> FilePath -> IO (Problem Scientific)
- readLPFile :: FileOptions -> FilePath -> IO (Problem Scientific)
- readMPSFile :: FileOptions -> FilePath -> IO (Problem Scientific)
- parseLPString :: FileOptions -> String -> String -> Either (ParseError Char Void) (Problem Scientific)
- parseMPSString :: FileOptions -> String -> String -> Either (ParseError Char Void) (Problem Scientific)
- writeFile :: FileOptions -> FilePath -> Problem Scientific -> IO ()
- writeLPFile :: FileOptions -> FilePath -> Problem Scientific -> IO ()
- writeMPSFile :: FileOptions -> FilePath -> Problem Scientific -> IO ()
- toLPString :: FileOptions -> Problem Scientific -> Either String Text
- toMPSString :: FileOptions -> Problem Scientific -> Either String Text
- data ParseError t e :: * -> * -> *
- = TrivialError (NonEmpty SourcePos) (Maybe (ErrorItem t)) (Set (ErrorItem t))
- | FancyError (NonEmpty SourcePos) (Set (ErrorFancy e))
Documentation
module ToySolver.Data.MIP.Base
readFile :: FileOptions -> FilePath -> IO (Problem Scientific) Source #
Parse .lp or .mps file based on file extension
readLPFile :: FileOptions -> FilePath -> IO (Problem Scientific) Source #
Parse a file containing LP file data.
readMPSFile :: FileOptions -> FilePath -> IO (Problem Scientific) Source #
Parse a file containing MPS file data.
parseLPString :: FileOptions -> String -> String -> Either (ParseError Char Void) (Problem Scientific) Source #
Parse a string containing LP file data.
parseMPSString :: FileOptions -> String -> String -> Either (ParseError Char Void) (Problem Scientific) Source #
Parse a string containing MPS file data.
writeFile :: FileOptions -> FilePath -> Problem Scientific -> IO () Source #
writeLPFile :: FileOptions -> FilePath -> Problem Scientific -> IO () Source #
writeMPSFile :: FileOptions -> FilePath -> Problem Scientific -> IO () Source #
toLPString :: FileOptions -> Problem Scientific -> Either String Text Source #
toMPSString :: FileOptions -> Problem Scientific -> Either String Text Source #
data ParseError t e :: * -> * -> * #
represents a parse error parametrized over the token
type ParseError
t et
and the custom data e
.
Note that the stack of source positions contains current position as its head, and the rest of positions allows to track full sequence of include files with topmost source file at the end of the list.
Semigroup
and Monoid
instances of the data type allow to merge parse
errors from different branches of parsing. When merging two
ParseError
s, the longest match is preferred; if positions are the same,
custom data sets and collections of message items are combined. Note that
fancy errors take precedence over trivial errors in merging.
Since: 6.0.0
TrivialError (NonEmpty SourcePos) (Maybe (ErrorItem t)) (Set (ErrorItem t)) | Trivial errors, generated by Megaparsec's machinery. The data constructor includes the stack of source positions, unexpected token (if any), and expected tokens. |
FancyError (NonEmpty SourcePos) (Set (ErrorFancy e)) | Fancy, custom errors. |
(Eq e, Eq t) => Eq (ParseError t e) | |
(Ord e, Ord t, Data e, Data t) => Data (ParseError t e) | |
(Ord e, Ord t, Read e, Read t) => Read (ParseError t e) | |
(Show e, Show t) => Show (ParseError t e) | |
Generic (ParseError t e) | |
(Ord t, Ord e) => Semigroup (ParseError t e) | |
(Ord t, Ord e) => Monoid (ParseError t e) | |
(Show t, Ord t, ShowToken t, Typeable * t, Show e, ShowErrorComponent e, Typeable * e) => Exception (ParseError t e) | |
(NFData t, NFData e) => NFData (ParseError t e) | |
type Rep (ParseError t e) | |