SPB Git

Repository Public MIT Research preview

MA02-F01-cinq-agents-asynchrones.tex 3.7 KB 55 lines latex

1% MA02-F01 — Diagramme temporel de cinq agents asynchrones : le lot de démonstration, tel qu'il s'est exécuté.2% Idée : cinq agents, mais jamais plus de trois appels en vol. Un agent n'est pas « occupé » tout le temps : il3% ATTEND (une place, puis la réponse, puis avant une reprise), et c'est pendant ces attentes que les autres avancent.4% Données : portées de la trace du lot de démonstration (graine choisie), MA02-donnees.tex. Millisecondes simulées.5\input{MA02-donnees.tex}%6\begin{tikzpicture}[x=1mm, y=1mm]7  \path (0,0) rectangle (142,56);8  \def\ech{.0625}% mm par milliseconde9  \def\xo{21}%10  \foreach \k in {1,...,5}{11    \node[atlas note, anchor=east, text=maTexte] at (\xo-2,51.5-6.5*\k) {agent-\k};12    \draw[maNeutre, line width=.4pt] (\xo,48.6-6.5*\k) -- ++(118,0);}13  \foreach \k/\deb/\fin/\g/\t/\ok in \MBChronoSegments {14    \pgfmathsetmacro{\y}{51.5-6.5*\k}15    \pgfmathsetmacro{\xa}{\xo+\deb*\ech}16    \pgfmathsetmacro{\larg}{(\fin-\deb)*\ech}17    \ifdefstring{\g}{a}{%18      \ifnum\ok=119        \draw[maActeur, fill=maPanneau, line width=.9pt] (\xa,\y-2.3) rectangle ++(\larg,4.6);20      \else21        \draw[maRisque, fill=maPanneau, line width=1.4pt] (\xa,\y-2.3) rectangle ++(\larg,4.6);22        \draw[maRisque, line width=1.1pt] (\xa+\larg-2.6,\y-1.3) -- ++(1.9,2.6) (\xa+\larg-2.6,\y+1.3) -- ++(1.9,-2.6);23      \fi24      \pgfmathparse{\larg > 6.4 ? 1 : 0}\ifnum\pgfmathresult=125        \node[font=\ttfamily\AtlasSizeTiny, text=maTexte, inner sep=0pt] at (\xa+.5*\larg,\y) {\t};\fi26    }{}27    \ifdefstring{\g}{p}{\draw[maDiscret, line width=.7pt, dash pattern=on 1.2pt off 1.2pt] (\xa,\y) -- ++(\larg,0);28      \draw[maDiscret, line width=.7pt] (\xa,\y-1.2) -- ++(0,2.4);}{}29    \ifdefstring{\g}{r}{\draw[maDecision, line width=1.4pt, dash pattern=on 2.2pt off 1.4pt] (\xa,\y) -- ++(\larg,0);}{}30  }31  % Appels en vol : courbe en escalier, plafonnée par le sémaphore32  \node[atlas note, anchor=east, text=maTexte, align=right] at (\xo-2,9.2) {appels\\ en vol};33  \foreach \v in {0,3}{\node[atlas note, anchor=east, inner sep=.6pt] at (\xo-.4,6+2.2*\v) {\v};}34  \draw[maRisque, line width=.8pt, dash pattern=on 3pt off 2pt] (\xo,12.6) -- ++(118,0);35  \node[atlas note, anchor=south west, text=maRisque, inner sep=.8pt] at (\xo+92,12.9) {plafond : \MBDemoPlaces\ places};36  \begin{scope}[shift={(\xo,6)}, x=\ech mm, y=2.2mm]37    \edef\tmp{\noexpand\draw[maActeur, line width=1.1pt] plot[const plot] coordinates {\MBChronoEnVol};}\tmp38  \end{scope}39  % Axe du temps40  \draw[maNeutre, line width=.8pt, -{Stealth[length=4pt,width=3.6pt]}] (\xo,4) -- ++(121,0);41  \foreach \t in {0,500,1000,1500}{\draw[maNeutre, line width=.6pt] (\xo+\t*\ech,4) -- ++(0,-1.1) node[atlas note, anchor=north, inner sep=1pt] {\t};}42  \node[atlas note, anchor=north east, inner sep=1pt] at (142,2.9) {ms};43  \draw[maValide, line width=1.2pt] (\xo+\MBDemoDureeBrut*\ech,5) -- ++(0,42.6);44  \node[atlas note, anchor=south east, text=maValide, font=\AtlasSizeTiny\bfseries, inner sep=.8pt] at (142,47.8) {fin : \MBDemoDuree\ ms};45  % Légende46  \draw[maActeur, fill=maPanneau, line width=.9pt] (0,52.2) rectangle ++(6,3.4);47  \node[atlas note, anchor=west, text=maTexte] at (6.8,53.9) {appel du modèle};48  \draw[maRisque, fill=maPanneau, line width=1.4pt] (33,52.2) rectangle ++(6,3.4);49  \node[atlas note, anchor=west, text=maTexte] at (39.8,53.9) {appel en échec};50  \draw[maDiscret, line width=.7pt, dash pattern=on 1.2pt off 1.2pt] (63.5,53.9) -- ++(6,0);51  \node[atlas note, anchor=west, text=maTexte] at (70.3,53.9) {attend une place};52  \draw[maDecision, line width=1.4pt, dash pattern=on 2.2pt off 1.4pt] (95.5,53.9) -- ++(6,0);53  \node[atlas note, anchor=west, text=maTexte] at (102.3,53.9) {attend avant de reprendre};54\end{tikzpicture}55
Files main
Menu

Theme