Skip to content

Algorithms

Thomas COUCHOUD edited this page Apr 3, 2019 · 3 revisions

Les algorithmes

La classe de document polytech inclut la package algorithm. Cette classe est configurée pour vous permettre d'écrire vos algorithmes directement en anglais. Les possibilités offertes par ce package sont très importantes, il vous est donc recommandé de consulter la documentation associée. Vous pouvez notamment si les mots clés existants ne vous suffisent pas en ajouter.

Un exemple :

\begin{algorithm}
	\caption{Calcul des temps de recharge à chaque point d'arrêt en prenant en compte les n\oe uds présents dans plusieurs régions}
			\label{alg:algorithm1}
			\hspace*{\algorithmicindent} \textbf{Input:}
			The set $S=\left\{1,\dots, m\right\}$ of $m$ regions obtained from the 2 firsts steps of the first step. The set $S_j=\left\{1,\dots ,n_j\right\}$ of $n_j$ sensors inside a region $R_j$ with their charging time $\tau_i$, $\forall i\in S$. $t_i$ is the charging time required by the sensor $i$. The set $K$ which for each sensor contains a set containing each regions the sensor is in.
	\begin{algorithmic}[1]
		\For{$j\in S$}
			\State $P_j\leftarrow \left\{\right\}$
			\State $t_j\leftarrow 0$
			\For{$i\in S_j$}
				\If{$\text{card}\left(K_i\right)>1$}
					\State $P_j\leftarrow P_j\cup\left\{ i\right\}$
					\State $K_i \leftarrow K_i\prive{j}$
				\Else
					\State $\tau_j \leftarrow \max\left( \tau_j, t_i\right)$
				\EndIf
			\EndFor
			\For{$i\in P_j$}
				\State $t_i\leftarrow t_i - \tau_j$
			\EndFor
		\EndFor
	\end{algorithmic}
\end{algorithm}

texstudio_j8MAVDwRJb

Clone this wiki locally