chiark / gitweb /
strategy: new, wip, found
[topbloke-formulae.git] / strategy.tex
index c8a0bfe41846f830e22019a152b950ac53648286..341285349c2da86dc891b5cb1a00c668f6f11cf2 100644 (file)
@@ -43,7 +43,7 @@ partial order.
 
 \item[ $\pendsof{\set J}{\p}$ ]
 Convenience notation for
-the maximal elements of $\bigcup_{J \in \set J} \pendsof{J}{\p}$
+the $\le$-maximal elements of $\bigcup_{J \in \set J} \pendsof{J}{\p}$
 (where $\set J$ is some set of commits).
 
 \item[ $\pendsof{\set X}{\p} \le T$ ]
@@ -86,28 +86,101 @@ dependencies to use.  This allows the specification of any desired
 
 \section{Ranking phase}
 
-{\bf Ranking} is:
+We run the following algorithm:
 \begin{enumerate}
 \item Set $\allpatches = \{ \}$.
 \item Repeatedly:
 \begin{enumerate}
-\item Clear out the graph $\hasdirdep$ so it has neither nodes nor edges.
-\item Execute {\bf Rank-Recurse}($\pc_0$) .
+\item Clear out the graph $\hasdirdep$ so it has no edges.
+\item Execute {\bf Rank-Recurse}($\pc_0$)
 \item Until $\allpatches$ remains unchanged.
 \end{enumerate}
 \end{enumerate}
 
 {\bf Rank-Recurse}($\pc$) is:
 \begin{enumerate}
+
+\item If we have already done {\bf Rank-Recurse}($\pc$) in this
+ranking iteration, do nothing.  Otherwise:
+
 \item Add $\pc$ to $\allpatches$ if it is not there already.
-\item Let $\set S_{\pcn} = h(\pcn)
+
+\item Let
+$$
+  \set S = h(\pcn)
      \cup 
         \bigcup_{\p \in \allpatches}
         \bigcup_{H \in h(\pn) \lor H \in h(\py)}
-         \{ \baseof{E} \; | \; E \in \pendsof{H}{\pcy} \} $.
+         \{ \baseof{E} \; | \; E \in \pendsof{H}{\pcy} \}
+$$
+
+and $W = w(h(\pcn))$
+
+\item While $\exists_{S \in \set S} S \ge W$,
+update $W \assign S$ and $\set S \assign \set S \, \backslash \{ S \}$
+
+(This will often remove $W$ from $\set S$.  Afterwards, $\set S$
+is a collection of heads to be merged into $W$.)
 
-(We write $\set S = \set S_{\pcn}$ when it's not ambiguous.)
+\item Choose an order of $\set S$, $S_i$ for $i=1 \ldots n$.
+
+\item For each $S_i$ in turn, choose a corresponding $M_i$
+such that $$
+   M_i \le S_i \land \left[
+   M_i \le W \lor \bigexists_{S_i, j<i} M_i \le S_i
+   \right]
+$$
+
+\item Set $\Gamma = \depsreqof{W}$.
+
+If there are multiple candidates we prefer $M_i \in \pcn$
+if available.
+
+\item For each $i \ldots 1..n$, update our putative direct
+dependencies:
+$$
+\Gamma \assign \text{\bf set-merge}\left(\Gamma, 
+ \left[ \begin{cases} 
+  M_i \in \pcn :     & \depsreqof{M_i} \\
+  M_i \not\in \pcn : & \{ \}
+ \end{cases} \right],
+ \depsreqof{S_i}
+ \right)
+$$
+
+\item Finalise our putative direct dependencies
+$
+\Gamma \assign g(\pc, \Gamma)
+$
+
+\item For each direct dependency $\pd \in \Gamma$,
+
+\begin{enumerate}
+\item Add an edge $\pc \hasdirdep \pd$ to the digraph (adding nodes
+as necessary).
+If this results in a cycle, abort entirely (as the function $g$ is
+inappropriate; a different $g$ could work.)
 \end{enumerate}
+\item Run ${\text{\bf Rank-Recurse}}(\pd)$.
+
+\end{enumerate}
+
+The results of the ranking phase are:
+
+$ \allpatches, \hasdirdep $ and hence the completion of $\hasdirdep$
+into the partial order $\hasdep$.
+
+For each $\pc$, the base branch starting point commit $W_{\pcn} = W$,
+the direct dependencies $\Gamma_{\pc}$,
+the ordered set of base branch sources $\set S_{\pcn} = \set S,
+S_{\pcn,i} = S_i$
+and corresponding merge bases $M_{\pcn,i} = M_i$.
+
+\section{Traversal phase}
+
+
+
+
 
 \section{Planning phase}