Copyright | (c) Masahiro Sakai 20122016 |
---|---|
License | BSD-style |
Maintainer | masahiro.sakai@gmail.com |
Stability | provisional |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extensions |
|
ToySolver.Text.SDPFile
Description
- SDPA (Semidefinite Programming Algorithm) User's Manual http://sdpa.indsys.chuo-u.ac.jp/~fujisawa/sdpa_doc.pdf
- http://euler.nmt.edu/~brian/sdplib/FORMAT
Synopsis
- data Problem = Problem {
- blockStruct :: [Int]
- costs :: [Scientific]
- matrices :: [Matrix]
- type Matrix = [Block]
- type Block = Map (Int, Int) Scientific
- mDim :: Problem -> Int
- nBlock :: Problem -> Int
- blockElem :: Int -> Int -> Block -> Scientific
- data Solution = Solution {
- primalVector :: [Scientific]
- primalMatrix :: Matrix
- dualMatrix :: Matrix
- evalPrimalObjective :: Problem -> Solution -> Scientific
- evalDualObjective :: Problem -> Solution -> Scientific
- readDataFile :: FilePath -> IO Problem
- writeDataFile :: FilePath -> Problem -> IO ()
- type DenseMatrix = [DenseBlock]
- type DenseBlock = [[Scientific]]
- denseMatrix :: DenseMatrix -> Matrix
- denseBlock :: DenseBlock -> Block
- diagBlock :: [Scientific] -> Block
- renderData :: Problem -> Builder
- renderSparseData :: Problem -> Builder
- type ParseError = ParseErrorBundle ByteString Void
- parseData :: String -> ByteString -> Either ParseError Problem
- parseSparseData :: String -> ByteString -> Either ParseError Problem
The problem type
Constructors
Problem | |
Fields
|
The solution type
Constructors
Solution | |
Fields
|
evalPrimalObjective :: Problem -> Solution -> Scientific Source #
evalDualObjective :: Problem -> Solution -> Scientific Source #
File I/O
readDataFile :: FilePath -> IO Problem Source #
Parse a SDPA format file (.dat) or a SDPA sparse format file (.dat-s)..
Construction
type DenseMatrix = [DenseBlock] Source #
type DenseBlock = [[Scientific]] Source #
denseMatrix :: DenseMatrix -> Matrix Source #
denseBlock :: DenseBlock -> Block Source #
diagBlock :: [Scientific] -> Block Source #
Rendering
renderData :: Problem -> Builder Source #
renderSparseData :: Problem -> Builder Source #
Parsing
type ParseError = ParseErrorBundle ByteString Void Source #
parseData :: String -> ByteString -> Either ParseError Problem Source #
Parse a SDPA format (.dat) string.
parseSparseData :: String -> ByteString -> Either ParseError Problem Source #
Parse a SDPA sparse format (.dat-s) string.