-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Very basic simplex implementation.
--
-- Very basic simplex implementation.
@package simplex-basic
@version 0.0.0.1
module Linear.Simplex.Primal.Types
type Objective = IneqSlack
-- | Standard-form inequality populated with arbitrary slack variables.
data IneqSlack
[IneqSlack] :: IneqStdForm -> [LinVar] -> IneqSlack
[slackIneq] :: IneqSlack -> IneqStdForm
[slackVars] :: IneqSlack -> [LinVar]
instance Eq IneqSlack
instance Show IneqSlack
instance Arbitrary IneqSlack
module Linear.Simplex.Primal
-- | Takes an objective function, a set of constraints, and an operation
-- mode, then returns a substitution. . Objective function should be in
-- the form of Ax + By + Cz + P = 0, where P is the
-- resule, and free in the constraint set.
simplexPrimal :: IneqStdForm -> [IneqStdForm] -> [(String, Rational)]
-- | Finds next pivot row by the smallest ratio in each row. Note: row list
-- should be non-empty
nextRow :: [IneqSlack] -> Int -> Maybe Int
-- | finds next column index from objective function
nextColumn :: IneqSlack -> Maybe Int
-- | Computes coefficient ratio to constant, based on a column index.
-- Warning: Int parameter must be less than the length of the
-- primal variables.
coeffRatio :: IneqSlack -> Int -> Maybe Rational
-- | flattens targeted row to form the identity at it's column coefficient,
-- then reduces each non-zero row at this column, via a multiple of this
-- flattened row. Heart of the simplex method. Also prepends
-- objective back on constrs.
pivot :: (Int, Int) -> Objective -> [IneqSlack] -> [IneqSlack]
-- | Flattens a row for further processing.
flatten :: IneqSlack -> Int -> IneqSlack
-- | Takes the focal row, the row to affect, and the column in question to
-- facilitate the sum-oriented part of the pivot.
compensate :: IneqSlack -> IneqSlack -> Int -> IneqSlack
-- | Note: Must have identical occurrances of variables, and must be
-- EquStd. subtracts rhs from lhs.
diffZip :: IneqSlack -> IneqSlack -> IneqSlack
-- | Extracts resulting data from tableau, excluding junk data
getSubst :: [IneqSlack] -> [(String, Rational)]
-- | Also translates Ax >= Q to -Ax <= -Q. Ie;
-- result will exclude GteStd.
makeSlackVars :: MonadState Integer m => IneqStdForm -> m IneqSlack
-- | Fills missing variables. List of inequalities includes objective
-- function.
populate :: [IneqSlack] -> [IneqSlack]