module Linear.Simplex.Primal.Types where
import Linear.Grammar
import Test.QuickCheck
import Data.List
import Control.Monad
type Objective = IneqSlack
data IneqSlack = IneqSlack
{ slackIneq :: IneqStdForm
, slackVars :: [LinVar]
} deriving (Show, Eq)
instance Arbitrary IneqSlack where
arbitrary = liftM2 IneqSlack arbitrary (arbitrary `suchThat` isUniquelyNamed)
`suchThat` slackNamesAreDisjoint
where
isUniquelyNamed x = hasNoDups $ map varName x
slackNamesAreDisjoint x = null $ slackVars x `intersect` getStdVars (slackIneq x)