Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -536,21 +536,29 @@ printSolution :: InstanceList ...@@ -536,21 +536,29 @@ printSolution :: InstanceList
-> [Placement] -> [Placement]
-> ([String], [[String]]) -> ([String], [[String]])
printSolution il ktn kti sol = printSolution il ktn kti sol =
unzip $ map let
(\ (i, p, s) -> mlen_fn = maximum . (map length) . snd . unzip
let inst = Container.find i il imlen = mlen_fn kti
inam = fromJust $ lookup (Instance.idx inst) kti nmlen = mlen_fn ktn
npri = fromJust $ lookup p ktn pmlen = (2*nmlen + 1)
nsec = fromJust $ lookup s ktn in
opri = fromJust $ lookup (Instance.pnode inst) ktn unzip $ map
osec = fromJust $ lookup (Instance.snode inst) ktn (\ (i, p, s) ->
(moves, cmds) = computeMoves inam opri osec npri nsec let inst = Container.find i il
inam = fromJust $ lookup (Instance.idx inst) kti
in npri = fromJust $ lookup p ktn
(printf " I: %s\to: %s+>%s\tn: %s+>%s\ta: %s" nsec = fromJust $ lookup s ktn
inam opri osec npri nsec moves, opri = fromJust $ lookup (Instance.pnode inst) ktn
cmds) osec = fromJust $ lookup (Instance.snode inst) ktn
) sol (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. -- | Print the node list.
printNodes :: [(Int, String)] -> NodeList -> String printNodes :: [(Int, String)] -> NodeList -> String
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment