Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- simplexPrimal :: IneqStdForm -> [IneqStdForm] -> [(String, Rational)]
- nextRow :: [IneqSlack] -> Int -> Maybe Int
- nextColumn :: IneqSlack -> Maybe Int
- coeffRatio :: IneqSlack -> Int -> Maybe Rational
- pivot :: (Int, Int) -> Objective -> [IneqSlack] -> [IneqSlack]
- flatten :: IneqSlack -> Int -> IneqSlack
- compensate :: IneqSlack -> IneqSlack -> Int -> IneqSlack
- diffZip :: IneqSlack -> IneqSlack -> IneqSlack
- getSubst :: [IneqSlack] -> [(String, Rational)]
- makeSlackVars :: MonadState Integer m => IneqStdForm -> m IneqSlack
- populate :: [IneqSlack] -> [IneqSlack]
Documentation
simplexPrimal :: IneqStdForm -> [IneqStdForm] -> [(String, Rational)] Source
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.
nextRow :: [IneqSlack] -> Int -> Maybe Int Source
Finds next pivot row by the smallest ratio in each row. Note: row list should be non-empty
nextColumn :: IneqSlack -> Maybe Int Source
finds next column index from objective function
coeffRatio :: IneqSlack -> Int -> Maybe Rational Source
Computes coefficient ratio to constant, based on a column index. Warning:
Int
parameter must be less than the length of the primal variables.
pivot :: (Int, Int) -> Objective -> [IneqSlack] -> [IneqSlack] Source
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
.
compensate :: IneqSlack -> IneqSlack -> Int -> IneqSlack Source
Takes the focal row, the row to affect, and the column in question to facilitate the sum-oriented part of the pivot.
diffZip :: IneqSlack -> IneqSlack -> IneqSlack Source
Note: Must have identical occurrances of variables, and must be EquStd
.
subtracts rhs from lhs.
getSubst :: [IneqSlack] -> [(String, Rational)] Source
Extracts resulting data from tableau, excluding junk data
makeSlackVars :: MonadState Integer m => IneqStdForm -> m IneqSlack Source
Also translates Ax >= Q
to -Ax <= -Q
. Ie; result will exclude GteStd
.