From 04df2c3653f75de63e166358a9a5efb701f942c0 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sat, 2 Jan 2016 13:28:04 -0800 Subject: [PATCH] tweak --- day13.scrbl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/day13.scrbl b/day13.scrbl index 3369b4b..782e06f 100644 --- a/day13.scrbl +++ b/day13.scrbl @@ -19,8 +19,6 @@ Also, whereas a path between cities had a start and end, a seating arrangement i Those wrinkles noted, we'll proceed as we did in @secref{Day_9}. We'll parse the input data and put the happiness scores into a hash table. Then we'll loop through all possible seating arrangements with @racket[in-permutations] and see what the best score is. -Math jocks might note that because our seating arrangement is circular, our permutations will include a lot of ``rotationally equivalent'' arrangements — e.g., @racket['(A B C D)] is the same as @racket['(B C D A)] and @racket['(C D A B)]. If we had more people, or the happiness function were more expensive, we might want to prune out these equivalent arrangements as a performance optimization. But in this case, it's unnecessary. - @chunk[ @@ -48,6 +46,7 @@ Math jocks might note that because our seating arrangement is circular, our perm ] + @chunk[ (define (q1 input-str) @@ -60,6 +59,9 @@ Math jocks might note that because our seating arrangement is circular, our perm (apply max table-arrangement-scores))] +@margin-note{Math jocks might note that because our seating arrangement is circular, our permutations will include a lot of ``rotationally equivalent'' arrangements — e.g., @racket['(A B C D)] is the same as @racket['(B C D A)] and @racket['(C D A B)]. If we had more people, or the happiness function were more expensive, we might want to prune out these equivalent arrangements as a performance optimization. But in this case, it's unnecessary.} + + @section{What's the optimal happiness score, including ourself in the seating?}