{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
module Algorithms.Geometry.LinearProgramming.Types where
import Control.Lens
import Data.Geometry.HalfSpace
import Data.Geometry.HalfLine
import Data.Geometry.Point
import Data.Geometry.Vector
data LPSolution d r = NoSolution
| Single !(Point d r)
| UnBounded (HalfLine d r)
makePrisms ''LPSolution
deriving instance (Arity d, Show r) => Show (LPSolution d r)
deriving instance (Arity d, Eq r) => Eq (LPSolution d r)
data LinearProgram d r = LinearProgram { _objective :: !(Vector d r)
, _constraints :: [HalfSpace d r]
}
makeLenses ''LinearProgram
deriving instance Arity d => Functor (LinearProgram d)
deriving instance (Arity d, Show r) => Show (LinearProgram d r)
deriving instance (Arity d, Eq r) => Eq (LinearProgram d r)