\hypertarget{group__AlgorithmOverview}{\subsection{Algorithm Overview}
\label{group__AlgorithmOverview}\index{Algorithm Overview@{Algorithm Overview}}
}


Description of the algorithm.  


Description of the algorithm. The algorithm top-\/level is implemented in the {\ttfamily \hyperlink{classKite_1_1NegociateWindow}{Negociate\-Window}}.

{\bfseries First step~\-:} Negociate\-Window\-::\-\_\-load\-Routing() 
\begin{DoxyEnumerate}
\item Load routing wires ({\ttfamily Auto\-Segment}) from {\ttfamily Katabatic\-Engine} inside the \hyperlink{namespaceKite}{Kite} {\ttfamily G\-Cell's}. Then update the {\ttfamily G\-Cell's} density. 
\item Sort the {\ttfamily G\-Cell's} according to decreasing density (denser {\ttfamily G\-Cell's} are to be routed first). 
\item Agglomerate clusters of contiguous G\-Cell's whose density is superior to 0.\-7 to the seed G\-Cell. See {\ttfamily G\-Cell\-Routing\-Set} for the mechanism.

G\-Cell\-Routing\-Set receive an increasing order number. The higher the order the lower the density. This order is transmitted to the {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} of the {\ttfamily G\-Cell\-Routing\-Set} to be taken into account by the track cost function. 
\end{DoxyEnumerate}

{\bfseries Second step~\-:} {\ttfamily Negociate\-Window\-::\-\_\-run\-On\-G\-Cell\-Routing\-Set()} 

For each {\ttfamily G\-Cell\-Routing\-Set} in decreasing density, negociate the set of associated {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}}. 
\begin{DoxyEnumerate}
\item Build a {\ttfamily \hyperlink{classKite_1_1RoutingEventQueue}{Routing\-Event\-Queue}} from the list of {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}}. The queue is responsible for allocating the {\ttfamily \hyperlink{classKite_1_1RoutingEvent}{Routing\-Event}} associated to each {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}}. 
\item The queue is sorted according to the \char`\"{}event level\char`\"{} then to the priority, which is for now the slack of the {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}}. That is, constrained {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} are routed first. 
\item The queue is processed till it's empty (no unprocessed {\ttfamily \hyperlink{classKite_1_1RoutingEvent}{Routing\-Event}} remains).

Processing a {\ttfamily \hyperlink{classKite_1_1RoutingEvent}{Routing\-Event}} is trying to insert a {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} in a suitable \hyperlink{classKite_1_1Track}{Track}. We proceed as follow~\-: 
\begin{DoxyItemize}
\item The maximum ripup count for the to be inserted segment has been reached. Issue a severe warning and left unrouted this {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} (for now). 
\item Compute the Tracks in which the {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} can be inserted, then compute the insertion cost in each one. The candidates are ordered by the insertion cost. 
\item Now consider the lower cost {\ttfamily \hyperlink{classKite_1_1Track}{Track}}. If there is a free interval for the {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}}. Issue a {\ttfamily Session\-::add\-Insert\-Event()} then finish.

If there is a {\itshape \char`\"{}soft overlap\char`\"{}}, that is the overlaping {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} already in the {\ttfamily \hyperlink{classKite_1_1Track}{Track}} could be shrunk either to the left or the right so the new {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} can be inserted. This is managed by {\ttfamily Routing\-Event\-::\-\_\-set\-Aside()}, for each soft overlaping {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}}, gets its perpandiculars and issue a displacement request for all of them. That is, re-\/post a {\ttfamily \hyperlink{classKite_1_1RoutingEvent}{Routing\-Event}} with updated constraints and remove the perpandicular from it's \hyperlink{classKite_1_1Track}{Track} if it has already been routed. Note that no request is issued for the overlaping {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} itself has it do not change of \hyperlink{classKite_1_1Track}{Track}.

If there is a {\itshape \char`\"{}hard overlap\char`\"{}}, that is the two {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} cannot share the same {\ttfamily \hyperlink{classKite_1_1Track}{Track}}, remove the previous one from the {\ttfamily \hyperlink{classKite_1_1Track}{Track}} and re-\/post a {\ttfamily \hyperlink{classKite_1_1RoutingEvent}{Routing\-Event}}. Note that, the cost object should have selected a {\ttfamily \hyperlink{classKite_1_1TrackSegment}{Track\-Segment}} which could be ripped-\/up. Otherwise the {\ttfamily \hyperlink{classKite_1_1Track}{Track}} would'nt even be a candidate. 
\end{DoxyItemize}

When a \hyperlink{classKite_1_1TrackSegment}{Track\-Segment} is riped up, it is re-\/routed immediately afterward. This is done by increasing his event level. 
\end{DoxyEnumerate}