Commit ab271fc1 authored by Iustin Pop's avatar Iustin Pop
Browse files

Show the step counter in the solution list

This patch changes the solution list to include a step counter so that
it's more clear these are successive steps (in a definite order), and
not just an unordered list of changes.
parent 9b91b5a3
......@@ -573,8 +573,9 @@ printSolutionLine :: InstanceList
-> Int
-> Int
-> Placement
-> Int
-> (String, [String])
printSolutionLine il ktn kti nmlen imlen plc =
printSolutionLine il ktn kti nmlen imlen plc pos =
let
pmlen = (2*nmlen + 1)
(i, p, s, c) = plc
......@@ -588,8 +589,8 @@ printSolutionLine il ktn kti nmlen imlen plc =
ostr = (printf "%s:%s" opri osec)::String
nstr = (printf "%s:%s" npri nsec)::String
in
(printf " %-*s %-*s => %-*s %.8f a=%s"
imlen inam pmlen ostr
(printf " %3d. %-*s %-*s => %-*s %.8f a=%s"
pos imlen inam pmlen ostr
pmlen nstr c moves,
cmds)
......@@ -612,7 +613,8 @@ printSolution il ktn kti sol =
imlen = mlen_fn kti
nmlen = mlen_fn ktn
in
unzip $ map (printSolutionLine il ktn kti nmlen imlen) sol
unzip $ map (uncurry $ printSolutionLine il ktn kti nmlen imlen) $
zip sol [1..]
-- | Print the node list.
printNodes :: [(Int, String)] -> NodeList -> String
......
......@@ -72,7 +72,7 @@ iterateDepth ini_tbl max_rounds ktn kti nmlen imlen cmd_strs oneline =
do
let
(sol_line, cmds) = Cluster.printSolutionLine ini_il ktn kti
nmlen imlen (head fin_plc)
nmlen imlen (head fin_plc) fin_plc_len
upd_cmd_strs = cmds:cmd_strs
unless (oneline || fin_plc_len == ini_plc_len) $ do
putStrLn sol_line
......
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