never executed always true always false
1 {-# LANGUAGE ConstraintKinds #-}
2 {-# LANGUAGE FunctionalDependencies #-}
3 {-# LANGUAGE OverloadedStrings #-}
4 {-# LANGUAGE UndecidableInstances #-}
5
6 {- |
7 Module : NITTA.Model.Problems.Allocation
8 Description : PU allocation on the bus network
9 Copyright : (c) Aleksandr Penskoi, Vitaliy Zakusilo, 2022
10 License : BSD3
11 Maintainer : aleksandr.penskoi@gmail.com
12 Stability : experimental
13 -}
14 module NITTA.Model.Problems.Allocation (
15 Allocation (..),
16 AllocationProblem (..),
17 ) where
18
19 import Data.String.ToString (ToString (..))
20 import GHC.Generics (Generic)
21
22 data Allocation tag = Allocation
23 { networkTag :: tag
24 -- ^ Tag of the BusNetwork where PU will be allocated
25 , processUnitTag :: tag
26 -- ^ Tag of the prototype that will be used for allocation
27 }
28 deriving (Generic, Eq)
29
30 instance ToString tag => Show (Allocation tag) where
31 show Allocation{networkTag, processUnitTag} = "Allocation of " <> toString processUnitTag <> " on " <> toString networkTag
32
33 class AllocationProblem u tag | u -> tag where
34 allocationOptions :: u -> [Allocation tag]
35 allocationDecision :: u -> Allocation tag -> u