-filterFails :: (Monad m) => [(OpResult Node.List,
- Instance.Instance, [Node.Node])]
- -> m [(Node.List, [Node.Node])]
-filterFails sols =
- if null sols then fail "No nodes onto which to allocate at all"
- else let sols' = concat . map (\ (onl, _, nn) ->
- case onl of
- OpFail _ -> []
- OpGood gnl -> [(gnl, nn)]
- ) $ sols
- in
- if null sols' then
- fail "No valid allocation solutions"
- else
- return sols'
-
-processResults :: (Monad m) => [(Node.List, [Node.Node])]
- -> m (String, [Node.Node])
-processResults sols =
- let sols' = map (\(nl', ns) -> (Cluster.compCV nl', ns)) sols
- sols'' = sortBy (compare `on` fst) sols'
- (best, w) = head sols''
- (worst, l) = last sols''
- info = (printf "Valid results: %d, best score: %.8f for node(s) %s, \
- \worst score: %.8f for node(s) %s" (length sols'')
- best (intercalate "/" . map Node.name $ w)
- worst (intercalate "/" . map Node.name $ l))::String
- in return (info, w)
+processResults (Evacuate _) as = return as
+
+processResults _ as =
+ case Cluster.asSolutions as of
+ _:[] -> return as
+ _ -> fail "Internal error: multiple allocation solutions"