1 {-| Module describing an instance.
3 The instance data type holds very few fields, the algorithm
4 intelligence is in the "Node" and "Cluster" modules.
9 data Instance = Instance { mem :: Int -- ^ memory of the instance
10 , dsk :: Int -- ^ disk size of instance
11 , pnode :: Int -- ^ original primary node
12 , snode :: Int -- ^ original secondary node
13 , idx :: Int -- ^ internal index for book-keeping
16 create :: String -> String -> Int -> Int -> Instance
17 create mem_init dsk_init pn sn = Instance {
25 -- | Changes the primary node of the instance.
26 setPri :: Instance -- ^ the original instance
27 -> Int -- ^ the new primary node
28 -> Instance -- ^ the modified instance
29 setPri t p = t { pnode = p }
31 -- | Changes the secondary node of the instance.
32 setSec :: Instance -- ^ the original instance
33 -> Int -- ^ the new secondary node
34 -> Instance -- ^ the modified instance
35 setSec t s = t { snode = s }
37 -- | Changes both nodes of the instance.
38 setBoth :: Instance -- ^ the original instance
39 -> Int -- ^ new primary node index
40 -> Int -- ^ new secondary node index
41 -> Instance -- ^ the modified instance
42 setBoth t p s = t { pnode = p, snode = s }
44 -- | Changes the index.
45 -- This is used only during the building of the data structures.
46 setIdx :: Instance -- ^ the original instance
48 -> Instance -- ^ the modified instance
49 setIdx t i = t { idx = i }