| Copyright | (c) Junaid Rasheed 2020-2023 |
|---|---|
| License | BSD-3 |
| Maintainer | jrasheed178@gmail.com |
| Stability | experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Linear.Simplex.Util
Description
Helper functions for performing the two-phase simplex method.
Synopsis
- isMax :: ObjectiveFunction -> Bool
- simplifySystem :: [PolyConstraint] -> [PolyConstraint]
- dictionaryFormToTableau :: Dict -> Tableau
- tableauInDictionaryForm :: Tableau -> Dict
- extractObjectiveValue :: Maybe Result -> Maybe SimplexNum
- combineVarLitMapSums :: VarLitMapSum -> VarLitMapSum -> VarLitMapSum
- foldDictValue :: [DictValue] -> DictValue
- foldVarLitMap :: [VarLitMap] -> VarLitMap
- insertPivotObjectiveToDict :: PivotObjective -> Dict -> Dict
- showT :: Show a => a -> Text
- logMsg :: (MonadIO m, MonadLogger m) => LogLevel -> Text -> m ()
- extractTableauValues :: Tableau -> Map Var SimplexNum
- extractDictValues :: Dict -> Map Var SimplexNum
Documentation
isMax :: ObjectiveFunction -> Bool Source #
Is the given ObjectiveFunction to be Maximized?
simplifySystem :: [PolyConstraint] -> [PolyConstraint] Source #
Simplifies a system of PolyConstraints by first calling simplifyPolyConstraint,
then reducing LEQ and GEQ with same LHS and RHS (and other similar situations) into EQ,
and finally removing duplicate elements using nub.
tableauInDictionaryForm :: Tableau -> Dict Source #
Converts a Tableau to a Dict.
We do this by isolating the basic variable on the LHS, ending up with all non basic variables and a SimplexNum constant on the RHS.
extractObjectiveValue :: Maybe Result -> Maybe SimplexNum Source #
If this function is given Nothing, return Nothing.
Otherwise, we lookup the Integer given in the first item of the pair in the map given in the second item of the pair.
This is typically used to extract the value of the ObjectiveFunction after calling twoPhaseSimplex.
combineVarLitMapSums :: VarLitMapSum -> VarLitMapSum -> VarLitMapSum Source #
Combines two 'VarLitMapSums together by summing values with matching keys
foldDictValue :: [DictValue] -> DictValue Source #
foldVarLitMap :: [VarLitMap] -> VarLitMap Source #
insertPivotObjectiveToDict :: PivotObjective -> Dict -> Dict Source #
extractDictValues :: Dict -> Map Var SimplexNum Source #