Commit 671b85b9 authored by Iustin Pop's avatar Iustin Pop
Browse files

Beautify solution list

This patch makes the tabular solution list nicer, by changing from tabs
to explicit widths.
parent 289c3835
......@@ -536,21 +536,29 @@ printSolution :: InstanceList
-> [Placement]
-> ([String], [[String]])
printSolution il ktn kti sol =
unzip $ map
(\ (i, p, s) ->
let inst = Container.find i il
inam = fromJust $ lookup (Instance.idx inst) kti
npri = fromJust $ lookup p ktn
nsec = fromJust $ lookup s ktn
opri = fromJust $ lookup (Instance.pnode inst) ktn
osec = fromJust $ lookup (Instance.snode inst) ktn
(moves, cmds) = computeMoves inam opri osec npri nsec
in
(printf " I: %s\to: %s+>%s\tn: %s+>%s\ta: %s"
inam opri osec npri nsec moves,
cmds)
) sol
let
mlen_fn = maximum . (map length) . snd . unzip
imlen = mlen_fn kti
nmlen = mlen_fn ktn
pmlen = (2*nmlen + 1)
in
unzip $ map
(\ (i, p, s) ->
let inst = Container.find i il
inam = fromJust $ lookup (Instance.idx inst) kti
npri = fromJust $ lookup p ktn
nsec = fromJust $ lookup s ktn
opri = fromJust $ lookup (Instance.pnode inst) ktn
osec = fromJust $ lookup (Instance.snode inst) ktn
(moves, cmds) = computeMoves inam opri osec npri nsec
ostr = (printf "%s:%s" opri osec)::String
nstr = (printf "%s:%s" npri nsec)::String
in
(printf " %-*s %-*s => %-*s a=%s"
imlen inam pmlen ostr
pmlen nstr moves,
cmds)
) sol
-- | Print the node list.
printNodes :: [(Int, String)] -> NodeList -> String
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment