-options :: [OptDescr (Options -> Options)]
-options =
- [ Option ['V'] ["version"]
- (NoArg (\ opts -> opts { optShowVer = True}))
- "show the version of the program"
- , Option ['h'] ["help"]
- (NoArg (\ opts -> opts { optShowHelp = True}))
- "show help"
- ]
-
-
-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' = concatMap (\ (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)
+options :: [OptType]
+options = [oShowVer, oShowHelp]
+
+processResults :: (Monad m) => Cluster.AllocSolution -> m (String, [Node.Node])
+processResults (fstats, succ, sols) =
+ case sols of
+ Nothing -> fail "No valid allocation solutions"
+ Just (best, (_, _, w)) ->
+ let tfails = length fstats
+ info = printf "successes %d, failures %d,\
+ \ best score: %.8f for node(s) %s"
+ succ tfails
+ best (intercalate "/" . map Node.name $ w)::String
+ in return (info, w)