From 4dca559b1a7d4ad6b104bec3f0d909cb68259fe4 Mon Sep 17 00:00:00 2001 From: Aria Shrimpton Date: Sun, 10 Mar 2024 18:39:02 +0000 Subject: more writing --- thesis/parts/implementation.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'thesis/parts/implementation.tex') diff --git a/thesis/parts/implementation.tex b/thesis/parts/implementation.tex index b1e156a..1c131ed 100644 --- a/thesis/parts/implementation.tex +++ b/thesis/parts/implementation.tex @@ -78,11 +78,12 @@ This provides us with estimates for each singular candidate. In order to try and suggest an adaptive container, we use the following algorithm: \begin{enumerate} +\item Sort partitions in order of ascending maximum n values. \item Calculate the cost for each candidate and for each partition \item For each partition, find the best candidate and store it in the array \code{best}. Note that we don't sum across all partitions this time. \item Find the lowest index \code{i} where \code{best[i] != best[0]} \item Check that \code{i} partitions the list properly: For all \code{j < i}, \code{best[j] == best[0]} and for all \code{j>=i}, \code{best[j] == best[i]}. -\item Let \code{before} be the name of the candidate in \code{best[0]}, \code{after} be the name of the candidate in \code{best[i]}, and \code{threshold} be the maximum n value of partition \code{i}. +\item Let \code{before} be the name of the candidate in \code{best[0]}, \code{after} be the name of the candidate in \code{best[i]}, and \code{threshold} be halfway between the maximum n values of partition \code{i} and partition \code{i-1}. \item Calculate the cost of switching as: $$ C_{\textrm{before,clear}}(\textrm{threshold}) + \textrm{threshold} * C_{\textrm{after,insert}}(\textrm{threshold}) -- cgit v1.2.3