Prise en compte de la complexité géométrique des modèles structuraux dans des méthodes de maillage fondées sur le diagramme de Voronoï - Congrès Informatique
Prise en compte de la complexité géométrique des modèles structuraux dans des méthodes de maillage fondées sur le diagramme de Voronoï - Congrès Informatique
- Revenir à l'accueil
Prise en compte de la complexit´e g´eom´etrique des
mod`eles structuraux dans des m´ethodes de maillage
fond´ees sur le diagramme de Vorono¨ı
Jeanne Pellerin
To cite this version:
Jeanne Pellerin. Prise en compte de la complexit´e g´eom´etrique des mod`eles structuraux dans
des m´ethodes de maillage fond´ees sur le diagramme de Vorono¨ı. Applied geology. Universit´e
de Lorraine, 2014. French.
HAL Id: tel-01005722
https://tel.archives-ouvertes.fr/tel-01005722
Submitted on 13 Jun 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Prise en compte de la complexite
´
geom
´
etrique des mod
´
eles
`
structuraux dans des methodes
´
de maillage fondees sur le
´
diagramme de Vorono¨ı
These `
pour obtenir le grade de
Docteur de l’Universit´e de Lorraine
Ecole doctorale RP2E ´
Sp´ecialit´e G´eosciences
par
Jeanne PELLERIN
Th`ese soutenue le 20 mars 2014 devant le jury :
M. Pascal Frey Professeur, Universit´e Paris 06 Rapporteur
M. Hamdi Tchelepi Professeur, Stanford University Rapporteur
M. Stephan Matth¨ai Professeur, University of Leoben Examinateur
M. Jean-Fran¸cois Remacle Professeur, Universit´e de Louvain Examinateur
M. Jean Virieux Professeur, Universit´e Grenoble 01 Examinateur
M. Bruno L´evy Directeur de recherche, INRIA Directeur de th`ese
M. Guillaume Caumon Professeur, Universit´e de Lorraine Directeur de th`ese
M. David Ledez Total Invit´e
UMR 7359 - GeoRessources
ENSG - Universit´e de Lorraine
TSA 70605, 54518 Vandœuvre-l`es-Nancy Cedex - FRANCEA mes parents, `Remerciements
Je suis en premier lieu tr`es reconnaissante `a mon directeur de th`ese Guillaume
Caumon de m’avoir permis de d´ecouvrir que, contrairement `a ce que j’avais pu croire,
la recherche me plaisait, et de m’avoir convaincue de faire une th`ese. Je remercie vivement
mon second directeur de th`ese Bruno L´evy pour ses consultations de soutien
`a th´esarde en d´etresse et son enthousiasme communicatif. Je tiens ´egalement `a remercier
Pascal Frey, David Ledez, Stephan Matth¨ai, Jean-Fran¸cois Remacle, Hamdi
Tchelepi et Jean Virieux d’avoir accept´e de faire partie de mon jury de th`ese.
Merci `a tous les coll`egues de l’´equipe de recherche Alice du Loria dont les remarques
et questions ont influenc´e ce travail. Merci `a tous les membres de l’´equipe
de recherche Gocad (ceux qui l’ont ´et´e et ceux qui le sont toujours) pour tous les bons
moments pass´es au labo et en dehors du labo, pour leur aide et leur soutien : Pauline
CD, Nicolas C., Florent L., Gautier L., Romain M., Fran¸cois B., Th´eophile G.,
Pablo M., Charline J., J´er´emy R., Arnaud B., Guillaume R., Paul C. Merci `a Pierre,
Christophe, et Fatima pour le n´ecessaire soutien technique et administratif. Un grand
merci `a Guillaume, Bruno, Arnaud, J´er´emy, Pauline, Charline, Pablo, Jonathan E.,
Jonathan M., ainsi qu’`a mon papa d’avoir relu tout ou partie de ce travail.
Je tiens `a remercier plus particuli`erement Arnaud et J´er´emy, coll`egues de bureau
de cette derni`ere ann´ee et demi, de m’avoir aid´ee `a passer le cap de la fin de th`ese,
Gautier et Romain pour leur aide en d´ebut de th`ese, Fran¸cois pour son organisation
qui envoie du steak et sa g´en´erosit´e, et enfin Pauline, coll`egue de recherche, de couture,
de litt´erature anglaise, de step, de papote, de cin´e, tout cela me manquera.
Je finirai en remerciant tous ceux qui m’ont aid´e dans les moments difficiles avant
et pendant la th`ese, tout particuli`erement mes parents.R´esum´e
Selon la m´ethode utilis´ee pour construire un mod`ele structural en trois dimensions
et selon l’application `a laquelle il est destin´e, son maillage, en d’autres termes sa
repr´esentation informatique, doit ˆetre adapt´e afin de respecter des crit`eres de type,
de nombre et de qualit´e de ses ´el´ements. Les m´ethodes de maillage d´evelopp´ees dans
d’autres domaines que la g´eomod´elisation ne permettent pas de modifier le mod`ele
d’entr´ee. Ceci est souhaitable en g´eomod´elisation afin de mieux contrˆoler le nombre
d’´el´ements du maillage et leur qualit´e.
L’objectif de cette th`ese est de d´evelopper des m´ethodes de maillage permettant
de remplir ces objectifs afin de g´erer la complexit´e g´eom´etrique des mod`eles structuraux
d´efinis par fronti`eres. Premi`erement, une analyse des sources de complexit´e
g´eom´etrique dans ces mod`eles est propos´ee. Les mesures d´evelopp´ees constituent une
premi`ere ´etape dans la d´efinition d’outils permettant la comparaison objective de
diff´erents mod`eles et aident `a caract´eriser pr´ecis´ement les zones plus compliqu´ees `a
mailler dans un mod`ele. Ensuite, des m´ethodes originales de remaillage surfacique
et de maillage volumique fond´ees sur l’utilisation des diagrammes de Vorono¨ı sont
propos´ees. Les fondements de ces deux m´ethodes sont identiques : (1) une optimisation
de type Vorono¨ı barycentrique est utilis´ee pour globalement obtenir un nombre
contrˆol´e d’´el´ements de bonne qualit´e et (2) des consid´erations combinatoires pour
localement construire le maillage final, ´eventuellement en modifiant le mod`ele initial.
La m´ethode de remaillage surfacique est automatique et permet de simplifier un
mod`ele `a une r´esolution donn´ee. L’originalit´e de la m´ethode de maillage volumique
est que les ´el´ements g´en´er´es sont de types diff´erents. Des prismes et pyramides sont
utilis´es pour remplir les zones tr`es fines du mod`ele, tandis que le reste du mod`ele est
rempli avec des t´etra`edres.Table des mati`eres
Remerciements iii
R´esum´e v
Introduction 1
1 Objets g´eom´etriques fondamentaux 9
1.1 Diagramme de Vorono¨ı et triangulation de Delaunay . . . . . . . . . . 9
1.1.1 Diagramme de Vorono¨ı . . . . . . . . . . . . . . . . . . . . . . 9
1.1.2 Triangulation de Delaunay . . . . . . . . . . . . . . . . . . . . 10
1.1.3 Calcul du diagramme de Vorono¨ı . . . . . . . . . . . . . . . . . 12
1.2 Diagramme de Vorono¨ı et triangulation de Delaunay restreints . . . . 12
1.2.1 Diagramme de Vorono¨ı restreint . . . . . . . . . . . . . . . . . 12
D´efinitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Cas d´eg´en´er´es . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2.2 Calcul du diagramme de Vorono¨ı restreint . . . . . . . . . . . . 13
1.2.3 Triangulation de Delaunay restreinte . . . . . . . . . . . . . . . 15
1.2.4 Topologie de la triangulation de Delaunay restreinte . . . . . . 15
D´efinitions pr´eliminaires . . . . . . . . . . . . . . . . . . . . . . 16
Propri´et´e de la boule topologique . . . . . . . . . . . . . . . . . 16
Epsilon ´echantillonage . . . . . . . . . . . . . . . . . . . . . . . 17
1.3 Optimisation des diagrammes de Vorono¨ı . . . . . . . . . . . . . . . . 17
1.3.1 Diagramme de Vorono¨ı barycentrique . . . . . . . . . . . . . . 18
1.3.2 Diagramme de Vorono¨ı barycentrique restreint . . . . . . . . . 18
1.3.3 Calculs du diagramme de Vorono¨ı barycentrique et du diagramme
de Vorono¨ı barycentrique restreint . . . . . . . . . . . 19
2 Etat de l’art : objectifs et g´en´eration des maillages ´ 21
2.1 Maillages et g´eomod´elisation . . . . . . . . . . . . . . . . . . . . . . . 21
2.1.1 Qu’est ce qu’un maillage ? . . . . . . . . . . . . . . . . . . . . . 21
D´efinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Types de maillages . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.1.2 Objectifs des maillages en g´eomod´elisation . . . . . . . . . . . 23
Des maillages pour repr´esenter les mod`eles . . . . . . . . . . . 23
Des maillages pour r´ealiser des simulations num´eriques . . . . . 24
2.1.3 Maillages volumiques utilis´es en g´eomod´elisation . . . . . . . . 25
Maillages pour la simulation d’´ecoulement . . . . . . . . . . . . 25viii TABLE DES MATIERES `
Maillages pour d’autres applications . . . . . . . . . . . . . . . 26
2.2 Qualit´e d’un maillage et d´efis de g´en´eration . . . . . . . . . . . . . . . 27
2.2.1 Qualit´e d’un maillage . . . . . . . . . . . . . . . . . . . . . . . 27
Qualit´e d’approximation du mod`ele . . . . . . . . . . . . . . . 27
Qualit´e du maillage pour les simulations num´eriques . . . . . . 29
2.2.2 Effet n´egatifs de la g´eom´etrie du mod`ele . . . . . . . . . . . . . 30
2.2.3 Gestion des caract´eristiques probl´ematiques du mod`ele . . . . . 30
Pr´e-identification . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Simplification du mod`ele . . . . . . . . . . . . . . . . . . . . . . 31
Prise en compte dans la g´en´eration du maillage . . . . . . . . . 32
Post-traitement . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.3 Maillage volumique `a base de t´etra`edres . . . . . . . . . . . . . . . . . 32
2.3.1 Maillages t´etra´edriques . . . . . . . . . . . . . . . . . . . . . . 33
Subdivision de l’espace . . . . . . . . . . . . . . . . . . . . . . . 33
Avanc´ee de front . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Delaunay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Optimisation Vorono¨ı-Delaunay . . . . . . . . . . . . . . . . . . 36
2.3.2 Maillage de mod`eles multi-mat´eriaux . . . . . . . . . . . . . . . 37
2.3.3 Maillage hybride t´etra`edres-prismes . . . . . . . . . . . . . . . 38
2.4 Maillage surfacique `a base de triangles . . . . . . . . . . . . . . . . . . 40
2.4.1 Subdivision de l’espace . . . . . . . . . . . . . . . . . . . . . . . 40
M´ethodes octree . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Diagramme de Vorono¨ı restreint barycentrique . . . . . . . . . 40
2.4.2 Maillage de surfaces avec garanties . . . . . . . . . . . . . . . . 41
2.5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3 Contribution : El´ements d’´evaluation de la complexit´e g´eom´etrique
des mod`eles structuraux 43
3.1 Motivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.2 Sources de complexit´e . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.2.1 Nombre d’objets g´eologiques . . . . . . . . . . . . . . . . . . . 44
3.2.2 Interactions entre les objets . . . . . . . . . . . . . . . . . . . . 46
Couches stratigraphiques conformes . . . . . . . . . . . . . . . 46
Non-conformit´es stratigraphiques . . . . . . . . . . . . . . . . . 46
Failles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.3 Mesures g´en´eralistes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3.1 Mesures globales de complexit´e . . . . . . . . . . . . . . . . . . 47
3.3.2 Mesures dans un voisinage . . . . . . . . . . . . . . . . . . . . . 48
3.4 Mod`eles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.5 R´esultats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.5.1 Mesures globales . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.5.2 Mesures locales . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
M´ethode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Mesures locales de connectivit´e . . . . . . . . . . . . . . . . . . 52
R´esultats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6.1 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53TABLE DES MATIERES ` ix
3.6.2 Perspectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4 Contribution : Remaillage des surfaces de mod`eles structuraux `a
une r´esolution donn´ee 57
4.1 Motivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.2 Objectifs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.3 Optimisation de l’´echantillonnage du mod`ele . . . . . . . . . . . . . . 59
4.3.1 Optimisation CVT . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.3.2 Optimisation de la position des sites le long des bords . . . . . 60
4.3.3 Impl´ementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.4 Construction du maillage . . . . . . . . . . . . . . . . . . . . . . . . . 61
4.4.1 Remaillage des composantes connexes surfaciques . . . . . . . . 61
4.4.2 Remaillage des lignes de bord . . . . . . . . . . . . . . . . . . . 62
4.4.3 Remaillage des coins . . . . . . . . . . . . . . . . . . . . . . . . 63
4.4.4 Impl´ementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.4.5 Am´eliorations du maillage . . . . . . . . . . . . . . . . . . . . . 64
4.5 R´esultats pour 12 mod`eles structuraux . . . . . . . . . . . . . . . . . . 66
4.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.6.1 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.6.2 Perspectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5 Contribution : Vers un mailleur volumique hybride `a partir d’un
diagramme de Vorono¨ı 77
5.1 Motivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.2 Principe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.3 Construction des cellules hybrides . . . . . . . . . . . . . . . . . . . . . 79
5.3.1 D´etermination des cellules `a construire . . . . . . . . . . . . . . 81
5.3.2 Cellules duales des segments . . . . . . . . . . . . . . . . . . . 81
5.3.3 Cellules duales des points . . . . . . . . . . . . . . . . . . . . . 81
Ajout des sommets . . . . . . . . . . . . . . . . . . . . . . . . . 82
Ajout des arˆetes . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Ajout des facettes . . . . . . . . . . . . . . . . . . . . . . . . . 83
5.4 Traitement des cellules invalides . . . . . . . . . . . . . . . . . . . . . . 83
5.5 R´esultats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.6.1 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.6.2 Perspectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Conclusion 91Introduction
Mod`eles g´eologiques : des cartes aux mod`eles num´eriques en 3D
Comprendre l’organisation en trois dimensions des roches dans le sous-sol est
indispensable dans des domaines comme la prospection, l’exploitation, la protection
des ressources naturelles min´erales ou ´energ´etiques. Except´e sur les affleurements, le
sous-sol est invisible et nous disposons de peu d’information pour comprendre son
organisation. C’est dans cet objectif qu’est d´etermin´ee une carte g´eologique, elle indique,
en tout point d’une r´egion, quelle est la nature des roches `a la surface de la
Terre (figure 1a). Cette carte est ´etablie par les g´eologues en interpolant les observations
de terrain. L’organisation des roches en profondeur est caract´eris´ee par des
coupes verticales dans le sous-sol. Nous voyons que, dans la zone repr´esent´ee sur la
figure 1b, le sous-sol est stratifi´e. Les diff´erentes couches sont s´epar´ees par des lignes
appel´ees horizons et sont d´ecoup´ees par deux failles. Les couches 2, 3 et 4 ont ´et´e
en partie ´erod´ees. Cet ´etat actuel est le r´esultat d’une ´evolution que les g´eologues
essaient de reconstituer lors de la d´etermination de ces cartes et coupes (figure 2).
Les cartes et les coupes g´eologiques sont des mod`eles de la r´ealit´e ; elles en sont
des repr´esentations sch´ematiques en deux dimensions. Cependant cette r´ealit´e est
tridimensionnelle et ce sont les mod`eles structuraux qui donnent en chaque point du
sous-sol le type de roche pr´esent (figure 3). Leur construction et leur repr´esentation
sont informatiques. Il est possible, comme pour une photo num´erique, dans laquelle
chaque pixel est associ´e `a une couleur, de d´ecouper un mod`ele structural en voxels
(cubes ´el´ementaires) auxquels est associ´e un type de roche (figure 3a). Une alternative
est de repr´esenter seulement les surfaces (horizons, failles, ´erosions, etc) d´elimitant
les diff´erents volumes rocheux. Cette repr´esentation, dite par fronti`eres 1
, permet de
mod´eliser une tr`es grande partie des configurations complexes rencontr´ees dans la
nature.
Des maillages pour visualiser et ´etudier le comportement des mod`eles
Quelle que soit la repr´esentation choisie du mod`ele structural, un maillage est
utilis´e pour l’enregistrer et le visualiser en trois dimensions sur un ordinateur. Un
maillage d’un objet est d´efini comme un ensemble d’´el´ements g´eom´etriques simples
(carr´es, triangles, cubes, t´etra`edres, etc) qui ne s’intersectent pas et dont l’union
est une approximation de l’objet. Il est d´efini par les sommets de ces ´el´ements et
par les r`egles permettant de relier ces sommets. Par exemple, le d´ecoupage en pav´es
1. Boundary Representation ou B-Rep.2 Introduction
Figure 1 – Modeles g ` eologiques en deux dimensions : une carte et une coupe. ´
La carte donne, en vue de dessus, le type des roches qui affleurent `a la surface terrestre, la
coupe en donne une vue en profondeur. Les lignes (surfaces en 3D figure 3) s´eparant deux
couches diff´erentes sont appel´ees les horizons. Ces horizons sont pliss´es et d´ecoup´es par deux
failles. La ligne d’´erosion dessine la topographie de la zone.
Figure 2 – Vue en coupe de l’evolution des couches de la coupe de la figure ´ 1
depuis leur dep´ ot. ˆIntroduction 3
Figure 3 – Deux representations d’un mod ´ ele structural en trois dimensions. `
Ce mod`ele synth´etique correspond `a la carte et `a la coupe de la figure 1. (a) Repr´esentation
volumique : le mod`ele est d´ecoup´e en pav´es, chacun a la couleur de la couche associ´ee. (b) Repr´esentation
par limites : seules les surfaces d´elimitant les volumes rocheux sont repr´esent´ees.
Les surfaces qui d´elimitent la zone d’int´erˆet (dite aussi boˆıte) ne sont pas affich´ees.4 Introduction
Figure 4 – Deux defis pour la g ´ en´ eration de maillage des mod ´ eles structuraux. `
(a) La couche bleue est localement tr`es fine et ne peut pas dans cette zone ˆetre maill´ee avec
des triangles de plus de 5m de cˆot´e. (b) La couche rouge fait un angle de 16 degr´es, pour
respecter ses limites au moins un triangle du maillage doit avoir un angle de 16 degr´es.
du mod`ele structural vu figure 3a est un maillage. Si la taille de ces pav´es est trop
importante, l’image des structures g´eologiques est, de la mˆeme mani`ere qu’une photo
num´erique `a basse r´esolution, impr´ecise.
En plus de repr´esenter les mod`eles, les maillages sont n´ecessaires pour r´epondre
`a des probl`emes d’ing´enierie, par exemple l’estimation de l’impact du creusement
d’un tunnel sur la stabilit´e des roches l’entourant. En utilisant les th´eories physiques
ad´equates, ce probl`eme peut ˆetre transform´e en probl`eme math´ematique. Ce dernier
ne peut g´en´eralement pas ˆetre r´esolu de mani`ere exact et eu maillage est utilis´e pour
en d´eterminer une version approch´ee qui sera r´esolue num´eriquement. Ceci est le
second objectif des maillages : permettre de r´ealiser les simulations num´eriques pour
calculer l’approximation d’un comportement naturel.
D´efis de la g´en´eration de maillage - Probl´ematique
Lorsque les hypoth`eses sur lesquelles reposent les ´etapes permettant de passer du
probl`eme d’ing´enierie au r´esultat ne sont pas v´erifi´ees, l’´ecart entre le r´esultat de la
simulation num´erique et le comportement r´eel peut ˆetre important. Afin d’obtenir des
r´esultats fiables dans le temps imparti, le maillage doit repr´esenter le mod`ele assez
pr´ecis´ement et respecter un ensemble de crit`eres de qualit´e sur le nombre, l’aspect
et la taille de ses ´el´ements. Ces deux conditions sont contradictoires et il n’est pas
toujours possible de mailler les composantes du mod`ele qui ont un impact sur la
solution tout en respectant ces crit`eres de qualit´e. Par exemple, un mod`ele dans
lequel une couche a localement une ´epaisseur de 5m et pour lequel il faut g´en´erer
un maillage ayant des ´el´ements dont la taille minimale requise des arˆetes est 10m
est impossible (figure 4a). De mˆeme, il ne sera pas possible de g´en´erer des ´el´ements
ayant tous des angles sup´erieur `a 30 degr´es si le mod`ele contient un angle de 16 degr´es
(figure 4b).
Dans ces cas, un choix est n´ecessaire pour obtenir le meilleur compromis entreIntroduction 5
d’une part la pr´ecision, la fiabilit´e, la robustesse des r´esultats obtenus, et d’autre
part les besoins en m´emoire et le temps n´ecessaires au calcul. A priori, la relaxation
des contraintes sur le maillage (plus grand nombre d’´el´ements, ´el´ements plus petits)
accroˆıt les temps de calcul et les besoins en m´emoire, mais augmente la pr´ecision du
r´esultat. La modification de la g´eom´etrie du mod`ele (diminution de son niveau de d´etail)
permet de le mailler avec moins d’´el´ements, tout en simplifiant des composantes
qui peuvent ˆetre n´efastes pour la r´esolution num´erique, mais risque de diminuer la
pr´ecision des r´esultats. Id´ealement, pour faire le meilleur choix, il faudrait comparer
les r´esultats obtenus pour diff´erents maillages `a diff´erents niveaux de d´etail du mod`ele.
Ceci implique de disposer d’outils automatiques pour (1) modifier et mailler un
mod`ele `a une r´esolution donn´ee avec des ´el´ements de la qualit´e souhait´ee et (2) ´evaluer
les ´ecarts entre le r´esultat et le comportement r´eel. Dans cette th`ese, nous nous
int´eressons au premier point et apportons des ´el´ements de r´eponses aux questions
suivantes :
– Comment caract´eriser le niveau de d´etail d’un mod`ele g´eologique en trois dimensions
et comment identifier ses petites caract´eristiques g´eom´etriques ?
– Comment modifier automatiquement le niveau de d´etail d’un mod`ele et simplifier
ses petites caract´eristiques ?
– Comment mailler un mod`ele (surfaces et volumes) lorsque la taille requise pour
les ´el´ements est sup´erieure `a la r´esolution du mod`ele ?
D´emarche
Nous utilisons une subdivision du mod`ele structural par un diagramme de Vorono¨ı
pour analyser la g´eom´etrie et la connectivit´e du mod`ele et g´en´erer un maillage de ses
surfaces et de ses r´egions volumiques (figure 5). Un diagramme de Vorono¨ı est d´efini
pour un ensemble de points, il associe `a chaque point la partie du mod`ele plus proche
de ce point que des autres points (la cellule de Vorono¨ı). A partir du diagramme de `
Voronoi et de ses intersections avec les fronti`eres du mod`ele, un maillage des surfaces
et des r´egions volumiques du mod`ele peut ˆetre d´etermin´e (figure 5).
Nous proposons des strat´egies pour construire un maillage quelles que soient les
configurations des intersections entre le mod`ele et le diagramme de Vorono¨ı. En effet,
selon la taille des cellules de Vorono¨ı, les intersections avec les surfaces d´efinissant le
mod`ele sont plus ou moins compliqu´ees (figure 5). Cette approche nous permet de
privil´egier le contrˆole du nombre d’´el´ements dans le maillage final et d’autoriser des
modifications du mod`ele (figure 5). L’´ecart entre la r´esolution du mod`ele et celle du
maillage est ainsi r´eduit.
Apr`es avoir d´efini les objets g´eom´etriques d´eriv´es du diagramme de Vorono¨ı, fondements
de ces travaux (chapitre 1), nous pr´ecisons les objectifs des maillages et
passons en revue les m´ethodes de g´en´eration de maillage triangulaire et t´etra´edrique
(chapitre 2). Nous proposons dans le chapitre 3 des mesures de la complexit´e g´eom´etrique
des mod`eles structuraux dont le but est de caract´eriser pr´ecis´ement les zones
compliqu´ees `a mailler dans un mod`ele. Puis, nous proposons une m´ethode de remaillage
des surfaces d’un mod`ele structural (chapitre 4) qui permet de contrˆoler le
nombre d’´el´ements dans le maillage, de simplifier le mod`ele et de g´en´erer des triangles
aussi ´equilat´eraux que possible. Cette m´ethode est ´etendue dans le chapitre 5 pour6 Introduction
Figure 5 – Utilisation d’une subdivision par un diagramme de Vorono¨ı pour
analyser, modifier et mailler un modele par fronti ` ere. ` Cette th`ese se concentre
sur la construction d’un maillage dans le cas o`u la subdivision du mod`ele par le diagramme
de Vorono¨ı est grossi`ere et o`u les intersections avec les bords sont potentiellement complexes.
Notre travail vise `a g´en´erer soit un maillage du mod`ele simplifi´e (1) soit un maillage du
mod`ele complet (2) en limitant le nombre d’´el´ements.Introduction 7
g´en´erer un maillage volumique constitu´e d’´el´ements de diff´erents types du mod`ele
structural. Des prismes et pyramides sont utilis´es pour remplir les zones tr`es fines du
mod`ele, tandis que le reste du mod`ele est rempli avec des t´etra`edres.
R´esum´e des contributions
Dans cette th`ese nous pr´esentons les contributions suivantes :
– des mesures aidant `a identifier les petites caract´eristiques g´eom´etriques des
mod`eles g´eologiques. Elles sont d´ecrites dans le chapitre 3. Ces travaux ne
sont, pour l’instant, pas publi´es ;
– une m´ethode de construction d’un remaillage des surfaces d’un mod`ele d´efini
par fronti`eres `a partir de l’intersection d’un diagramme de Vorono¨ı avec ces
fronti`eres. Ces travaux sont pr´esent´es dans le chapitre 4, et publi´es dans Pellerin
et al. [2014], une version pr´eliminaire ayant ´et´e pr´esent´ee dans Pellerin et al.
[2011] ;
– une strat´egie de construction d’un maillage hybride (prismes, pyramides et
t´etra`edres) des r´egions d’un mod`ele d´efini par fronti`ere `a partir d’un diagramme
de Vorono¨ı et de son intersection avec les fronti`eres du mod`ele qui est d´ecrite
dans le chapitre 5. Une version courte de ces travaux a ´et´e pr´esent´ee dans
Pellerin et al. [2012].
Publications associ´ees `a cette th`ese
J. Pellerin, B. L´evy et G. Caumon : Topological control for isotropic remeshing of
nonmanifold surfaces with varying resolution : application to 3D structural models.
In Proc. IAMG. cogeo@oeaw-giscience, sept. 2011.
J. Pellerin, B. L´evy et G. Caumon : A Voronoi-based hybrid meshing method. In
International Meshing Roundtable, Research Notes, oct. 2012.
J. Pellerin, B. L´evy, G. Caumon et A. Botella : Automatic surface remeshing of
3D structural models at specified resolution : A method based on Voronoi diagrams.
Computers & Geosciences, 62(0):103 – 116, 2014.Chapitre 1
Objets g´eom´etriques
fondamentaux
Dans ce chapitre nous d´efinissons les objets g´eom´etriques utilis´es par de nombreuses
m´ethodes de g´en´eration de maillage et sur lesquels ces travaux de th`ese sont
fond´es. Ils sont li´es au diagramme de Vorono¨ı, une structure fondamentale en g´eom´etrie,
voir notamment Aurenhammer [1991] et Okabe et al. [2009].
1.1 Diagramme de Vorono¨ı et triangulation de Delaunay
1.1.1 Diagramme de Vorono¨ı
Un diagramme de Vorono¨ı [Vorono¨ı, 1908] est un d´ecoupage de l’espace en plusieurs
r´egions `a partir d’un ensemble de points, appel´es sites et not´es S. Chaque site,
p ∈ S, correspond `a une r´egion, appel´ee cellule de Vorono¨ı, qui contient les points
de l’espace plus proches de ce site p que de n’importe quel autre site (figure 1.1).
Formellement, dans le cas o`u l’espace consid´er´e est R
2
et o`u la proximit´e entre un
point x et un site p est mesur´ee par la distance euclidienne entre ces deux points
||x − p||, la cellule de Vorono¨ı de p est d´efinie par :
Vp = {x ∈ R
2
, ||x − p|| ≤ ||x − q||, q ∈ S} (1.1)
L’ensemble des cellules de Vorono¨ı forme le diagramme de Vorono¨ı de S (fi-
gure 1.1a). Ces cellules sont des polygones ferm´es convexes born´es ou non qui recouvrent
l’espace sans se chevaucher. Leurs arˆetes, appel´ees arˆetes de Vorono¨ı, sont
les points `a ´egale distance entre deux sites voisins. Les sommets des cellules, ou sommets
de Vorono¨ı, sont les points `a ´egale distance de trois sites voisins (figure 1.2). Ces
d´efinitions s’´etendent en dimension sup´erieure. Nous nous arrˆetons dans cette th`ese
`a la dimension trois o`u les r´egions associ´ees aux sites sont des poly`edres (figure 1.3).
Leurs faces, les facettes de Vorono¨ı, sont les points `a ´egale distance de deux sites
voisins ; elles sont contenues par le plan m´ediateur de ces deux sites. Les arˆetes sont
partag´ees par trois cellules de Vorono¨ı et les sommets par quatre cellules (figure 1.4a).
Il est important de noter que ce que nous venons de d´ecrire est correct dans le10 Chapitre 1. Objets geom ´ etriques fondamentaux ´
Figure 1.1 – Diagramme de Vorono¨ı et triangulation de Delaunay correspondante
dans le plan. (a) Le diagramme de Vorono¨ı des 21 sites (points noirs) est un ensemble
de 21 polygones convexes qui recouvrent le plan. Les cinq cellules intersectant le bord
du carr´e sont infinies. (b) La triangulation de Delaunay correspondante triangule l’enveloppe
convexe des sites.
Figure 1.2 – Relation duale Vorono¨ı-Delaunay en 2D. Le sommet de Vorono¨ı V est
partag´e par trois cellules de Vorono¨ı : A, B, et C. Il correspond `a un triangle de Delaunay
ABC, dont les sommets sont les sites et dont chacun des trois cˆot´es correspondent `a une arˆete
de Vorono¨ı (num´eros 1 `a 3).
cas o`u les sites S sont en position g´en´erale, c’est-`a-dire qu’il n’y a pas quatre sites ou
plus cocycliques dans le mˆeme plan, et cinq points ou plus cosph´eriques dans l’espace.
Ces cas d´eg´en´er´es disparaissent avec une perturbation infime de la position des sites,
qui est ´eventuellement r´ealis´ee de mani`ere symbolique [Edelsbrunner et Mucke ¨ , 1990].
Dans ce qui suit, nous supposerons que les sites sont en position g´en´erale.
Remarque : Il existe de tr`es nombreuses g´en´eralisations du diagramme de Vorono¨ı
obtenues en changeant la fonction de distance entre un site et un point de l’espace,
la nature des sites etc, voir les revues de [Okabe et al., 2009] et Aurenhammer [1991].
Il est ´egalement possible de travailler dans des espaces non-euclidiens, par exemple
celui d´efini par une surface plong´ee dans un espace 3D.
1.1.2 Triangulation de Delaunay
Un second objet, particuli`erement int´eressant dans un contexte de g´en´eration de
maillage, peut ˆetre construit depuis un diagramme de Vorono¨ı : la triangulation de
Delaunay. Nous avons vu que dans le plan, en position g´en´erale, chaque sommet de
Vorono¨ı est `a ´egale distance de trois sites. Le triangle qui relie ces sites est dit de
Delaunay et la triangulation de Delaunay est l’ensemble des triangles correspondantsDiagramme de Vorono¨ı et triangulation de Delaunay 11
Figure 1.3 – Diagramme de Vorono¨ı en 3D. (a) 200 sites sont distribu´es dans un pav´e.
(b) Coupe solide dans le diagramme de Vorono¨ı des sites recoup´e par les bords du pav´e.
(c) Une cellule de Vorono¨ı.
A
B
C
D
V
A
B
C
D
V
1
2
3
4
(a) (b) (c)
6
1
2
4
3
5
A
B
C
D
V
Figure 1.4 – Relation duale Vorono¨ı-Delaunay en 3D. (a) Le sommet de Vorono¨ı
V est `a ´egale distance des sites des cellules A, B, C et D. (b) A chaque facette de Vorono¨ı
contenant V (num´eros 1 `a 6) correspond un segment reliant les sites des 2 cellules partageant
la facette. (c) A chaque arˆete de Vorono¨ı contenant V (num´eros 1 `a 4) correspond un triangle
reliant les sites des 3 cellules partageant cette arˆete.12 Chapitre 1. Objets geom ´ etriques fondamentaux ´
aux sommets de Vorono¨ı (figure 1.1b). La triangulation de Delaunay des sites S est
dite duale du diagramme de Vorono¨ı de S car, `a chaque cellule de Vorono¨ı correspond
un sommet de la triangulation, `a chaque arˆete de Vorono¨ı correspond une arˆete de
la triangulation et `a chaque sommet de Vorono¨ı correspond un triangle de Delaunay
(figure 1.2). Comme le diagramme de Vorono¨ı, le concept de triangulation de Delaunay
se g´en´eralise en dimension sup´erieure. En trois dimensions, la t´etra´edrisation de
Delaunay contient une arˆete pour chaque facette de Vorono¨ı, un triangle pour chaque
arˆete de Vorono¨ı et un t´etra`edre pour chaque sommet de Vorono¨ı (figure 1.4).
La triangulation de Delaunay d’un ensemble de points S peut ˆetre d´efinie ind´ependamment
du diagramme de Vorono¨ı `a partir du crit`ere de la boule vide ou crit`ere
de Delaunay [Delaunay, 1934] qui stipule que, dans R
2
, un triangle est de Delaunay
si son cercle circonscrit ne contient aucun autre point de S que ses sommets. Les
propri´et´es math´ematiques de la triangulation de Delaunay en ont fait un objet de
choix en g´en´eration de maillage (partie 2.3).
1. Les boules ouvertes circonscrites aux simplexes 1 de la triangulation de Delaunay
ne contiennent aucun sommet de S. Ce crit`ere de la boule vide ou de
Delaunay est associ´e `a un lemme qui donne que, pour une triangulation quelconque
des points S, si le crit`ere de la boule vide est vrai pour toute paire
d’´el´ements adjacents, alors il l’est pour tous les ´el´ements [Delaunay, 1934].
2. Pour tout ensemble de points S en position g´en´erale, la triangulation de Delaunay
existe et est unique.
3. La triangulation de Delaunay maximise l’angle minimal de la triangulation de S.
1.1.3 Calcul du diagramme de Vorono¨ı
Le calcul du diagramme de Vorono¨ı d’un ensemble de points peut se faire soit
directement, soit en calculant la triangulation de Delaunay duale. De nombreuses
m´ethodes ont ´et´e d´evelopp´ees, voir les synth`eses de Fortune [1992], Okabe et al.
[2009], Boissonnat et Yvinec [1995] et les impl´ementations de TetGen 2 ou CGAL 3
.
1.2 Diagramme de Vorono¨ı et triangulation de Delaunay
restreints
1.2.1 Diagramme de Vorono¨ı restreint
D´efinitions
Un diagramme de Vorono¨ı d´ecoupe en r´egions convexes l’espace sur lequel il est
d´efini. Nous nous int´eressons ici au d´ecoupage d’un objet inclus dans cet espace par
ce diagramme de Vorono¨ı : le diagramme de Vorono¨ı restreint 4
. Pour un ensemble
1. Les triangles dans R
2
et les t´etra`edres dans R
3
.
2. http://wias-berlin.de/software/tetgen/
3. http://www.cgal.org/
4. RVD pour Restricted Voronoi Diagram en anglaisDiagramme de Vorono¨ı et triangulation de Delaunay restreints 13
de sites S et un objet Ω le diagramme de Vorono¨ı restreint est d´efini comme l’intersection
du diagramme de Vorono¨ı de S avec Ω 5
. Deux exemples sont donn´es sur
les figures 1.5b et 1.5e. L’intersection d’une cellule de Vorono¨ı, Vp, avec l’objet Ω
est appel´ee cellule de Vorono¨ı restreinte de p `a Ω et est d´efinie par Vp∩Ω = Vp ∩ Ω.
La dimension de la cellule restreinte d´epend de la dimension de l’objet. Les cellules
restreintes `a l’´etoile sont surfaciques (figure 1.5b), tandis que celles restreintes `a son
contour sont lin´eaires (figure 1.5e).
L’intersection d’une arˆete de Vorono¨ı avec l’objet est une arˆete de Vorono¨ı restreinte,
l’intersection d’une facette de Vorono¨ı avec l’objet est une facette de Vorono¨ı
restreinte et l’intersection entre un sommet de Vorono¨ı et l’objet est un sommet de
Vorono¨ı restreint. Contrairement aux ´el´ements d’un diagramme de Vorono¨ı, ceux d’un
diagramme de Vorono¨ı restreint peuvent avoir plus d’une composante connexe, c’est-
`a-dire qu’il existe au moins deux points dans un ´el´ement qui ne peuvent pas ˆetre reli´es
par un chemin contenu dans cet ´el´ement. Par exemple, dans le cas du diagramme de
Vorono¨ı restreint au contour de l’´etoile, figure 1.5e, les cellules restreintes au milieu
des branches ont deux composantes connexes - deux segments.
Cas d´eg´en´er´es
Nous avons vu sur l’exemple de l’´etoile, figure 1.5, que la dimension des cellules
de Vorono¨ı restreintes est la mˆeme que celle de l’´etoile, `a savoir deux. Ceci est vrai
seulement si les intersections d´eg´en´er´ees entre la cellule de Vorono¨ı et l’objet (´egales
`a un sommet ou `a une arˆete de Vorono¨ı) sont exclues (figure 1.6). Cette remarque
se g´en´eralise pour les intersections de chaque ´el´ement du diagramme de Vorono¨ı
(cellule, facette, arˆete et sommet) avec l’objet. Dans un espace de dimension d, un
´el´ement du diagramme de Vorono¨ı (dimension l) intersecte g´en´eriquement un objet
de dimension m si l’intersection a la dimension attendue : m + l − d [Edelsbrunner
et Shah, 1997]. Dans R
3
, les intersections des cellules, facettes, arˆetes et sommets
de Vorono¨ı avec une surface doivent respectivement ˆetre de dimension deux (des
morceaux de surface), un (des morceaux de lignes), z´ero (des points) et vide. Les
intersections entre un sommet de Vorono¨ı et une quelconque ligne ou surface sont
donc exclues. D’apr`es Edelsbrunner et Shah [1997], ces hypoth`eses sont raisonnables
et nous supposerons qu’elles sont v´erifi´ees dans ce qui suit. Toutefois, nous verrons
`a la fin du chapitre 4 que la plupart des probl`emes rencontr´es lors du calcul d’un
maillage `a partir d’un diagramme de Vorono¨ı restreint sont li´es `a des configurations
proches de ces configurations d´eg´en´er´ees.
1.2.2 Calcul du diagramme de Vorono¨ı restreint
La notion de diagramme de Vorono¨ı restreint telle que nous l’avons pr´esent´ee
recouvre un grand nombre de cas en termes de dimension de l’objet. Lorsque qu’un
objet est d´efini par ces fronti`eres et que sa dimension est celle de l’espace de travail,
le calcul de l’intersection entre l’objet et le diagramme de Vorono¨ı d’un ensemble de
points est assez d´elicat. L´evy et Liu [2010] proposent une m´ethode en trois dimensions,
5. Dans d’autres travaux, dans le cas o`u l’objet consid´er´e et l’espace le contenant sont de mˆeme
dimension (figure 1.5c) le diagramme de Vorono¨ı restreint est aussi appel´e diagramme de Vorono¨ı
coup´e (clipped Voronoi diagram en anglais).14 Chapitre 1. Objets geom ´ etriques fondamentaux ´
Figure 1.5 – Diagramme de Vorono¨ı restreint et triangulation de Delaunay
restreinte. (b) Diagramme de Vorono¨ı restreint `a une ´etoile (a). (c) La triangulation de
Delaunay restreinte correspondante maille l’´etoile. (e) Diagramme de Vorono¨ı restreint au
contour de l’´etoile (d). (f) La triangulation de Delaunay restreinte correspondante est un
sous-ensemble de celle `a l’´etoile (c). Elle ne contient pas le site au centre de l’´etoile, car la
cellule de Vorono¨ı de ce site ne recoupe pas le contour.
Figure 1.6 – Cas deg´ en´ er´ es d’intersection entre une cellule de Vorono ´ ¨ı et un
rectangle. La cellule A intersecte le rectangle en un unique point. La cellule B intersecte
le rectangle le long d’une de ses arˆetes.Diagramme de Vorono¨ı et triangulation de Delaunay restreints 15
mais elle est cependant peu robuste aux configurations d´eg´en´er´ees [Merland, 2013].
Quand l’objet a une dimension inf´erieure `a celle du diagramme de Voronoi, le calcul
est plus ais´e.
Dans cette th`ese, nous nous int´eressons au diagramme de Vorono¨ı restreint `a une
surface triangul´ee en trois dimensions. Pour le calculer, nous utilisons la m´ethode
initialement d´evelopp´ee par Yan et al. [2009] et am´elior´ee par Nivoliers [2012]. L’op´eration
de base est le calcul de l’intersection entre un triangle de la surface et une
cellule de Vorono¨ı. Comme une cellule de Vorono¨ı peut ˆetre d´efinie par l’intersection
des demi-plans m´ediateurs entre son site et ses voisins les plus proches, il suffit de
d´ecouper successivement le triangle par ces plans. Pour calculer l’intersection entre
un triangle et une cellule de Vorono¨ı une seule fois, et acc´el´erer le calcul, plusieurs
strat´egies de propagation sont possibles, elles sont d´ecrites en d´etail par Nivoliers
[2012].
1.2.3 Triangulation de Delaunay restreinte
De la mˆeme mani`ere que la triangulation de Delaunay est duale du diagramme
de Vorono¨ı, la triangulation de Delaunay restreinte est d´efinie comme le dual du
diagramme de Vorono¨ı restreint Edelsbrunner et Shah [1997]. Dans R
2
, elle contient
un sommet pour chaque cellule restreinte, un segment pour chaque arˆete restreinte
et un triangle pour chaque sommet de Vorono¨ı restreint (figures 1.5c et f).
La triangulation de Delaunay restreinte est donc constitu´ee des ´el´ements de la
triangulation de Delaunay qui sont duaux d’´el´ements du diagramme de Vorono¨ı intersectant
l’objet consid´er´e. Ses triangles, arˆetes et sommets (figure 1.5c) sont un
sous-ensemble de la triangulation de Delaunay (figure 1.1). En effet, par construction,
le diagramme de Vorono¨ı restreint est un sous-ensemble du diagramme de Vorono¨ı.
Consid´erons `a pr´esent les diagrammes de Vorono¨ı restreints `a deux objets A et
B tels que A inclus dans B. Le diagramme de Vorono¨ı restreint `a A est un sousensemble
du diagramme de Vorono¨ı restreint `a B et il en est de mˆeme pour les
triangulations de Delaunay restreintes. Les mˆemes sites peuvent donc ˆetre utilis´es
pour trianguler de mani`ere conforme, c’est-`a-dire de telle sorte que les int´erieurs des
deux triangulations ne s’intersectent pas, deux objets de dimensions potentiellement
diff´erentes. Par exemple, les segments de la triangulation de Delaunay restreinte au
contour de l’´etoile (figure 1.5f) sont inclus dans la triangulation de Delaunay restreinte
`a l’´etoile (figure 1.5c).
Lorsque certains ´el´ements de la triangulation de Delaunay restreinte ne sont pas
contenus dans le bord d’un ´el´ement de dimension sup´erieure, par exemple les segments
dans les branches de l’´etoile figure 1.5c, la triangulation de Delaunay restreinte est
un objet multi-dimensionnel. Elle peut alors ˆetre vue comme une version simplifi´ee
de l’objet initial.
1.2.4 Topologie de la triangulation de Delaunay restreinte
La propri´et´e de la boule topologique, introduite par Edelsbrunner et Shah [1997],
d´ecrit un crit`ere qui garantit que la triangulation de Delaunay restreinte a la mˆeme
topologie que l’objet initial (est hom´eomorphe) et n’en est pas une version simplifi´ee.16 Chapitre 1. Objets geom ´ etriques fondamentaux ´
Figure 1.7 – Boules topologiques et espaces variet´ es dans le plan. ´
D´efinitions pr´eliminaires
Les espaces topologiques X et Y sont hom´eomorphes, s’il existe une application
bijective de X dans Y continue et dont l’inverse est continue. Une k-boule ouverte est
un espace hom´eomorphe `a R
k
(figure 1.7). Une k-demi boule ouverte est un espace
hom´eomorphe au demi-espace Hk = {x = (ξi) ∈ R
k
| ξi ≥ 0}. Une k-boule ferm´ee
est un espace hom´eomorphe `a B
k = {x ∈ R
k
| ||x − O|| ≤ 1}. Le voisinage d’un sous
ensemble Y inclus dans X est un sous-ensemble de X qui contient Y. L’espace X inclus
dans R
d
est un k-vari´et´e sans bord si tous ses points ont un voisinage de k-boule
ouverte, c’est un k-vari´et´e avec bord si tous ses points ont un voisinage de k-boule
ouverte ou de k-demi boule ouverte (figure 1.7). L’ensemble des points qui n’ont pas
une k-boule ouverte comme voisinage forme le bord de X, et l’ensemble des points
qui ont un voisinage de k-boule ouverte forme l’int´erieur.
Propri´et´e de la boule topologique
Un ensemble de points de R
d fini non d´eg´en´er´e, S, a la propri´et´e de la boule
topologique [Edelsbrunner et Shah, 1997] pour X ⊆ R
d
, un m-vari´et´e ferm´e et born´e,
si pour chaque l ≤ m et chaque sous-ensemble de m + 1 − l points T ⊆ S :
– l’intersection entre X et l’ensemble des points communs aux cellules de Vorono¨ı
des sites T est soit vide soit une l-boule ferm´ee ;
– l’intersection entre le bord de X et l’ensemble des points communs aux cellules
de Vorono¨ı des sites est soit vide soit une (l − 1)-boule ferm´ee.
Ceci signifie qu’un ensemble S non-d´eg´en´er´e de points a la propri´et´e de la boule
topologique pour une surface vari´et´e Ω plong´ee dans R
3
si : toutes cellules de Vorono¨ı
restreintes (respectivement les facettes et arˆetes) de S `a Ω sont des 2-boules ferm´ees,
(respectivement des 1-boules et points) et si toutes les cellules de Vorono¨ı restreintes
(respectivement les facettes et arˆetes) de S aux bords de Ω sont des 1-boules ferm´ees
(respectivement des points et l’ensemble vide) (figure 1.8).Optimisation des diagrammes de Vorono¨ı 17
Figure 1.8 – Cellules de Vorono¨ı verifiant et ne v ´ erifiant pas la propri ´ et´ e de ´
la boule topologique. Les cellules A, B, C, G ont deux composantes connexes. Les cellules
D et F sont bien des disques, mais leurs intersections avec le bord du mod`ele (ligne grise) ont
deux composantes connexes.
Le th´eor`eme prouv´e par Edelsbrunner et Shah [1997] donne que : pour X ⊆ R
d
un compact vari´et´e, avec ou sans bord, et pour S ⊆ R
d un ensemble fini de points
non d´eg´en´er´es dont le diagramme de Vorono¨ı intersecte g´en´eriquement X, si S a la
propri´et´e de la boule topologique pour X alors la triangulation de Delaunay restreinte
de S `a X est hom´eomorphe `a X. Une extension aux espaces non vari´et´e est ´egalement
propos´ee, elle est cependant beaucoup moins utilis´ee et nous ne la d´etaillerons pas
ici.
Epsilon ´echantillonage
Introduite par Amenta et Bern [1999], la th´eorie de l’ǫ-´echantillonage donne un
moyen g´eom´etrique de garantir qu’une surface v´erifie la propri´et´e de la boule topologique.
Sa d´efinition est fond´ee sur la notion d’axe m´edian. L’axe m´edian d’un objet
est l’ensemble des points de l’espace qui ont plus d’un point le plus proche sur le bord
de l’objet. La notion de lfs, pour local feature size, qui peut ˆetre traduit par taille des
particularit´es locales, est d´efinie par Amenta et Bern [1999] comme la distance (euclidienne)
minimale `a l’axe (ou surface) m´edian de l’objet 6
. Un ensemble de points S
est un ǫ-´echantillonage d’une surface vari´et´e Ω si pour chaque point x de Ω, il existe
un point de S `a une distance inf´erieure `a ε × lfs(x). Quand ε < 0.1, Amenta et Bern
[1999] montrent que, dans ce cas, les points S ont la propri´et´e de la boule topologique
pour la surface Ω.
Le calcul exact de l’axe m´edian, et par cons´equence celui du lfs, est un probl`eme
particuli`erement compliqu´e (voir par exemple Attali et al. [2009]) et reste un sujet de
recherche. Cependant, il est possible de le d´eterminer de fa¸con approch´ee en utilisant
les sommets du diagramme de Vorono¨ı d’un ensemble de points ´echantillonnant l’objet
consid´er´e.
1.3 Optimisation des diagrammes de Vorono¨ı
Le d´ecoupage de l’espace en cellule de Vorono¨ı obtenu `a partir d’un ensemble
de sites distribu´es de mani`ere al´eatoire est ´egalement al´eatoire et la question de son
6. Une premi`ere version de lfs a ´et´e propos´ee par Ruppert [1995].18 Chapitre 1. Objets geom ´ etriques fondamentaux ´
optimisation apparaˆıt dans de nombreux probl`emes de statistiques, de traitement
d’image ou de g´en´eration de maillage. Il s’agit alors d’optimiser le placement des
sites afin de remplir un objectif particulier, par exemple, minimiser les distances
entre chacun des sites et les points de sa cellule de Vorono¨ı. Cette optimisation tend
vers un diagramme de Vorono¨ı particulier : le diagramme de Vorono¨ı barycentrique.
1.3.1 Diagramme de Vorono¨ı barycentrique
Le diagramme de Vorono¨ı d’un ensemble de sites est barycentrique si chaque site
se trouve au barycentre p∗ de sa cellule de Vorono¨ı Vp :
p∗ =
R
Vp
ydy
R
Vp
dy
(1.2)
Si une fonction de densit´e ρ est d´efinie, le barycentre devient :
p∗ =
R
Vp
yρ(y)dy
R
Vp
ρ(y)dy
(1.3)
Consid´erons `a pr´esent le probl`eme de la recherche d’une partition d’un domaine
Ω en k r´egions Ωi et des positions de k points si qui minimisent la fonction :
F((si
, Ωi)i=1...k) = X
k
i=1
Z
y∈Ωi
ρ(y)||y − si
||2
dy (1.4)
Cette fonction ´evalue la somme des carr´es des distances entre l’un des points si et
les points de la r´egion Ωi qui a le mˆeme indice. Du et al. [1999] d´emontrent que,
pour minimiser cette fonction, il est n´ecessaire que les r´egions Ωi soient les cellules de
Vorono¨ı des points si et que chaque point soit au barycentre de sa cellule de Vorono¨ı.
Ils d´emontrent ´egalement que cette fonction a les mˆemes minimums que la fonction :
FCV T ((si)i=1...k) = X
k
i=1
Z
y∈Vi
ρ(y)||y − si
||2
dy (1.5)
o`u Vi est la cellule de Vorono¨ı associ´ee au point si
. Les param`etres de la fonction
FCV T sont uniquement les positions des points, l’int´egration ´etant faite sur les cellules
de Vorono¨ı Vi
. Pour obtenir un diagramme de Vorono¨ı barycentrique il suffit
donc de minimiser cette fonction des positions des points. En pratique, l’obtention
d’un minimum global est tr`es difficile, et l’obtention d’un minimum local est souvent
consid´er´ee satisfaisante.
Remarque : Dans un mˆeme espace et pour un nombre de sites donn´e, il y a plusieurs
diagrammes de Vorono¨ı barycentriques et tous ne minimisent pas la fonction FCV T .
1.3.2 Diagramme de Vorono¨ı barycentrique restreint
Le diagramme de Vorono¨ı restreint d’un ensemble de points S `a un domaine Ω est
barycentrique si chaque site p est au barycentre de sa cellule de Vorono¨ı restreinte.Optimisation des diagrammes de Vorono¨ı 19
Sites al´eatoires Diag. de Vorono¨ı RVD RDT
Sites optimis´es Diag. de Vorono¨ı RVD RDT
Figure 1.9 – Optimisation de 100 sites sur une sphere. ` Apr`es optimisation le diagramme
de Vorono¨ı restreint est constitu´e de cellules dont la forme est proche de celle d’un
hexagone r´egulier et la triangulation de Delaunay restreinte contient des triangles qui sont
quasiment ´equilat´eraux.
Une propri´et´e similaire `a celle du diagramme de Vorono¨ı barycentrique classique est
´etablie en int´egrant uniquement sur les cellules de Vorono¨ı restreintes et la fonction
FCV T devient :
FΩ =
X
k
i=1
Z
y∈Vi∩Ω
ρ(y)||y − si
||2
dy (1.6)
Lorsque les points si appartiennent au domaine Ω, le diagramme de Vorono¨ı barycentrique
restreint est contraint [Du et al., 2003]. Parce que nous utilisons les sites
pour partitionner les r´egions volumiques et les surfaces d’un mod`ele, nous utilisons
un diagramme de Vorono¨ı barycentrique restreint non-contraint. Un exemple d’optimisation
de sites par rapport `a une sph`ere est donn´e figure 1.9. Apr`es optimisation
les triangles de la triangulation de Delaunay restreinte sont quasiment ´equilat´eraux.
1.3.3 Calculs du diagramme de Vorono¨ı barycentrique et du diagramme
de Vorono¨ı barycentrique restreint
Pour optimiser les positions des sites et obtenir un diagramme de Vorono¨ı barycentrique
ou un diagramme de Vorono¨ı barycentrique restreint le principe est celui
de nombreuses optimisations :
1. distribuer de mani`ere al´eatoire un ensemble de sites S ;
2. construire le diagramme de Vorono¨ı (restreint) de S `a l’objet ;
3. d´eterminer des nouvelles positions pour les sites S
′
;
4. si un crit`ere de convergence est atteint, terminer l’optimisation, sinon remplacer
S par les nouveaux sites S
′
et retourner `a l’´etape 2.
La question est alors de calculer les nouvelles positions des sites S
′
. L’objectif est
en effet d’atteindre un minimum pour la fonction FCV T (ou FΩ dans le cas restreint).
Une premi`ere strat´egie est de prendre pour les nouveaux points les barycentres des20 Chapitre 1. Objets geom ´ etriques fondamentaux ´
cellules de Vorono¨ı. L’algorithme r´esultant, appel´e algorithme de Llyod [Lloyd, 1982],
converge relativement lentement, c’est-`a-dire qu’il faut beaucoup d’it´erations avant
d’atteindre les minimums, le d´eplacement des sites vers leurs positions optimales
n’´etant pas assez rapide.
Liu et al. [2009] proposent de calculer un diagramme de Vorono¨ı barycentrique en
utilisant un algorithme de type Newton pour minimiser FCV T et sa version restreinte,
son gradient ´etant donn´e par Iri et al. [1984] ´egal `a :
dFCV T
dsi
= 2mi (si − pi∗) (1.7)
o`u mi est le volume de la i`eme cellule de Vorono¨ı. Toutefois ce type d’optimisation
requiert que la fonction FCV T soit de classe C
2
ce qui est presque toujours le cas, `a
l’exception des configurations o`u deux points entrent en collision [Zhang et al., 2012]
ou bien quand un plan m´ediateur co¨ıncide avec une facette du bord [Liu et al., 2009].
Les r´esultats pratiques montrent qu’une m´ethode de type Newton peut ˆetre utilis´ee
pour calculer un diagramme de Vorono¨ı barycentrique ou un diagramme de Vorono¨ı
barycentrique restreint [Liu et al., 2009, Yan et al., 2009, L´evy et Liu, 2010, Merland,
2013].Chapitre 2
Etat de l’art : objectifs et
´
g´en´eration des maillages
2.1 Maillages et g´eomod´elisation
Comprendre l’organisation en trois dimensions des roches dans le sous-sol est
indispensable dans des domaines comme la prospection, l’exploitation, et la protection
des ressources naturelles min´erales ou ´energ´etiques. La mod´elisation g´eologique, ou
g´eomod´elisation, participe `a cet objectif en fournissant des outils pour construire et
analyser des mod`eles du sous-sol. Les maillages sont le fondement de la plupart de
ces outils.
2.1.1 Qu’est ce qu’un maillage ?
D´efinition
Un maillage est une mani`ere de repr´esenter un objet de mani`ere informatique
en l’approchant par un ensemble d’´el´ements simples. Prenons l’exemple d’une ´etoile
dessin´ee dans le plan d´efinie par une infinit´e de points (figure 2.1a). En pla¸cant dix
points sur son bord et en reliant ces points de mani`ere ad´equate, nous obtenons un
maillage du contour de l’´etoile (figure 2.1b) ou de son int´erieur (figure 2.1c).
Figure 2.1 – Maillage d’une etoile. ´ (a) Etoile d´efinie par une infinit´e de points. (b) ´
Maillage du bord de l’´etoile avec 10 sommets et 10 segments. (c) Maillage de l’int´erieur de
l’´etoile avec 8 triangles.22 Chapitre 2. Etat de l’art ´
Figure 2.2 – Maillages invalide et non-conforme. (a) Maillage invalide car deux
segments s’intersectent. (b) Maillage triangul´e valide mais non-conforme.
Dans un cas plus g´en´eral, le maillage d’un objet est d´efini par un ensemble de
sommets associ´e `a un ensemble d’´el´ements reliant ces sommets. Pour que le maillage
soit valide ces ´el´ements doivent respecter trois conditions : leur union est une approximation
de l’objet, leurs int´erieurs sont non vides et l’intersection des int´erieurs
de deux ´el´ements est vide [Frey et George, 1999]. Les maillages des figures 2.1b, 2.1c
et 2.2b sont valides alors que le maillage figure 2.2a est invalide. Les segments reliant
deux sommets sont les ´el´ements de dimension 1. Les ´el´ements de dimension 2, les facettes,
sont des polygones, les plus simples ´etant les triangles et les quadrilat`eres. Les
´el´ements de dimension 3 sont des poly`edres, par exemple les hexa`edres ou t´etra`edres,
ils sont appel´es cellules du maillage.
Le maillage est conforme si l’intersection de deux ´el´ements est, soit vide, soit
un ´el´ement commun aux bords de ces deux ´el´ements (figure 2.2c). Le maillage est
contraint si des ´el´ements sont impos´es au moment de sa construction, tr`es souvent ce
sont des ´el´ements maillant la fronti`ere du domaine. Nous dirons que deux maillages
sont conformes si le maillage r´esultant de l’union de leurs ´el´ements est conforme. Par
exemple, le maillage de l’int´erieur de l’´etoile (figure 2.1c) est conforme au maillage
de son contour (figure 2.1b).
Types de maillages
Le type d’un maillage est d´efini par le type de ses ´el´ements et par leur connectivit´e
1
. Cette derni`ere d´etermine deux classes de maillages, les maillages structur´es,
qui ont une connectivit´e r´eguli`ere, c’est-`a-dire que tous leurs sommets ont le
mˆeme nombre de voisins, et les maillages non-structur´es, qui n’ont pas une connectivit´e
r´eguli`ere. Les maillages non-structur´es sont tr`es divers, ce sont principalement
leurs ´el´ements constitutifs qui les diff´erencient ; soit ces ´el´ements sont des poly`edres
quelconques, soit ils sont de types connus. Lorsque les ´el´ements sont tous du mˆeme
type, le type du maillage est d´eriv´e du nom des ´el´ements : maillage quadrangulaire,
maillage triangul´e, maillage h´exa´edrique, maillage t´etra´edrique, maillage prismatique,
etc. Lorsque le maillage contient des ´el´ements de diff´erents types, il est dit hybride 2
.
Un maillage est simplicial s’il est uniquement constitu´e de simplexes. Nous rap-
1. La connectivit´e d’un ´el´ement est d´efinie par les connexions de ses sommets.
2. Certains auteurs disent mixte.Maillages et geomod ´ elisation ´ 23
Figure 2.3 – Simplexes dans R
3
.
pelons qu’un d-simplexe est un ´el´ement correspondant `a l’enveloppe convexe d’un
ensemble de d + 1 sommets de R
n
(d ≤ n) ind´ependants de mani`ere affine 3
. L’enveloppe
convexe est d´efinie comme le plus petit ensemble convexe qui contient ces
sommets, c’est-`a-dire un ensemble qui contient les segments reliant chacune des paires
de points de l’ensemble. Dans R
3
, les 0-simplexes sont les points, les 1-simplexes sont
des segments, les 2-simplexes sont des triangles et les 3-simplexes sont des t´etra-
`edres (figure 2.3). L’avantage d’un maillage simplicial est que tous ses ´el´ements sont
convexes et que toutes ses facettes sont planes.
2.1.2 Objectifs des maillages en g´eomod´elisation
Des maillages pour repr´esenter les mod`eles
Comme nous l’avons vu dans la partie pr´ec´edente, les maillages sont tout d’abord
un moyen de repr´esenter un objet par une union finie d’´el´ements g´eom´etriques simples
et born´es. Les objets auxquels nous nous int´eressons dans ces travaux sont les mod`eles
structuraux du sous-sol. Il y a deux grands types de repr´esentations pour ces mod`eles
qui d´elimitent les diff´erents volumes rocheux.
Maillage volumique
Dans une repr´esentation volumique, les r´egions du mod`ele structural sont maill´ees,
et chaque cellule du maillage est associ´ee `a un type de roche. Le maillage le plus simple
est sans doute un d´ecoupage r´egulier du mod`ele en pav´es, similaire `a une image num´erique
en trois dimensions (figure 3a). Comme nous le verrons dans la partie 2.1.3,
les maillages constitu´es d’hexa`edres ou de t´etra`edres sont les plus utilis´es.
Repr´esentation par fronti`eres
Dans une repr´esentation d’un mod`ele par fronti`eres 4
, le mod`ele est d´ecrit par les
surfaces d´elimitant ses r´egions volumiques (figures 2.4 et 3b). Cette repr´esentation
est plus l´eg`ere en m´emoire, plus flexible, et permet de repr´esenter une grande partie
des configurations naturelles. Elle est ´egalement particuli`erement adapt´ee au cas des
mod`eles structuraux qui sont construits `a partir des surfaces g´eologiques d´elimitant
les couches de roches (horizons, failles, discordances, etc). La question est alors de
mailler ces surfaces, elles sont g´en´eralement triangul´ees 5
[Caumon et al., 2009]. Dans
3. Ceci exclut les cas o`u trois sommets sont align´es et ceux o`u quatre sommets sont coplanaires.
4. Aussi appel´e B-Rep, pour Boundary Representation.
5. Les surfaces, ensemble de points de coordonn´ees (x, y, z), peuvent ´egalement ˆetre repr´esent´ees
de mani`ere implicite f(x, y, z) = 0, param´etrique (x, y, z) = σ(u, v) ou explicite z = f(x, y).24 Chapitre 2. Etat de l’art ´
Figure 2.4 – Regions volumiques dans un mod ´ ele d ` efini par fronti ´ eres. ` Chaque
r´egion est d´efinie par ses surfaces limites. Certaines r´egions de ce mod`ele ne sont pas affich´ees
(voir aussi figure 3).
Figure 2.5 – Surfaces triangulees d’un mod ´ ele structural d ` efini par fronti ´ eres. `
Les surfaces d´efinissant la zone d’int´erˆet ne sont pas affich´ees. Les maillages des surfaces en
contact, sont conformes.
ces travaux, nous consid´erons uniquement des mod`eles dans lesquels les maillages des
surfaces sont conformes (figure 2.5). Les connexions entre surfaces peuvent alors ˆetre
d´etermin´ees `a partir de leur g´eom´etrie.
Des maillages pour r´ealiser des simulations num´eriques
En g´eomod´elisation comme en conception, un mod`ele est construit pour r´epondre
`a un ensemble de questions d´ependantes du domaine d’application, par exemple :
Comment les couches de roches ont-elle ´et´e d´eform´ees depuis leur formation ? Quelle
est la quantit´e de p´etrole r´ecup´erable ? Quel est l’impact du creusement d’un tunnel
sur la stabilit´e d’un massif ? Les processus mod´elisant la d´eformation m´ecanique
des roches, les ´ecoulements de fluides, la propagation de chaleur et la propagation
d’ondes sont mod´elis´es par des ´equations aux d´eriv´ees partielles, qui ne peuvent pas,
dans le cas g´en´eral, ˆetre r´esolues de fa¸con exacte (analytiquement), et sont r´esolues
de mani`ere approch´ee (num´eriquement). Depuis les d´ebuts des m´ethodes de r´esolutions
num´eriques, les maillages leurs sont associ´es comme moyen de discr´etiser l’espace
[Baker, 2005]. Ils sont un pr´e-requis `a toute simulation num´erique. Comme en
g´eomod´elisation les propri´et´es (composition, porosit´e, perm´eabilit´e, etc) des roches
varient au sein d’une r´egion du mod`ele, les maillages sont ´egalement le support de
stockage de ces propri´et´es.Maillages et geomod ´ elisation ´ 25
Figure 2.6 – Grille curvilineaire. ´ Les hexa`edres du maillage sont d´eform´es pour ˆetre
align´es sur les horizons et les failles. Les cellules adjacentes `a la surface d’´erosion (voir figure 3)
sont d´eg´en´er´ees et des cellules inactives sont cr´e´ees pour que la grille soit r´eguli`ere.
Nous ne d´etaillons pas ici les ´equations intervenant en g´eosciences. Les ´equations
d’´ecoulement en milieux poreux sont d´ecrites dans Farmer [2005], les ´equations en
g´eom´ecanique et transfert de chaleur dans Turcotte [2002], les ´equations de propagation
des ondes dans Aki et Richards [2009] et les ´equations mod´elisant les processus
de bassin dans Mello et al. [2009]. Nous ne donnons pas non plus de d´etails sur les
diff´erents sch´emas de r´esolution num´erique des ´equations aux d´eriv´ees partielles, le
lecteur est r´ef´er´e `a Allaire [2005] et Saad [2003] pour une description des principaux
sch´emas num´eriques : diff´erences finies, ´el´ements finis et volumes finis.
2.1.3 Maillages volumiques utilis´es en g´eomod´elisation
Si les surfaces des mod`eles g´eologiques structuraux sont souvent maill´ees par des
triangles, la diversit´e des maillages volumiques est plus grande.
Maillages pour la simulation d’´ecoulement
La plupart des maillages d´evelopp´es en g´eomod´elisation le sont pour la simulation
des ´ecoulements dans les r´eservoirs p´etroliers dont l’objectif principal est d’estimer
l’´evolution de la production d’hydrocarbures. Les maillages volumiques les plus
simples sont probablement les grilles cart´esiennes qui divisent r´eguli`erement les mod`eles
en pav´es (figure 3). Sur ces maillages structur´es, des sch´emas num´eriques de
type diff´erences finies, qui sont plus simples `a programmer et tr`es efficaces en temps
d’ex´ecution peuvent ˆetre utilis´es. En revanche, comme tous leurs ´el´ements ont la
mˆeme g´eom´etrie et la mˆeme connectivit´e, l’approximation des objets mod´elis´es est
souvent inacceptable du point de vue de la fiabilit´e de la simulation obtenue.
Grilles curvilin´eaires
Les grilles curvilin´eaires ou stratigraphiques 6
sont des maillages r´eguliers, constitu´es
d’hexa`edres qui sont d´eform´es afin d’ˆetre align´es sur les limites de couches g´eologiques
et les failles (figure 2.6). Cependant, dans les zones o`u ces limites s’intersectent,
6. Elles sont ´egalement appel´ees corner-point grids en anglais.26 Chapitre 2. Etat de l’art ´
les cellules ne peuvent pas, en g´en´eral, ˆetre align´ees avec toutes ces couches. Des cellules
d´eg´en´er´ees ou inactives sont alors cr´e´ees et certaines limites g´eologiques sont
supprim´ees ou approxim´ees en marches d’escalier, notamment les failles. Ces grilles
sont g´en´eralement g´en´er´ees par extrusion du maillage quadrangulaire d’un des horizons,
cr´eant ainsi le nombre souhait´e de couches d’hexa`edres. Elles sont massivement
utilis´ees dans un contexte d’exploration-production p´etroli`ere pour le remplissage g´eostatistique
des propri´et´es des roches et la simulation d’´ecoulements (voir par exemple
[Farmer, 2005]).
Maillages non-structur´es
Les maillages non-structur´es, dans lesquels les connectivit´e, taille, aspect et orientation
des ´el´ements sont variables, permettent de mieux capturer la g´eom´etrie des
mod`eles. Ils sont relativement peu utilis´es pour la simulation d’´ecoulement, puisque
les matrices r´esultant de la discr´etisation n’ont g´en´eralement pas un motif r´egulier
et sont plus coˆuteuses `a stocker et `a inverser. Toutefois, les simulateurs r´ecemment
d´evelopp´es, comme GPRS [Cao, 2002] et IX [DeBaun et al., 2005], et les travaux sur
de nouveaux sch´emas de discr´etisation (voir par exemple Eymard et al. [2012]) vont
peut ˆetre changer la donne.
La diversit´e des maillages non-structur´es est tr`es grande, nous en donnons ici
quelques uns utilis´es pour la simulation r´eservoir. Les grilles tronqu´ees sont obtenues
en d´ecoupant des grilles structur´ees, et ce, g´en´eralement par les failles sur lesquelles
la grille n’est pas align´ee [Lasseter et Jackson, 2004]. Ces grilles peuvent ˆetre raffin´ees
autour des zones d’int´erˆet [Sword et al., 2013] ce qui leur donne une grande flexibilit´e.
Les maillages semi-structur´es, c’est-`a-dire structur´es dans au moins une direction de
l’espace, sont similaires aux grilles stratigraphiques. La diff´erence est que les cellules
sont construites, en extrudant, non pas des quadrangles, mais des cellules de Vorono¨ı,
des triangles, ou bien un m´elange de diff´erents ´el´ements (voir par exemple Lepage
[2003]). Les maillages modulaires, directement li´es `a la d´ecomposition du mod`ele en
diff´erents blocs, les modules, sont constitu´es des maillages de ces diff´erentes parties.
Ceci permet d’utiliser des grilles r´eguli`eres dans les zones de faibles int´erˆet et d’adapter
les ´el´ements dans les zones plus importantes du point de vue de la simulation, voir
par exemple Flandrin et al. [2006] et Lepage [2003]. La difficult´e est alors de g´en´erer
le maillage reliant les diff´erents modules. Le dernier grand type de maillage nonstructur´e
est les grilles de poly`edres convexes quelconques, voir par exemple Merland
[2013].
Maillages pour d’autres applications
La diversit´e des maillages pour les applications autres que la simulation r´eservoir
est beaucoup plus r´eduite. Une grande partie des probl`emes m´ecaniques, thermiques
ou de propagation d’ondes sont r´esolus avec des m´ethodes num´eriques de type ´el´ement
fini. Les maillages utilis´es sont souvent des maillages simpliciaux car ils peuvent ˆetre
adapt´es `a toutes les g´eom´etries. Les maillages t´etra´edriques sont utilis´es en restauration
g´eom´ecanique, pour v´erifier la coh´erence des mod`eles ou comprendre l’´evolution
temporelle de certaines structures (voir par exemple Durand-Riard et al. [2011] et
Vidal-Royo et al. [2012]), pour calculer la propagation des ondes sismiques [LelievreQualite d’un maillage et d ´ efis de g ´ en´ eration ´ 27
Figure 2.7 – Utilisation d’un maillage tetra ´ edrique pour la restauration d’un ´
pli (tire de ´ Durand-Riard [2010]). L’horizon sup´erieur pliss´e est restaur´e dans son ´etat
de d´epˆot, c’est-`a-dire `a l’horizontale.
et al., 2012], la diffusion de la chaleur [Liu et al., 2012], ou les ´ecoulements en milieux
fractur´es [Mustapha et Mustapha, 2007]. Ils sont aussi utilis´es pour mod´eliser de
mani`ere implicite les horizons stratigraphiques dans un espace d´epˆot [Mallet, 2004].
Moretti [2008] et [Moretti et al., 2006] utilisent une grille curvilin´eaire align´ee sur les
horizons et les failles (sans cellule d´eg´en´er´ee ou d´esactiv´ee) pour des calculs de restauration.
L’utilisation de maillages hexa´edriques non-structur´es reste limit´ee puisque
l’automatisation de leur g´en´eration est difficile [Owen et Shelton, 2014].
2.2 Qualit´e d’un maillage et d´efis de g´en´eration
Nous avons vu dans la partie pr´ec´edente que les maillages ont deux objectifs
principaux en g´eomod´elisation : repr´esenter un mod`ele du sous-sol de mani`ere approch´ee
et r´ealiser des simulations num´eriques dans ce mod`ele. Pour avoir des r´esultats
fiables, rapides et robustes, le maillage doit respecter des crit`eres sur le nombre, la
taille et la forme de ses ´el´ements. Nous voyons dans cette partie comment ces crit`eres
de qualit´e sont parfois contradictoires, comment identifier les zones o`u ils le sont, et
comment prendre en compte de mani`ere ad´equate ces zones lors de la g´en´eration du
maillage.
2.2.1 Qualit´e d’un maillage
La qualit´e d’un maillage est un ensemble de crit`eres qui ´evalue son influence sur
la pr´ecision et l’efficacit´e des applications dans lesquels il est utilis´e. Par exemple
le maillage figure 2.8b donne une estimation moins pr´ecise du p´erim`etre de l’´etoile
que les maillages des figures 2.8a et c. Le maillage optimal est celui, qui pour une
application donn´ee, permet d’atteindre la pr´ecision souhait´ee tout en comptant le
moins d’´el´ements possible.
Qualit´e d’approximation du mod`ele
La qualit´e d’approximation des mod`eles par fronti`eres se r´eduit `a la qualit´e d’approximation
de ces fronti`eres. Les premiers crit`eres de mesure de la fid´elit´e de la repr´esentation
d’un objet (mod`ele) par un maillage sont g´eom´etriques. Il s’agit d’´evaluer28 Chapitre 2. Etat de l’art ´
Figure 2.8 – Qualite de l’approximation par maillages d’une ´ etoile. ´ Les trois
maillages de la mˆeme ´etoile sont trois approximations diff´erentes. Les distances de Hausdorff
entre le mod`ele initial et le maillage (d0 < d1 < d2) indiquent que la meilleure approximation
g´eom´etrique est le maillage (c) dont la caract´eristique d’Euler est incorrecte car un segment
manque. La topologie des maillages (a) et (b) est correcte mais l’approximation de l’´etoile
est vraiment mauvaise pour le maillage en (b).
Figure 2.9 – Distance de Hausdorff entre deux lignes X et Y. sup(F) d´esigne la
borne sup´erieure de F et inf(F) sa borne inf´erieure.Qualite d’un maillage et d ´ efis de g ´ en´ eration ´ 29
les diff´erences de propri´et´es des surfaces du mod`ele et du maillage, calcul de distance,
calcul de diff´erences de normale, de courbure, etc. [Frey et George, 1999]. Ces
diff´erences peuvent ˆetre ´evalu´ees localement pour chaque sommet, arˆete ou triangle,
ou bien globalement. Parmi les mesures possibles, la distance de Hausdorff ´evalue
la proximit´e entre deux mod`eles. Pour deux objets X and Y elle est d´efinie comme
(figure 2.9) :
dH(X, Y ) = max {supx∈X infy∈Y d(x, y)|supy∈Y infx∈X d(y, x)}.
Les crit`eres topologiques ´evaluent la fid´elit´e du maillage au mod`ele initial ind´ependamment
de sa g´eom´etrie. Dans un mod`ele par fronti`eres, il s’agit notamment
de v´erifier que les connexions entre les surfaces restent les mˆemes et que la topologie
de chacune des surfaces reste la mˆeme. Dire que deux domaines ont la mˆeme
topologie signifie, en g´en´eral, en informatique graphique, que l’objet initial et son
maillage sont hom´eomorphes (partie 1.2.4). S’il est possible de prouver que le r´esultat
d’un algorithme de maillage est hom´eomorphe `a la surface d’entr´ee (partie 1.2.4)
il n’est pas, `a notre connaissance, possible de calculer en pratique s’il l’est. Dans le
cas o`u le mod`ele initial est maill´e, des propri´et´es plus faibles, comme la caract´eristique
d’Euler-Poincar´e : X= S − A + F, avec S le nombre de sommets, A le nombre
d’arˆetes, et F le nombre de facettes, ou l’homologie [Boltcheva et al., 2011] peuvent
ˆetre compar´ees. Par exemple, l’´etoile remaill´ee sur la figure 2.8c n’est pas correcte,
car sa caract´eristique d’Euler vaut 1, alors que celle du contour de l’´etoile, une ligne
ferm´ee, vaut 0.
Qualit´e du maillage pour les simulations num´eriques
L’influence d’un maillage sur la pr´ecision et l’efficacit´e des simulations num´eriques
qui visent `a r´esoudre des ´equations aux d´eriv´ees partielles peut ˆetre grande.
Cette influence d´epend de nombreux facteurs parmi lesquels le processus physique
simul´e, la m´ethode de discr´etisation, les propri´et´es g´eom´etriques du maillage (distances,
courbure, angles, etc.), voir Knupp [2007], Berzins [1999] et les r´ef´erences
cit´ees. La qualit´e d’un maillage est d´efinie par Knupp [2007] comme l’ensemble des
caract´eristiques du maillage qui permettent que les calculs li´es `a une simulation num´erique
particuli`ere soient efficaces, fid`eles `a la physique, et obtenus avec la pr´ecision
demand´ee. Un maillage est de meilleure qualit´e si les erreurs qui lui sont imputables
plus faibles que pour un autre. Ces erreurs peuvent ˆetre ´evalu´ees a priori, en contrˆolant
certaines propri´et´es du maillage, ou a posteriori, en contrˆolant le r´esultat de la
simulation.
En pratique des crit`eres visant `a ´eliminer les ´el´ements cr´eant (a priori) des dif-
ficult´es pour la simulation num´erique d’un processus (suppos´e isotrope) sont utilis´es
en g´en´eration de maillage, voir par exemple la synth`ese de Field [2000]. Ces ´el´ements
sont notamment ceux ayant des petits ou grands angles (figure 2.10) ou bien ceux
dont la taille des arˆetes n’est pas dans l’intervalle souhait´e (longueurs minimale et
maximale des arˆetes).
Pour r´esumer, d´efinir la qualit´e d’un maillage ind´ependamment d’une application
n’a pas de sens. Cette application implique le plus souvent une ´equation aux d´eriv´ees
partielles et un sch´ema num´erique, et suivant ceux-ci, certaines caract´eristiques d’un
maillage deviennent d´esirables ou n´efastes. Par exemple, certains codes de calcul30 Chapitre 2. Etat de l’art ´
Figure 2.10 – Tetra ´ edres a priori de mauvaise qualit ` e, tir ´ e de ´ Shewchuk [2012].
requi`erent des ´el´ements quasiment ´equilat´eraux, tandis que d’autres se comporteront
mieux avec des ´el´ements anisotropes, d´eform´es selon les directions pr´ef´erentielles de
telle ou telle propri´et´e physique.
2.2.2 Effet n´egatifs de la g´eom´etrie du mod`ele
Les r´egions fines, celles fortement courb´ees, ou bien celles pr´esentant des surfaces
s’intersectant `a angle faible sont g´en´eralement incompatibles avec ces crit`eres de
qualit´e. Un mod`ele o`u un angle entre deux surfaces vaut 16 degr´es implique qu’au
moins un des ´el´ements du maillage aura un angle `a 16 degr´es (figure 4b).
Dey et al. [1997] d´efinissent les petites caract´eristiques du mod`ele comme les
composantes, ou morceaux des composantes, du mod`ele dont la taille est inf´erieure
`a celle qui permettrait de construire un maillage dont les ´el´ements satisfont des crit`eres
donn´es. Comme ces crit`eres d´ependent de l’application et ne sont pas toujours
clairement d´efinis, l’identification de ces petites caract´eristiques peut ˆetre compliqu´ee
et est souvent faite par les modeleurs et/ou ing´enieurs en charge de la construction
du mod`ele et des simulations [Quadros et Owen, 2012]. Cependant leur identification
automatique et leur prise en compte, avant, pendant, ou apr`es la g´en´eration du
maillage facilitent l’obtention d’un maillage de qualit´e.
2.2.3 Gestion des caract´eristiques probl´ematiques du mod`ele
Dans cette partie, nous nous int´eressons aux m´ethodes permettant d’identifier et
de g´erer les zones complexes pour la g´en´eration du maillage d’un mod`ele d´efini par
fronti`eres, ind´ependamment de la repr´esentation des surfaces du mod`ele, de l’objectif
dans lequel il est construit, ou de la m´ethode de maillage utilis´ee. Les ´el´ements
probl´ematiques dans les mod`eles structuraux seront d´ecrits dans le chapitre 3.
Pr´e-identification
L’identification des petites caract´eristiques dans un mod`ele par fronti`eres peut
ˆetre faite `a l’aide d’un ensemble de mesures ´evaluant la proximit´e entre deux surfaces
(distance `a la surface m´ediane), la proximit´e entre les bords des surfaces (distance `aQualite d’un maillage et d ´ efis de g ´ en´ eration ´ 31
l’axe m´edian), la courbure des surfaces, la longueur des bords des surfaces, leur courbure
[Quadros et Owen, 2012]. Les arˆetes et points anguleux 7 d’un mod`ele peuvent
´egalement ˆetre un d´efi, ils sont g´en´eralement pr´e-identifi´es. Si ce n’est pas le cas, ils
peuvent ˆetre recalcul´es, voir Botsch et al. [2010].
La complexit´e du mod`ele peut ´egalement ˆetre ´evalu´ee localement dans une subdivision
du mod`ele. Andrle [1996] utilise des cercles de rayons variables pour calculer
une mesure d’angle `a une r´esolution et ´evaluer la complexit´e de lignes g´eomorphiques.
Lindsay et al. [2013] proposent de compter pour chaque cellule d’une grille structur´ee
le nombre de mat´eriaux ´echantillonn´es par cette cellule et ses voisins. C’est ´egalement
sur ce principe de subdivision que fonctionnent les m´ethodes de calcul de dimension
fractale par comptage par boˆıte 8
, voir par exemple Kruhl [2013].
Simplification du mod`ele
La solution de gestion la plus radicale des zones complexes est sans doute de les
supprimer ou, tout du moins, de les modifier pour les rendre moins complexes avant
d’en g´en´erer un maillage. En mod´elisation g´eologique, la simplification de la g´eom´etrie
des mod`eles est souvent n´ecessaire, mais la litt´erature se concentre sur le probl`eme de
la mise `a l’´echelle des propri´et´es des roches, voir la revue de Durlofsky [2005], et est
rare `a ce sujet, `a l’exception de travaux sur les r´eseaux de fractures [Bourbiaux et al.,
2002, Mustapha et al., 2011]. En conception assist´ee par ordinateur les m´ethodes sont
nombreuses pour simplifier les mod`eles et supprimer les caract´eristiques qui affectent
la robustesse d’une simulation. Thakur et al. [2009] en font une tr`es bonne synth`ese.
Les trois strat´egies qui nous paraissent pertinentes pour la simplification de mod`eles
structuraux sont les m´ethodes qui op`erent sur les composantes surfaciques du mod`ele,
les m´ethodes qui op`erent dans le volume, et les m´ethodes de r´eduction de dimension.
Les premi`eres simplifient le mod`ele ou son maillage par modifications locales
[Shephard et al., 1998, Sheffer, 2001, Quadros et Owen, 2012]. La g´en´eralisation de
l’op´eration de contraction d’arˆetes propos´ee par Garland et Heckbert [1997] permet
de regrouper des sommets proches pour modifier la topologie des mod`eles. Cette
strat´egie a notamment ´et´e utilis´ee par Mustapha et al. [2011] pour modifier le maillage
de r´eseaux de fractures discrets.
La m´ethode volumique propos´ee par Andujar et al. [2002] op`ere sur une subdivision
r´ecursive du mod`ele `a l’aide d’un octree. Les cellules `a l’ext´erieur et `a l’int´erieur
du mod`ele sont identifi´ees et le mod`ele est reconstruit `a partir des cellules
restantes. Diff´erents niveaux de simplification sont obtenus pour diff´erentes profondeurs
d’arbres. Le fait de consid´erer le mod`ele dans sa globalit´e permet d’analyser
localement les relations entre ses diff´erentes composantes.
La r´eduction de dimension d’un mod`ele est une technique de simplification utilis´ee
en conception assist´ee par ordinateur. Par exemple, une barre cylindrique (3D)
peut ˆetre remplac´ee par une ligne (1D) sans impact significatif sur la pr´ecision de
certaines simulations [Thakur et al., 2009]. Les mod`eles r´esultants peuvent contenir
des composantes dont la dimension intrins`eque varie. Les maillages `a g´en´erer sont
7. sharp features
8. box-counting32 Chapitre 2. Etat de l’art ´
mixtes, ils contiennent des ´el´ements de dimensions diff´erentes (figure 1.5c), e.g. [Robinson
et al., 2011]. Il faut ´egalement transf´erer correctement les propri´et´es associ´ees
aux composantes du mod`ele. En g´eomod´elisation, les failles, qui sont en r´ealit´e des
volumes d’endommagement des roches, sont mod´elis´ees par des surfaces auxquelles
sont associ´ees des propri´et´es sp´ecifiques comme les multiplicateurs de transmissibilit´e
[Manzocchi et al., 1999].
Prise en compte dans la g´en´eration du maillage
Pour tenir compte des zones compliqu´ees `a mailler, la plupart des m´ethodes
de maillage d´ependent d’une fonction de taille des ´el´ements pour obtenir des ´el´ements
d’aspect satisfaisant. Cette fonction d´epend g´en´eralement des mesures faites
lors d’une pr´e-identification des zones potentiellement probl´ematiques sur le mod`ele
d’entr´ee, mesures de courbure, de d´eviation des normales, de distance `a l’axe m´edian,
voir par exemple Frey et George [1999] et Quadros et al. [2004]. Outre l’augmentation
du nombre d’´el´ements du maillage, il est ´egalement possible de modifier leur forme et
leur type pour mieux capturer la g´eom´etrie d’un mod`ele et/ou diminuer les erreurs
de simulations num´eriques. A nombre d’´el´ements constant, l’utilisation d’´el´ements
anisotropes peut permettre de mieux respecter la g´eom´etrie d’un domaine et de minimiser
l’erreur d’approximation d’une fonction donn´ee. Une seconde possibilit´e est
d’utiliser des ´el´ements de types diff´erents selon la zone du mod`ele, la troisi`eme est
d’utiliser des ´el´ements de degr´e sup´erieur (courbes). Leur g´en´eration est cependant
plus d´elicate, voir par exemple Luo et al. [2004].
Post-traitement
Quand les zones compliqu´ees ne sont ni pr´e-trait´ees, ni prises en compte lors
de la g´en´eration du maillage, elles peuvent ˆetre identifi´ees apr`es sa g´en´eration en
´evaluant l’ad´equation entre les ´el´ements g´en´er´es et les crit`eres requis [Dey et al.,
1997]. L’avantage est que tous les types de complications possibles sont identifi´es,
l’inconv´enient est qu’il faut g´en´erer un premier maillage volumique. Ce maillage est
ensuite modifi´e localement et it´erativement jusqu’`a ce qu’il se conforme `a ces crit`eres.
Ce raisonnement tr`es g´en´eral est celui des m´ethodes d’optimisation et d’adaptation
de maillage qui modifient it´erativement le maillage jusqu’`a diminuer l’erreur de calcul
sous un seuil admissible [Frey et George, 1999, Loseille, 2008].
2.3 Maillage volumique `a base de t´etra`edres
Dans les deux derni`eres parties de ce chapitre, nous passons en revue les m´ethodes
de g´en´eration de maillages simpliciaux volumiques et surfaciques. Nous commen¸cons
par d´ecrire les grandes m´ethodes de g´en´eration de maillage `a base de t´etra`edres, qui
sont plus simples `a appr´ehender, car la dimension de l’objet `a mailler est la mˆeme
que celle de l’espace dans lequel il est plong´e, `a savoir trois.
Apr`es les grandes m´ethodes de maillage t´etra´edrique, nous d´etaillons des m´ethodes
de maillage plus particuli`erement reli´ees aux travaux men´es durant cette
th`ese : le maillage de mod`eles multi-mat´eriaux et la g´en´eration de maillages hybrides
majoritairement compos´es de t´etra`edres. Pour la g´en´eration d’autres types deMaillage volumique a base de t ` etra ´ edres ` 33
Figure 2.11 – Subdivisions recursives de la bo ´ ˆıte contenant l’etoile. ´
Figure 2.12 – Patrons pour la construction d’un maillage depuis une subdivision.
Le maillage final est construit `a partir des sommets des cellules (points noirs) et des points
d’intersection entre l’´etoile et les cellules (points blancs). A chaque cellule est associ´e un des
dix patrons de d´ecoupage en triangles. Pour ´eviter de cr´eer des triangles de mauvaise qualit´e
les sommets proches sont regroup´es (cercles verts).
maillages, le lecteur est invit´e `a se r´ef´erer aux synth`eses de Thompson et al. [1999],
Frey et George [1999], Baker [2005] et Farmer [2005].
2.3.1 Maillages t´etra´edriques
Les m´ethodes de g´en´eration de maillages t´etra´edriques sont tr`es nombreuses.
Elles peuvent ˆetre reli´ees `a l’une des trois grandes approches suivantes : les m´ethodes
fond´ees sur une subdivision de l’espace (octree), celles par avancement de front et
celles dites Delaunay.
Subdivision de l’espace
Le principe des m´ethodes fond´ees sur une subdivision de l’espace est de d´ecouper
une boˆıte englobante du mod`ele en cellules de tailles variables, puis de construire
les t´etra`edres du maillage en subdivisant ces cellules (voir par exemple [Shephard
et Georges, 1991]). Ce d´ecoupage utilise une structure hi´erarchique d’arbres, d’o`u le
nom de ces m´ethodes en anglais, octree (3D) et quadtree (2D). Une boˆıte englobante34 Chapitre 2. Etat de l’art ´
Figure 2.13 – Principe de maillage par avancee de front. ´ (a) Le front initial est un
maillage de la fronti`ere du domaine. Un segment est choisi et le point optimal pour former
un triangle avec ce segment est d´etermin´e. (b) Une fois le triangle construit le front est mis
`a jour. (c) Front apr`es construction de trois autres triangles.
du mod`ele est d´ecoup´ee en huit (quatre en 2D) cellules, puis chaque cellule est r´ecursivement
d´ecoup´ee en huit (quatre) jusqu’`a un crit`ere d’arrˆet donn´e (figure 2.11).
Ce crit`ere d’arrˆet prend en compte la taille d’´el´ement souhait´ee et un nombre maximal
d’intersections entre les bords du mod`ele et les cellules. Souvent, l’intersection de
chaque feuille avec le bord du mod`ele est tenue d’avoir une seule composante connexe.
Pour contrˆoler les variations des tailles des cellules, les diff´erences de niveaux entre
cellules adjacentes sont limit´ees `a un facteur deux, voir les subdivisions en ligne
pointill´ee ajout´ees sur la figure 2.12. Les sommets des t´etra`edres du maillage final
sont donn´es par l’ensemble des sommets des cellules de l’arbre auxquels sont ajout´es
les intersections entre les cellules et la fronti`ere du domaine et, ´eventuellement, les
sommets de la discr´etisation initiale de la fronti`ere (figure 2.12). Les t´etra`edres (ou
triangles) du maillage final sont construits en subdivisant les cellules de l’arbre selon
des patrons pr´ed´efinis. En deux dimensions, il y a dix patrons (figure 2.12) ; en
trois dimensions, le nombre de configurations est tr`es grand, et des strat´egies plus
g´en´erales de d´ecoupe des octants sont mises en place.
Ces m´ethodes sont relativement robustes et fiables [Frey et George, 1999]. Elles
n´ecessitent de mettre en place des strat´egies pour am´eliorer la qualit´e des ´el´ements
proche des fronti`eres, par exemple regrouper les sommets trop proches l’un de l’autre.
Elles ne requi`erent pas que les fronti`eres du domaine soient discr´etis´ees, leur maillage
´etant un sous-produit du maillage du mod`ele. Si elles le sont, le maillage g´en´er´e n’est
pas conforme `a leur discr´etisation. Notons que, r´ecemment, des m´ethodes de type
octree proposant des garanties sur les angles di`edres des t´etra`edres construits ont ´et´e
propos´ees [Labelle et Shewchuk, 2007, Wang et Yu, 2012].
Avanc´ee de front
La strat´egie des m´ethodes par avanc´ee de front (ou frontales) est de construire le
maillage ´el´ement par ´el´ement en avan¸cant progressivement dans le domaine `a mailler
depuis sa fronti`ere (figure 2.13) [L¨ohner et Parikh, 1988]. Tant que le front de maillage
n’est pas vide, un ´el´ement est construit `a partir d’un de ses segments (2D) ou triangles
(3D). Ces m´ethodes d´eterminent de mani`ere heuristique les points `a cr´eer et les
´el´ements `a construire, ce qui permet d’obtenir des ´el´ements qui ont la taille et la
forme souhait´ee. Par construction, le maillage respecte la fronti`ere du domaine, et
la qualit´e des ´el´ements le long de cette fronti`ere est tr`es bonne, au contraire des
m´ethodes par subdivision ou de type Delaunay. La construction d’un ´el´ement impliqueMaillage volumique a base de t ` etra ´ edres ` 35
Figure 2.14 – Maillages de type Delaunay, contraint et par raffinement, tire´
de Shewchuk [2012]. (a) La triangulation de Delaunay des sommets du bord de l’objet ne
contient pas un des segments de ce bord. (b) La triangulation de Delaunay obtenue en ins´erant
des points de Steiner. (c) La triangulation de Delaunay contrainte contient ce segment.
Figure 2.15 – Insertion d’un point dans une triangulation de Delaunay, algorithme
de Bowyer-Watson, modifie d’apr ´ es` Shewchuk [2012].
de (1) s´electionner un ´el´ement du front selon un crit`ere sp´ecifique, (2) d´eterminer un
point optimal pour construire un ´el´ement du maillage final bas´e sur celui du front, (3)
chercher si un point existant du maillage peut remplacer ce point optimal, (4) former
l’´el´ement, (5) tester si cet ´el´ement est valide et changer le point optimal si ce n’est pas
le cas, et enfin, (6) mettre `a jour le front. La convergence des m´ethodes par avanc´ee
de front n’est pas garantie en trois dimensions, mais des strat´egies efficaces peuvent
ˆetre mises en place pour l’obtenir. Par exemple, le logiciel NetGen 9
impl´emente une
m´ethode de ce type [Sch¨oberl, 1997].
Delaunay
Le troisi`eme grand type de m´ethodes de g´en´eration de maillages t´etra´edriques
est celui des m´ethodes fond´ees sur la triangulation de Delaunay (partie 1.1.2). Leur
principe est de construire la triangulation de Delaunay d’un ensemble de points et de
modifier cet ensemble de points et/ou cette triangulation pour atteindre les crit`eres
de qualit´e souhait´es, voir ´egalement George et Borouchaki [1997], Cheng [2013] et le
cours de Shewchuk [2012]. Elles sont fond´ees sur la proc´edure qui permet d’ins´erer un
9. http://www.hpfem.jku.at/netgen/36 Chapitre 2. Etat de l’art ´
Figure 2.16 – Principe du maillage par optimisation Vorono¨ı-Delaunay.
point dans une triangulation de Delaunay en gardant une triangulation de Delaunay
(figure 2.15).
Les m´ethodes de type Delaunay contraint visent avant tout `a reconstituer la discr´etisation
des fronti`eres du domaine d’entr´ee dans le maillage g´en´er´e (figure 2.14a).
Les sommets de la fronti`ere du mod`ele sont ins´er´es dans le maillage d’une boˆıte englobante
du mod`ele. Il faut ensuite recouvrer, point tr`es d´elicat en trois dimensions, les
´el´ements de la fronti`ere qui ne sont pas dans la triangulation de Delaunay 10. Des sommets
suppl´ementaires sont ensuite ins´er´es dans le mod`ele jusqu’`a ce que des crit`eres
de taille et d’aspect des ´el´ements soient remplis [George et al., 1991, Borouchaki et al.,
1997, Shewchuk, 2002a, Si et G¨artner, 2011, Si, 2010]. Des logiciels comme Tetgen 11
et MG-Tetra 12 permettent d’obtenir des t´etra´edrisations contraintes de mod`eles d´e-
finis par des surfaces triangul´ees conformes.
Le principe des m´ethodes de type raffinement de Delaunay, est d’ins´erer it´erativement
des sommets au centre des sph`eres circonscrites aux t´etra`edres qui ne satisfont
pas un crit`ere donn´e [Chew, 1997, Shewchuk, 1998, Cheng et al., 2005, Shewchuk,
2002b, Cohen-Steiner et al., 2004, Rineau et Yvinec, 2007, Si, 2008]. Souvent ce crit`ere
est fonction du ratio entre le rayon de la sph`ere circonscrite au t´etra`edre et la
longueur de sa plus courte arˆete, car il est alors prouv´e que, sous certaines conditions,
l’algorithme se termine. Ces m´ethodes fournissent des garanties sur les angles di`edres
minimaux dans le maillage final. Les diff´erences entre algorithmes sont sur la gestion
du bord de l’objet dont la discr´etisation est en g´en´eral modifi´ee. Gmsh 13, TetGen,
NetGen et la librairie CGAL 14 impl´ementent ce type de m´ethode. La qualit´e des
maillages obtenus est a priori relativement bonne, en revanche le contrˆole du nombre
de sommets ajout´e est difficile et les fronti`eres du domaine sont remaill´ees.
Optimisation Vorono¨ı-Delaunay
Une seconde strat´egie pour g´en´erer des maillages de type Delaunay consiste `a
d´eterminer les positions de tous les sommets du maillage final avant d’en construire
la triangulation de Delaunay [Du et Wang, 2003, Alliez et al., 2005a, Tournois et al.,
10. Ce maillage n’est plus alors dans la plupart des cas strictement Delaunay.
11. http://wias-berlin.de/software/tetgen/
12. http://www.meshgems.com/volume-meshing-meshgems-tetra.html
13. http://geuz.org/gmsh/
14. http://www.cgal.org/Maillage volumique a base de t ` etra ´ edres ` 37
2009, Tournois, 2009, Dardenne et al., 2009, L´evy et Liu, 2010]. Dans un premier
temps un nombre donn´e de points est distribu´e pour ´echantillonner la surface ou le
volume `a mailler, puis les coordonn´ees de ces points sont optimis´ees afin de minimiser
une fonction objectif, enfin la triangulation de Delaunay des points est construite
et donne le nouveau maillage (figure 2.16). Cette fonction objectif est d´eriv´ee de
celle du diagramme de Vorono¨ı barycentrique (section 1.3.1) et/ou de la notion de
triangulation de Delaunay optimale [Chen et Xu, 2004].
Les deux caract´eristiques qui distinguent cette approche des m´ethodes plus classiques
de maillage sont que (1) le nombre de sommets est fix´e et que (2) la qualit´e et la
forme des t´etra`edres sont globalement contrˆol´ees par la fonction objectif. Cependant
leur coˆut de calcul est grand devant celui des m´ethodes d´ecrites pr´ec´edemment. Remarquez
que le fait de consid´erer le diagramme de Vorono¨ı rapproche ces m´ethodes
de Delaunay des m´ethodes de type octree. En effet, le diagramme de Vorono¨ı est
une subdivision de l’espace, et le patron pour construire le maillage t´etra´edrique est
donn´e par la relation duale Vorono¨ı-Delaunay (partie 1.1.2). De plus, comme pour les
m´ethodes octree, le maillage des surfaces fronti`eres du domaine peut ˆetre obtenu en
mˆeme temps que le maillage volumique avec la triangulation de Delaunay restreinte
(partie 1.2.3).
2.3.2 Maillage de mod`eles multi-mat´eriaux
Il y a, dans un mod`ele g´eologique, plusieurs unit´es de roches et donc plusieurs
r´egions. L’objectif est de mailler, de mani`ere conforme, ces r´egions, les surfaces qui les
d´elimitent et les lignes d’intersection entre ces surfaces, c’est-`a-dire que les t´etra`edres
de part et d’autre d’une surface doivent partager la mˆeme facette triangulaire et les
triangles de part et d’autre d’une ligne de contact doivent partager le mˆeme segment.
Avec une m´ethode de g´en´eration de maillage contraint, c’est-`a-dire qui g´en`ere
un maillage strictement conforme `a une discr´etisation des fronti`eres donn´ee, les r´egions
du mod`ele peuvent ˆetre maill´ees ind´ependamment (figure 2.17). Les m´ethodes
ne g´en´erant pas un maillage contraint sont beaucoup moins robustes. Lepage [2003],
Pr´evost et al. [2005] proposent d’utiliser une version modifi´ee d’une m´ethode de raffi-
nement de Delaunay pour mailler les surfaces des mod`eles structuraux. Les maillages
obtenus sont caract´eristiques de ce type de m´ethode, ils sont tr`es raffin´es dans les
coins des mod`eles.
Les m´ethodes d´evelopp´ees en informatique graphique ne s’int´eressent g´en´eralement
pas au probl`eme de surfaces non-vari´et´es ou aux mod`eles multi-mat´eriaux.
Celles qui le font explicitement sont d´evelopp´ees pour des applications m´edicales.
L’objectif est de g´en´erer des maillages volumiques `a partir d’images num´eriques 3D
(scanner, IRM) afin de r´ealiser des simulations de propagation d’ondes, de chaleur,
etc. La donn´ee d’entr´ee n’est alors pas un mod`ele par fronti`ere. La m´ethode propos´ee
par Sullivan et al. [1997] est bas´ee sur une subdivision par une grille, il en est de
mˆeme pour les travaux plus r´ecents de Zhang et al. [2010], Mohamed et Davatzikos
[2004]. Des m´ethodes de type raffinement de Delaunay [Boltcheva et al., 2009, Dey
et Levine, 2009], ou d’optimisation Vorono¨ı [Dardenne et al., 2009, Dardenne, 2009]
ont ´egalement ´et´e propos´ees.38 Chapitre 2. Etat de l’art ´
Figure 2.17 – Tranche solide dans un maillage tetra ´ edrique d’un mod ´ ele de `
diapir. Le maillage de chaque r´egion est contraint au maillage des surfaces triangul´ees d´efi-
nissant le mod`ele. Les cinq r´egions ont ´et´e maill´ees ind´ependamment les unes des autres avec
TetGen 15
.
2.3.3 Maillage hybride t´etra`edres-prismes
En simulation d’´ecoulements fluides, les zones d’int´erˆets, comme celle entourant
la surface d’un avion, sont maill´ees avec des couches de prismes ou de t´etra`edres. La
plupart des m´ethodes qui construisent ces maillages en couche limite 16 utilisent une
strat´egie de surface (ou de facette) qui avance dans le domaine `a mailler et proposent
des solutions pour obtenir un maillage valide quand la surface d’entr´ee est localement
concave ou anguleuse (voir e.g. [Garimella et Shephard, 2000, Sahni et al., 2008, Dyedov
et al., 2009, Ito et al., 2011]). La zone `a remplir avec des prismes est d´etermin´ee
depuis la surface et une hauteur de prisme est g´en´eralement pr´ed´etermin´ee. Une exception
notable est le travail pr´esent´e par Dyedov et al. [2009], o`u une m´ethode de
face offsetting [Jiao, 2007] est adapt´ee aux g´eom´etries rencontr´ees en biologie. Cette
m´ethode produit des maillages hybrides de tr`es bonne qualit´e dans lesquels l’´epaisseur
des prismes est adapt´ee `a une mesure locale de la taille des objets. Marchandise
et al. [2013] tirent parti de la g´eom´etrie tubulaire des vaisseaux sanguins. Loseille et
L¨ohner [2013] proposent d’utiliser des strat´egies de modifications locales du maillage
pour g´en´erer des couches de prismes.
Pour mailler l’int´erieur de mod`eles, des approches compl´ementaires ont ´et´e d´evelopp´ees.
Garimella et Shephard [1999] raffinent un maillage isotrope t´etra´edrique
quand le nombre de t´etra`edres s´eparant les facettes triangulaires sur deux cˆot´es oppos´es
du mod`ele est inf´erieur `a une valeur donn´ee. Luo et al. [2010] estiment l’axe m´edian
de la surface bordant le mod`ele pour identifier les sections fines. Pour construire les
prismes, ils dupliquent les triangles d’un des cˆot´es du mod`ele.Maillage surfacique a base de triangles ` 39
Figure 2.18 – Operations locales de remaillage de surface. ´
Figure 2.19 – Maillage de surface dans un espace parametrique, modifi ´ e d’apr ´ es`
Geuzaine et Remacle [2009]. Le maillage est g´en´er´e dans le plan sur une projection de
la surface.40 Chapitre 2. Etat de l’art ´
2.4 Maillage surfacique `a base de triangles
Les diff´erentes repr´esentations possibles des surfaces (implicite, param´etrique,
discr´etis´ee) et la diversit´e des applications les utilisant pour repr´esenter des objets
expliquent le grand nombre de m´ethodes pour les mailler. Mailler une surface signifie
en g´en´erer maillage valide ; remailler une surface sous-entend que cette surface est
d´ej`a maill´ee et d´ecrite sous forme discr`ete. Dans ce cas, le maillage initial peut ˆetre
modifi´e afin d’obtenir un second maillage ayant les propri´et´es souhait´ees. Ces modifi-
cations it´eratives, d´eplacement des sommets ou op´erations sur les arˆetes du maillage
(figure 2.18), sont r´ealis´ees tant que des crit`eres de qualit´e donn´es ne sont pas atteints
(´ecart entre les ´el´ements du maillage et la surface d’entr´ee, m´etrique `a respecter, etc.,
voir par exemple [Frey, 2000, Geuzaine et Remacle, 2009, Botsch et al., 2010]).
Le maillage des surfaces dans un espace tridimensionnel a la particularit´e de
consid´erer des objets de dimension inf´erieure `a celle de l’espace. Les m´ethodes param´etriques
op`erent sur une projection de la surface dans le plan alors que les m´ethodes
directes op`erent directement dans l’espace 3D. Lorsqu’une param´etrisation ad´equate
de la surface est disponible, la robustesse des m´ethodes param´etriques est sans doute
la meilleure car, en deux dimensions, les m´ethodes de maillage Delaunay et par avancement
de front sont garanties de terminer. La d´etermination d’une projection peut
elle-mˆeme ˆetre un probl`eme compliqu´e si la surface initiale est discr´etis´ee ou si elle
n’est pas un ouvert. Il est alors possible d’adapter aux surfaces des m´ethodes 2D
comme l’avancement de front [L¨ohner, 1996, Sifri et al., 2003, Peyr´e et Cohen, 2006,
Aubry et al., 2011] et raffinement de Delaunay (2.4.2), ou bien d’utiliser des m´ethodes
d´edi´ees.
2.4.1 Subdivision de l’espace
M´ethodes octree
Nous avons vu dans la partie 2.3.1 que les m´ethodes de maillage t´etra´edrique
fond´ees sur une subdivision de l’espace 3D de type octree ou diagramme de Vorono¨ı
g´en`erent une discr´etisation des fronti`eres du mod`ele, qui est, en quelque sorte, un
produit du maillage volumique. Le bord de l’´etoile (figure 2.12) et celui de la sph`ere
(figure 2.16) sont maill´es lors du maillage leur int´erieur. Que ce soit pour mailler des
surfaces ou un volume, la subdivision octree est la mˆeme. Les points d’intersections
entre les coins, arˆetes, faces des cellules avec la surface (plus des points particuliers)
sont ensuite reli´es pour cr´eer des arˆetes et des boucles (contour de l’intersection d’une
cellule avec la surface) et construire le maillage final [Shephard et Georges, 1991].
Diagramme de Vorono¨ı restreint barycentrique
Pour les m´ethodes de maillage surfacique utilisant une subdivision de type diagramme
de Voronoi barycentrique, c’est l’intersection entre les cellules et le diagramme
de Vorono¨ı qui doit ˆetre barycentrique (partie 1.3.2). L’optimisation de la
subdivision du volume du mod`ele n’est pas n´ecessaire. Les sommets du maillage final
sont les sites optimis´es pour obtenir un diagramme de Vorono¨ı barycentrique restreint
(´equation 1.6).
16. Boundary layerDiscussion 41
Ces m´ethodes permettent de g´en´erer des maillages d’a priori bonne qualit´e. Du
et al. [2003] d´efinissent la notion de diagramme de Vorono¨ı barycentrique contraint
o`u les sites sont contraints `a ˆetre sur la surface, et donnent des r´esultats de maillage
isotrope adaptatif pour des surfaces d´efinies par une fonction f(x, y, z). Alliez et al.
[2005b] remaillent des surfaces triangul´ees en param´etrisant globalement les surfaces,
Surazhsky et al. [2003] en les param´etrisant localement. Yan et al. [2009], Liu et al.
[2009] calculent l’intersection du diagramme de Vorono¨ı avec les surfaces en 3D et
optimisent la fonction objectif donn´ee par l’´equation 1.6. Cette approche est ´etendue
dans L´evy et Liu [2010], pour g´erer les caract´eristiques anguleuses des mod`eles sans
identification pr´ealable et contrˆoler l’´ecartement entre les sites et les surfaces d’entr´ee,
et dans L´evy et Bonneel [2013] pour g´en´erer des maillages anisotropes. Valette et
Chassery [2004], Valette et al. [2008] utilisent une version discr`ete des diagrammes
de Vorono¨ı pour diminuer la r´esolution d’un maillage.
La difficult´e principale pour les m´ethodes de maillage par subdivision de l’espace,
est, qu’a priori, toutes les configurations sont possibles pour les intersections entre
une cellule et le mod`ele. C’est pour ´eviter des configurations trop compliqu´ees que
les cellules sont raffin´ees jusqu’`a avoir des intersections en une composante connexe
et, pour les m´ethodes de type Vorono¨ı, v´erifier par la mˆeme occasion la propri´et´e de
la boule topologique (partie 1.2.4).
2.4.2 Maillage de surfaces avec garanties
Les m´ethodes de raffinement de Delaunay ont ´et´e d`es leurs d´ebuts utilis´ees pour
mailler directement des surfaces en trois dimensions [Chew, 1993]. Comme pour le
maillage t´etra´edrique, des travaux th´eoriques fournissent des garanties sur la topologie
du maillage et/ou sur la qualit´e des ´el´ements. Une partie de ces m´ethodes consid`erent
s´epar´ement l’´echantillonnage de la surface et la construction des triangles, ceci relie la
g´en´eration de maillage de surfaces en 3D `a un probl`eme de reconstruction de surface
[Hoppe et al., 1992, Boissonnat et Cazals, 2000]. C’est dans ce cadre qu’a ´et´e introduite
la notion d’ǫ-´echantillonage (partie 1.2.4) par Amenta et Bern [1999] qui donne
que, lorsque l’´echantillonnage par les sommets est assez dense vis `a vis de la distance `a
l’axe m´edian, ces sommets ont la propri´et´e de la boule topologique (partie 1.2.4) pour
la surface initiale. De la propri´et´e de la boule topologique sont d´eriv´es des travaux
visant `a relˆacher les contraintes pour obtenir un bon ´echantillonage et `a consid´erer
des surfaces plus g´en´erales. A partir de ces travaux sont d´evelopp´es des algorithmes `
de remaillage Delaunay `a garanties, voir par exemple [Boissonnat et Oudot, 2005,
Cheng et al., 2007]. Des travaux plus r´ecents s’int´eressent tout particuli`erement au
maillage de surfaces implicites [Cheng et al., 2009, Dey et Levine, 2009, Gelas et al.,
2009, Dey et al., 2010]
2.5 Discussion
Nous venons de voir que les maillages ont principalement deux objectifs en g´eomod´elisation
: repr´esenter les objets g´eologiques et r´ealiser des simulations num´eriques ;
le tout dans le but de comprendre l’organisation et le comportement du sous-sol. Les
maillages ne sont pas l’apanage de la g´eomod´elisation. Si leurs domaines d’utilisation
sont extrˆemement vari´es, la question de leur g´en´eration int´eresse des communaut´es42 Chapitre 2. Etat de l’art ´
Figure 2.20 – Modele David maill ` e par ´ Valette et al. [2008] et modele synth ` e- ´
tique d’un diapir de sel.
plus restreintes, ce sujet faisant intervenir des comp´etences en informatique, g´eom´etrie,
g´eom´etrie algorithmique, et simulation num´erique.
Les m´ethodes d´evelopp´ees par la communaut´e d’informatique graphique ou de
g´eom´etrie informatique le sont g´en´eralement dans un objectif de mod´elisation de surfaces.
Les objectifs des m´ethodes de maillage d´evelopp´ees pour des les simulations
physiques sont d’obtenir des r´esultats de simulation fiables, assez pr´ecis, et ce, rapidement.
Les objectifs des maillages en g´eomod´elisation sont partag´es entre ces deux
aspects, d’une part mod´eliser les interfaces entre les volumes rocheux, d’autre part
simuler le comportement du sous-sol. Les surfaces ´etudi´ees en informatique graphique
sont plus simples d’un point de vue topologique que les mod`eles structuraux g´eologiques,
g´en´eralement elles sont vari´et´es et n’ont pas de bord, et plus compliqu´ees d’un
point de vue g´eom´etrique, elles peuvent ˆetre tr`es courb´ees et, en comparaison des cheveux
boucl´es du mod`ele David (figure 2.20), les surfaces g´eologiques sont plates et
lisses. Les similarit´es sont plus grandes avec les mod`eles ´etudi´es en conception assist´ee
par ordinateur 17
.
17. L’acronyme anglais CAD, pour Computer Aided Design, est dans le nom du logiciel de g´eomod´elisation
GOCAD.Chapitre 3
Contribution : El´ements
d’´evaluation de la complexit´e
g´eom´etrique des mod`eles
structuraux
Un article correspondant aux travaux pr´esent´es dans ce chapitre est en pr´eparation
pour le journal Mathematical Geosciences. Ce travail a ´et´e r´ealis´e en collaboration
avec Guillaume Caumon, Charline Julio, Pablo Mejia et Arnaud Botella.
R´esum´e
Dans ce chapitre, nous proposons d’analyser les sources de complexit´e g´eom´etrique
dans les mod`eles structuraux `a une r´esolution donn´ee. Nous ne fournissons
pas de crit`ere d´efinitif de complexit´e, mais d´ecrivons de mani`ere syst´ematique les
´el´ements qui contribuent `a la complexit´e d’un mod`ele structural `a l’aide de mesures
des connexions entre les ´el´ements du mod`ele (r´egions, surfaces, lignes et coins) et
de la g´eom´etrie de ces composantes. Les m´etriques propos´ees sont calcul´ees sur un
ensemble de 9 mod`eles synth´etiques.
3.1 Motivations
Le terme complexe est souvent invoqu´e pour qualifier les mod`eles construits ou
analys´es avec telle ou telle m´ethode. Cependant, la notion de complexit´e, dans le sens
de quelque chose qui est difficile `a comprendre, difficile `a r´ealiser, ou bien inhabituel,
est extrˆemement subjective. Elle d´epend de la personne qui porte ce jugement, de sa
formation et de son exp´erience, des moyens mis `a sa disposition, et avant tout, du
probl`eme qu’elle a `a r´esoudre. Un g´eologue structuraliste pourra consid´erer complexe
la r´eactivation de failles normales en failles inverses [Sassi et al., 1993], alors que
cela aura moins d’importance pour l’ing´enieur r´eservoir qui consid´erera complexes
les r´eservoirs o`u les r´eseaux de failles et de fractures ont un contrˆole pr´epond´erant
sur le pi´egeage et la production d’hydrocarbures [Jolley et al., 2007].44 Chapitre 3. Complexite g ´ eom ´ etrique ´
Cette subjectivit´e de la complexit´e rend difficile la comparaison des mod`eles
structuraux, ce qui, plus ou moins directement, rend difficile la comparaison des m´ethodes
d´evelopp´ees en g´eomod´elisation, comparaisons qui sont pourtant essentielles
pour la recherche. Nous nous restreignons ici `a la complexit´e des mod`eles structuraux
du point de vue de la g´en´eration de maillage, ´etape commune `a une grande
partie des applications en g´eomod´elisation et tentons d’apporter des ´el´ements pour
´evaluer la complexit´e relative de deux mod`eles, estimer la r´esolution minimale d’un
maillage d’un mod`ele et identifier les zones probl´ematiques d’un mod`ele `a une r´esolution
donn´ee. La complexit´e est alors li´ee `a la g´eom´etrie et au niveau de d´etail du
mod`ele, dont d´epend la faisabilit´e d’un maillage `a une r´esolution donn´ee localement
ou globalement.
Nous avons vu dans la partie 2.2.3, diff´erentes mesures utilis´ees pour caract´eriser
les zones complexes des mod`eles pour diverses applications, certains auteurs proposant
mˆeme des calculs de complexit´e g´eom´etrique [Quadros et al., 2004] ou de la
complexit´e de la g´en´eration d’un maillage hexa´edrique [White et al., 2005]. Apr`es
avoir analys´e les sources de complexit´e g´eom´etrique dans les mod`eles g´eologiques
(partie 3.2), nous proposons des mesures globales et locales de cette complexit´e (partie
3.3) et les ´evaluons sur des mod`eles synth´etiques (parties 3.4 et 3.5)
3.2 Sources de complexit´e
Avant de donner les sources de complexit´e dans un mod`ele, nous pr´ecisons le
vocabulaire employ´e dans ces travaux. Que ce soit pour les r´egions, les surfaces ou les
lignes du mod`ele par fronti`ere, nous consid´erons ind´ependamment les composantes
connexes des entit´es g´eologiques constitutives du mod`ele. Chaque r´egion volumique
est compl`etement d´efinie par l’ensemble des surfaces qui constituent son bord (fi-
gure 3.1). Ces surfaces sont elles-mˆemes d´efinies par leurs bords, des lignes, qui sont,
soit `a l’intersection de plusieurs surfaces, soit sur le bord d’une seule de ces surfaces.
Les lignes ouvertes sont d´elimit´ees par deux points que nous appellerons coins.
Chaque r´egion, surface, ligne ou coin, correspond `a une seule entit´e g´eologique, une
entit´e g´eologique pouvant ˆetre divis´ee en plusieurs r´egions, surfaces, lignes, et coins
(figure 3.1). Pour qu’un mod`ele soit valide, ses ´el´ements 1 doivent s’intersecter uniquement
au niveau de leurs fronti`eres et les ´el´ements de mˆeme dimension doivent
partager la mˆeme g´eom´etrie le long de ces fronti`eres, leurs maillages doivent ˆetre
conformes.
3.2.1 Nombre d’objets g´eologiques
La complexit´e d’un mod`ele d´epend principalement du nombre de couches qu’il
contient ainsi que du nombre de discontinuit´es les affectant. Lors de la construction
d’un mod`ele, la coh´erence de chacun de ces objets doit ˆetre v´erifi´ee, ce qui influence
directement le temps n´ecessaire `a la construction d’un mod`ele. Le nombre de r´egions
volumiques d´etermine ´egalement le nombre de r´egions stationnaires `a utiliser pour les
mod`eles p´etrophysiques, et donc le travail n´ecessaire lors de la mod´elisation g´eostatistique.
De plus, chaque surface du mod`ele est susceptible de d´efinir des compartiments
1. Nous employons aussi le terme de composante.Sources de complexite´ 45
Figure 3.1 – El´ ements d’un mod ´ ele structural. ` Le mod`ele est constitu´e de quatre
couches (A, B, C, D) s´epar´ees par trois horizons (h0, h1, h2) et d´ecoup´ees par une faille F. (a)
La couche B est d´ecoup´ee en deux r´egions B.1 et B.2. (b) L’horizon h1 a deux composantes
connexes surfaciques, que nous appelons surfaces. (c) La faille a quatre surfaces num´erot´ees
de 1 `a 4. Chacune de ces surfaces est d´elimit´ee par quatre lignes, elles-mˆemes d´elimit´ees par
des coins. La ligne rouge est sur le bord d’une seule surface F4.
(a) Couche fine (b) Pli couché (c) Discontinuité stratigraphique
(d) Failles avec faible rejet (f) Failles en Y (e) Diagramme de juxtaposition
Figure 3.2 – Quelques sources de complexite dans les mod ´ eles structuraux. ` Le
diagramme de juxtaposition (f) est une vue sur la surface de faille des traces des horizons
recoup´es par cette faille.46 Chapitre 3. Complexite g ´ eom ´ etrique ´
dans le domaine, ayant ainsi souvent un impact de premier ordre sur les ´ecoulements
fluides et les processus g´eophysiques.
3.2.2 Interactions entre les objets
La distribution dans le mod`ele des objets g´eologiques, c’est `a dire leur densit´e, a
des cons´equences directes sur les ´etapes de mod´elisation, de maillage et de simulation.
Cette densit´e est li´ee `a la g´eom´etrie des objets g´eologiques, mais ´egalement aux
intersections entre les couches du mod`ele avec les failles et les autres non-conformit´es.
Les ´el´ements simples interagissent faiblement avec les autres et sont plus faciles `a
modifier ou `a supprimer du mod`ele, au contraire de ceux, qui, tels les discontinuit´es
sont plus difficiles `a supprimer.
Couches stratigraphiques conformes
Des couches conformes 2
, mais localement tr`es fines peuvent ˆetre probl´ematiques.
En effet, la validit´e de la couche (pas d’intersection entre les horizons sup´erieur et
inf´erieur) est plus difficile `a v´erifier dans le cas g´en´eral (figure 3.2a). De plus, les
d´eformations affectant les couches peuvent modifier les ´epaisseurs et courbures des
horizons. Certaines structures comme les plis couch´es (figure 3.2b) sont plus complexes
que les plis simples `a mod´eliser, puisqu’ils ne peuvent pas ˆetre repr´esent´es
avec une seule fonction de la position horizontale, ce qui pose probl`eme pour certaines
applications.
Non-conformit´es stratigraphiques
Les relations verticales entre les couches sont contrˆol´ees par les non-conformit´es
(´erosions, onlaps) qui sont tr`es courantes dans les r´eservoirs stratigraphiques. Leur
g´eom´etrie implique souvent des objets tr`es fins et des faibles angles de contact entre
les horizons qui sont difficiles `a caract´eriser avec les donn´ees et requi`erent des op´erations
de mod´elisation plus compliqu´ees que dans le cas des s´equences continues
(figure 3.2c). Comme nous l’avons vu au chapitre 2, ces angles faibles sont particuli`erement
probl´ematiques lors de la g´en´eration d’un maillage. De plus, leur position
dans le mod`ele peut ˆetre mal connue [Caumon, 2003, Lallier, 2012].
Failles
Les failles sont des discontinuit´es qui correspondent `a un d´eplacement localis´e des
couches le long d’une surface (figure 3.2d). Elles sont souvent difficiles `a caract´eriser
`a partir des donn´ees du sous-sol et introduisent une complexit´e significative `a cause
de leur connectivit´e, leur forme et leurs propri´et´es sp´ecifiques [Jolley et al., 2007].
Le contrˆole qualit´e est crucial pour valider les d´eplacements sur les failles car les
donn´ees sismiques sont bruit´ees autour d’elles. Ce contrˆole peut ˆetre par exemple fait
en analysant les lignes de contact faille-horizon avec un diagramme de juxtaposition
(figure 3.2e) [Groshong, 2008, Caumon et al., 2009]. La juxtaposition de volumes rocheux
ayant des propri´et´es diff´erentes est aussi tr`es importante pour les ´ecoulements
2. Couches r´esultant du d´epˆot continu de s´edimentsMesures gen´ eralistes ´ 47
Figure 3.3 – Calcul de mesures geom ´ etriques en 2D. ´ Mesures d’´epaisseur Ce et
d’angle Ca pour une r´egion R et mesure de forme Cf pour un de ses bords B2.
fluides, car elle entraˆıne de fortes non-lin´earit´es de la r´eponse en ´ecoulement lorsque
la g´eom´etrie est l´eg`erement perturb´ee [Jolley et al., 2007, Tavassoli et al., 2005]. Les
intersections `a angles faibles entre failles et horizons peuvent rendre plus difficile la
cartographie de la juxtaposition des couches et peuvent influencer la transmissibilit´e
de la faille. Les failles qui se terminent dans un mod`ele posent des probl`emes similaires,
car `a leurs extr´emit´es, le d´eplacement des horizons atteint z´ero (figure 3.2e)
et elles ne d´elimitent pas deux r´egions volumiques distinctes, ce qui rend nombre
d’algorithmes inutilisables tels quels.
La complexit´e d’un r´eseau de failles n’est pas seulement une combinaison des
complexit´es de chacune des failles, les diff´erences d’orientation et de pendage des
failles, ainsi que leurs connexions doivent ˆetre consid´er´ees. Le nombre d’intersections
entre failles d´etermine la compartimentation du mod`ele et les angles au niveau de ces
intersections ont des cons´equences majeures sur les approximations n´ecessaires lors
de la g´en´eration d’une grille volumique. Les intersections de failles en Y (figure 3.2f)
ou les variations d’orientation et de pendage des failles peuvent empˆecher une repr´esentation
du mod`ele par extrusion d’une coupe et la construction d’une grille
stratigraphique (partie 2.1.3) [Farmer, 2005].
3.3 Mesures g´en´eralistes
Deux types de mesures peuvent ˆetre utilis´es pour ´evaluer la complexit´e des composantes
d’un mod`ele structural en trois dimensions : les mesures de connectivit´e 3
et les mesures g´eom´etriques. Les premi`eres caract´erisent les relations entre les composantes
du mod`ele et sont ind´ependantes de la g´eom´etrie, les secondes caract´erisent
les tailles et formes de chaque ´el´ement.
3.3.1 Mesures globales de complexit´e
Nous proposons trois mesures pour calculer globalement la complexit´e d’un mod`ele.
La premi`ere d´enombre les ´el´ements du mod`ele (r´egions, surfaces, lignes et coins)
en excluant ceux qui d´efinissent le volume d’int´erˆet. Cette mesure donne `a chaque
´el´ement la mˆeme importance.
3. Ensemble des connexions entre les composantes du mod`ele, aussi appel´ee topologie.48 Chapitre 3. Complexite g ´ eom ´ etrique ´
Pour pond´erer l’importance des ´el´ements en fonction des probl`emes potentiels
qu’ils impliquent, la seconde mesure prend en compte la g´eom´etrie des ´el´ements. Deux
´el´ements, qu’ils soient dans le mˆeme mod`ele ou non peuvent ainsi ˆetre compar´es. Les
coins ne sont pas directement pris en compte dans ce calcul, ils ont cependant une
influence directe sur les mesures faites pour les surfaces et les lignes. Nous calculons
la complexit´e de chaque ´el´ement comme la somme de quatre mesures ´el´ementaires
qui caract´erisent (1) sa taille Ct
; (2) sa forme Cf ; (3) son ´epaisseur Ce ; et (4) ses
angles Ca. Ces mesures sont choisies de mani`ere `a prendre des valeurs entre 0 et 1.
Les mesures de taille et d’´epaisseur d’une composante e de dimension d sont d´efinies
par rapport `a une taille caract´eristique donn´ee h :
Ct(e) =
0 si taille(e) > hd
1 sinon
Ce(e) = (
0 pour les lignes
Ah
taille(Be)
pour les r´egions et les surfaces
o`u Be est l’ensemble des ´el´ements du bord de la composante et Ah la taille de la zone
o`u l’´epaisseur de la composante est inf´erieure `a la taille caract´eristique (figure 3.3).
La mesure de forme Cf ´evalue globalement la d´eformation pour les surfaces et lignes.
Elle est prise ´egale `a 1 moins la taille de la composante projet´ee sur son plan ou
segment moyen divis´e par la taille de la composante (figure 3.3). Elle vaut z´ero pour
les r´egions volumiques. La mesure angulaire Ca est d´efinie par rapport `a un angle
donn´e α pour les r´egions (respectivement les surfaces) et ´evalue le pourcentage de
la longueur des lignes (respectivement le nombre de coins) o`u l’angle entre deux
surfaces (respectivement deux lignes) du bord de la composante s’intersectent `a un
angle inf´erieur `a α (figure 3.3).
Avec la troisi`eme mesure globale, nous proposons d’´evaluer la complexit´e des
´el´ements d’un type donn´e comme une statistique de la taille des ´el´ements de ce type.
Nous avons choisi le coefficient de variation 4 qui caract´erise les distributions relatives
des tailles des ´el´ements et ´evalue les changements d’´echelle pour un type d’´el´ement.
3.3.2 Mesures dans un voisinage
Le calcul des mesures g´eom´etriques ou de connectivit´e dans le voisinage d’un
point permet de capturer localement les relations entre les ´el´ements d’un mod`ele
et d’identifier plus pr´ecis´ement les zones plus complexes. Nous avons vu dans la
partie 2.2.3 des strat´egies permettant d’analyser la complexit´e d’un mod`ele en prenant
des mesures dans le voisinage de points ´echantillonnant le mod`ele. La mise en place
d’une telle m´ethode requiert de calculer l’intersection des voisinages avec le mod`ele
rapidement et de mani`ere robuste.
Pour capturer les relations spatiales entre les ´el´ements d´efinissant un mod`ele,
nous proposons de calculer localement le nombre de coins, composantes connexes de
lignes, composantes connexes de surface et r´egions dans le voisinage de points ´echantillonnant
le mod`ele. Des statistiques basiques : moyenne, coefficient de variation,
4. La moyenne divis´e par l’´ecart-type.Modeles ` 49
maximum et le 90eme `
centile de ces valeurs ´evaluent la complexit´e. Les mesures obtenues
d´ependront de la r´esolution de l’´echantillonnage mais aussi du placement de
de la forme des voisinages utilis´es.
3.4 Mod`eles
Nous proposons un ensemble de mod`eles synth´etiques construits depuis le mod`ele
d’un pli anticlinal cylindrique constitu´e de trois horizons et nomm´e A1 (figure 3.4).
Dans le mod`ele A2, deux failles normales r´egionales affectent les horizons (fi-
gure 3.4). Ces failles planes sont parall`eles, recoupent la totalit´e de la zone d’int´erˆet
et ont un pendage de 60 degr´es vers l’Est. Leur rejet 5
est constant, d’o`u des lignes
de contact faille-horizon parall`eles.
Dans le mod`ele A3, les deux failles sont locales et ne compartimentent pas le
mod`ele (figure 3.4). Les rejets des failles sont maximaux `a proximit´e de leur centre
et deviennent nuls sur leur contour.
Dans le mod`ele A4, une faille est r´egionale tandis que la faille la plus `a l’Ouest
se termine vers le Sud (figure 3.4). Les d´eplacements induits par les failles augmentent
vers le Nord ; une cons´equence est que les lignes de contact horizon-faille s’intersectent
`a angles faibles.
Les failles du mod`ele A5 s’intersectent le long d’une ligne de branchement, elles
ont une configuration en “Y” (figure 3.4). Les rejets des failles sont constants et le
mod`ele peut ˆetre restaur´e en A1 par mouvement de blocs rigides. Cependant, comme
la hauteur du rejet sur une des failles est proche de l’´epaisseur de la couche sup´erieure,
des sections fines apparaissent dans son diagramme de juxtaposition.
Le mod`ele A6 est obtenu en coupant le mod`ele A4 par une surface topographique
(´erosion). Plusieurs petites parties de surfaces isol´ees dont la taille est tr`es
petite compar´ee `a celle du mod`ele apparaissent. De plus, de tr`es faibles angles apparaissent
entre la surface d’´erosion et les couches ´erod´ees (figure 3.4).
Les trois autres mod`eles que nous proposons illustrent des d´efis diff´erents. Le
mod`ele B est un mod`ele de pli li´e `a la propagation d’une faille en compression
(figure 3.5). Dans la partie inf´erieure, la faille a un pendage faible et se branche sur
un niveau de d´ecollement horizontal. Le pendage de la faille varie vers un angle moyen
avant l’arrˆet de la faille dans la couche sup´erieure o`u la d´eformation est accommod´ee
par une d´eformation interne des couches. Dans le mod`ele C, des couches horizontales
sont d´epos´ees en discordance sur un horizon pliss´e (figure 3.5). Le diapir du mod`ele D
est intrusif et recoupe trois couches stratigraphiques. Les horizons sont peu d´eform´es
except´e dans la zone d’influence du diapir (figure 3.5).
3.5 R´esultats
Nous avons calcul´e les mesures propos´ees dans la partie 3.3 pour les neuf mod`eles
pr´esent´es ci-dessus. Les composantes d´efinissant le volume d’int´erˆet des mod`eles
5. D´eplacement induit par la faille.50 Chapitre 3. Complexite g ´ eom ´ etrique ´
Mod`ele A1 : Couches l´eg`erement pliss´ees Mod`ele A2 : Failles parall`eles
Mod`ele A3 : Failles locales
Mod`ele A4 : D´eplacements complexes sur les
failles
Mod`ele A5 : Failles normales obliques Mod`ele A6 : Erosion
Figure 3.4 – Suite de modeles cr ` e´es´ a partir du mod ` ele A1. ` Dimensions : 1600m ×
930m × 500m.Resultats ´ 51
Mod`ele B : Faille thrust (1590m×915m×578m)
Mod`ele C : Stratigraphie onlap (1600m×930m×
500m)
Mod`ele D : Diapir de sel (140m×140m×100m)
Figure 3.5 – Modeles conduisant ` a des configurations potentiellement probl ` e- ´
matiques.
(boˆıte) ne sont pas prises en compte dans ces calculs, ce qui permet de caract´eriser
la complexit´e intrins`eque des mod`eles.
3.5.1 Mesures globales
La premi`ere mesure qui compte le nombre total d’´el´ements dans le mod`ele donne
une premi`ere classification des mod`eles, en ordre croissant : A1, C, D, B, A2, A3,
A4, A5, A6 (table 3.1). La complexit´e obtenue d´epend du nombre de discontinuit´es
affectant le mod`ele et des intersections entre ces discontinuit´es. Trois groupes de
mod`eles apparaissent : ceux qui ont au plus une discontinuit´e (A1, B, C, et D), ceux
qui en ont deux (A2, A3, et A4) et ceux qui en ont deux connect´ees (A6 et A5).
Comme les ´el´ements d´efinissant le domaine d’int´erˆet ne sont pas pris en compte,
cette mesure tr`es simple diff´erencie les failles r´egionales des failles ne recoupant pas
la totalit´e du mod`ele.
Pour ´evaluer la seconde mesure nous avons choisi une r´esolution de 10m et un
angle α de 20 degr´es (table 3.2). La classification r´esultante : A1, C, B, A2, D, A4,
A3, A5, A6 est l´eg`erement diff´erente de la premi`ere. A1 reste le mod`ele le plus simple
tandis que A6 et A5 restent ceux qui sont les plus complexes. La complexit´e accrue de
D est due au fait que l’´echelle de ce mod`ele est significativement plus petite que celle
des autres mod`eles et que la couche inf´erieure a une ´epaisseur en moyenne inf´erieure
`a 10m. Le mod`ele A3 est class´e troisi`eme `a cause de la forte complexit´e g´eom´etrique
induite par les failles qui se terminent `a l’int´erieur de la zone d’int´erˆet. En effet, les
lignes de contact faille-horizon s’y intersectent `a des angles inf´erieurs `a 10 degr´es.52 Chapitre 3. Complexite g ´ eom ´ etrique ´
A1 A2 A3 A4 A5 A6 B C D
R´egions 4 12 4 8 12 14 5 4 5
Surfaces 3 23 16 23 31 42 8 4 6
Lignes 0 13 24 22 30 44 4 1 2
Coins 0 0 12 6 10 15 0 0 0
Total 7 48 56 59 83 115 17 9 13
Table 3.1 – Nombre d’el´ ements dans les mod ´ eles. `
A1 A2 A3 A4 A5 A6 B C D
R´egions 0.13 0.59 0.22 0.34 1.19 6.58 0.35 0.55 2.97
Surfaces 0.03 3.21 12.01 7.41 9.30 12.58 0.25 0.00 1.20
Lignes 0.00 0.01 0.56 0.10 4.01 2.92 0.00 0.00 1.62
Total 0.16 3.81 12.79 7.85 14.50 22.07 0.60 0.55 5.79
Table 3.2 – Somme des complexites g ´ eom ´ etriques ( ´ Ct + Cf + Ce + Cα) pour les
el´ ements. ´
Les coefficients de variation (table 3.3) donnent une classification (A1, D, B,
C, A2, A4, A3, A5, A6) similaire aux pr´ec´edentes. Sa signification est cependant
diff´erente car elle identifie la complexit´e due aux changements d’´echelle des ´el´ements
dans les mod`eles.
3.5.2 Mesures locales
M´ethode
Pour calculer les voisinages dans lesquels les mesures vont ˆetre calcul´ees nous
utilisons les cellules d’un diagramme de Vorono¨ı barycentrique d’un nombre de points
donn´e (parties 1.1.1 et 1.3.1). Les cellules de Vorono¨ı barycentriques donnent une
subdivision du mod`ele relativement isotrope moins sensible `a une orientation donn´ee
que le serait une grille cart´esienne.
Mesures locales de connectivit´e
Nous avons fait ces mesures pour trois nombres de cellules 100 ; 1 000 ; 10 000
cellules et donc `a trois r´esolutions, la r´esolution ´etant estim´ee `a partir de la racine
cubique du volume du mod`ele divis´ee par le nombre de cellules. Pour les mod`eles A,
B et C ces r´esolutions sont respectivement de 198m, 92m, et 43m ; le mod`ele D est
plus petit et les r´esolutions sont 26m, 12m, et 5.7m.
A1 A2 A3 A4 A5 A6 B C D
R´egions 0.74 0.76 0.74 0.84 1.08 1.67 0.57 0.94 0.54
Surfaces 0.00 0.93 1.97 1.41 1.74 1.62 0.79 0.71 0.56
Lignes 0.01 0.63 0.67 0.82 1.06 0.00 0.13
Total 0.74 1.71 3.35 2.92 3.64 4.35 1.37 1.65 1.23
Table 3.3 – Coefficients de variation des tailles des el´ ements dans chaque ´
modele type par type. `Discussion 53
R´esultats
Les statistiques sur le nombre d’´el´ements comptabilis´es dans une cellule sont
donn´ees dans la table 3.4. Les moyennes, maximums, coefficients de variation et les
90eme `
centiles sont trac´es dans un graphe radar (figure 3.6). Selon la statistique
choisie, la classification relative des ´el´ements varie l´eg`erement, particuli`erement pour
les mod`eles les plus simples. Cependant la s´eparation des mod`eles en deux groupes
distincts est claire pour quasiment toutes les mesures et `a toutes les r´esolutions : les
mod`eles les plus simples (A1, B, C et D) qui ont au plus une discontinuit´e et ceux
qui ont au moins deux discontinuit´es (A2, A3, A4, A5, et A6).
Une observation attendue est que, lorsque la r´esolution augmente, la complexit´e
locale et les diff´erences entre les mod`eles diminuent 6
. La moyenne est fortement
influenc´ee par cette diminution. Par exemple, dans le mod`ele A5, elle diminue de 5.51
(100 cellules) `a 1.84 (10 000 cellules) soit une perte de 66.6%, le maximum diminuant
simplement de 30 `a 19 (36.6%). Le maximum caract´erise la zone la plus complexe du
mod`ele, c’est `a dire l’´el´ement contenu dans le plus grand nombre d’´el´ements. Selon
ce crit`ere, la classification obtenue est : B, D, A1, C, A3, A2, A4, A6, A5. A la plus
grande r´esolution, le 90eme `
centile est le mˆeme pour tous les mod`eles (la valeur 3
correspond `a une cellule qui contient un morceau de surface et deux r´egions), mais il
pourrait permettre de classer les mod`eles `a de plus faibles r´esolutions. Le coefficient
de variation ´evalue la dispersion des mesures et peut aussi ˆetre pris comme une mesure
de complexit´e.
Le principal avantage des mesures locales est la possibilit´e de comprendre l’organisation
spatiale de la complexit´e et d’estimer l’extension des zones o`u une m´ethode
donn´ee pourrait ´echouer `a partir des cellules dans lesquelles le nombre total d’´el´ements
est sup´erieur `a un chiffre donn´e. Comme nous pouvons le voir sur la figure 3.7,
ces cellules sont celles qui recoupent les sections fines du mod`ele, couches fines (mod`ele
A6), faible rejet sur une faille (mod`ele A2), angle faible entre des lignes de contact
sur une faille (mod`ele A5) (figure 3.7).
3.6 Discussion
3.6.1 Contributions
Dans ce chapitre, nous avons propos´e d’utiliser des mesures g´en´erales pour ´evaluer
la complexit´e d’un mod`ele structural afin de pouvoir comparer de mani`ere plus
objective plusieurs mod`eles. Les m´etriques d´eriv´ees de ces mesures et les mod`eles de
r´ef´erence qui sont propos´es sont des outils importants pour quantifier notre perception
de la complexit´e d’un mod`ele, c’est-`a-dire les configurations que nous avons du
mal `a comprendre et qui posent probl`eme aux logiciels que nous utilisons, d´eveloppons,
etc. Ces mesures sont simples, certaines sont faites `a une r´esolution donn´ee.
Elles aident `a comprendre la complexit´e induite par chaque ´el´ement ind´ependamment
de son type et `a comparer les mod`eles d’une mˆeme zone `a des r´esolutions diff´erentes.
6. Cet effet est similaire `a celui de support en g´eostatistique [Journel, 2003].54 Chapitre 3. Complexite g ´ eom ´ etrique ´
A1 A2 A3 A4 A5 A6 B C D
100
Q10 1 1 1 1 1 2 3 1 3
Q50 5 5 5 5 5 7 5 5 5
Q90 7 11 10 11 11 12 7 8 6
Max 7 15 15 16 30 22 8 8 9
Moy. 4.300 5.950 5.210 5.630 5.510 6.710 4.290 4.040 4.060
Coeff.Var. 0.547 0.630 0.658 0.665 0.775 0.696 0.390 0.593 0.390
1000
Q10 1 1 1 1 1 1 1 1 1
Q50 1 3 1 3 3 3 3 1 3
Q90 5 7 5 7 6 7 5 5 5
Max 7 15 13 14 22 19 6 8 6
Moy. 2.500 3.137 2.710 2.960 2.950 3.170 2.630 2.360 2.569
Coeff.Var. 0.751 0.814 0.808 0.804 0.858 0.871 0.523 0.813 0.581
10000
Q10 1 1 1 1 1 1 1 1 1
Q50 1 1 1 1 1 1 1 1 1
Q90 3 3 3 3 3 3 3 3 3
Max 5 11 11 12 19 15 6 6 6
Moy. 1.688 1.910 1.746 1.850 1.840 1.920 1.770 1.570 1.760
Coeff.Var. 0.728 0.788 0.755 0.778 0.795 0.827 0.609 0.721 0.676
Table 3.4 – Statistiques sur le nombre d’el´ ements par cellule. ´
A1
A2
A3
A4
A5
A6
B
C
D
Maximum
Q90
Moy.
Coeff.Variation
Maximum
Q90
Moy.
Coeff. Variation
Maximum
Q90
Moy.
Coeff.Variation
100 cellules 1 000 cellules
10 000 cellules
30
12
6.71
0.76
22
7
3.17
0.87
19
3
1.92
0.83
Figure 3.6 – Statistiques normalisees sur les nombres d’ ´ el´ ements compt ´ es dans ´
100, 1 000, ou 10 000 cellules de Vorono¨ı.Discussion 55
A2
A3
A5
A4
Nombre d´éléments par cellule
N
A6
6
7
8
9
10
11
>12
Figure 3.7 – Zones complexes des modeles. ` Les cellules, parmi 10 000, contenant plus
de 6 composantes sont situ´ees autour des discontinuit´es. Il n’y en a aucune dans le mod`ele
A1, 188 dans A2, 54 dans A3, 158 dans A4, 161 dans A5 et 535 dans A6.56 Chapitre 3. Complexite g ´ eom ´ etrique ´
3.6.2 Perspectives
Les perspectives de ce travail sont tr`es nombreuses. Les mesures pourraient ˆetre
utilis´ees pour d´eterminer la r´esolution n´ecessaire pour mailler une zone donn´ee d’un
mod`ele [Quadros et al., 2004] ou pourraient ˆetre combin´ees pour ´evaluer la complexit´e
d’une tˆache de mod´elisation donn´ee. Ceci requiert de connaˆıtre parfaitement
les m´ethodes et algorithmes utilis´es, de consid´erer la complexit´e de la repr´esentation
du mod`ele (taille du maillage) et de r´ealiser de nombreuses analyses de sensibilit´e.
Ces trois points rendent difficile d’envisager `a court terme la d´etermination de telles
mesures ´evaluant par exemple, pour un mod`ele, si une m´ethode de maillage donn´ee
permettra d’atteindre la qualit´e, la r´esolution et le nombre d’´el´ements souhait´es.
L’examen de r´esultats obtenus pour des mod`eles r´eels et pour des mod`eles synth´etiques
de r´ef´erence cr´e´es dans le but d’´evaluer les impacts d’un changement d’´echelle
ou bien l’ajout d’une entit´e g´eologique, permettrait d’affiner les mesures que nous
avons propos´ees et de confirmer l’effet de telle ou telle configuration sur l’une d’elle.
Des calculs sp´ecifiques de la complexit´e des entit´es g´eologiques par type apporteraient
des informations compl´ementaires. Par exemple, pour les surfaces de failles, le
nombre de couches affect´ees, la distribution des rejets, les angles faits avec les horizons,
les contacts induits entre des couches diff´erentes sont des informations cruciales
en mod´elisation. Pour le r´eseau de failles, ce sont les contacts entre failles, les angles
`a ces intersections et leurs variations d’orientation qui importent, tandis que pour
les formations s´edimentaires les nombres de blocs, l’intensit´e des d´eformations, les
variations d’´epaisseur pourraient ˆetre consid´er´ees.
Enfin un calcul des mesures g´eom´etriques dans les cellules de Vorono¨ı permettrait
de caract´eriser localement la g´eom´etrie du mod`ele ind´ependamment de la qualit´e de
son maillage, au contraire des mesures de g´eom´etrie que nous faisons. Nous pourrions
aussi envisager d’utiliser d’autres types de cellules, voxels, sph`eres, etc.Chapitre 4
Contribution : Remaillage des
surfaces de mod`eles structuraux
`a une r´esolution donn´ee
Les travaux pr´esent´es dans ce chapitre ont fait l’objet d’une publication Pellerin
et al. [2014], une version pr´eliminaire ayant ´et´e pr´esent´ee `a la conf´erence annuelle de
l’IAMG [Pellerin et al., 2011].
R´esum´e
Dans ce chapitre, nous proposons une m´ethode de remaillage des surfaces des
mod`eles structuraux d´efinis par fronti`ere avec des triangles les plus ´equilat´eraux possibles.
Nous utilisons une m´ethode de type optimisation de diagramme de Vorono¨ı
barycentrique pour placer les sommets des surfaces remaill´ees. Nous introduisons
une ´energie pour am´eliorer le placement des sites le long des bords des surfaces. Le
maillage est construit en analysant les intersections entre le mod`ele et les cellules de
Vorono¨ı. Quand les cellules de Vorono¨ı restreintes aux surfaces, lignes et coins ont
une unique composante connexe, nous construisons la triangulation de Delaunay restreinte
des sites au mod`ele. Dans le cas contraire, nous construisons un maillage dual
de ces composantes connexes. Lorsque la r´esolution finale est suffisante, les lignes et
les coins initiaux sont ´egalement des lignes et des coins du mod`ele final. Cependant,
pour des mod`eles o`u les contacts sont complexes, la r´esolution peut ˆetre localement
insuffisante, et au lieu d’ajouter des points pour raffiner le maillage, nous proposons
de simplifier des ´el´ements du mod`ele. La m´ethode est appliqu´ee `a 12 mod`eles
structuraux.
4.1 Motivations
Les diff´erentes strat´egies pour g´en´erer les mod`eles structuraux conduisent `a des
surfaces qui sont, la plupart du temps, d´efinies par des triangles [Caumon et al., 2009].
La qualit´e et la r´esolution du maillage peuvent ˆetre tr`es diff´erentes selon les choix du
modeleur et les algorithmes utilis´es pour construire le mod`ele. Les triangles peuvent58 Chapitre 4. Maillage surfacique
ˆetre de tr`es mauvaise qualit´e 1
, notamment quand les horizons sont obtenus par une
m´ethode de type marching tetrahedra depuis une surface implicite. Le maillage doit
donc ˆetre adapt´e pour visualiser efficacement le mod`ele, modifier sa g´eom´etrie, faire
des calculs de restauration d’horizons [e.g., Dunbar et Cook, 2003] et surtout g´en´erer
un maillage volumique ad´equat.
Comme nous l’avons vu dans la partie 3.2, il y a de nombreuses configurations
dans lesquelles il est difficile de respecter la g´eom´etrie du mod`ele g´eologique tout en
conservant un nombre et une qualit´e d’´el´ements acceptables. Dans ce chapitre, nous
choisissons d’autoriser les simplifications du mod`ele pour adapter sa r´esolution, et
de privil´egier le nombre et la qualit´e des triangles remaillant les surfaces. L’objectif
est double : remailler les surfaces d´efinissant le mod`ele et adapter la r´esolution du
mod`ele.
La plupart des tr`es nombreuses m´ethodes de (re)maillage de surface ne permettent
pas de modifier le mod`ele d’entr´ee (partie 2.4). Les m´ethodes de type Delaunay
contraint ou frontale remaillent les surfaces une par une sans consid´erer le
mod`ele dans son ensemble. Les m´ethodes qui fournissent des garanties th´eoriques sur
la topologie et la qualit´e du r´esultat ne donnent pas du tout de contrˆole sur la r´esolution
et le nombre d’´el´ements dans le maillage final (partie 2.4.2). Lorsque la qualit´e
des triangles des surfaces initiales est tr`es mauvaise, le calcul d’une param´etrisation
pour les projeter dans un espace 2D peut poser probl`eme. Les m´ethodes de maillage
de surface de type octree exploitent une subdivision du mod`ele en voxels. Cette subdivision
est ´egalement utilis´ee par les m´ethodes de simplification qui op`erent sur les
composantes volumiques d’un mod`ele, elles analysent localement les relations entre les
composantes du mod`ele et les cellules pour reconstruire un maillage `a la r´esolution
de la subdivision consid´er´ee (partie 2.2.3). Nous proposons une approche similaire
combin´ee `a une m´ethode de remaillage de type optimisation de diagramme de Vorono¨ı
et nous exploitons le fait que, lorsque les sites ne v´erifient pas la propri´et´e de la
boule topologique, la triangulation de Delaunay restreinte est une version simplifi´ee
de l’objet initial (partie 1.2.3 et figure 1.5).
4.2 Objectifs
Donn´ees d’entr´ee
La m´ethode de remaillage que nous proposons prend en entr´ee un ensemble de
surfaces triangul´ees qui d´efinissent un mod`ele structural par fronti`ere valide. Leurs
maillages doivent ˆetre conformes.
R´esultat
Un remaillage global des surfaces du mod`ele pour lequel les triangles sont les
plus ´equilat´eraux possible. Les lignes de contact entre les surfaces sont ´egalement remaill´ees,
et les surfaces restent conformes le long de ces lignes. Des modifications sont
r´ealis´ees lorsque des lignes de contacts ou des coins sont trop proches (figure 4.1).
1. Notre objectif est d’obtenir des triangles ´equilat´eraux.Optimisation de l’echantillonnage du mod ´ ele ` 59
Modèle initial fracturé Modèle fracturé remaillé
Horizon supérieur initial Horizon supérieur remaillé
1
2
3
1
2
3
Figure 4.1 – Remaillage d’un modele affect ` e par 200 fractures. ´ La qualit´e du
maillage des surfaces est am´elior´e. Trois types de configuration sont potentiellement probl´ematiques
: (1) les fractures s’intersectant `a peine (2) celles qui s’intersectent presque (3)
celles qui s’intersectent `a angle faible, sont remaill´ees et modifi´ees en fonction de la r´esolution
souhait´ee.
Cette capacit´e `a simplifier le mod`ele d’entr´ee permet d’adapter la r´esolution du mod`ele
automatiquement. La m´ethode a ´et´e appliqu´ee `a 12 mod`eles structuraux (partie
4.5).
Principe
Nous utilisons un diagramme de Vorono¨ı restreint barycentrique pour placer les
sommets du maillage final de mani`ere ad´equate pr`es des surfaces et des lignes de
contact du mod`ele initial (partie 4.3). Ensuite, un contrˆole topologique permet de
d´eterminer les sommets des triangles du maillage final `a partir des intersections entre
le diagramme de Vorono¨ı des sites et les ´el´ements du mod`ele (partie 4.4).
4.3 Optimisation de l’´echantillonnage du mod`ele
4.3.1 Optimisation CVT
Dans un premier temps, un nombre pr´ed´etermin´e de sites est plac´e dans l’espace
de telle sorte qu’ils soient un bon ´echantillonage du mod`ele structural. Chaque site
´echantillonne le mod`ele car il repr´esente la partie du mod`ele plus proche de ce site
que des autres sites : sa cellule de Vorono¨ı restreinte (partie 1.2.1). Le nombre initial
de sites d´etermine la r´esolution `a laquelle le mod`ele va ˆetre remaill´e, il peut ˆetre,60 Chapitre 4. Maillage surfacique
par exemple, estim´e en prenant la racine carr´ee de l’aire des surfaces du mod`ele
divis´ee par la longueur d’arˆete cible. Nous avons vu dans la partie 1.3.2 que, quand le
diagramme de Vorono¨ı restreint est barycentrique, les cellules de Vorono¨ı restreintes
sont compactes et que la triangulation de Delaunay restreinte remaille les surfaces
du mod`ele avec des triangles quasiment ´equilat´eraux.
4.3.2 Optimisation de la position des sites le long des bords
Lors du calcul du diagramme de Vorono¨ı restreint `a une surface avec bord, les
sites, apr`es optimisation, ne sont pas sur ce bord car le barycentre d’une cellule
intersectant une ligne du bord n’est pas sur cette ligne. Pour modifier cette position
de stabilit´e, un terme d’´energie sp´ecifique aux bords peut ˆetre ajout´e `a la fonction
objectif pour les sites dont la cellule de Vorono¨ı (Vp) intersecte la ligne du bord (B) :
FB(S) = X
p∈S
"Z
Vp∩B
||y − p||dy#2
(4.1)
Pour ´evaluer cette fonction et son gradient, la restriction de chaque cellule de Vorono¨ı
au bord (Vp ∩ B) est d´ecompos´ee en plusieurs segments (figure 4.2). Pour chaque
segment, E = C1C2, la fonction vaut F
E
B = 1/2||−−→C2 p.
−−−→ C2 C1||2
, c’est `a dire l’aire du
triangle p C1 C2 au carr´e (figure 4.2). Le gradient est :
dFB
dS (p, C1, C2) = dF E
B
dp +
dFB
dC1
dC1
dS +
dFB
dC2
dC2
dS (4.2)
o`u dFB/dp =
−→N ×
−−−→ C1 C2, les termes dFB/dC1 et dFB/dC2 sont ´evalu´es de mani`ere
similaire. Le terme dC/dS d´epend de la configuration du point C. Soit C est un
sommet du maillage des surfaces initiales et sa d´eriv´ee par rapport aux sites est
nulle, soit C est `a l’intersection du bisecteur s´eparant les sites p0 et p1 et est calcul´e
comme :
dC
dS =
[p1 − p0]
t
[N1]
t
[N2]
t
[C − p0]
t
[p1 − C]
t
[C − p0]
t 0
0 0
(4.3)
o`u N1 et N2 sont les normales `a deux plans construits de sorte que leur ligne d’intersection
contienne le segment C1C2. La preuve est donn´ee par L´evy et Liu [2010].
Pour am´eliorer le placement des sites pr`es des bords et des lignes de contacts nous
minimisons donc la fonction objectif F = (1 − α)FCV T + αFB avec α le ratio entre
les normes des gradients de l’´energie de bord et de l’´energie CVT.
4.3.3 Impl´ementation
L’algorithme 4.1 r´esume les diff´erentes ´etapes de l’optimisation d’un nombre
donn´e de sites sur un mod`ele Ω. (1) Le placement initial des sites est fait en utilisant
la m´ethode d´evelopp´ee par L´evy et Bonneel [2013]. (2) Le diagramme de Vorono¨ı
restreint est calcul´e avec une m´ethode ´egalement d´ecrite par L´evy et Bonneel
[2013]. (3) Les contributions de chaque cellule du diagramme de Vorono¨ı restreint `a
la fonction objectif et `a son gradient sont calcul´es suivant la m´ethode de Yan et al.Construction du maillage 61
p
C1
C2
Figure 4.2 – Segments d’integration pour le calcul de l’ ´ energie de bord. ´
[2009]. La minimisation de la fonction objectif F est faite par un algorithme L-BFGS
[Nocedal, 1980]. En pratique, l’optimisation est arrˆet´ee apr`es un nombre d’it´erations
pr´ed´etermin´e, typiquement une centaine.
4.4 Construction du maillage
Une fois que les sites sont distribu´es de mani`ere optimale, leur diagramme de
Vorono¨ı restreint au mod`ele structural est calcul´e afin de d´eterminer les sommets et
les triangles du maillage r´esultant.
4.4.1 Remaillage des composantes connexes surfaciques
Prenons par exemple un mod`ele, non g´eologique, dans lequel les surfaces n’ont
pas d’intersection et n’ont pas de bord : deux sph`eres imbriqu´ees l’une dans l’autre
(figure 4.3). Les deux surfaces sont ´echantillonn´ees avec 100 sites qui, apr`es optimisation,
sont positionn´es entre les deux sph`eres (figure 4.4a). Pour avoir deux sph`eres
dans le maillage final, deux sommets sont associ´es `a chaque site : un pour chaque
composante connexe de la cellule de Vorono¨ı restreinte du site (figure 4.4b). Il y a
ensuite un triangle `a construire pour chaque point partag´e par trois cellules de Vorono¨ı
restreintes (figures 4.3c et 4.4c). Le maillage obtenu est dual des composantes
connexes du diagramme de Vorono¨ı barycentrique restreint. Il est plus fid`ele au mod`ele
initial que la triangulation de Delaunay restreinte (une seule sph`ere dans ce cas
o`u la propri´et´e de la boule topologique n’est pas v´erifi´ee - partie 1.2.4). Si toutes les
Algorithme 4.1 - Optimisation des sites.
Donn´ees : le mod`ele Ω, le nombre de sites n
R´esultat : un ´echantillonage isotrope S de Ω
(1) S ← ´echantillonage al´eatoire de Ω [L´evy et Bonneel, 2013] ;
tant que le minimum n’est pas atteint faire
(2) Calculer le diagramme de Vorono¨ı restreint de S `a Ω [L´evy et Bonneel, 2013] ;
(3) Calculer F(S) et dF/dS [Liu et al., 2009] ;
(4) D´eterminer la direction de recherche ∆S [Liu et al., 2009] ;
(5) S ← S + ∆S ;
fin62 Chapitre 4. Maillage surfacique
(a) (b) (c)
Figure 4.3 – Remaillage de deux spheres imbriqu ` ees. ´ (a) 100 sites optimis´es sont entre
les deux sph`eres. (b) Chaque cellule de Vorono¨ı restreinte a 2 composantes connexes. (c) Dual
des composantes connexes du diagramme de Vorono¨ı restreint (voir aussi la figure 4.4).
Figure 4.4 – Remaillage de deux surfaces proches. (a) 3 sites (A, B et C) sont
positionn´es entre deux surfaces, leurs cellules de Vorono¨ı restreintes ont deux composantes
connexes. La triangulation de Delaunay restreinte a un seul triangle ABC. (b) Deux sommets
sont ajout´es pour chaque cellule. (c) Deux triangles A1B1C1 et A2B2C2 sont construits comme
duals des points v1 et v2 qui sont partag´es par trois cellules de Vorono¨ı.
composantes connexes des cellules de Vorono¨ı restreintes sont contractiles, le th´eor`eme
du multi-nerf [Colin de Verdi`ere et al., 2012] donne que le mod`ele construit de
cette fa¸con est ´equivalent par homotopie au maillage d’entr´ee.
4.4.2 Remaillage des lignes de bord
Consid´erons `a pr´esent une surface qui a un bord. De la mˆeme mani`ere que pour
les surfaces, ce bord peut ne pas ˆetre correctement remaill´e quand le nombre de
sites est trop petit, c’est-`a-dire quand la propri´et´e de la boule topologique n’est pas
respect´ee. Pour le remailler de mani`ere ad´equate, autant de points que la restriction
de sa cellule de Vorono¨ı restreinte au bord a de composantes connexes sont associ´es
`a chaque site (figure 4.5). Ces points additionnels doivent ˆetre pris en compte pour
construire les triangles. Puisqu’une cellule de Vorono¨ı restreinte peut correspondre `a
plusieurs points (figure 4.5b), le dual des points de Vorono¨ı n’est plus toujours un
triangle. Des polygones, duals des arˆetes de Vorono¨ı qui intersectent deux fois le bord,
sont `a construire (figures 4.5c & d).
Plus il y a d’intersections entre une cellule de Vorono¨ı restreinte et les lignes de
bord du mod`ele, plus il y a de sommets dans le maillage final qui correspondent `a
cette cellule. Cela peut conduire `a des configurations o`u les polygones `a construireConstruction du maillage 63
(a)
(c)
(b)
(d)
Figure 4.5 – Remaillage d’une surface avec bord. (a) 21 sites ´echantillonnent l’´etoile ;
les cellules de Vorono¨ı des sites blancs intersectent deux fois le bord, celles les sites noirs
l’intersectent au plus une fois. (b) Chacun des sites blancs correspond `a deux points. (d) Les
polygones du maillage final sont duals des points de Vorono¨ı restreints voisins d’au moins
une cellule de Vorono¨ı restreinte associ´ee `a deux points (gris), et des segments de Vorono¨ı
restreints qui intersectent deux fois le bord (c).
s’intersectent. Nous proposons donc de r´eunir les points associ´es `a une composante
connexe d’une cellule s’ils sont plus de deux. Cette augmentation de la robustesse
de la m´ethode se fait au prix de modifications des connexions entre les surfaces du
mod`ele, modifications qui ne sont pas toujours valides d’un point de vue g´eologique.
De plus, ces modifications d´ependent du positionnement des sites dans le mod`ele et
une petite modification de ces positions peut entraˆıner la suppression ou l’apparition
d’une ou plusieurs modifications. Ce sont cependant ces modifications qui permettent
de contrˆoler la r´esolution du mod`ele.
4.4.3 Remaillage des coins
Les derniers ´el´ements du mod`ele `a prendre en compte dans le remaillage sont
les coins : les points qui d´elimitent les composantes connexes des lignes de bord.
Pour tous les repr´esenter dans le maillage final, il n’y a pas d’autre solution que
d’associer chacun d’eux `a un sommet du maillage final. Pour reconstruire le mod`ele
d’entr´ee, il y a, dans chaque cellule de Vorono¨ı restreinte, un point par coin, un point
par composante connexe de ligne, et un point par composante connexe de surface
(algorithme 4.2).
La pr´esence de plusieurs coins dans une composante connexe d’une cellule de
Vorono¨ı restreinte au bord signifie que la r´esolution n’est pas suffisante, et nous choisissons
de ne pas remettre tous ces coins dans le maillage final mais de les regrouper64 Chapitre 4. Maillage surfacique
Figure 4.6 – Configurations dans lesquelles le modele est modifi ` e. ´ (a) La cellule
de Vorono¨ı restreinte au centre correspond `a 3 points (A, B, C) (b) Les polygones `a construire
`a partir de ces points ABGF et ADEC se recoupent. Les trois points sont regroup´es en P. (c)
Des lignes de contacts (noires) coupent cette cellule en 6 composantes connexes. (d) Les 4
coins (A, B C, et D) sont regroup´es en P car ils sont reli´es par des segments du bord.
(figure 4.6). Une fois ce regroupement effectu´e, le regroupement pr´ec´edemment d´ecrit
est ´egalement r´ealis´e. Ainsi, chaque composante connexe de chaque cellule de Vorono¨ı
restreinte est associ´ee `a un ou deux points et les quadrangles ou triangles `a construire
`a partir de ces points ne s’intersectent pas.
La derni`ere modification que nous proposons est de regrouper les sommets associ´es
`a une mˆeme cellule de Vorono¨ı qui correspond `a des composantes s´epar´es par
une distance inf´erieure `a une r´esolution (distance) donn´ee en entr´ee. Ceci permet de
simplifier les composantes du mod`ele dont la r´esolution est inf´erieure `a cette distance
(figure 4.7). Par exemple sur la figure 4.6c, les petits rejets le long des failles ont ´et´e
annul´es.
4.4.4 Impl´ementation
L’algorithme 4.3 r´esume les ´etapes de la construction du maillage final `a partir
d’une surface polygonale repr´esentant le diagramme de Vorono¨ı restreint dans lequel
chaque facette est associ´ee au triangle et au site dont elle est issue. Premi`erement
les cellules de Vorono¨ı restreintes et leurs composantes connexes sont construites,
puis les sommets `a associer `a chacune d’elle sont calcul´es (algorithme 4.2). Enfin les
polygones reliant ces sommets sont construits (figure 4.5).
4.4.5 Am´eliorations du maillage
La qualit´e des triangles du maillage produit d´epend compl`etement de la forme
des composantes connexes des cellules de Vorono¨ı restreintes. Quand cette forme est
proche d’un hexagone r´egulier, les triangles duals sont proches de l’´equilat´eralit´e. En
revanche, les petites cellules triangulaires peuvent poser probl`eme. Elles apparaissent
quand une arˆete ou un point de Vorono¨ı est situ´e `a proximit´e d’une surface ou ligneConstruction du maillage 65
Figure 4.7 – Controle de la r ˆ esolution du mod ´ ele. ` Si les surfaces ´echantillonn´ees
par une cellule sont s´epar´ees par une distance inf´erieure `a une valeur donn´ee dresolution ´ , les
points correspondants sont regroup´es. (a) Le rejet minimal sur la faille dmin est inf´erieur `a
dresolution ´ et les points A et B sont regroup´es. Le rejet est annul´e dans le mod`ele final. (b)
La distance minimale entre les deux surfaces est inf´erieure `a dresolution ´ et dans le mod`ele
remaill´e elle sont jointes.
Algorithme 4.2 - Calcul des sommets du maillage final.
Donn´ees : cellule de Vorono¨ı restreinte du site i, distance dresolution ´
R´esultat : points remaillant la cellule
(1) pour chaque composante connexe CC faire
si CC intersecte les lignes de bord alors
pour chaque composante connexe du bord BC faire
si BC contient des coins alors
Associer un point `a chaque coin ;
sinon
Associer un point `a BC ;
fin
fin
sinon
Associer un point au barycentre de CC ;
fin
fin
(2) Regrouper les points correspondants `a des coins et reli´es par des segments du bord
(figure 4.6b) ;
(3) pour chaque composante connexe CC faire
si nombre de points > 2 (figure 4.6a) alors
Regrouper les points ;
fin
fin
(4) Regrouper les points correspondant `a des objets proches du mod`ele
(dmin
HAL Id: tel-01093355
https://hal.inria.fr/tel-01093355
Submitted on 10 Dec 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.1
Thèse de Doctorat
é c o l e d o c t o r a l e s c i e n c e s p o u r l ’ i n g é n i e u r e t m i c r o t e c h n i q u e s
U N I V E R S I T É D E F R A N C H E - C O M T É
No X X X
THÈSE présentée par
Ivan Enderlin
pour obtenir le
Grade de Docteur de
l’Université de Franche-Comté
K 8 k
Génération automatique de tests unitaires avec
Praspel, un langage de spécification pour PHP
The Art of Contract-based Testing
in PHP with Praspel
Spécialité Informatique
Instituts Femto-ST (département DISC) et INRIA (laboratoire LORIA)
Rapporteurs Lydie du Bousquet Professeur à l’Université Joseph Fourier
Arnaud Gotlieb Chargé de recherche habilité à l’IRISA
Examinateur Michel Rueher Professeur à l’Université de Nice Sophia Antipolis
Directeurs Fabrice Bouquet Professeur à l’Université de Franche-Comté
Frédéric Dadeau Maître de conférences à l’Université de Franche-Comté
Alain Giorgetti Maître de conférences à l’Université de Franche-Comté
Soutenue publiquement le 16 juillet 2014 devant le Jury composé de :Remerciements Je tiens à profiter de l’occasion qui m’est offerte pour remercier
toutes les personnes qui ont été soutenantes. Je tiens à remercier avant tout mon
Dieu, the Everlasting, pour cette épreuve, ses promesses et son soutien en tout temps.
Merci.
Je souhaite remercier ma petite femme, Hend, lady caramel, pour son éternel amour,
sa patience, son écoute et son infini tendresse. Je t’aime.
.½J
.k@ . ú
×XB
@ A
î
EA
Jk C
« ð A
î
EA
@
ð A
ëQ
. C
« Y
Jë
èñÊmÌ'@ ð
è
QK
QªË@ ú
æ
k.ð
P Qº @
à@ YK
P@
Je souhaite particulièrement remercier mes parents et beaux-parents, Nadine et
Christophe, Q
ÖÞ
ð
èA
J
k, mes sœurs et belles-sœurs, Naomi et Joanna, ø
Q
å
ð
PðQ
¯,
ainsi que toute ma famille, pour leur présence et leur soutien.
Merci à tous les amis de France, de Suisse, de Tunisie, du Maroc, d’Italie, de Grèce,
du Brésil, du Kenya, de Belgique, du Mexique, de Macédoine et de partout, qui
m’ont aidé dans ma thèse et qui m’aident dans Hoa. Par ordre alphabétique, un
immense et sincère merci à Abdallah Ben O., Alexandre V., Alexis von G., Baptiste
et Anne-Laure F., Елизабета F.-С., Emmanuel T., Frédéric H., Guislain D.,
Gérard E., Isabelle et Yves D., ÈC
g. YÒm×, Jean-Marie G., Julien B., Julien C., Julien L.,
Kalou C. C., Laura et Raphaël E., Lucie et á
Ó
@ M., María Aydeé S. S. et Cédric J.,
Marta P., Mikaël R., Naomy W., Nawo M., Ophélie et Matthieu C., Raphaëlle M.,
Σοφία και Κώστας Τ., Stéphane P., Sylvie et Kiko F., Sébastien H., Willy M., Wilma
et Fabio S. (et toute la troupe !), Yohann D., toute la communauté de Hoa, d’atoum
et de PHP, et tout ceux que j’aurais oublié. . .
Et bien sûr, merci à mes encadrants : Fabrice B., Frédéric D. et Alain G. pour leur
savoir, leur patience et être restés à mes côtés durant cette aventure !
x
y
−15 −10 −5 0 5 10 15
−15
−10
−5
5
10
x = 16 sin(t)
3
y = 13 cos(t) − 5 cos(2t) − 2 cos(3t) − cos(4t)
The Emergence of Multimodal Concepts: From
Perceptual Motion Primitives to Grounded Acoustic
Words
Olivier Mangin
To cite this version:
Olivier Mangin. The Emergence of Multimodal Concepts: From Perceptual Motion Primitives
to Grounded Acoustic Words. Robotics. Universit´e de Bordeaux, 2014. English.
HAL Id: tel-01061809
https://tel.archives-ouvertes.fr/tel-01061809
Submitted on 8 Sep 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Universite de Bordeaux ´
Ecole doctorale de math´ematiques et informatique ´
Th`ese pour obtenir le titre de
Docteur en sciences
Sp´ecialit´e informatique
Emergence de concepts
´
multimodaux
De la perception de mouvements primitifs
a l’ancrage de mots acoustiques `
Pr´esent´ee par
Olivier Mangin
Effectu´ee sous la direction de
Pierre-Yves Oudeyer
Soutenue le 19 mars 2014 devant le jury form´e par
Pr. Angelo Cangelosi — University of Plymouth Rapporteur
Dr. Jean-Luc Schwartz — CNRS Rapporteur
Dr. Jacques Droulez — Coll`ege de France President ´
Dr. Emmanuel Dupoux — Ecole des hautes ´etudes en sciences sociales ´ Examinateur
Dr. Manuel Lopes — INRIA Examinateur
Dr. David Filliat — ENSTA-ParisTech ´ ExaminateurA mes parents, `
A mes grand-parents, `
iiiivR´esum´e
Cette th`ese consid`ere l’apprentissage de motifs r´ecurrents dans la perception multimodale.
Elle s’attache `a d´evelopper des mod`eles robotiques de ces facult´es telles
qu’observ´ees chez l’enfant, et elle s’inscrit en cela dans le domaine de la robotique
d´eveloppementale.
Elle s’articule plus pr´ecis´ement autour de deux th`emes principaux qui sont d’une
part la capacit´e d’enfants ou de robots `a imiter et `a comprendre le comportement
d’humains, et d’autre part l’acquisition du langage. A leur intersection, nous exami- `
nons la question de la d´ecouverte par un agent en d´eveloppement d’un r´epertoire de
motifs primitifs dans son flux perceptuel. Nous sp´ecifions ce probl`eme et ´etablissons
son lien avec ceux de l’ind´etermination de la traduction d´ecrit par Quine et de la
s´eparation aveugle de source tels qu’´etudi´es en acoustique.
Nous en ´etudions successivement quatre sous-probl`emes et formulons une d´efinition
exp´erimentale de chacun. Des mod`eles d’agents r´esolvant ces probl`emes sont ´egalement
d´ecrits et test´es. Ils s’appuient particuli`erement sur des techniques dites de sacs
de mots, de factorisation de matrices et d’apprentissage par renforcement inverse.
Nous approfondissons s´epar´ement les trois probl`emes de l’apprentissage de sons
´el´ementaires tels les phon`emes ou les mots, de mouvements basiques de danse et
d’objectifs primaires composant des tˆaches motrices complexes. Pour finir nous
´etudions le probl`eme de l’apprentissage d’´el´ements primitifs multimodaux, ce qui
revient `a r´esoudre simultan´ement plusieurs des probl`emes pr´ec´edents. Nous expliquons
notamment en quoi cela fournit un mod`ele de l’ancrage de mots acoustiques.
Cette th`ese a ´et´e effectu´ee au sein de l’´equipe Flowers de l’INRIA Bordeaux
Sud-Ouest et financ´ee par une allocation moniteur polytechnicien (AMX).
Mots-cl´es apprentissage multimodal ; acquisition du langage ; ancrage de symboles ;
apprentissage de concepts ; compr´ehension de comportement humains ; d´ecomposition
du mouvement ; primitive motrice ; d´ecomposition de taches ; factorisation de matrice
positive ; apprentissage par renforcement inverse factoris´e
vviR´esum´e substantiel
Les sciences cognitives constituent aujourd’hui le sujet de recherches tr`es actives
mais surtout sont `a l’intersection d’un grand nombre de domaines scientifiques. En
effet l’apparition de plusieurs disciplines nouvelles telles les neurosciences, l’imagerie
c´er´ebrale, mais aussi de la psychologie ou encore la ph´enom´enologie comme branche
de la philosophie ont fait suite `a des d´ecouvertes scientifiques et avanc´ees technologiques
majeures du si`ecle dernier. A ces sciences de la cognition, ayant pour objets `
principaux les intelligences humaines et animales, est venue s’ajouter l’informatique,
dont l’av`enement comme science puis comme technologie a marqu´e la mˆeme p´eriode.
Outre son apport, consid´erable pour les autres sciences, de la simulation num´erique,
c’est en tant que nouveau langage que l’informatique a constitu´e le substrat n´ecessaire
au d´eveloppement de l’intelligence artificielle.
La robotique d´eveloppementale, dont l’´elaboration remonte aux derni`eres d´ec´enies
s’inscrit dans un double h´eritage. D’une part, `a l’instar de l’intelligence artificielle, elle
constitue non seulement un domaine applicatif des sciences cognitives, mais ´egalement
un nouveau paradigme, autant exp´erimental que conceptuel, pour penser l’intelligence
du vivant. D’autre part, `a la suite de la psychologie d´eveloppementale, elle se tourne
r´esolument, non pas vers l’´etude de l’intelligence adulte, mais vers celle des m´ecanismes
qui permettent sa maturation. En r´ealit´e l’id´ee d’un ordinateur programm´e, non
pas pour faire mais pour apprendre (Turing, 1950), pr´ec`ede le d´eveloppement de
l’intelligence artificielle comme domaine actif de recherche. En outre, on ne saurait
r´esoudre `a la simple compr´ehension d’un programme le d´eveloppement de l’intelligence.
Jean Piaget en propose ainsi une approche syst´emique : ≪ L’intelligence ne d´ebute
ainsi ni par la connaissance du moi ni par celle des choses comme telles, mais par celle
de leur interaction, et c’est en s’orientant simultan´ement vers les deux pˆoles de cette
interaction qu’elle organise le monde en s’organisant elle-mˆeme. ≫ (Piaget, 1937) La
robotique apporte ici un ´eclairage particulier : en effet mod´eliser l’intelligence en
int´eraction avec le monde c’est mod´eliser le corps, mais aussi la perception sensorielle
et l’expression motrice.
Le travail pr´esent´e dans cette th`ese embrasse cette approche de la robotique d´eveloppementale
: il s’attache `a ´etudier les m´ecanismes de l’apprentissage chez le nourrisson
ou l’enfant, entre autre par le d´eveloppement de techniques permettant `a des syst`emes
cognitifs artificiels d’atteindre des comportements d’apprentissage similaires. Il s’articule
plus pr´ecis´ement autour de deux th`emes principaux qui sont, d’une part la
capacit´e d’enfants ou de robots `a imiter correctement des humains et `a comprendre
leur comportement, et d’autre part l’acquisition du langage.
La notion d’imitation a ´et´e ´etudi´ee sous de nombreux aspects. En effet ce terme
viiviii
regroupe en premier lieu un ensemble de m´ecanismes qui jouent un rˆole essentiel
dans la transmission culturelle, autant chez l’animal que l’humain (Whiten and
Ham, 1992, Nadel, 1986, Tomasello, 2008). D’autre part, il a ´et´e mis en ´evidence
la capacit´e d’une classe de neurones, appel´es neurones miroirs, `a s’activer aussi
bien lors de l’ex´ecution d’une action par un primate, que lors de son observation,
ex´ecut´ee par un autre agent (Cattaneo and Rizzolatti, 2009). Enfin, l’application de
l’imitation `a la transmission de comp´etence d’un humain `a un robot est ´egalement
sujette `a de nombreux travaux de recherche. D’autre part, sans n´ecessairement
en viser la reproduction, la compr´ehension des comportement humains par des
syst`emes de surveillance ou des robots pr´esente ´egalement de nombreuses perspectives
d’application. Notre travail aborde ces probl´ematiques plus sp´ecifiquement sous l’angle
des questions ≪ Qu’imiter ? ≫ et ≪ Quand imiter ? ≫. En effet les comportement
humains sont souvent composites et il n’est, par exemple, pas attendu d’un robot ou
d’un ´el`eve qu’il r´ep`ete les instructions du professeur en plus de reproduire un geste
de danse enseign´e. Nous ´etudions la question de la d´ecomposition d’un mouvement
ou comportement complexe en parties pertinentes et expliquons en quoi elle n’est en
fait qu’une facette du probl`eme de la structuration du mouvement.
La question de l’aquisition du langage est un second th`eme dominant de ce travail.
Nous nous int´eressons plus pr´ecis´ement `a la d´ecouverte et l’apprentissage dans le flux
acoustique d’unit´es lexicales ou sous-lexicales ainsi qu’`a celle de leur valeur s´emantique.
Plus sp´ecifiquement c’est le lien entre l’acquisition du langage et l’apprentissage
de gestes ou de motifs perceptuels qui nous int´eresse. Nous ´etudions d’une part ce
lien `a travers un ensemble d’analogies. Analogie de l’origine perceptuelle commune
de ces apprentissage, analogie de la langue parl´ee et du langage des signes. Mais
surtout analogie de certaines structures du langage et de l’action : un mouvement
complexe se d´ecompose en plusieurs gestes, sa description linguistique en plusieurs
mots. Enfin, analogie des ambiguit´es introduite par cette structure : la difficult´e
de d´ecomposer une phrase en mots (Brent, 1999) fait ´echo `a celle du d´ecoupage
d’une action complexe en gestes ´el´ementaires mais ´egalement au probl`eme de la
s´eparation aveugle de sources, bien connu des acousticiens. Nous nous effor¸cons dans
ce travail de d´evelopper une dimension algorithmique de ces analogies; c’est `a dire que
nous proposons de r´esoudre par les mˆemes m´ethodes et dans un cadre exp´erimental
similaire, des probl`emes provenant de chacun de ces domaines. D’autre part le lien
entre l’acquisition du langage et celle de gestes ´el´ementaires ou de motifs visuels,
apparait fortement dans la question de l’apprentissage de la s´emantique. Le probl`eme
de l’ancrage de symboles (Harnad, 1990, Glenberg and Kaschak, 2002) questionne
ainsi l’origine du lien entre les mots du langage et leur sens, par exemple des gestes
qu’ils d´ecrivent. Dans ce travail nous ´etudions de front, non seulement l’origine de ce
lien, mais ´egalement l’origine de la perception des mots eux mˆemes et celle des unit´es
s´emantiques. Encore une fois, cette question n’est pas sans ambig¨uit´e, `a commencer
par l’ambiguit´e de la traduction d´ecrite par Quine (1960).
Le travail pr´esent´e unifie ces diff´erentes probl´ematiques dans le cadre g´en´eral de
l’apprentissage de motifs et structures dans un flux perceptuel multimodal. Nous
nous concentrons plus pr´ecis´ement sur le cas o`u cette structure prend la forme
d’un r´epertoire d’´el´ements ou de motifs primitifs r´ecurrents dans la perception. La
notion d’´el´ements primitifs ainsi que leurs propri´et´es combinatoires sont donc au
centre de ce travail. Cette notion couvre des domaines vari´es et nous la d´eclinons
simultan´ement `a travers les exemples de mouvements basiques de danse, d’objectifs
simples qui composent des tˆaches motrices complexes, puis de sons ´el´ementaires,ix
tels les phon`emes ou les mots. Finalement, nous expliquons comment de tels motifs
redondants peuvent ˆetre appris, qui recouvrent plusieurs modalit´es, comme par
exemple la vue et l’ou¨ıe. Nous d´emontrons que l’apprentissage de ces motifs constitue
un mod`ele d’un aspect essentiel de l’acquisition du langage : l’ancrage des mots dans
des concepts s´emantiques.
La d´ecomposition de mouvement en gestes simultan´es Une premi`ere contribution
importante de ce travail est d’´etudier la question nouvelle de la d´ecomposition
de mouvements complexes, c’est `a dire qui combinent simultan´ement plusieurs gestes
simples. En effet la d´ecomposition de mouvements dans le cadre de l’imitation, en
robotique mais aussi dans le domaine de la compr´ehension automatique d’activit´es
humaines, a principalement ´et´e ´etudi´ee dans le cas o`u les gestes complexes sont
obtenus par juxtaposition successive de plusieurs gestes ´el´ementaires. Nous proposons
dans ce travail d’´etudier une structure orthogonale, la composition simultan´ee, que
nous illustrons par des mouvements de danse. En r´ealit´e les chor´egraphies font clairement
apparaitre deux dimensions pour la composition de mouvements : en s´equence
et en parall`ele.
La question que nous posons est la suivante. Est-il possible pour un syst`eme cognitif
artificiel qui observe un danseur ex´ecuter des chor´egraphies, d’apprendre, `a partir
de son observation seule, le lexique de gestes que le danseur combine dans son
mouvement ? En d’autres termes, est-il possible pour notre syst`eme d’apprendre la
structure sous-jacente aux d´emonstrations observ´ees ? Il apparait rapidement `a l’´etude
de cette question que sa r´eponse n’est pas unique : rien ne garantit qu’un tel syst`eme
construise le mˆeme lexique de gestes qu’un humain dans la mˆeme situation. En
r´ealit´e, rien ne garantit non plus que deux humains aux origines culturelles diff´erentes
percevraient les mˆemes gestes dans ces mouvements observ´es. Cette ambig¨uit´e est
encore une fois l’analogue directe de celle rencontr´ee dans le probl`eme de la s´eparation
aveugle de source ou bien dans les ph´enom`enes de multistabilit´e des perceptions
visuelles (Blake, 1989).
Cette difficult´e en cache ´egalement une autre : celle de l’´evaluation d’un tel syst`eme.
En effet, comment ´evaluer la valeur intrins`eque des repr´esentations mentales que se
construit un tel syst`eme perceptuel ? Comment d´efinir ce que c’est que de comprendre
la structure des mouvements observ´es ? En r´eponse `a cette difficult´e, nous consid´erons
le cas o`u le flux perceptuel du syst`eme cognitif inclue des symboles inconnus, qui
forment une description linguistique des mouvements observ´es. Chaque geste du
r´epertoire du danseur est associ´e `a un symbole et chaque chor´egraphie est d´ecrite par
l’ensemble form´e des symboles associ´es `a chacun des gestes qui la composent. A la `
suite d’un phase d’entrainement, au cours de laquelle le syst`eme observe un ensemble
de d´emonstrations de chor´egraphies ainsi que leurs descriptions, il est ´evalu´e de la
mani`ere suivante : une nouvelle chor´egraphie lui est pr´esent´ee et il doit en reconstituer
une description linguistique en utilisant les symboles. Cette description peut ˆetre
alors compar´ee `a l’ensemble de gestes que le danseur a effectivement compos´es. Ce
proc´ed´e est pr´esent´e dans la figure 1.
A ce probl`eme nouveau nous proposons de r´epondre `a l’aide d’un algorith ` me classique
: la factorisation de matrices positives. Soit un ensemble de stimuli perceptuels,
repr´esent´es chacun par un vecteur de grande dimension, et regroup´es dans une matrice
de donn´ee V . Les algorithmes de factorisation de matrices permettent de calculerx
L5
?
linguistic
descriptions
choreography
demonstrations The system observes a choreography and is asked
to reconstruct the associated linguistic description.
Task
L2 L4 L
L6
3
Demonstration 1 Demonstration 2
Training
Figure 1 – Proc´ed´e d’entrainement et d’avaluation du syst`eme. L’entrainement
se fait par l’observation des d´emonstrations de chor´egraphies et de leur descriptions
linguistiques (`a gauche). Le syst`eme est alors ´evalu´e sur sa capacit´e `a d´ecrire
correctement une nouvelle d´emonstration de chor´egraphie (`a droite).
deux matrices W et H de telle sorte que :
V ≃ W · H.
Dans cette ´equation la matrice W est appel´ee dictionaire et forme une base de
dimension inf´erieure `a celle de l’espace des donn´ees dans laquelle les observations
sont approxim´ees. Chacun des vecteurs qui la composent, et que nous appellerons
atomes, est ainsi de mˆeme nature que les observations. La matrice H contient les
coefficients de cette d´ecomposition ; nous l’interpr´eterons comme la repr´esentation
compress´ee ou interne des observations par notre syst`eme.
Les algorithmes de factorisation de matrices positives s’int´eressent particuli`erement
au cas o`u ces matrices sont `a coefficients positifs. Une cons´equence importante de cette
contrainte est que chaque atome contribue ou non positivement `a l’approximation
des observations, en particulier une partie de mouvement est pr´esente ou non mais
n’est en aucun cas combin´ee en n´egatif. Cette interpr´etation, bien qu’intuitive, de la
contrainte correspond en r´ealit´e `a des propri´et´es int´eressantes de cette m´ethode. La
notion de similarit´e, laiss´ee volontairement floue dans l’´equation pr´ec´edente, constitue
un param`etre essentiel de cette famille d’algorithmes ; nous utiliserons dans la suite
les deux cas particuliers de la distance Euclidienne, d´eriv´ee de la norme de Frobenius
sur les matrices, et de la I-divergence, apparent´ee `a la divergence de Kullback-Leibler.
Plus pr´ecis´ement nous utilisons les algorithmes par mise `a jour multiplicative, qui
optimisent simultan´ement cette approximation par rapport au dictionnaire et aux
coefficients Lee and Seung (1999).
Dans l’exp´erience consid´er´ee, chaque observation est en r´ealit´e constitu´ee de deux
modalit´es : d’une part le mouvement du danseur, et d’autre part sa description
symbolique. La contrainte majeure de la m´ethode consid´er´ee est que les observations
doivent ˆetre repr´esent´ees par des vecteurs de dimension fixe et `a coefficients positifs.
Nous choisissons de repr´esenter de cette mani`ere les observations dans chaque modalit´e,
avant de fusionner le mouvement et sa description symbolique en concat´enant leurs
repr´esentations vectorielles. De plus, la motivation de cette exp´erience est d’apprendre
au syst`eme la structure combinatoire des mouvements observ´es. La m´ethode choisie
est capable de repr´esenter les vecteurs d’observations comme combinaison lin´eaire
des atomes du dictionnaire. Afin de tirer parti de cette propri´et´e, nous avons donc
d´evelopp´e une nouvelle repr´esentation des mouvements de longueur arbitraire par un
vecteur de taille constante, qui rend compte approximativement de la combinaison
d’´el´ements de ce mouvement par la combinaison lin´eaire des repr´esentations de cesxi
Gesture 1 Gesture 2 Gesture 3 Gesture 4 Gesture 5 Gesture 6
Figure 2 – Sont repr´esent´es sch´ematiquement sur cette figure quelques uns des
mouvements combin´es par le danseur dans les chor´egraphies.
´el´ements. Pour cela nous utilisons une repr´esentation `a base d’histogrammes de ces
mouvements (pour plus de d´etails se r´ef´erer `a la suite de ce document ou Mangin and
Oudeyer, 2012a). D’autre part, l’ensemble de symboles qui d´ecrit chaque mouvement
est repr´esent´e sous la forme d’un vecteur binaire de dimensionalit´e le nombre total
de symboles, repr´esentant par 1 la pr´esence du symbole dans la description et par 0
son absence.
Du fait de cette repr´esentation, on peut d´ecomposer autant la matrice de donn´ee V
que le dictionnaire W en deux parties correspondant aux deux modalit´es, comme
repr´esent´e dans les ´equations suivantes.
V =
Vmouvement
Vlangage
W =
Wmouvement
Wlangage
Durant la phase d’entrainement, l’algorithme est utilis´e pour apprendre les matrices W
et Hentrainement `a partir de l’ensemble des observations repr´esent´ees par V
entrainement
.
Dans la phase d’´evaluation, l’algorithme est utilis´ee d’une mani`ere diff´erente. Cette
fois-ci seuls les mouvement sont observ´es et repr´esent´es sous la forme d’un matrice
V
´evaluation
mouvement `a partir de laquelle le mˆeme algorithme, fonctionnant cette fois `a dictionnaire
Wmouvement fixe, fournit une repr´esentation interne H´evaluation de ces mouvements.
Finalement les descriptions symboliques correspondant `a ces coefficients sont
simplement calcul´ees comme le produit matriciel : V
reconstruit
langage = Wlangage ·H´evaluation
.
Les descriptions linguistiques ainsi obtenues sont constitu´ees de coefficients positifs
mais non binaires. Un m´ecanisme de seuillage est alors utilis´e pour obtenir un vecteur
binaire que l’on peut comparer `a la vraie description. En comptant comme succ`es une
reconstruction exacte, c’est `a dire o`u tout les bons symboles mais uniquement ceux-ci
sont fournis, on peut calculer un score moyen du syst`eme comme ceux repr´esent´es ci
dessous.
Afin d’obtenir les r´esultats suivants, nous avons enregistr´e principalement deux bases
de donn´ees de mouvements composites. Celles-ci contiennent respectivement 137
chor´egraphies obtenues par combinaison de 16 getses et 277 chor´egraphies obtenues
par combinaison de 47 gestes. La figure 2 fournit quelques exemples de gestes utilis´es
dans ces bases de donn´ees1
.
Les r´esultats suivants pr´esentent les scores de reconstruction des descriptions de
chor´egraphies par le syst`eme. Ces scores doivent ˆetre rapport´es au nombre de combinaisons
possible des 47 gestes constituant le lexique (de l’ordre de 2000), mais
1Par ailleurs ces bases de donn´ees sont publiquement accessibles `a l’adresse suivante. http:
//flowers.inria.fr/choreography_database.htmlxii
lfull lgiven number
16 labels (SVM, linear) 0.818 —
16 labels (NMF, Frobenius) 0.854 0.971
16 labels (NMF, DKL) 0.789 0.905
47 labels (SVM, linear) 0.422 —
47 labels (NMF, Frobenius) 0.625 0.755
47 labels (NMF, DKL) 0.574 0.679
Table 1 – Resultats g´en´eraux sur les bases de donn´ees. A titre de comparaison on `
calcule ´egalement les scores (given number ) pour un probl`eme simplifi´e o`u le syst`eme
connait le nombre de symboles ou gestes pr´esents dans l’observation. Une autre
approche algorithmique utilisant des support vector machines (SVM) est ´egalement
compar´ee.
lfull lgiven number
16 labels (NMF, Frobenius) 0.568 0.800
16 labels (SVM, linear) 0.667 —
47 labels (NMF, Frobenius) 0.406 0.653
47 labels (SVM, linear) 0.206 —
Table 2 – Resultats pour des combinaisons de gestes qui n’ont jamais ´et´e rencontr´ees
au cours de l’entrainement. Ce r´esultat met l’accent sur la capacit´e du syst`eme
`a reconnaˆıtre effectivement la structure des chor´egraphies en en construisant des
descriptions in´edites.
´egalement au nombre plus consid´erable de descriptions symboliques possibles sans
autre a priori sur la structure des gestes (247).
Bien que ce premier ensemble de r´esultats d´emontre la capacit´e du syst`eme cognitif
`a reconnaˆıtre les chor´egraphies dans leur ensemble, il ne garantit pas que ceci passe
par une repr´esentation effective de la structure des mouvements. Afin d’´eclaircir
ce point nous avons raffin´e l’´evaluation en testant le syst`eme uniquement sur des
chor´egraphies in´edites, c’est `a dire des combinaisons de gestes qui n’ont jamais ´et´e
observ´es ensemble par le syst`eme durant son entraˆınement. La table 2 pr´esente ces
r´esultats qui d´emontrent que c’est bien la structure du mouvement qui est repr´esent´ee.
En conclusion cette exp´erience d´emontre la possibilit´e d’explorer la d´ecomposition de
mouvements naturels en composantes actives simultan´ement. Nous avons pour cela
introduit une nouvelle repr´esentation des mouvements qui ne d´epend pas de la dur´ee de
celui-ci et vise la transformation approximative de la combinaison des mouvements en
combinaison lin´eaires de leurs repr´esentations. D’autre part, `a travers ce travail, nous
´etablissons un lien entre les algorithmes d’apprentissage de dictionnaire, appartenant
au domaine du feature learning, avec la question de la d´ecomposition de mouvement.
Au del`a de la simple transposition algorithmique, cela ´etablit une importante analogie
entre ces domaines. De mani`ere int´eressante le cadre exp´erimental et l’approche
algorithmique que nous instancions dans ce travail sont une transposition directe des
travaux effectu´ees par ten Bosch et al. (2008), Driesen et al. (2009) dans le domaine
de l’apprentissage du langage. Nous poursuivons cette analogie dans la derni`ere
partie de ce travail o`u nous d´emontrons que la mˆeme m´ethode permet d’apprendrexiii
simultan´ement `a partir du langage et du mouvement.
La d´ecomposition du comportement en objectifs Une limitation importante
des r´esultats que nous venons de pr´esenter vient directement de la repr´esentation
des mouvements utilis´ee dans ceux-ci. En effet il s’agit en fait plus d’une signature
de celui-ci que d’une repr´esentation de l’int´egralit´e de ses caract´eristiques. Une
cons´equence majeure de cette limitation est qu’il est impossible de renverser cette
exp´erience, c’est `a dire concr`etement, de faire danser par un robot ou un agent virtuel
la chor´egraphie correspondant `a une description symbolique donn´ee. Cette limitation
venant en premier lieu de la repr´esentation du mouvement, et non de l’algorithme
de d´ecomposition, nous explorons dans un second travail pr´esent´e ici une approche
similaire, cette fois fond´ee sur une autre conception du mouvement.
Le premier travail pr´esent´e approchait le mouvement comme trajectoire du corps.
Plus pr´ecis´ement nous nous concentrions sur la trace de cette trajectoire. Nous
proposons ici d’envisager le mouvement comme moyen d’atteindre un objectif : de
tels objectifs peuvent ˆetre de maintenir son centre de gravit´e `a une certaine altitude,
comme r´ealis´e dans la station debout et la marche, ou bien d’influencer l’´etat de son
environnement et en particulier des objets qu’il contient, comme lorsqu’on remplit un
verre d’eau, ou des ˆetres qu’ils contient, comme lorsqu’on sourit `a un interlocuteur
pour accroˆıtre sa sympathie. Cependant, `a objectif ou tˆache donn´ee, on observe une
grande variabilit´e dans les trajectoires y aboutissant. En effet, suivant le contexte, de
nombreux mouvements diff´erents peuvent r´ealiser le verre plein, selon que de l’eau
est accessible dans une broc ou par un robinet et selon les obstacles qui s´eparent de
l’un ou l’autre.
Nous partons du constat suivant : deux mouvements tr`es diff´erents, au sens de leurs
trajectoires, peuvent ˆetre per¸cus et sont g´en´eralement d´ecrits comme tr`es similaires
lorsque, par exemple, ils conduisent `a un mˆeme effet d´esir´e. Se pose alors la question
des m´ecanismes qui expliquent une telle similarit´e de la perception de haut niveau
alors que les stimuli, g´en´eralement visuels, sont d´eriv´es de trajectoires ´eventuellement
tr`es dissemblables. En particulier nous cherchons `a construire une repr´esentation du
mouvement qui rende compte de telles similarit´es.
Parce que pouvoir construire une telle repr´esentation a des applications importantes
pour la compr´ehension automatique des comportements humains et pour leur imitation,
plusieurs approches techniques ont ´et´e d´evelopp´ees dans ce but. Nous nous
concentrons ici sur une formulation de cet objectif sous la forme de l’apprentissage
par renforcement inverse (Russell, 1998). L’apprentissage par renforcement
suppose que l’action est motiv´ee par la maximisation d’une r´ecompense. Etant donn´e ´
cette r´ecompense il s’int´eresse aux algorithmes d’optimisation des actions, et plus
pr´ecis´ement d’une politique d’action. Le probl`eme inverse consiste `a ne pas partir
de la r´ecompense mais de l’observation de trajectoires. On se place typiquement
du point de vue d’un apprenti qui observe les mouvements d’un tuteur en train de
d´emontrer la r´esolution d’une tˆache. L’objectif de l’apprenti est d’inf´erer une fonction
de r´ecompense qui explique les actions du tuteur. L’hypoth`ese ici est celle du mod`ele
du comportement du tuteur comme motiv´e par la maximisation de la r´ecompense.
Malheureusement, mˆeme pour un tuteur parfait et une infinit´e de d´emonstrations,
il n’y a pas unicit´e de la fonction de r´ecompense sous-jacente. Il est donc illusoire
d’´evaluer l’apprenti au regard de la seule inf´erence de la fonction de r´ecompense. En
pratique on s’attachera plutˆot `a une ´evaluation de sa performance du point du vuexiv
du tuteur dans la r´esolution de la mˆeme tˆache. En d’autres termes, l’apprenti sera
´evalu´e dans l’espace des trajectoires qu’il produit `a partir d’une repr´esentation de
la tˆache dans l’espace des r´ecompenses. L’int´erˆet d’une telle approche par rapport
`a une imitation directe des trajectoires est qu’elle peut conduire `a une meilleur
g´en´eralisation. En effet imiter le remplissage du verre d’eau par la copie exacte d’une
ancienne trajectoire dans un nouveau contexte o`u les obstacles sont d´eplac´es est
probablement vou´e `a l’´echec.
Nous nous pla¸cons ici dans le cas de l’apprentissage par renforcement inverse dont
nous ´etendons le cadre classique. En effet, la majorit´e des travaux sur cette question
consid`ere que le tuteur fournit un grand nombre de d´emonstrations d’une seule
tˆache. En pratique, on veut souvent pouvoir apprendre `a partir de l’observation
d’un agent dont les mouvements vont naturellement correspondre `a plusieurs tˆaches
inconnues a priori. De plus il semble que dans de nombreuses situations chacune
de ces tˆaches n’est pas monolithique mais consiste plutˆot en la combinaison d’un
ensemble d’objectifs ou de pr´ef´erences distinctes. En effet l’objectif du verre plein
est combin´e avec ceux d’´eviter chacun des obstacles. Ainsi nous ´etudions ici, non
pas directement l’apprentissage d’une tˆache `a partir de nombreuses d´emonstrations
de cette tˆache, mais l’apprentissage d’un ensemble de tˆaches ou objectifs primitifs
qui permettent d’expliquer des comportements correspondant `a des tˆaches distinctes
mais partageant une structure commune.
Nous formalisons ce probl`eme et en proposons une solution algorithmique dans le
cadre d’un probl`eme synth´etique tr`es simle : le tuteur comme l’apprenti ´evoluent dans
un monde constitu´e d’une grille d’´etats et les actions, correspondant aux d´eplacements
cardinaux bruit´es, sont disponibles. Le tuteur utilise un petit nombre d’objectifs
´el´ementaires pour g´en´erer des tˆaches complexes par combinaisons lin´eaires al´eatoires
de celles-ci. Il en fournit des d´emonstrations solvant approximativement chaque tˆache
pour diff´erents contextes, c’est `a dire ici diff´erentes positions initiales. A partir de `
ces d´emonstrations un apprenti construit son propre lexique de tˆaches ´el´ementaires
et recherche des repr´esentations des tˆaches d´emontr´ees comme combinaisons des
tˆaches ´el´ementaires apprises. L’apprenti est ´evalu´e selon deux protocoles : dans
un premier temps sur sa performance moyenne sur chaque tˆaches inf´er´ee `a partir
des d´emonstrations du tuteur, et dans un second temps sur de nouvelles tˆaches
complexes dont une d´emonstration br`eve est fournie. Ainsi nous ´evaluons la capacit´e
de l’apprenti `a tirer parti de la structure commune des tˆaches d´emontr´ees pour
mieux les apprendre, mais ´egalement son aptitude `a utiliser cette connaissance pour
apprendre plus vite de nouvelles tˆaches partageant la mˆeme structure.
Nous utilisons pour atteindre cet objectif une extension de l’algorithme par descente
de gradient propos´e par Neu and Szepesv´ari (2007) `a un cadre de factorisation de
matrice. Les r´esultats sur l’ensemble d’entrainement, c’est `a dire les d´emonstrations
initiales utilis´ees pour apprendre le lexique de tˆaches ´el´ementaires, et sur l’ensemble
de test sont pr´esent´ees en figure 3.
Apprentissage multimodal et apprentissage du langage La contribution
principale de ce travail est une autre extension de la premi`ere exp´erience pr´esent´ee :
la situation d’apprentissage de celle-ci pr´esentait simultan´ement une d´emonstration
de mouvement et sa description par un ensemble de symboles. Nous rempla¸cons
`a pr´esent cet ensemble de symbole par l’enregistrement acoustique d’une phrase
parl´ee. En d’autres termes nous consid´erons le probl`eme de l’apprentissage `a partirxv
0 50 100 150 200
Number of training tasks
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Avg. dev. from opt. score on training tasks
Flat
Fact. (rand. init)
Fact. (PCA init)
Flat (PCA features)
Flat (ground truth features)
0 50 100 150 200
Number of training tasks
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
Avg. dev. from opt. score on testing tasks
Flat
Fact. (rand. init)
Fact. (PCA init)
Flat (PCA features)
Flat (features from ex.)
Flat (ground truth features)
Figure 3 – Pour un nombre de tˆaches suffisant, l’algorithme pr´esent´e d’apprentissage
factoriel de tˆaches (fact), d´epasse la m´ethode classique (flat). Cette derni`ere ne
pouvant apprendre la structure commune des diff´erentes tˆaches, consid`ere chaque
tˆache comme ind´ependante. Les r´eultats pr´esent´es correspondent `a l’´ecart de la
r´ecompense obtenue en moyenne par rapport `a la solution optimale (les points les
plus bas sont donc les plus performants). Les courbes du haut repr´esentent les scores
sur les tˆaches servant `a apprendre le lexique de tˆaches ´el´ementaires, celles du bas,
les scores sur de nouvelles tˆaches. A titre de comparaison les figures repr´esentent `
´egalement (flat (ground truth features)) la performance d’un apprenti qui connaitrait
d´ej`a le dictionaire de tˆaches ´el´ementaires et devrait uniquement estimer comment
celles-ci ont ´et´e combin´ees pour obtenir chaque d´emonstration. Finalement deux
approches na¨ıves, mais inefficaces, au mˆeme probl`eme sont pr´esent´ees (flat (PCA
features) et flat (features from ex.))
de donn´ees r´eelles, en ce qu’elles sont enregistr´ees `a partir de variables physiques
continues qui r´esultent d’une production humaine, incluant plusieurs modalit´es. En
pratique nous ´etudions, en plus des modalit´es de la parole et du mouvement, des
images d’objets.
Dans la premi`ere exp´erience, des gestes ´etaient associ´ees `a des symboles et un syst`eme
cognitif devait apprendre `a reconnaˆıtre ces gestes en produisant les symboles ad´equats.
Une fois ces symboles remplac´es par du son ou des images, c’est `a dire par des
grandeurs continues et de grande dimension, une telle ´evaluation par la comparaison
de symboles produits avec une valeur de r´ef´erence n’est plus possible, du moins
pas de mani`ere imm´ediate. Nous choisissons donc une nouvelle forme d’´evaluation
que nous voulons l’analogue comportemental du probl`eme de classification. Nousxvi
Apprentissage Le syst`eme observe un
ensemble d’exemples de gestes, chacun ´etant
associ´e `a une description parl´ee.
I make circles with my arm.
I am clapping!
Evaluation ´ Le syst`eme entend une nouvelle
phrase et doit choisir un geste parmi
plusieurs d´emonstrations qui correspond le
mieux `a cette description.
Look at the circles I do.
?
L’apprenti choisit le
geste qui correspond
au mieux `a la phrase.
Figure 4 – Illustration de la tˆache de classifiction cross-modale. La transcription
des phrases parl´ees repr´esent´ee est illustrative de la pr´esence de mots cl´es dans les
phrases parl´ees mais n’est en aucun cas observ´ee par l’apprenti.
revenons pour cela au cas plus simple o`u un seul concept est pr´esent dans chaque
exemple ; c’est `a dire dans le cas du mouvement qu’un seul geste est d´emontr´e
`a la fois. Plus pr´ecis´ement nous disposons d’une base de donn´ee de gestes, d’une
base de donn´ees de phrases, chacune caract´eris´ee par un mot cl´e, et d’une base
de donn´ee d’images, chacune repr´esentant un objet parmi un ensemble fix´e. Un
ensemble d’associations arbitraires est choisi entre un geste, un mot cl´e et un objet ;
nous appelons association cross-modale un tel ensemble et concept chaque triplet.
Le syst`eme cognitif est entrain´e par l’observation d’un grand nombre d’exemples
constitu´es de la manifestation dans plusieurs modalit´es du mˆeme concept ; c’est `a
dire par exemple que le geste est observ´e en mˆeme temps qu’une phrase qui contient
le mot cl´e associ´e `a ce geste. Le syst`eme est ensuite ´evalu´e de la fa¸con suivante : un
nouveau stimulus est observ´e, dans une seule modalit´e cette fois, par exemple une
phrase ; le syst`eme doit alors, parmi plusieurs stimuli provenant d’une autre modalit´e,
choisir celui qui correspond au premier. Par exemple, le syst`eme observe un ensemble
de gestes et doit choisir celui qui correspond le mieux `a la phrase, c’est `a dire celui
qui correspond au mˆeme concept que le mot cl´e contenu dans la phrase. Ce protocole
est illustr´e dans la figure 4.
Le syst`eme ´evalu´e dans nos exp´erimentations est le mˆeme que celui pr´esent´e pour la
premi`ere exp´erience, fond´e sur la factorisation de matrices positives. Plus pr´ecis´ement
l’apprentissage est effectu´e `a partir d’une matrice de donn´ee o`u chaque exemple
est repr´esent´e par la concat´enation des repr´esentations vectorielles des stimuli dansxvii
chaque modalit´e. Par exemple,
V =
Vmod1
Vmod2
Vmod3
.
Une fois l’apprentissage effectu´e, et donc le dictionnaire multimodal appris, il est
possible au syst`eme de convertir la perception d’un stimulus dans une modalit´e
en repr´esentation interne ou en perception attendue dans une autre modalit´e. Ces
m´ecanismes sont synth´etis´es en figure 5. Afin de comparer, par exemple, une phrase `a
plusieurs d´emonstrations de gestes, on peut convertir les perceptions de la phrase et
des gestes en leurs repr´esentations internes puis comparer ces repr´esentations internes.
Il est ´egalement possible de convertir la phrase en une perception de geste attendue
puis de comparer celle-ci aux perceptions r´eelles de gestes ou r´eciproquement. Enfin
plusieurs mesures de similarit´e peuvent ˆetre utilis´ees pour cela ; nous consid´erons la
distance Euclidienne, la I-divergence ainsi que la similarit´e cosinus.
h
vmod1 vmod2
arg min
h
DI (vmod1 , Wmod1 · h) Wmod2 · h
Perception r´eelle Perception attendue
Repr´esentation interne
Figure 5 – Une fois que le syst`eme a appris le dictionnaire (Wmod1 et Wmod2 ), ´etant
donn´e une observation dans une modalit´e vmod1 , il peut construire la repr´esentation
interne correspondant h, ainsi que la perception attendue dans une autre modalit´e
vmod2 .
Les r´esultats de cette exp´erience pour la comparaison dans l’espace des repr´esentations
internes avec la similarit´e cosinus sont pr´esent´es en figure 6.
Ces r´esultats importants d´emontrent la capacit´e du syst`eme `a apprendre correctement
les associations cross-modales `a partir des observations. De mani`ere int´eressante,
d’autres exp´eriences d´emontrent que ces scores ne sont pas am´elior´es lorsque le
syst`eme observe ´egalement des labels symboliques. Plus g´en´eralement il ne semble
pas au vu de ces r´esultats que la pr´esence d’une modalit´e additionnelle change
significativement les r´esultats.
Nous effectuons ´egalement d’autres exp´eriences afin d’´etudier la localisation temporelle
de la s´emantique des associations au sein de la phrase. Celles-ci indiquent que le
sens des phrases serait, de mani`ere non surprenante, souvent localis´e autour du mot
qui est associ´e `a ce sens. D’autre part une autre exp´erience indique que certains
coefficients de la repr´esentation interne se sp´ecialisent dans la reconnaissance de
certains des concepts. Il y a donc d’une certaine mani`ere ´emergence de ceux-ci.xviii
0.0
0.2
0.4
0.6
0.8
1.0
Cross-modal association score
image, motion motion, sound image, sound motion, sound, image
motion → sound
motion → image
sound → motion
sound → image
image → motion
image → sound
Figure 6 – Scores pour la tˆache de classification, pour diff´erentes exp´eriences dans
lesquelles deux o`u trois modalit´es sont pr´esent´ees `a l’entraˆınement. Chaque groupe
correspond `a un choix de modalit´e pour l’entrainement : trois groupes d’exp´eriences o`u
deux modalit´es sont pr´esentes et un avec les trois modalit´es. Chaque boˆıte repr´esente
la distribution des scores pour plusieurs r´ep´etition de l’exp´erience et un choix d’une
tˆache de classification, c’est `a dire d’une modalit´e dont un exemple est fourni et doit
ˆetre compar´e `a plusieurs exemples de r´ef´erence observ´es dans une autre modalit´e.
Discussion La premi`ere contribution de ce travail r´eside dans les nouvelles questions
qu’il aborde. Ainsi nous proposons une formulation des probl`emes de la
d´ecomposition de mouvement en composantes actives simultan´ement ou en tˆaches
´el´ementaires, ainsi qu’une r´eponse algorithmique `a ces nouveaux probl`emes.
De mani`ere g´en´erale, nous explorons l’apprentissage de concepts `a partir d’une
perception multimodale et non symbolique. Dans ce cadre l`a nous proposons un
approche originale, puisque s’appuyant sur des outils classiques d’apprentissage de
feature, au probl`eme de l’ancrage de mots acoustiques. En effet ce probl`eme a souvent
´et´e explor´e au travers d’approches consid´erant la parole et les autres modalit´es de
mani`ere tr`es dissym´etrique, et ayant souvent recours `a des processus de segmentation
ou de transcription statiques de la parole. Une originalit´e importante de ce travail
consiste en la relative sym´etrie de traitement des diff´erentes modalit´es.
L’absence de segmentation a priori de la parole r´ev`ele un autre aspect int´eressant de
ce travail. En effet, on peut opposer deux approches `a l’apprentissage de donn´ees
structur´ees : d’une part celle supposant que l’apprentissage des composantes de cette
structure pr´ec`ede la compr´ehension des donn´ees complexes, et d’autre part cellexix
pour laquelle la compr´ehension du tout pr´ec`ede celle des parties (voir Wrede et al.,
2012, pour de plus amples explications). Bien entendu de nombreuses approches se
positionnent ´egalement entre ces deux pˆoles. De ce point de vue notre travail apporte
un mod`ele d’apprentissage original o`u, en particulier, la compr´ehension des phrases
dans leur ensemble pr´ec`ede le concept de mot : il n’est pas besoin de segmenter
la phrase parl´ee en mots et de comprendre chacun de ceux-ci pour comprendre le
sujet g´en´eral de la phrase. Au contraire, c’est la compr´ehension du sens g´en´eral de la
phrase qui peut ˆetre localis´ee et ainsi d´elimiter des sons que l’on peut qualifier de
mots et qui peuvent correspondre aux mots r´eels.
Le travail que nous pr´esentons ici constitue ainsi une contribution originale `a plusieurs
questions ; il n’en pr´esente pas moins un certain nombre de limitations qui ouvrent
des perspectives diverses. Tout d’abord, une premi`ere famille de limitations concerne
la port´ee des exp´eriences pr´esent´ees : nombre d’entre elles consid`erent des probl`emes
qui restent tr`es simples et contraints, en comparaison de ce `a quoi est confront´e, par
exemple, un nourrisson. Une premi`ere voie d’am´elioration de ces travaux est donc
celle de l’am´elioration des techniques utilis´ees pour lever les contraintes et atteindre
des probl`emes plus r´ealistes.
De plus, nous nous concentrons ici sur la combinaison simultan´ee de parties de
mouvements mais laissons de cˆot´e de nombreuses autres formes de combinaisons.
En particulier il serait int´eressant d’´etudier simultan´ement la d´ecomposition de
mouvements combin´es en s´equence et en parall`ele. Une autre forme de structure
essentielle dans le cas du langage mais aussi du mouvement est la grammaire. Le
parall`ele important que constitue notre travail entre les structures du langage et du
mouvement pourrait ainsi ˆetre ´etendu `a l’´etude des structures grammaticales.
Dans la derni`ere exp´erience pr´esent´ee, nous partons de donn´ees qui associent de
mani`ere artificielle des exemples dans plusieurs modalit´es appartenant `a une mˆeme
classe s´emantique artificielle. Le syst`eme pr´esent´e utilise fortement l’hypoth`ese que
les exemples d’une mˆeme classe sont observ´es simultan´ement ; cette hypoth`ese sur les
donn´ee est appel´ee cross-situational learning par les psychologues. Le syst`eme pr´esent´e
est ainsi limit´e `a cette hypoth`ese. En revanche cette limitation ouvre une perspective
importante ; en effet appliquer ce mˆeme algorithme sur des donn´ees acquises au cours
d’interactions r´eelles entre un enfant et son environnement permettrait d’en apprendre
plus sur la structure de ces donn´ees et en particulier la viabilit´e du cross-situational
learning comme mod`ele d’apprentissage humain. Un autre perspective importante est
le d´eveloppement d’algorithmes tirant parti d’autre mod`eles d’apprentissages (voir
par exemple ceux pr´esent´es par Markman, 1990, Landau et al., 1998).
Finalement le sc´enario d’apprentissage que nous pr´esentons ne peut pas ˆetre compl`etement
qualifi´e de d´eveloppemental, et ce pour de nombreuses raisons. Parmi celles-ci
on compte la nature purement perceptuelle du syst`eme pr´esent´e. Une extension
importante en est l’´etude du couplage entre la structuration de cette perception et la
structuration qu’elle pourrait induire sur une boucle d’action et ainsi sur les donn´ees
per¸cues par le syst`eme cognitif.xxUniversite de Bordeaux ´
School of mathematics et computer science
Submitted in fulfillment of requirements for the degree of
Doctor of Philosophy
Specialized in Computer Science
The Emergence of
Multimodal Concepts
From Perceptual Motion Primitives
to Grounded Acoustic Words
Presented by
Olivier Mangin
Completed under the supervision of
Pierre-Yves Oudeyer
Defended on March, the 19th 2014 in front the committee composed of
Pr. Angelo Cangelosi — University of Plymouth Reviewer
Dr. Jean-Luc Schwartz — CNRS Reviewer
Dr. Jacques Droulez — Coll`ege de France President
Dr. Emmanuel Dupoux — Ecole des hautes ´etudes en sciences ´
sociales
Examiner
Dr. Manuel Lopes — INRIA Examiner
Dr. David Filliat — ENSTA-ParisTech ´ ExamineriiAbstract
This thesis focuses on learning recurring patterns in multimodal perception. For
that purpose it develops cognitive systems that model the mechanisms providing
such capabilities to infants; a methodology that fits into the field of developmental
robotics.
More precisely, this thesis revolves around two main topics that are, on the one hand
the ability of infants or robots to imitate and understand human behaviors, and on
the other the acquisition of language. At the crossing of these topics, we study the
question of the how a developmental cognitive agent can discover a dictionary of
primitive patterns from its multimodal perceptual flow. We specify this problem
and formulate its links with Quine’s indetermination of translation and blind source
separation, as studied in acoustics.
We sequentially study four sub-problems and provide an experimental formulation
of each of them. We then describe and test computational models of agents solving
these problems. They are particularly based on bag-of-words techniques, matrix
factorization algorithms, and inverse reinforcement learning approaches. We first
go in depth into the three separate problems of learning primitive sounds, such
as phonemes or words, learning primitive dance motions, and learning primitive
objective that compose complex tasks. Finally we study the problem of learning
multimodal primitive patterns, which corresponds to solve simultaneously several of
the aforementioned problems. We also detail how the last problems models acoustic
words grounding.
This thesis was conducted in the Flowers team from INRIA institute and funded
by an AMX allocation.
Keywords multimodal learning; language acquisition; symbol grounding; concept
learning; human behavior understanding; motion decomposition; motion primitive;
task decomposition; nonnegative matrix factorization; factorial inverse reinforcement
learning; developmental robotics
iiiivAcknowledgement
First of all I would like to thank Pierre-Yves for his enthusiastic, open minded, and
supportive supervision. He has been and continue to be a very enlightening mentor
and advisor.
I would also like to thank all the members of my jury and in particular my reviewers
for their rich and insightful comments on this work. I was sincerely honoured by
their interest they had for it and their presence at my defense.
Many thoughts and thanks goes to the Flowers team and collaborators. I would
like to thank in particular Louis ten Bosch for his friendly advices during his stay
in Bordeaux as well as the numerous and detailed explanation he gave me on his
previous work and. I also would like to thank Haylee for her patient participation
while recording motion datasets, Natalia for her helpful image data, and Caio for his
collaboration on conducting many experiments under sometime loose supervision.
I would like to thank all the members of the team for sharing many stimulating
discussions, common projects, and other great moments; in (approximate) order
of appearance: Pierre, Adrien, Jerome, B´erenger, Franck, J´er´emy, Thomas, Mai,
Olivier, Matthieu, Fabien and Fabien, Paul, Jonathan, Timoth´ee, Damian, Hong Li,
the other Thomas, Jonathan, Cl´ement, Aur´elien, the other Cl´ement, Didier, as well
as the Parisian members of the team and our team assistants, Marie, Nathalie, and
Nicolas.
I would like to thank the French state for its confidence and support in form of the
principal funding of this thesis and the INRIA institute for providing the environment
in which this work was developed.
I would also like to thank all those of my teachers and others who made me discover
the joys of science and fostered my curiosity.
To conclude, I would like most importantly to thank my family and friends for making
me who I am and consistently supporting what they have made ever since.
vviContents
A developmental robotics perspective 1
1 Complex and simple, whole and parts 7
1.1 Understanding and imitation of human behaviors . . . . . . . . . . . 8
1.2 Structured representations for complex motions . . . . . . . . . . . . 10
1.3 Language acquisition and multimodal learning . . . . . . . . . . . . 13
1.4 Important questions . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2 Technical background 19
2.1 Nonnegative matrix factorization . . . . . . . . . . . . . . . . . . . . 19
2.1.1 Problem description . . . . . . . . . . . . . . . . . . . . . . . 19
2.1.2 Basic algorithms . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.1.3 Variants and improvements . . . . . . . . . . . . . . . . . . . 25
2.2 Inverse reinforcement learning . . . . . . . . . . . . . . . . . . . . . . 26
2.2.1 Background: reinforcement learning . . . . . . . . . . . . . . 26
2.2.2 What is inverse reinforcement learning? . . . . . . . . . . . . 29
2.2.3 Algorithms for inverse reinforcement learning . . . . . . . . . 33
3 Learning a dictionary of primitive motions 37
3.1 Combination and discovery of motion primitives . . . . . . . . . . . 38
3.1.1 What does combination mean? . . . . . . . . . . . . . . . . . 38
3.1.2 Motion representations . . . . . . . . . . . . . . . . . . . . . . 39
3.1.3 Algorithms to decompose observed motions . . . . . . . . . . 42
3.2 Histograms of motion velocity . . . . . . . . . . . . . . . . . . . . . . 43
3.3 Discover simultaneous primitives by NMF . . . . . . . . . . . . . . . 45
3.3.1 The choreography data . . . . . . . . . . . . . . . . . . . . . 46
3.3.2 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.3.3 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.4 Concluding perspectives . . . . . . . . . . . . . . . . . . . . . . . . . 53
4 Learning a dictionary of primitive tasks 55
4.1 Previous work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.1.1 Inverse feedback and reinforcement learning . . . . . . . . . . 57
4.2 Factorial inverse control . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.2.1 Problem definition and algorithm . . . . . . . . . . . . . . . . 58
4.2.2 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.2.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
viiviii CONTENTS
4.3 Factorial inverse reinforcement learning . . . . . . . . . . . . . . . . 66
4.3.1 Multi-task inverse reinforcement feature learning . . . . . . . 66
4.3.2 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.3.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5 Learning a dictionary of primitive sounds 75
5.1 Models of language acquisition . . . . . . . . . . . . . . . . . . . . . 75
5.2 Hierarchical clustering of basic sounds . . . . . . . . . . . . . . . . . 77
5.2.1 Background and principle . . . . . . . . . . . . . . . . . . . . 78
5.2.2 Presentation of the framework . . . . . . . . . . . . . . . . . 78
5.2.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.2.4 Experimental scenario . . . . . . . . . . . . . . . . . . . . . . 84
5.3 HAC representation . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
5.3.1 Codebooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.3.2 Histograms of co-occurrences . . . . . . . . . . . . . . . . . . 88
5.4 Learning words with NMF . . . . . . . . . . . . . . . . . . . . . . . . 89
5.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
6 Multimodal learning 91
6.1 Multimodality in perception and learning . . . . . . . . . . . . . . . 91
6.2 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
6.3 Experimental setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
6.4 NMF for multimodal learning . . . . . . . . . . . . . . . . . . . . . . 98
6.4.1 Learning a dictionary of multimodal components . . . . . . . 98
6.4.2 NMF to learn mappings between modalities . . . . . . . . . . 99
6.5 Data and representation . . . . . . . . . . . . . . . . . . . . . . . . . 101
6.5.1 Motions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
6.5.2 Sounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
6.5.3 Images and videos . . . . . . . . . . . . . . . . . . . . . . . . 102
6.6 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.6.1 Learning semantic associations . . . . . . . . . . . . . . . . . 103
6.6.2 Learning words in sentences . . . . . . . . . . . . . . . . . . . 111
6.6.3 Emergence of concepts . . . . . . . . . . . . . . . . . . . . . . 114
6.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
7 Discussion and perspectives 119
A Non-negative matrices and factorization 125
A.1 Non-negative matrix theory . . . . . . . . . . . . . . . . . . . . . . . 125
A.1.1 Base definitions and notations . . . . . . . . . . . . . . . . . 125
A.1.2 Taxonomy of non-negative matrices . . . . . . . . . . . . . . 126
A.1.3 Perron-Frobenius theorem . . . . . . . . . . . . . . . . . . . . 127
A.2 Ambiguity in the problem definition . . . . . . . . . . . . . . . . . . 128
A.2.1 Generative model . . . . . . . . . . . . . . . . . . . . . . . . . 128
A.2.2 Representation of simplicial cones . . . . . . . . . . . . . . . 129
A.2.3 First case: linearly independent generators . . . . . . . . . . 129
A.2.4 Second case: rk(W) < K . . . . . . . . . . . . . . . . . . . . 130
B Datasets 131
B.1 The Acorns Caregiver dataset . . . . . . . . . . . . . . . . . . . . . . 131
B.2 The first choreography dataset . . . . . . . . . . . . . . . . . . . . . 131CONTENTS ix
B.2.1 Description of the data . . . . . . . . . . . . . . . . . . . . . 132
B.3 The second choreography dataset . . . . . . . . . . . . . . . . . . . . 132
B.3.1 Description of the data . . . . . . . . . . . . . . . . . . . . . 134
C Code 135x CONTENTSA developmental robotics
perspective
Late nineteenth and twentieth centuries have witnessed major scientific discoveries
in several fields: neurosciences, brain imaging, but also the study of phenomenology
by philosophers, the development of psychology, the invention of the theory of
computation, and further development of the computer science. It was followed by
the technical revolutions that lead to modern computers and robots, and mathematical
developments driven by new applications such as machine learning. All these elements
played an essential role in the advent of the understanding of cognition and intelligence,
in such a way that cognitive sciences, the name given to that knowledge and fields of
study, is a vastly multidisciplinary domain, that includes computational and robotics
models of cognition.
Among these discoveries, develpmental psychology has brought attention on the
processes that give rise to intelligence: instead of trying to understand directly the
structure of an adult mind, it examines the mechanisms that shape and organize
intelligence, starting from early childhood. Later, after a large part of research in
both cognitive sciences and artificial intelligence had been mainly focused on the
problem of understanding or imitating the adult mind, a similar shift in methodology
also appeared in artificial intelligence and robotics. However the idea that the human
mind should be studied through the processes of its development and maturation
was already clear in Turing’s mind sixty years ago.
“ Instead of trying to produce a programme to simulate the adult mind, why
not rather try to produce one which simulates the child’s? If this were then
subjected to an appropriate course of education one would obtain the adult brain.
Presumably the child brain is something like a notebook as one buys it from the
stationer’s. Rather little mechanism, and lots of blank sheets. (Mechanism and
writing are from our point of view almost synonymous.) Our hope is that there
is so little mechanism in the child brain that something like it can be easily
programmed. The amount of work in the education we can assume, as a first
approximation, to be much the same as for the human child. ”
Alan Turing, Computing machinery and intelligence (1950)
Although Turing was right about the importance of modeling child learning, he
was wrong saying the child starts with a blank sheet. Developmental and social
robotics therefore studies developmental mechanisms that can guide and constrain
the learning of robots, animals, and infants. The focus thus moves from building
12 A DEVELOPMENTAL ROBOTICS PERSPECTIVE
intelligent robots to a closer study of the behavior and learning mechanisms that make
the interaction between these robots and their environment evolve towards structured
interactions with persistent patterns. In other words this paradigm pertains to a
systemic approach of cognitive development that is directly grounded in Piaget’s
thoughts.
≪ L’intelligence ne d´ebute ainsi ni par la connaissance du moi ni par celle des
choses comme telles, mais par celle de leur interaction, et c’est en s’orientant
simultan´ement vers les deux pˆoles de cette interaction qu’elle organise le monde
en s’organisant elle-mˆeme.2 ≫
Jean Piaget, La construction du r´eel chez l’enfant (1937)
Developmental robotics is also often denoted as epigenetic robotics: a name that
emphasises the role of the robot history and environment in determining its final
state, in opposition to behaviors fully determined by its initial programming. The
motivations behind developmental and social robotics come from two goals, namely
building better robots and understanding human development, that are very different
in nature, but pointing toward the same area of research.
Firstly developmental robotics is motivated by building better robots. Indeed, science
fiction has been exploring for some time now all the possible impacts of robots on
our every day life and spreading the idea that robots could, as tools or companions,
be a great improvement to our quality of life, provided that security and ethical
issues are well dealt with. Actual robots are however still mainly confined to factories
or have to be remotely controlled by human operators. The truth is that robots
currently are only capable of very poor adaptivity to unpredictable environments
they have not been specifically programmed for. Real human environment are such
environments and thus this limitation constitutes a strong obstacle to deployment
of robots in every day life applications such as domestic assistance or human-robot
collaborative work. One reason of these limitations is that the programmer cannot
take explicitly into account all possible environments and situations the robot might
face. A promising approach to make such programming possible is to implement
basic mechanisms that make the robot capable of adapting its behavior throughout
its discovery of its environment.
The second motivation is that robots could help us understand the human brain.
Robots actually constitute a unique tool to model some biological, psychological
or cognitive processes and systems. This motivation lead to some early robotics
realizations that had a great impact on biological scientific communities. As one
early example, In 1912, Hammond and Miessner developed a robot called electric
dog (Miessner, 1919), that happened to be a good model of Jacques Loeb’s theory
to explain phototropism in insects. The robot had a major impact on the scientific
acceptance and diffusion of Loeb’s ideas (see Oudeyer, 2010). Building robots as
models of the child development is an analogous methodology that can help exploring
the mainly unresolved question of how children intelligence develops before reaching
the adult state. For that purpose developmental robotics research complements the
work done in other disciplinary fields that also focus on understanding the functioning
of the adult human brain.
2“Therefore intelligence does not start from self-awareness neither from the awareness of its
objects in their own, but from the interactions between both. Instead, intelligence organizes the
world by organizing itself simultaneously between both sides of that interaction.”3
Figure 7: Illustration of the electric dog from Miessner (1919).
Reviews on advances in developmental robotics can be found in work from Lungarella
et al. (2003), Asada et al. (2009). Among the many questions that are studied
by developmental robotics two are of greater importance for this work. First,
understanding the mechanisms enabling language acquisition by children is still
subject to many open scientific questions (see Kuhl, 2010). Furthermore, building
robots with language acquisition capabilities is a promising way of improving human
robot or human computer interaction. Although there exist speech acquisition systems
and natural language interfaces, these do not feature the adaptability required by the
great variety in user preferences and languages. Most of these systems are built for a
few target languages and user cases, that have nothing to do with the variety of words
and skills people even enjoy teaching to their dog. Furthermore many systems do not
focus on the transmission of concepts through natural interaction and the grounding
of natural interaction on these concepts, although they are fundamental mechanisms
of the emergence of communication between humans or humans and pets. The range
of skills that a user would expect from a robot is also very wide and made even wider
by the addition of user preferences. Similarly, natural teaching of robots seems a much
more plausible solution than specific engineering for each use case; one way to achieve
such teaching is known as imitation learning or robot programming by demonstration.
Indeed, to have humans directly demonstrate tasks to a robot, or shaping the robot4 A DEVELOPMENTAL ROBOTICS PERSPECTIVE
behavior to fit their preferences, is much more accessible than actually programming
the robot. Furthermore user preferences are not always easy to formulate, either
using robots currently very poor language capabilities, or programming languages.
While many techniques have been developed toward imitation learning for robots,
most of them still target the single task setup. Such limitation is problematic, not
only because robots are not necessarily expected to achieve only one task, but also
because what seems to be a single task often is, after closer inspection, a combination
of several tasks. Also, typical teaching to children does not go directly to complex
tasks but through the learning of skills of increasing complexity: such a progressive
trajectory might also be beneficial to teaching robots. Furthermore, common skills
might be seen as prerequisites to learning complex ones; being able to re-use such
skills, as already learnt by a robot, is also a promising way to ease the skill acquisition
process.
In this thesis, we embrace the developmental robotics approach and consider the
learning and developments that occurs directly on top of the sensori-motor perception.
We particularly explore the questions related to the decomposition of motions as well
as multimodal perceptual signals and therefore target several aspects of perception
and language acquisition. Decomposing the complex into simple parts and composing
simple building blocks into complex things are actually processes of great interest
for the aforementioned questions. The acquisition of language is a very intuitive
example of that decomposition that the structure of language itself implements:
spoken language is made of sentences that are composed of words, which, themselves,
are produced by sequencing phonemes. On the other side, the study of language
acquisition by children shows that they first learn to recognize and produce phonemes,
before going to words, and then sentences of increasing complexity (Kuhl, 2004).
Similar observations on the production of actions suggests that children first learn
to grasp before combining this skill with placement, and before they start building
piles of toys. The motivation for roboticists is then to build mechanisms that make a
robot capable of similar combinations of simple skills it already masters into more
complex ones. Indeed, while it is now possible to teach various tasks to a robot,
the evolution over time of the number of tasks a robot masters is typically linear:
the time required to learn each new task does not really decrease as experience is
accumulated by the robot, even if the task has a lot in common with a task already
learnt. Achieving better re-use of knowledge is thus a promising way of improving
the amount of tasks a robot can learn and achieving life-long learning (as claimed
by Thrun and Mitchell, 1995): exploiting the combinatorial structure of skills and
knowledge makes it possible to learn new skills by efficiently combining mastered
competences (see Taylor and Stone, 2009, Cangelosi et al., 2010).
From a wider perspective, the question of how learning can happen in an open-ended
perspective is well identified as a major challenge for developmental robotics (see
Lungarella et al., 2003, Weng et al., 2001). Despite that objective being clearly
identified, most experiments in that fields, for example those involving between tens
and thousands of repetitions of single grasping tasks, rarely last more than a few
hours or days: much less than the scales of animal lives. Precisely, the mechanisms
that could drive the shift from simple to complex in such learning, as observed on
children, are still not well understood. Often, the tasks on which domestic robots
are expected to be used, are too complex to be teachable, even to a state of the art
robot; an important part of that complexity actually comes from the highly variable
and complex nature of the environment in which they take place.5
Computational approaches often implement a notion of primitive elements that
models the simple to complex approach. This follows the intuition of cumulative
learning: a learning system gradually acquires a lexicon of elements. At first it
acquires elements of very low complexity; then this complexity gradually increases as
learnt elements can be combined into more complex ones, that become themselves
parts of the lexicon (see Cangelosi et al., 2010, sec. 3 and 4). This model is clearly
inspired by the structure of language where the lexicon is initially populated by words
before including word groups, propositions, and sentences of increasing complexity.
The same idea have been used to model motion and is often behind the notion
of motor primitives, as used by roboticists (see the discussion by Konczak, 2005).
A similar idea have been studied extensively in the field of machine learning and
often applied to vision (Aharon et al., 2005, Lee et al., 2006); it is named dictionary
learning. Therefore one motivation behind the work in this thesis was to explore the
application of these ideas and the large literature of associated techniques to the
aforementioned questions of developmental robotics.
Despite being quite intuitive, the idea that learning systems first learn basic and
local elements, such as words or short and precise motions, and then combine them
into complex knowledge, is neither necessarily how it happens for children nor the
only way to build artificial learning systems. Indeed such an approach, denoted as
compositional puts the ability to segment complex motions or sequences into small
parts as a prerequisite to learn these parts. As explained further these capabilities
often corresponds to solving quite difficult or ambiguous problems. On the other
hand the teleological approach (Wrede et al., 2012) achieves first a global or holistic
representation, that enables basic interactions with the world, before understanding
the details and parts that compose for example the motion or sentence. As explained
further, this thesis provides models of the learning of perceptual components that
follows the holistic to decomposed pattern.
Chapter 1 introduces more precisely the central questions studied in this thesis.
It explains how concrete issues from the fields of imitation learning, programming
by demonstration, human behavior understanding, the learning of representation,
structure learning, language acquisition, and multimodality connects with this work.
That chapter identifies more precisely three central issues studied in this thesis: “How
can the intuition about simple and complex be made explicit and implemented on a
robot or an artificial cognitive system?”, “How can primitive elements emerge or be
discovered through interaction of the agent with its physical and social environment?”,
and “What mechanisms can overcome the intrinsic ambiguity and indeterminacy
that is characteristic of many approaches regarding the learning and emergence of
these primitive elements?”
In chapter 2, background on the techniques and algorithms used in this work is
provided. It first introduces in details the family of nonnegative matrix factorization
algorithms as well as related mathematical theories, but also other affiliated
algorithms. Then an introduction to the domain of inverse reinforcement learning
and inverse feedback learning is provided, on which new algorithms are grounded in
chapter 4.
Chapter 3 introduces contributions of this thesis to the field of motion primitives in
more detail (Mangin and Oudeyer, 2012a). It explains why it is important to take
into account the simultaneous combination of motion primitives, and provides an
algorithm and a dataset to illustrate these ideas. Finally it discusses the evaluation6 A DEVELOPMENTAL ROBOTICS PERSPECTIVE
of that algorithm with respect to a linguistic weak supervision.
Chapter 4 explores similar questions in the space of intentions that often underly
actions: following inverse optimal control and inverse reinforcement learning, demonstrations
of actions can be modelled by a demonstrator’s intention, that takes the form
of an objective function, also called task. Chapter 4 derives new algorithms (one of
which was presented in Mangin and Oudeyer, 2012b) to decompose a demonstrator’s
behavior in the task space instead of in the action space.
Chapter 5 reviews methods used to discover primitive acoustic elements that can
form basis for word representations. Two approaches are presented, one from Mangin
et al. (2010) based on a hierarchical clustering algorithm, and an other one from ten
Bosch et al. (2008), re-used in the following.
Finally chapter 6 brings together the work from chapters 3 and 5 to provide a
multimodal learning algorithm (first presented in Mangin and Oudeyer, 2013) that
models language grounding and the acquisition of abstract semantic concepts. We
explain how that algorithm can model the simultaneous learning of components in
several modalities (two or three in the experiments), and of their semantic relations.
Furthermore, in the case where one modality contains spoken sentences, we demonstrate
that the system focuses more precisely on parts of sentences that bear the
semantics, thus illustrating a form of word acquisition, where that segmentation of
words is more a consequence than a prerequisite of acquiring semantic knowledge.
A discussion of the contributions and perspectives introduced by this thesis is provided
in chapter 7.Chapter 1
Complex and simple, whole
and parts
The main focus of this work is on the learning by a cognitive agent of dictionaries of
basic or primitive elements from various potentially multimodal perceptual signals
such as motion, images, or sound, which includes language, but also action. By
primitive elements we mean, for example, phoneme-like primitive sounds, primitive
dance gestures such as raising an arm, primitive objectives in complex tasks such as
reaching a body configuration, or patterns in multimodal perception that ground
semantic concepts. In the following these elements are denoted as primitive elements.
This notion does not imply that such element are atomic or indivisible, but rather
that they may be combined together to form more complex elements. As an example,
if the elements are vectors and combination means linear combination, these elements
may form a basis in the sense of linear algebra. However, as discussed further, linear
combination is far from the only possible combination.
We claim that the study of primitive elements, together with their combinatorial
properties and the algorithms to learn them, is of great interest for developmental
robotics in two main aspects. First, composite representations of perception and
actions for robots are promising ideas toward overcoming the limitation of many
current robotic platforms to a single task in a single context. Indeed some of these
platforms have an approach equivalent to learning by heart a whole sentence from
many examples, whereas focusing on learning a dictionary of words together with a
grammar would enable generalization to new sentences. We believe that, not only
robots could benefit from this approach by gaining better versatility in their ability
to re-use skills, but composite representations might be more understandable by
humans and ease the process of programming or interacting with robots. A simple
example of this idea is given by Calinon and Billard (2008) who demonstrate how
one can separately teach a robot to pour watter and to hold a glass, before having
the robot merge the two tasks to fill a glass of water1
. Also, building algorithms
that are able to learn such composite elements is an attempt to model aspects of
human perception that features such properties, and eventually also its limitation.
1A video of this experiment can be found on Sylvain Calinon’s home page (http://calinon.ch/
showVideo.php?video=11).
78 CHAPTER 1. COMPLEX AND SIMPLE, WHOLE AND PARTS
For instance Kuhl et al. (1992), Kuhl (2004) explain that during early language
acquisition infants learn classes of sounds that are functionally equivalent, but also
that this process makes them unable to differentiate between sounds from the same
class: not only the brain learns some primitive sounds but these elements later play
a fundamental role in the acoustic perception. In that particular example, the learnt
primitive elements not only feature combinatorial properties in the way they are
later combined into words, but also become, to a certain extent, atomic elements of
perception.
In the remaining of this chapter the relation of this topic with various subjects of
developmental robotic, but also psychology and machine learning, is explained in
more details.
1.1 Understanding and imitation of human behaviors
Imitation has long been identified as a central mechanism for cultural transmission
of skills in animals, primates, and humans, but also for the development of
communication (see Whiten and Ham, 1992, Nadel, 1986, Tomasello, 2008). It is
indeed not only an example of learning from social signal, but also a central aspect of
learning to be social. Back to a robotic perspective, programming by demonstration
refers to the transposition of the mechanism of learning by imitation as observed
in humans to robots. The word programming actually suggests that teaching a
skill to a robot by providing demonstrations to that robot may remove the need
to actually program the robot, which currently requires advanced technical skills.
Another important motivation of such an approach is that tasks are sometimes too
complex to be reasonably described, even using natural language, or correspond
to preferences of a user that are not fully conceptualized. In addition to learning
the whole task from imitation, it is possible to use demonstrations together with a
feedback signal and self-refinement of skills (see for example Kober and Peters, 2009)
as well as self-exploration. Finally, designing systems capable of human behavior
understanding, even without reproducing such behaviors, is a research field that faces
issues very similar to the one presented in this section.
Although children seem to be capable of learning by imitation very easily, the task
turns out to be more complicated on a closer examination. As is often the case, the
difficulties are easily observed once one try to program a robot imitator. The first
important issue faced by the imitator is known as the correspondence problem: how
can the imitator relate the motions on the demonstrator’s body to its own body? The
problem is even made more complicated by the fact that the demonstrator’s body
is not identical to the imitator’s one and might actually be very different. Nehaniv
and Dautenhahn (2000) formalize this issue as the one of “finding a relational
homomorphism between the two bodies”.
The correspondence problem might be overcome by using hard coded mappings
between the demonstrator’s and the imitator’s bodies or even by directly demonstrating
the skill on the imitator body, a techniques called kinesthetic demonstration.
However the question of how this capability emerges in children is a very interesting
one; some models of early imitation have been developed on that question by Nagai1.1. UNDERSTANDING AND IMITATION OF HUMAN BEHAVIORS 9
(2007). Andry et al. (2001) have explained how a homeostastatic mechanism, that
is to say that tries to reduce the error between prediction and observation, can be
sufficient to generate imitation behaviors. Following that idea Boucenna et al. (2010)
showed through a robotic experiment how imitation of facial expressions by a robot
can emerge from a predictor that was learnt while the human was first imitating the
robot. Kaplan and Oudeyer (2007) also provide a model of imitation as emerging
from intrinsic motivations: a progress based model of curiosity can drive a robot
toward imitation as an efficient learning strategy.
The ability of the brain to relate actions of others to its own has been shown to
have a neural manifestation in the existence of mirror neurons. Rizzolati and his
collaborators have indeed discovered neurons in the premotor cortex of monkeys
that fire both when the monkey performs a specific action or observes someone else
performing the same action (Cattaneo and Rizzolatti, 2009). Strong evidence from
neuro-imaging suggests the existence of areas with similar functions in the human
brain. Their discoveries suggest that the ability to recognize an action done by
someone else is related, from a neurone point of view, to the one of producing the
same action.
The correspondence problem is not the only difficulty brought by imitation learning.
Should the exact motions of the demonstrator be reproduced? Or should the imitator
rather try to solve the same task? But what is that task? Should the imitator
try to fit some kind of preference of the demonstrator while achieving the task? Is
every action of the demonstrator relevant to the imitator? Such questions are often
summarized as “What, Who, When, and How to imitate?” Although they seem
naturally answered by children, it is not clear how to make these choices. See also in
fig. 1.1 the strategy triangle from Lopes et al. (2009a) that illustrates some of these
modelling choices.
Follow intrinsic preferences
Imitation Adhere to inferred
“intention”, replicate observed
action and effect.
Emulation Replicate observed
effects.
Non-social behavior
Social behavior
Figure 1.1: The strategy triangle from Lopes et al. (2009a) illustrates the potential
combination of several simple behaviors into an imitation mechanism.
The work we present is mainly related to the question of “What to imitate?”, which,
following Cederborg and Oudeyer (2013), includes the motor ‘gavagai’ problem
that extends Quine’s translation indeterminacy (see section 1.3). A way to clarify
this point is to discriminate different levels of imitation. Byrne and Russon (1998)
introduced the distinction between action-level imitation, which consists in mimicking
every action of the demonstrator (for example following the same arm trajectory),
and program-level imitation, which focuses on reproducing the overall structure of10 CHAPTER 1. COMPLEX AND SIMPLE, WHOLE AND PARTS
the movement (for example following a different trajectory but featuring the same
steps of reaching, grasping, lifting, etc.) Although quite intuitive, the notion of
program-level imitation leaves open the question of the nature of the structure that
the imitator should preserve, a question very similar to the ones introduced in the
following section. Demiris and Hayes (1997) further introduce functional imitation,
also called effect-level imitation by Nehaniv and Dautenhahn (2000), which consists
in producing the same effect than the demonstrator, and abstract imitation, which
denotes imitation of the demonstrator’s internal state (for example the demonstrator
laughing could be imitated by smiling). Lopes et al. (2009a) provide a model of
some of these imitation mechanism, formulated in a Bayesian framework in which
effect-level imitation is named emulation.
It follows from that discussion that the question “What to imitate?” closely relates
to the question of how to decompose an observation into parts, including the choice
of the level of granularity of the decomposition, together with the question of the
nature of that decomposition. Furthermore the relevance of a level of decomposition,
or a certain part in that decomposition, closely relates to focus, saliency, attention,
and mutual attention that are central properties of imitation in humans and animals.
While these two sets of questions might seem related but distinct at first sight, they
actually are entangled: on one side having a good representation of motion is crucial
to distinguish what is relevant within and across motions; on the other side mutual
attention and other social signals are essential to achieving that decomposition and
solving the indeterminacy that comes with it, as detailed in the followings sections.
The work presented in this manuscript provides examples of what can be achieved
by addressing both issues at the same time.
1.2 Structured representations for complex motions
The question of the complexity of movements and skills comes from the observation
of human learners. It also seems to be both an empirical evidence in pedagogy and a
natural way to proceed that learning occurs in a cumulative manner, starting simple
and then growing in complexity. It seems quite easy to have an intuition about what
a simple or a complex movement is: driving a plane looks obviously more complex
than grasping simple toys. However, if one looks at what robots can actually do,
it seems that currently robots are better at driving planes (or helicopters2
) than
at grasping objects. Actually this example is not really fair, but it points out that
actually defining what a complex movement or skill is probably looks easier than it
really is. Indeed, the complexity of a motion or an action is highly subjective to the
agent’s body, experience, culture, etc. Taking another example, why is a newborn
gnu capable of walking within a few minutes3 when human infants need months
to achieve a similar behavior? Is this a proof that the gnu brain is more advanced
regarding the learning of walking, or the expression of an evolutionary trade-off
between the ability to quickly learn one task and the ability to learn a wider variety
of tasks? From an epistemological point of view, research in artificial intelligence
have long focused on solving the problems that looked difficult from a human point
of view, such as playing chess, and considered as more anecdotal problems such as
the ability to acquire mental representations of the world and grasp a chess tower or
2More information and videos can be found at: http://heli.stanford.edu
3As demonstrated by the online video: http://youtube.com/watch?v=zGaD2DH4evs1.2. STRUCTURED REPRESENTATIONS FOR COMPLEX MOTIONS 11
knife (see Brooks, 1991). It seems now that the latter are much more difficult than
the former. In particular we ground our study on the cognitive development starting
from the sensori-motor level of perception: we thus take more interest in the shaping
of that perception than in solving high level problems in a symbolic world.
A fundamental question behind these realities, both for biologists and roboticists, is
to understand how life long learning is possible in a way that enables the efficient
re-use of previously acquired knowledge and skills: answering this question provides
at least one definition of complexity or simplicity of skills from a biological point
of view. One approach, often labelled as cumulative learning, consists in gradually
acquiring a lexicon of elements of increasing complexity, such that new elements can
be obtained as the combination of simpler ones (see Cangelosi et al., 2010, sec. 3–4).
The concepts of motor synergies and motion primitives have been introduced as
a potential implementation of this approach, by both motor control theorists and
roboticists (see Konczak, 2005). Motor primitives represent simple building blocks
that can be composed to form complex motions. For example Mussa-Ivaldi and Bizzi
(2000) interpret a group of experiments on the control system of frogs and rats as
giving strong evidence that the brain features a set of primitive force fields that are
combined linearly into more motor commands. Tresch and Jarc (2009) provide a
more detailed review of that subject.
1 cm 0.5 N
&
A B
+
Figure 1.2: Illustration from Mussa-Ivaldi and Bizzi (2000): A and B are two force
fields measured on a frog while stimulating two distinct spinal sites. & is measured
by separately stimulating both sites and + is obtained by summing A and B: the
result illustrates the combination in the frog’s spine of two primitive force fields.
Although it seems natural to try to decompose complex motions into simpler elements,
one could ask: “What is a complex movement or skill?” There are actually multiple
answers to this question, each of which is of great interest regarding this work.
First, an easy answer to the question is: “A complex motion is a motion composed of
simpler parts.” This actually leaves us with new questions. The first one is naturally:
“What is a simple motion or skill?” Actually, for roboticists, this question is deeply12 CHAPTER 1. COMPLEX AND SIMPLE, WHOLE AND PARTS
related to the way motions and actions are represented. Indeed simplicity, for a
computer, often means efficiency of representation (or compression) whereas, for a
human, a motion is often called natural or simple when it seems simple to produce.
Unfortunately it seems that these definitions sometime refer to very different or
even opposite notions of simplicity. The same difference arises with computers: it is
easy for a computer to perform operations on very big numbers that a human could
not perform. On the other hand a human is for example able to intuitively detect
intersections between a large number of segments, an operation for which a computer
requires complex algorithms. Actually in that last example, the problem described
is not really the same for the human and the computer: while for the human the
segments are represented visually, for the computer they are represented as a list of
pairs of points. Therefore the human representation is much closer to both the nature
of the geometrical property under consideration and to the processing capabilities of
the human visual cortex. From using this analogy for robotics skills or behaviors, it
follows that the first question on defining simplicity of motions can be studied through
the research of motion representation that lead to efficient representation of human
natural motions. Li et al. (2010) have shown that learning such representation from
a set of observations of human motions also leads to good compression capabilities
of natural human motion. Therefore, learning an appropriate representation have
brought together both a computational notion of complexity, related to compression
capabilities, to a more human centric one.
Looking back to the aforementioned easy answer, namely “A complex motion is a
motion composed of simpler parts.”, raises an other question, that is given by looking
at the dual problem: instead of trying to define what a simple and a complex motion
are, we could try to define what relates the simple to the complex motion, that
is to say how primitive motions can be composed or combined into more complex
ones. The study of the different ways of decomposing motions is central to this work
and studied in more details in chapter 3. In many cases there is not uniqueness of
decomposition; we refer to this issue as the indeterminacy of the decomposition. The
indeterminacy of decomposition is analogous to phenomenon such as multistability
in perception (see Blake, 1989, Leopold and Logothetis, 1999, Schwartz et al., 2012b,
and fig. 1.3). Another central question is, knowing what notion of composition is
involved, find means of removing the indeterminacy, that is to say find a relevant
decomposition into simpler elements.
Although the ambiguity of decomposition is faced by learning systems throughout their
development it is not necessarily a prerequisite of that development. Furthermore,
we have seen that complex components of perception and action could be defined as
composed of simpler parts, but this notion of complexity may not fit the order in
which infants acquire knowledge. In order to clarify this point in the following, we
chose a different terminology: we refer to components that are combined into complex
perceptions or actions as primitive or local components. Wrede et al. (2012) contrast
compositional understanding, that describes an agent that is aware of the local
components and their combination into a global perception or action, and teleological
understanding, that accounts for an agent that only features global perception. More
precisely the term teleological refers to a pragmatic emphasis on using the global
knowledge even without refined understanding of its structure.
According to Wrede et al. (2012) the developmental path of infants goes first through
teleological understanding before reaching compositional understanding. This devel-1.3. LANGUAGE ACQUISITION AND MULTIMODAL LEARNING 13
Figure 1.3: Necker’s cube is a classical example of multistability in vision.
opmental path is to contrast to the one stating that compositional understanding
occurs first before any usage of the knowledge. Actually if simple and complex are
defined with respect to the developmental path, each vision leads to an opposite
definition of these notions: according to Wrede et al. (2012) the global stimulus
is simpler, since used before by infants, than the local or primitive stimuli, whose
awareness comes later. Conversely stating that compositional understanding comes
first means that the primitive stimuli are simple and their composition complex.
Because of that antagonism it is important to notice that ‘primitive’ may not mean
simple and to differentiate ‘complex’, meaning ‘composed’, and ‘complex’, meaning
harder to learn.
This thesis studies directly relations between local parts and global perceptions.
With respect to these questions, we embrace the point of view of Wrede et al. (2012),
positing that teleological understanding may comes first. Therefore we generally
do not assume the understanding of the compositional structure of perception to
achieve global understanding. Furthermore we demonstrate that the perception of
components can result from an auto-organisation of global perception: we provide
models of the emergence of local components of perceptions (primitive motions, words)
from the global perception, in contrast to achieving decomposition of perception as a
pre-requisite to learning.
1.3 Language acquisition and multimodal learning
We already mentioned the question of the emergence of phonemes and words as
examples of primitive elements occurring in the speech signal. Chapter 5 presents in
more details technical approaches to the question.
A difficult aspect of the discovery of phonemes and words is the issue of segmentation.
In the fields of speech recognition and acquisition, segmentation refers to the task of
finding word boundaries from an acoustic stream containing spoken language. This14 CHAPTER 1. COMPLEX AND SIMPLE, WHOLE AND PARTS
is a difficult problem: unlike written language, spoken signal does not feature easy
to detect word boundary cues similar to space characters or silences at the end of
sentences (Brent, 1999). An illustrative example of the difficulty and ambiguity of
segmenting written language without spaces is given by Kuhl (2004): the sentence
“theredonateakettleoftenchips” could be segmented into “the red on a tea kettle often
chips” or “there, don ate a kettle of ten chips”. Importantly the previous example
highlights the ambiguous nature of the segmentation problem.
It has indeed been largely discussed whether the segmentation capability is a prerequisite
or a consequence of word recognition, and whether it should play a central
role in the word recognition process. Actually experiments on infants performed
by Saffran et al. (1996), Saffran and Wilson (2003) have shown that young infant
were capable of discovering words from an unknown language after a very short
period of exposition (three minutes in their experiment) to acoustic signal only. More
precisely their experiment demonstrates that children react differently when hearing
sentences containing words they have been exposed to; interestingly this behavior
emerges only from statistics on the acoustic signal. Following this experiment a
large number of computational models of word discovery have been developed that
implement a word segmentation process. A review of early work in that direction
is given by Brent (1999). An interesting experiment from Park and Glass (2008)
proposes a computational approach for an unsupervised setup very close to the
one of Saffran et al. (1996). On the other hand ten Bosch et al. (2008) have also
demonstrated that word recognition can be achieved by an artificial learner without
an explicit implementation of a segmentation process, but instead some form of
symbolic supervision. The work presented in chapter 6 is inspired from the approach
of Bosch and colleagues; however, we relax the symbolic supervision and instead
study the use of multimodality to address the ambiguity issue.
Similar studies have also been conducted about the important question of grammar
acquisition. Gomez and Gerken (1999) and later Saffran and Wilson (2003) have
shown in experiments very similar to the previous one of Saffran et al. (1996), that
children around twelve months that are exposed for a short time to continuous speech
generated from a grammar involving unknown words, react differently at the end of
the initial exposure to utterances that are grammatically correct or not.
The notion of multimodal learning, which is a major topic of this thesis, refers to the
ability of learning from a stream of mixed data coming from various sensory inputs,
with different nature (for example sound, vision, taste). The close relation between
language learning and multimodal learning is a central question of the work presented
in this thesis. One immediate reason of that relation is that language acquisition is a
multimodal problem because the language signal is multimodal. An evidence of that
aspect was given by McGurk and MacDonald (1976) and is referred to as the McGurk
effect: when someone observes lips pronouncing ‘ga’ while he hears ‘ba’, he most of
the time reports to have perceived the sound ‘da’ (see also Schwartz, 2010). Another
major reason for claiming language and multimodal learning are closely related is
the following: considering learning is taking place on top of multimodal perception,
that not only include language signal but also other contextual information, provides
a plausible solution to the ambiguity issues that occurs from language learning. One
important source of ambiguity in language acquisition is related to the process of
associating words to meanings, a process that is also known as symbol grounding
and was introduced by Harnad (1990) (see also Glenberg and Kaschak, 2002). Many1.3. LANGUAGE ACQUISITION AND MULTIMODAL LEARNING 15
unsupervised approaches introduced above only model the discovery of acoustic
words, without relating these words to any kind of meaning, and relying exclusively
on acoustic properties of the signal for their discovery. On the other hand the work
presented by ten Bosch et al. (2008) focuses on the discovery of relations between
the acoustic signal and a symbolic contextual information. The discovery of word is
then shown to be a side effect of the learning of these correlations. In chapter 6 this
idea is taken further and shown to extend to a multimodal signal that do not contain
any predefined symbol. Similar ideas, but with some kind of symbolic information,
where also featured in several previous works (Roy and Pentland, 2002, Yu and
Ballard, 2004, Massera et al., 2010, Driesen et al., 2010, Saenko and Darrell, 2007,
BenAbdallah et al., 2010, Ngiam et al., 2011).
Symbol grounding is however not an easy problem but rather an ambiguous one. An
important aspect of such ambiguity is the indeterminacy of reference introduced by
Quine (1960), which is often illustrated by the ‘gavagai’ thought experiment. Quine
presents the situation of a linguist who studies an unknown language and observes a
speaker pointing toward a rabbit while saying ‘gavagai’. In that situation the linguist
cannot discriminate between several possible meanings of the word ‘gavagai’: it could
actually mean ‘rabbit’ as well as ‘undetached rabbit parts’, ‘animal’, ‘food’, or even
‘an object out of my reach’. Interestingly very similar issues occur in other modalities;
one of them is referred as motor ‘gavagai’ problem in the case of imitation learning
(see section 1.1 as well as Cederborg and Oudeyer, 2013).
Finally, language is strongly related to action. The actual production of spoken
language through the articulatory system is an immediate example of this relation.
Indeed a spoken utterance may be seen either on the side of the produced acoustic
stream, or on the side of the muscle commands that yielded that acoustic stream.
The role of each one of these aspects of sound in its perception is still an actively
discussed subject (for more details please refer to Schwartz et al., 2012a). Either way
this duality constitutes another important aspect of language multimodality.
Another important facet of the relations between language and action comes with
the notion of grammar of action. While similarities between linguistic grammatical
constructs and the structure of many common actions is quite straightforward (in
the sense that it is perceived without effort), it is less clear to know if this similarity
is coincidental or whether we perceive action this way because of our exposure to
language, or if language has evolved on top of our perception of action grammar.
The latter opinion is actually the subject of a whole theory about language origin
called the syntactic motor system introduced by Roy and Arbib (2005).
The talking heads experiment (Steels, 1999, Steels and Kaplan, 2002) has been
introduced by Steels and colleagues to study the emergence of language inside a
community of robots as a model of the emergence of language in human communities.
Each robot possess its own set of visual concepts and its own lexicon of associations
between these concepts and initially arbitrary words. The experiment is based on
an interaction frame between two robots called guessing game. During the game
the pair of robots is looking at a visual scene that consists in geometric shapes on
a magnetic board. The game follows several stages: to start, the first robot, called
‘speaker’, chooses a part of the visual scene that is shared with the second robot; then
the speaker choses a topic among the objects in that region4 and vocalizes a verbal
description of that object; after perceiving the object description, the hearer robot
4
In practice, in many experiments, the topic is actually chosen randomly.16 CHAPTER 1. COMPLEX AND SIMPLE, WHOLE AND PARTS
guesses the described object (communicating its guess with a mechanism equivalent
to pointing) and the speaker provides positive or negative feedback on the interaction,
depending on whether it was successful or not. The experiment demonstrates that
the simple interactions, combined with rotations in the role the robots play in the
game, as well as in the pairs of interacting robots, lead to the emergence of a shared
language at the scale of the robot community. Steels and colleagues define the
semiotic square (see fig. 1.4) that illustrates the indirect nature of the communication:
both agents in the guessing game have to go through the lexicon and ontological
levels to bind the vocalization to its meaning (the referent object). This aspect is
closely related to the grounding problem mentioned previously; it emphasizes the
distinction between the sign used to communicate, its meaning for one agent, and the
grounding of that meaning into perception. Importantly neither the signs, nor the
meaning, nor the perception is exactly shared between the two agents: each of them
has its own instances of signs, meanings, and perception. Throughout the interaction,
the coherence between the signs, meanings, and perceptions of the agents increases.
image topic
meaning utterance
perceive
conceptualize
verbalize
referent image
utterance meaning
act
apply
interpret
Speaker Hearer
Figure 1.4: Illustration of the semiotic square as presented by Steels (1999). The left
part illustrates the generation by the speaker of an utterance describing the topic,
and the left part to the interpretation of the utterance, as perceived by the hearer,
into an hypothesis about the referent.
In this thesis we provide implementations of language learning experiments that
do not assume direct access of the learner concepts as symbols, that is to say that
do not shortcut the semiotic square (see chapter 6). The experimental frame we
study for the language experiments is very close to the one of the talking heads.
Therefore, although the questions studied in this thesis are mainly agent-centric, the
implementations we described can be thought as replacement of the agent model in
the talking heads experiment. However, a limitation has to be added to that claim,
which is that we do not address the question of language production.
1.4 Important questions
In this chapter many subjects amongst those targeted by developmental robotics were
introduced in which primitive elements play an important role for action, perception,
and their acquisition and development. Such primitive elements might be phonemes,
words, elementary motions, primitive objectives in tasks, objects or parts of objects
in visual scenes, or multimodal elements combining several of these. In this thesis we
explore this notion of primitive elements and various aspects of it. This study and
its presentation is organized along specific axes that are listed below.1.4. IMPORTANT QUESTIONS 17
How can the intuition about simple and complex be made explicit and
implemented on a robot or artificial system? We have seen that the notions
of simple and complex, although being very intuitive, are not so easily formalized and
that some perspectives can lead to definitions that are even opposite to their intuitive
counterpart. We have discussed that one approach is to define the complex as the
combination of several simpler parts. This shifts the question of defining simple
and complex to the nature of the algebraic properties of the simple or primitive
elements. We introduced several ways of combining primitive elements into complex
ones. Given one of these, the question of the implementation remains: how can the
low-level representation of motion or sound include sufficient algebraic properties
so that real complex sounds are well represented as combinations of simpler ones,
under these properties? In other words, the question is to find representations of the
perception and associated algorithms that are good substrates to the emergence of
behaviors, regarding the simple to complex paradigm, that match the observation of
children behaviors.
How can primitive elements emerge or be discovered through interaction
of the agent with its physical and social environment? The importance of
this question for both the understanding of children development and the conception
of robots with similar capabilities is quite straightforward. However the diversity
in nature in physical and social interactions that are essential to this emergence
suggests a large number of candidate principles that could explain it. We study this
question with a focus on the approach stating that the compositional understanding
occurs after global representation of stimuli and actions.
What mechanisms can overcome the intrinsic ambiguity and indeterminacy
that is characteristic of many approaches regarding the learning and
emergence of these primitive elements? Many of the questions regarding the
decomposition of perception into meaningful parts are actually very ambiguous. We
have introduced several examples of such ambiguity as for example the decomposition
of sentences into words or the relation between a word and its meaning. Communication
with humans requires that these ambiguities are resolved; furthermore the
mechanisms used by humans to resolve similar ambiguous issues seems to be central
in their development. Therefore gaining insights on these mechanisms is expected to
provide a better understanding of the associated cognitive processes.18 CHAPTER 1. COMPLEX AND SIMPLE, WHOLE AND PARTSChapter 2
Technical background
As a preliminary to the presentation of experiments in direct relation to the subject
of this thesis, we present separately in this chapter a set of technical details, in
order not to burden the main presentation. Although the theories and algorithms
presented in this chapter are important for a deep understanding and reproduction
of the experiments, they are not essential for a high level understanding of these
experiments.
2.1 Nonnegative matrix factorization
Experiments presented in chapters 3, 5 and 6 are based on the nonnegative matrix
factorization algorithm. Although slightly different versions of this algorithm are
used in various experiments, we give here a unified presentation of these algorithms.
2.1.1 Problem description
Non-negative Matrix Factorization (NMF, Paatero and Tapper, 1994, Lee and Seung,
1999) is a well-known machine learning algorithm. Given a data matrix V ∈ R
F ×N
which columns are examples, with non-negative coefficients, it approximates it as the
product:
V ≃ W · H.
W ∈ R
F ×K and H ∈ R
K×N also are non-negative. When the inner dimension K of
the product is smaller than original dimension M and number of examples N, this
achieves data compression by capturing structure in the matrix W.
Furthermore, with previous notations, the reconstructed matrix, W · H, is of rank at
most K, which makes this process a low rank approximation.
This is a form of dictionary learning in the case of non-negative data, where the
columns of W are called atoms. The non-negativity constraint fits well in the case of
frequency-like coefficients in the data matrix, which happens when histograms are
used as data representation.
1920 CHAPTER 2. TECHNICAL BACKGROUND
Singh and Gordon (2008) presents a broad range of matrix factorization and clustering
algorithms in a unified frame that consists in solving a optimization problem.
arg min
(W,H)∈C
D(V, f(W · H)) + R(W, H) (2.1)
The following modeling components are identified in Singh and Gordon (2008):
• constraints on W and H represented as set C,
• measure of loss D, often a generalized Bregman divergence,
• transformation f,
• regularization R.
The basic NMF algorithms frame in eq. (2.1) with R = 0, f equals to identity
and only constraining W and H to have non-negative coefficients, that is to say
C = R
M×K
+ × R
K×N
+ .
Problem ambiguity
It is important to notice at that point that the problem addressed by non-negative
matrix factorization does not have an unique solution. For example, for any invertible
matrix M ∈ SLk, W′ = W · M and H′ = M · H yield the same product as W and
H: W · H = W′
· H′
.
Some ambiguity in the solution of NMF problem exists for any factorization and is
treated in this section. However even other sources of ambiguity can arise, depending
on the generative model of the data. A geometrical model and an analysis of these
questions are provided in Appendix A.2.
As pointed out in previous paragraph, any non-singular matrix M can transform the
terms of the factorization without changing the result: W · H = (W · M)(M−1
· H).
In addition if both M and M−1 are non-negative, then the new factors are still
non-negative.
It is easy to show that the converse is true: if a matrix M is such that, for any W
and H, W′ = W · M and H′ = M · H are non-negative and yield the same product
as W and H: W · H = W′
· H′
, then M must be non-singular and both M and M−1
must be non-negative.
Furthermore, the set of invertible non-negative matrices with non-negative inverse is
exactly the set of monomial matrices, that is to say matrices that are the product of
a diagonal matrix with positive coefficients and a permutation matrix (Plemmons
and Cline, 1972).
Thus the only transformations that leave unchanged any non-negative factorization
are the compositions of a scaling of columns and a permutation of columns.
In order to compare two non-negative factorizations of the same non-negative matrix,
it is useful to be able to normalize or compare such factorizations in a robust way
regarding these transformations.2.1. NONNEGATIVE MATRIX FACTORIZATION 21
Dealing with scaling The easiest way to remove ambiguity due to scaling indeterminacy
is to normalize the columns of W or H, for some norm or metric.
Dealing with permutations At least two approaches can be used to get rid of
the permutation invariance of the factorization.
• A first approach is to use a total order on the columns to W or H to sort them
increasingly. This yields a canonical form for the factorization. Any total order
can be used. However this method might not be robust to noise (for example,
using lexical order on coefficients of columns, a small perturbation on the first
coefficient would change the ordering regardless the other coefficients).
• For the purpose of comparison between factorizations, it might be useful to
define a distance between two such factorizations. For example from a measure
of distance d between columns of W one could define the distance:
D(A, B) = arg min
σ∈Sn
i
d(Ai
, Bσ(i))
Computing such a distance would be done in O(K!) by a naive approach,
however this problem is equivalent to finding a coupling of minimum weight
in a bipartite graph, which can be solved by Kuhn-Munkres algorithm1
(a.k.a.
Hungarian method) in O(K3
).
Loss
The factorization of V as W · H is obtained through an optimization process, in
which distance between data matrix V and reconstructed matrix W · H is minimized.
We call cost function the function L(V, W · H) that we want to minimize.
The first descriptions of NMF algorithms have been using both Frobenius norm and
generalized Kullback-Leibler divergence on matrices.
Most common algorithms however extend well to the broader class of generalized β-
divergence, which are separable (i.e. expressed as a sum over functions on coefficients)
defined as follows:
Dβ(V |Y ) =
F
f=1
N
n=1
dβ(Vfn|Yfn) (2.2)
where dβ(x, y) =
x
y − log x
y − 1 : β = 0
x log x
y − x + y : β = 1
1
β(β−1)
x
β + (β − 1)y
β − βxyβ−1
: β ∈ R\{0, 1}
(2.3)
Cases where β equals 2, 1 and 0 corresponds to Frobenius norm, I divergence and
Itakura-Saito divergence.
1http://en.wikipedia.org/wiki/Hungarian_algorithm22 CHAPTER 2. TECHNICAL BACKGROUND
The Frobenius norm is one of the most common norms on matrices. The
Frobenius norm of a matrix A, denoted by ∥A∥F is defined as the square root of the
sum of the square norms of columns of A.
∥A∥F =
m
i=1
n
j=1
ai,j
2
(2.4)
= Tr(A
T A) (2.5)
The Kullback-Leibler divergence is an information theoretic measure of the
similarity between two probability distributions. It is denoted by DKL (p∥q) and
defined, for to probability distributions p and q as:
DKL (p∥q) =
x∈X
p(x) ln
p(x)
q(x)
(2.6)
= H(p, q) − H(p) (2.7)
where H(p) and H(p, q) are the Shannon entropy of p and the cross entropy of p and
q.
For nonnegative matrices A and B a variant called generalized Kullback-Leibler
divergence or I-divergence is often considered. It is defined as follows:
DI (A∥B) =
i,j
Ai,j ln
Ai,j
Bi,j
− Ai,j + Bi,j
. (2.8)
2.1.2 Basic algorithms
Many algorithms have been designed to solve the NMF problem. While gradient
descent can be used to find a local minimum of the joint problem, it is often more
efficient (Lin, 2007) to use an EM-like approach based on alternating steps solving
the problem in W and H. For the latter approach, the most common approached
are: alternate gradient descents and multiplicative algorithms.
Both families share a common optimization approach: alternate optimization on
matrices W and H. The following method was initially developed to take advantage
of the convex nature of L(V, W · H) both in W and H in cases such as Frobenius
norm or generalized Kullback-Leibler divergence (for β-divergences this happens for
β ∈ [1, 2]) to perform alternate optimization on W and H. However, since even these
cost function are not jointly convex in W and H, these methods can only converge
towards local minimums.
Alternate projected gradient descent for β-divergence
The alternate projected gradient descent algorithms are based on alternating updates
of the form presented in eqs. (2.9) and (2.10), where η is an update parameter. P is
the projection on the first orthant, which means it replaces all negative entries in the
matrices by 0.2.1. NONNEGATIVE MATRIX FACTORIZATION 23
H ←− P
H − η
∂Dβ(V |W H)
∂H
(2.9)
W ←− P
W − η
∂Dβ(V |W H)
∂W
(2.10)
These gradients are easily shown to be given by the following formula where the
same notation is used for the real function ∂dβ(x,y)
∂y and its point-wise extension to
matrices.
∂Dβ(V |W H)
∂H = WT
·
∂dβ
∂y (V, W H) (2.11)
∂Dβ(V |W H)
∂W =
∂dβ
∂y (V, W H) · HT
(2.12)
Actually these formulas are not restrictive to the case of β-divergences but to all
separable cost function. In the particular case of the family of β-divergence, the
element-wise derivatives to use are given in eq. (2.13).
∂dβ
∂y (x, y) =
1
y −
x
y2 : β = 0
1 −
x
y
: β = 1
y
β−1 − xyβ−2
: β ∈ R\{0, 1}
(2.13)
In order to get an efficient gradient descent algorithm it is necessary to use a step
size adaptation method.
Multiplicative updates
This section is mainly based on presentation by F´evotte and Idier (2011), please refer
to this article for a more in-depth description of those algorithms.
Auxiliary function In this section we consider the case of separable cost functions
in the particular example of β-divergences, for which the optimization with respect
to H can be made separately on each columns of H. The same result is true for
columns of W. Furthermore since D(X|Y ) = D(XT
|Y
T
) each result on H for the
optimization problem can be literally transposed to W by replacing V by V
T and
thus H by WT and W by HT
.
Targeting alternate optimization process we consider the problem, arg min
h∈RK, h≥0
C(h)
with C(h) = Dβ(x|W h). To solve it we introduce auxiliary functions as follows.
Definition (Auxiliary function). G : R
K
+ × R
K
+ −→ R+ is said to be an auxiliary
function of cost C if and only if
(i) ∀h ∈ R
K
+ , C(h) = G(h, h)24 CHAPTER 2. TECHNICAL BACKGROUND
(ii) ∀(h, h˜) ∈ (R
k
+)
2
, C(h) ≤ G(h, h˜)
The idea behind auxiliary functions is that if a sequence of values (ht) is such that
G(ht+1, ht) ≤ G(ht, ht) then
C(ht+1) ≤ G(ht+1, ht) ≤ G(ht, ht) = C(ht)
and thus the sequence (C(ht)) is non-increasing.
To construct such an auxiliary function we use a convex-concave-constant decomposition
of dβ, that is to say functions ˘d,
“d and ¯d which are respectively convex, concave
and constant with respect to their second variable, all differentiable with respect to
the second variable and such that
dβ(x, y) = ˘d(x, y) + “d(x, y) + ¯d(x).
In the following we also assume that these functions are differentiable with respect
to y. Such a decomposition is given in Table 2.1
Theorem 1. Let h, h ˜ ∈ R
K
+ , and v˜ = W h, the function defined by eq. (2.14) is an
auxiliary function for the β-divergence loss,
G(h|h˜) =
f
k
wfkh˜
k
v˜f
˘d
vf |v˜f
hk
h˜
k
+ “d
′
(vf |v˜f )
k
wfk(hk − h˜
k) + “d(vf |v˜f ) + ¯d(vf )
(2.14)
d˘(x|y) d˘′
(x|y) d“(x|y) d“′
(x|y) d¯(x|y)
β < 1, β ̸= 0 −1
β−1
xyβ−1 −xyβ−2 1
β
y
β
y
β−1 1
β(β−1)x
β
β = 0 xy−1 −xy−2
log(y) y
−1 x(log(x) − 1)
1 ≤ β ≤ 2 dβ(x|y) d
′
β(x|y) 0 0 0
β ≥ 2
1
β
y
β
y
β−1 −1
β−1
xyβ−1 −xyβ−2 1
β(β−1)x
β
Table 2.1: Auxiliary function for the β-divergence
Maximization-Minimization In this paragraph an update rule for h will be
chosen such that the next value hMM solves:
h
MM = arg min
h
G(h, h˜).
This is obtained from current value h˜ by equation (2.15). The values γ(β) are given
in Table 2.2.
h
MM
k = h˜
k
f
wfkvf v˜
β−2
f
f
wfkv˜
β−1
f
γ(β)
(2.15)2.1. NONNEGATIVE MATRIX FACTORIZATION 25
β < 1 1 ≤ β ≤ 2 β > 2
γ(β)
1
2−β
1
1
β−1
Table 2.2: Values γ(β)
The update rule can actually be re-written in terms of matrix operations, in which it
takes a relatively simple form. We denotes the Hadamard (i.e. entry-wise) product by
⊗ and the entry-wise division with fractions. In this section matrix power is meant
entry wise.
H ← H ⊗
WT
V ⊗ (W H)
β−2
WT (W H)
β−1 W ← W ⊗
V ⊗ (W H)
β−2
HT
(W H)
β−1HT
(2.16)
Heuristics algorithm Another kind of update, that guarantees G(ht+1, ht) ≤
G(ht, ht) at least for β in [0, 1] is given by equation (2.17).
h
MM
k = h˜
k
f
wfkvf v˜
β−2
f
f
wfkv˜
β−1
f
(2.17)
Frobenius norm and I-divergence In Frobenius and generalized KullbackLeibler
cases, γ(β) = 1 thus there is no difference between the two variants of
the algorithm. More precisely the associated multiplicative updates were introduced
by Lee and Seung (2001). 1 denotes a matrix which coefficients are all ones.
H ← H ⊗
WT V
WT W H
W ← W ⊗
V HT
W HHT
Frobenius update (2.18)
H ← H ⊗
WT
V
W H
WT · 1
W ← W ⊗
V
W H
HT
1 · HT
I-divergence update (2.19)
2.1.3 Variants and improvements
Sparse NMF
Sparseness of the components or the coefficients can be enforced for NMF. However
several approaches may be used to achieve this goal.
Projected gradient Hoyer (2004) proposes a measure of sparseness of a nonnegative
vector as follows:
sparseness(x) =
√
n∥x∥2 − ∥x∥1
∥x∥2(
√
n − 1) (2.20)26 CHAPTER 2. TECHNICAL BACKGROUND
It is defined for any x which is nonzero and takes values in [0, 1].
Hoyer then proposes to solve the NMF problem with the additional constraint that
any column of W and row of H has a fixed sparseness. Hoyer also provides an
algorithm to project to the set satisfying the constraint.
Regularization F´evotte and Idier (2011) present propose algorithms to solve the
NMF problem extended with a sparsity inducing regularization of the dictionary or
coefficients based on the l1 norm.
Semi-NMF and convex-NMF
See the paper of Ding et al. (2010) for semi and convex algorithms and clustering
interpretation; see work from F´evotte and Idier (2011) for adaptation of β-NMF
algorithm.
2.2 Inverse reinforcement learning
This section provides a general presentation of the fields of reinforcement learning
and inverse reinforcement learning whose concepts are supporting the experiments
from chapter 4. Further details are also provided on specific inverse reinforcement
learning algorithms on which the algorithm presented in section 4.3 is based.
2.2.1 Background: reinforcement learning
This paragraph provides a quick introduction of the concepts grounding reinforcement
learning. A more extensive introduction to reinforcement learning is given by Sutton
and Barto (1998).
“ Reinforcement learning is a computational approach to understanding and
automating goal-directed learning and decision-making. It is distinguished from
other computational approaches by its emphasis on learning by the individual
from direct interaction with its environment, without relying on exemplary
supervision or complete models of the environment. ”
Richard Sutton and Andrew Barto, Reinforcement learning (1998)
One important motivation behind reinforcement learning is to provide a model for
trial and error learning, as originally described by Thorndike (1911). The technical
background for such models was developed on top of previous work on dynamic
programming (Bellman, 1957a) and Markov decision process (Bellman, 1957b, Howard,
1960).
The agent and the world
The reinforcement learning model introduces an important, and sometime counterintuitive,
separation between an agent and its environment. It also assumes that2.2. INVERSE REINFORCEMENT LEARNING 27
the agent is involved in a discrete sequence of interactions with the environment.
More precisely, at discrete time steps t, the agent measures the state xt ∈ X of the
environment and performs an action at ∈ A. The action triggers a change in the
state of the environment and the emission of a reward rt from the environment to
the agent (see fig. 2.1). The distinction between the agent and the environment
can be misleading for it does not in general correspond to the physical separation
between the body of the agent and its living environment. Instead anything that is
not in direct control of the agent’s decisions, such as the reward, is considered part
of the environment. This differs from a more intuitive model of an animal in which
the reward may be a hormonal response to having eaten, thus being emitted by the
animal’s body and depending on a state of its body. Similarly, an agent may be
modifying its mental state which would thus be modelled as part of the environment.
Agent Environment
action
reward
observed state
Figure 2.1: The agent and the environment (reproduced from Sutton and Barto,
1998, p. 52).
The Markov property
Classical reinforcement learning assumes that the transitions between states of the
environment are Markovian. That is to say the probability distribution over next
state xt+1, given all previous states and actions, is such that, for all t ≥ 0:
P(xt+1|x0, . . . , xt, a0, . . . , at) = P(xt+1|xt, at).
That probability distribution is often denoted as the transition probability. Similarly,
the reward received by the agent at time t is assumed to only depend of at and xt.
The policy
The policy is the model of the agent behavior; it may be understood as an equivalent
of the stimulus-response rule. The policy is a distribution over possible actions taken
by the agent at time t, given the history of the environment state. The policy is
called deterministic when the distribution degenerates to a function, that is to say
when only one action has nonzero probability.
A policy is said to be stationary when it only depends on current state of the
environment. Under the Markovian hypothesis, since the reward only depends on the
current state and the action taken, stationary policies can achieve the same expected
rewards as general policies. Therefore, we can safely restrict to the class of stationary
policies.28 CHAPTER 2. TECHNICAL BACKGROUND
Markovian decision process
A Markovian decision process (MDP) is defined as a state space X , an action space
A, a transition probability P, a reward function r, and a return. The return defines
a notion of accumulated reward. For example one could consider the average return
over a period T, defined as:
Raverage =
1
T
T
−1
t=0
rt,
or the discounted return over an infinite horizon, with discount factor γ < 1, defined
as:
Rdiscounted =
t≥0
γ
t
rt.
A MDP is the problem of determining policies that maximize the expected return.
Both definition of return lead to similar results; in the following we focus on the
discounted return. The MDP is then denoted by a quintuple (X , A, γ, P, r). P is a
mapping from state actions pairs to probability distributions over next states. We
denote by P(x
′
|x, a) the probability to transition to state x
′
from state x, knowing
that action a was taken. Finally, r : X × A → R is the reward function.
Dynamic programming
For a given MDP and a given stationary policy π, that is a mapping from states
to probability densities over actions, one can define the value function V
π and the
action value function Qπ2
:
V
π
(x) = E
∞
t=0
γ
t
r(Xt, At)
X0 = x
(2.21)
Q
π
(x, a) = E
∞
t=0
γ
t
r(Xt, At)
X0 = x, A0 = a
. (2.22)
The expectations are taken over all possible trajectories (Xt, At)
t≥0
. Functions
verifying the following equations are called optimal value function and optimal action
value function:
V
∗
(x) = sup
π
V
π
(x), ∀x ∈ X (2.23)
Q
∗
(x, a) = sup
π
Q
π
(x, a), ∀(x, a) ∈ X × A. (2.24)
A policy that is optimal (w.r.t. to eq. (2.23) or eq. (2.24)) over all states is
said to be optimal. Greedy policies over Q∗
, that is to say policies such that
π(arg maxa Q∗
(x, a)|x) = 1, are known to be optimal. They are in particular deterministic
policies, which state that the existence of that maximum implies the
existence of optimal deterministic policies.
2For infinite state or action space some additional hypothesis is required for these functions to
be finite, such as the boundedness of the reward function.2.2. INVERSE REINFORCEMENT LEARNING 29
Equations (2.21) and (2.22) are equivalent to the following fixed point equations,
also denoted as Bellman equations.
V
π
(x) =
a∈A
π(x, a)
r(x, a) + γ
y∈X
P(y|x, a)V
π
(y)
(2.25)
Q
π
(x, a) = r(x, a) + γ
y∈X
P(y|x, a)
b∈A
π(y, b)Q
π
(x, b) (2.26)
Similarly, eqs. (2.23) and (2.24) are equivalent to the following fixed point equations,
denoted as Bellman optimality equations.
V
∗
(x) = max
a∈A
r(x, a) + γ
y∈X
P(y|x, a)V
∗
(y)
(2.27)
Q
∗
(x, a) = r(x, a) + γ
y∈X
P(y|x, a) max
b∈A
Q
∗
(x, b) (2.28)
The right members of these equations defines the Bellman operators and Bellman
optimality operators. The contracting property of these operators is sufficient to
prove the existence and uniqueness of solution of these equations from the Banach
fixed point theorem3
, in the case of discrete state and action spaces. Interestingly
this property provides a Picard iteration algorithm to compute value and optimal
value functions, named value iteration, which grounds dynamic programming.
2.2.2 What is inverse reinforcement learning?
In the formulation of reinforcement learning, the reward function is assumed to
be fixed and unknown but observed by the agent. Therefore, in order to build an
artificial agent, one must first fully specify that reward function, which turns out
to be both a very sensitive and difficult task. That difficulty yields limitations to
the accuracy of reinforcement learning models of living agents. Because the manual
specification of the reward function results in this limitation, the agent model could
instead be more accurately fitted to reality by learning the reward function, from
observation of the behavior it produces. That statement lead Russell (1998) to
formulate the problem of inverse reinforcement learning as follows.
“ It seems clear, however, that in examining animal and human behaviour we
must consider the reward function as an unknown to be ascertained. [ . . . ]
Therefore, to model natural learning using reinforcement learning ideas, we must
first solve the following computational task, which we call inverse reinforcement
learning:
Given 1. measurements of an agent’s behaviour over time, in a variety of
circumstances, 2. measurements of the sensory inputs to that agent; 3. a model
of the physical environment (including the agent’s body). Determine the reward
function that the agent is optimizing. ”
Russell (1998)
3http://en.wikipedia.org/wiki/Banach_fixed_point_theorem30 CHAPTER 2. TECHNICAL BACKGROUND
Another application of inverse reinforcement learning is the field of robot programming
by demonstration. Instead of having a robot that copies the actions of a demonstrator,
the robot could infer the intention of the demonstrator and then attempt to solve
the same task. Indeed, copying the same action in a different context is often not
effective, whereas understanding the intention enables better generalization. In that
perspective, a reward function models the intention of the agent and is supposed
to shape its behaviors through reinforcement learning. In the following we adopt a
formulation of the problem in terms of a demonstrator or expert, whom an apprentice
learns to imitate.
Inverse reinforcement learning assumes the observation of actions from an agent. This
agent is modelled as optimizing an unknown reward function and an apprentice tries
to guess the reward function that the agent is optimizing. We make the simplifying
assumption that the demonstrator and the apprentice share a common representation
of the world, as a set X of states, a set A of actions, and transition probabilities
P. We represent the demonstrator’s intention in the form of a reward function r,
which defines a Markov decision process (MDP), that is a quintuple (X , A, γ, P, r)
(see section 2.2.1). Finally, the objective of inverse reinforcement learning is to infer
the reward function r, given a set of observations that are couples (xt, at) of states
xt ∈ X and action at ∈ A from the demonstrator. The demonstrator or expert is for
that assumed to act optimally or nearly optimally. Strictly speaking, the optimality
of the demonstrator means:
at ∈ arg max
a∈A
Q
∗
r
(xt, a).
It is important to notice here, that, in opposition to section 2.2.1, we have written
the dependency of the MDP, and in particular the value functions, in the reward.
Limitations of the reward estimation problem
Unfortunately, the problem we have just formulated is ill-posed. First of all the null
reward is always a solution since it leads to constant null functions and therefore
arg max
a∈A
Q
∗
r
(x, a) = A
for all x ∈ X . Similarly any constant reward function yield constant value functions,
which makes any policy optimal.
Also, as explained by Ng et al. (1999), for given state and action spaces, any potentialbased
function (see the definition below) can be added to a reward function without
changing the set of optimal policies. Their result also comes with a weaker converse:
no other function can be added to any MDP without modifying the set of optimal
policies. Finally, the sufficient condition also guarantees stability of the set of
near-optimal policies.
Definition. Let F be a real-valued function on X ×A×X . It is said to be potentialbaised
if there exists a real-valued function φ : X → R such that for all x ∈ X ,
a ∈ A,
F(x, a, x′
) = γφ(x
′
) − φ(x)
Theorem 2. (Ng et al., 1999)2.2. INVERSE REINFORCEMENT LEARNING 31
• Sufficiency. If F is a potential-based function than any optimal policy of
M = (X , A, P, γ, R) is an optimal policy of M′ = (X , A, P, γ, R + F) (and
vice-versa).
• Necessity. If F is not a potential based function, then their exist (proper)
transition functions P and a reward function R : X × A −→ R such that no
optimal policy in M′ = (X , A, P, γ, R + F) is optimal in M = (X , A, P, γ, R).
4
The theorem from Ng et al. (1999) considers a definition of reward functions slightly
extended with respect to the one we use here: the reward is a function of next state in
addition to current state and current action. The notion of potential-based function
as defined above does not make sense without that formulation. However, the same
sufficiency result holds if we define in average potential-based functions, in terms of
expected next state, given an action. That is to say a function F such that their
exists a potential φ for which:
F(x, a) = γ E
x′∼P (·|x,a)
φ(x
′
)
− φ(x).
Such function is not always potential based in the sense of Ng et al. (1999) but the
necessity condition holds.56 Following this comment, in the case of non-deterministic
transition functions (for which some functions are not potential based but potential
based in average), the class of rewards that share the same set of optimal policies
can be expanded.
Finally other context dependant functions may, for a given family of transition
functions, be added to the reward function without changing the set of optimal
policies. Also the previous discussion only covers additions to the reward function but
not others transformations. For example we mentioned that the scalar multiplication
of the reward leaves invariant the set of optimal policies.
Formulations of the reward estimation problem
From the high level formulation of the inverse reinforcement learning problem by
Russell (1998), several more precise formulations have been made in order to bring
the problem to the range of algorithmic formulations.
First of all, Ng and Russell (2000) introduce a characterization of rewards that
make an action optimal. The following formulation uses a matrix representation of
the transition function: for each action a, Pa contains the transition probabilities
between states. Also r is assumed to only depend on the state and be bounded by
rmax; it is represented as a vector of one value for each state. Finally, for simplicity,
the actions are supposed to be re-ordered for each state in such a way that one action
a
∗
is optimal for all states. The symbol ⪰ denotes that each coefficient is greater.
4The theorem as formulated above is not true since a constant value can be added to the reward
function without changing the optimality of policies. Ng et al. (1999) actually mention this fact
in the demonstration of the necessity condition because they need to shift to zero the F function.
However, for this transformation to be made without loss of generality the necessity condition needs
to be slightly relaxed.
5Actually the proof does not change.
6Although this may seem in contradiction with the necessity condition from the theorem, it is
not. Indeed, the in average potential based functions depend on the transition function. Therefore
they do not leave invariant the set of optimal policies for any MDP.32 CHAPTER 2. TECHNICAL BACKGROUND
Theorem 3. (Ng and Russell, 2000) Let a finite state space X , a finite set of actions
A, transition probability matrices
Pa
a∈A, and a discount factor γ ∈ ]0, 1[ be given.
Then the policy π given by π(x) = a
∗
is optimal if and only if, for all a ̸= a
∗
, the
reward r satisfies:
Pa∗ − Pa
I − γPa∗
−1
r ⪰ 0
Ng and Russell (2000) use the previous theorem to derive an optimization problem.
For that they use the heuristic that the solution reward function should, in additional
to make the observed policy optimal, maximize the loss in return induced by diverging
from that policy. This is obtained by maximizing the quantity:
s
min
a̸=a∗
Pa∗ (s) − Pa(s)
I − γPa∗
−1
r
Finally, they also penalize the norm ∥r∥1 of the solution reward and bound its
coefficients. The inverse reinforcement learning problem then takes the form of a
linear programming problem.
maximize
s
min
a̸=a∗
Pa∗ (s) − Pa(s)
I − γPa∗
−1
r − λ∥r∥1
such that
Pa∗ − Pa
I − γPa∗
−1
r ⪰ 0, ∀a ̸= a
∗
∥r∥∞ ≤ rmax
Matching expected features Another interesting formulation of the inverse
reinforcement learning problem is expressed in terms of expected feature vector. In the
case where the reward function is assumed to be linearly parametrized on a feature
vector φ, that is r(x) = θ
T φ(x) for any state s, we define the feature expectation
under policy π as
f(π) = E
(xt)∼π
∞
t=0
γ
tφ(xt)
.
It follows immediately that the expected return for policy π is given as the scalar
product R(π) = θ
T f(π). The feature expectation under expert policy, f(πE) can be
empirically estimated from the demonstrations as ˆfE. Abbeel and Ng (2004) state
that finding a policy π˜ that matches the expert’s feature expectation to a certain
error is sufficient to achieve a return that is close, at most to the same error, to the
expert’s empirical return under the real reward.
Proposition 1. (Abbeel and Ng, 2004) Let π˜ be a policy and ε > 0.
If ∥f(˜π) − ˆfE∥2 ≤ ε then for any parameter ∥θ∥2 ≤ 1 and reward θ
T φ:
∥R(˜π) − R(ˆπE)∥2 ≤ ε
The proposition is actually a trivial consequence from the Cauchy-Schwartz inequality,
which is used as a starting point by Abbeel and Ng (2004) to express the problem
of matching the expert’s expected features. This leads to a new formulation of the
inverse reinforcement learning problem back into an apprenticeship learning problem:
the goal is not any more to recover the real reward function but to find a policy that
behaves as well as the expert’s under the real reward.2.2. INVERSE REINFORCEMENT LEARNING 33
Matching the policy Finally, another approach is to directly target the imitation
of the expert’s policy, but parametrized in the reward. That is to say find a reward
function r such as the optimal or nearly optimal policy πr associated to that reward
function is as close as possible to the expert’s, that is to say solve the following
problem for a given norm ∥ · ∥.
arg min
r
∥πr − πE∥
This approach is followed by Neu and Szepesv´ari (2007) and their algorithm to solve
it is detailed in section 2.2.3.
2.2.3 Algorithms for inverse reinforcement learning
Various algorithms have been developed to solve the various formulations of the
inverse reinforcement learning problem, as introduced in previous section.
Some approaches such as those of Ng and Russell (2000) and Ramachandran and
Amir (2007) directly attack the ill-posed problem of inferring the real reward function.
For that they need to introduce additional constraints on the problem. Ng and Russell
(2000) then use linear programming while Ramachandran and Amir (2007) introduce
a Markov chain Monte-Carlo algorithm.
Other approaches focus on finding policies that achieve as well as the expert’s on
the real, unknown, task. For example, Abbeel and Ng (2004) introduce a quadratic
programming and a projection algorithm to solve that task.
Finally, several algorithms have been developed to match the expert’s policy with
a learnt policy that is parametrized in the reward function. Examples include the
approach from Neu and Szepesv´ari (2007) described below, as well as the one from
Ratliff et al. (2006).
Gradient inverse reinforcement learning
In this section we present the algorithm and results introduced by Neu and Szepesv´ari
(2007). For more details and proofs the reader is invited to refer to the original paper.
Inverse reinforcement learning for apprenticeship learning is based in the assumption
that the expert’s intention is to solve a task, modeled by a reward function. Mimicking
the expert behavior therefore consists in using a policy that is optimal for the same
reward. The hybrid approach from Neu and Szepesv´ari (2007) focuses on learning a
reward such that an associated optimal policy matches the expert’s actions.
In the following we assume that the model of the world, that is composed of states,
actions, and transitions, is fixed and that the discount factor γ is known. However
we represent the intention of a demonstrator (called expert) as acting optimally with
respect to a task that is modelled as a reward function. Since the model of the world
is fixed no distinction is made between a reward function r and the associated MDP,
MDP(r).
We assume that we observe demonstrations ξ from an expert, that are sequences
(xt, at) of states xt ∈ X and action at ∈ A, such that ξ = (xt, at)
t∈[|1,T|]
.34 CHAPTER 2. TECHNICAL BACKGROUND
In this single task setup, the expert provides one or several demonstrations of solving
the same task. The expert actions are modeled by a stationary policy πE. The
objective of apprenticeship learning becomes to find a policy π that minimizes the
cost function from eq. (2.29), in which µ denotes the average state occupation, that
is to say µE(x) = lim
T→∞
Eπ
1
T
T
t=1
δXt=x .
J(π) =
x∈X ,a∈A
µE(x)
π(x|a) − πE(x|a)
2
(2.29)
For an expert demonstration represented by ξ = (xt, at)
t∈[|1,T|]
one estimates J by
eq. (2.30), in which ˆµE,ξ and ˆπE,ξ are empirical estimates of µE and πE from ξ.
Jξ(π) =
x∈X ,a∈A
µˆE,ξ(x)
π(x|a) − πˆE,ξ(x|a)
2
(2.30)
In the following the reward rθ is parametrized by θ ∈ Θ where Θ ∈ R
d and we
denote by Q∗
θ
the optimal action value function of the MDP associated to rθ. In
practice linear features are used for r. Let G be a smooth mapping from action value
functions to policies that returns a close to greedy policy to its argument. Instead
of minimizing Jξ over any subset of policies, Neu and Szepesv´ari (2007) suggest to
constrain π to be of the form πθ = G(Q∗
θ
).
Solving the apprenticeship learning problem is then equivalent to finding θ that
reaches:
min
θ∈Θ
Jξ(πθ) s.t. πθ = G(Q
∗
θ
). (2.31)
In practice, Neu and Szepesv´ari (2007) use Boltzmann policies as choice for the
G function, as given by eq. (2.32) where the parameter β is a nonnegative real
number. This choice ensures that G is infinitely differentiable. Assuming that Q∗
θ
is
differentiable w.r.t. θ its first derivate is given by eq. (2.33).
G(Q)(a|x) = exp
βQ(x, a)
a′∈A
exp
βQ(x, a′)
(2.32)
∂G(Q∗
θ
)(a|x)
∂θk
= G(Q
∗
θ
)(a|x)
∂Q∗
θ
(x, a)
∂θk
−
a′∈A
πθ(a
′
|x)
∂Q∗
θ
(x, a′
)
∂θk
(2.33)
The following proposition from Neu and Szepesv´ari (2007) provides both guarantees
that ∂Q∗
θ
(x, a)
∂θk
is meaningful and a practical way to compute it.
Proposition (Neu and Szepesvari). Assuming that rθ is differentiable w.r.t. θ and
sup(θ,x,a)∈Θ×X×A < ∞, the following statements hold:
1. Q∗
θ
is uniformly Lipschitz-continuous as a function of θ in the sense that there
exist L
′ > 0 such that for any (θ, θ′
) ∈ Θ2
, |Q∗
θ
(x, a) − Q∗
θ
′ (x, a)| ≤ L
′∥θ − θ
′∥2.2. INVERSE REINFORCEMENT LEARNING 35
2. The gradient ∇θQ∗
θ
is defined almost everywhere7 and is a solution of the
following fixed point equation, in which π is a greedy policy on Q∗
θ
:
ϕθ(x, a) = ∇θr(x, a) + γ
y∈X
P(y|x, a)
b∈A
π(b|y)ϕθ(y, b) (2.34)
The previous result thus provides an algorithm, similar to dynamic programming
that yields the derivative of Q∗
θ with respect to θ. It it then easy to combine it
with the differentiates of Jξ with respect to π and G to obtain a gradient descent
algorithm that finds a local minima of the objective.
Neu and Szepesv´ari (2007) furthermore provide a variant of this algorithm following
a natural gradient approach.
7
that is except on a set of measure zero36 CHAPTER 2. TECHNICAL BACKGROUNDChapter 3
Learning a dictionary of
primitive motions
The idea of motion primitive, already introduced above in section 1.2, is both rooted
in biology (see Konczak, 2005, Mussa-Ivaldi and Bizzi, 2000, Tresch and Jarc, 2009)
and perceived as an appealing and efficient paradigm for robot programming (see
Cangelosi et al., 2010, Kruger et al., 2007): being able to encapsulate basic motion
representation and motor skills in a way that enables their combination is expected
to bring combinatorial growth of robot skills in place of the usually observed linear
growth. Indeed if a robot is capable of combine a new skill with all the other skills
it already knows, it actually has not learnt one skill but as many as the potential
combinations it can achieve. That way it scaffolds its knowledge in a way that models
the simple to complex learning trajectories observed in humans. The same principle
applies to the recognition of human motions (Nori and Frezza, 2004a).
However, we have seen in section 1.2 that the concept of motion primitive from
previous paragraph is vague and needs to be further defined. For instance, the
definition of motion primitive could be closely related to the nature of their potential
combinations into more complex motion or skills. In the next section, a closer look
is given to that concept of combination of primitive motions, with an emphasis on
two questions: “What does it mean to combine motion parts?” and “Where do the
primitives come from?”
The question of the nature of the composition is itself connected with issues of
motion or skill representation that make them compatible with such combinations,
but also with the algorithms that might be necessary to achieve the composition.
As for the second question, the origin of motion primitives can vary greatly in the
literature: some techniques involve pre-coded skills or motions, others, learning on
subproblems provided by a caregiver, learning from self-exploration, learning to
decompose a demonstrated motion or skill, etc. Finally the hierarchical nature of
a lexicon of primitives in which high order primitives are defined in terms not of
low levels primitives but intermediate ones, that in turn are defined on lower level
primitives, brings its own set of challenges. However we do not focussed on that
aspect in that work.
An approach to the learning of motion parts is to implement an algorithm that tries
3738 CHAPTER 3. LEARNING A DICTIONARY OF PRIMITIVE MOTIONS
to closely match a decomposition of motions to the high level representation we,
as grown-up humans, have of that motion. However that high level representation
is highly dependant of our perceptual and motor apparatuses, our development
history, our culture, which makes that task highly ambiguous. Therefore in the
work presented in this section and more generally throughout this thesis we do not
build an artificial learner that explicitly constructs a lexicon of motion primitives
each of which represents one abstract gesture and then decompose the global motion
as the combination of these gestures. Rather we build a learner which internal
representation has combinatorial properties that makes it capable of capturing the
compositional aspect of the observed motion. Then, instead of analysing the quality
of that representation by an open-skull approach, we evaluate the learner on a social
task which requires the ability to perceive the combinatorial nature of motions. In this
example the task is to reconstruct a symbolic linguistic representation of the motion,
where the combinations of symbols matches the high level human perception of
motions. That way the agent is not designed to have a purely compositional approach
to learning but rather the compositional representation is expected to emerge in
order to solve the task: which means that the compositional understanding is a
consequence of the teleological understanding (using the terminology of Wrede et al.,
2012, as introduced in section 1.2). Finally that leads to the important distinction
between two aspects of decomposition: the intrinsic compositional properties of the
representation and the high level decomposition that is encoded in the structure of
the social task. The former is expected to act as a substrate for the latter.
Our contribution, presented in this chapter covers three important topics. First we
discuss the nature of combinations of motion primitives that are active simultaneously,
in contrast to the study of sequential motion primitives. Then, the experiment
performed in the following demonstrated how an agent can leverage the compositional
structure of motions to learn primitives that were demonstrated only in an ambiguous
manner, which means the learnt primitives where not demonstrated alone but always
mixed together. Finally this chapter provides an example of language grounding in
the case of a simple symbolic language with a combinatorial structure.
3.1 Combination and discovery of motion primitives
This chapter targets the discovery of motion primitives that can be combined together
into complex motions. In this section we review and discuss the various meanings
of ‘combination’, properties of several approaches to motion representation, and
algorithms that can be used to decompose motions.
3.1.1 What does combination mean?
Sequencing is probably the most common way to combine motion primitives for
robotics. A simple example of sequential combination of motor primitives is: moving
to a door, turning the door knob, pushing the door and moving forward.
Despite looking quite coherent with our high level perception, the previous decomposition
is hiding a lot of complexity. Indeed, the actual motion executed to open the3.1. COMBINATION AND DISCOVERY OF MOTION PRIMITIVES 39
door might vary greatly depending on the kind and shape of the door knob: opening
a door with a round or a bar shaped knob is very different but perceived as the
same high level action. In that case both primitive are combined as two contextual
alternative into the high level action: if the knob is round, action 1 is executed, else
action 2 is used. Similarly two motion primitive can be combined through probabilistic
mixing: motion 1 is used with probability p and motion 2 with probability 1 − p. In
other words the motion primitive is seen as a probability distribution over motions
and the combination of the primitives results from the mixture of the associated
probability distribution. The case of contextual alternatives can easily be fitted into
that formalism by considering probability distributions over motions, conditioned
by the context. Such a formalism is quite general and actually covers most of the
approaches encountered in the literature and described further.
Even with contextual alternative and probabilistic mixing, we still miss some structure
in our motivating example. While moving to the door one generally also looks at the
knob, prepare its hand to open the door, avoid obstacles, and eventually say “good
bye”, in a completely simultaneous way. It thus appears from a closer look that many
primitive motion happen in a concurrent manner, which may include several degrees
of independence or interaction between the motion primitives. For example one can
consider two motions happening independently, one on each arm (for example while
dancing), or superposed such as a perturbation being added to a reaching motion to
avoid an obstacle seen at the last moment. However independence is often too strong
an approximation and one must consider the interaction between motion primitives
in more details. For robotic applications, it is common that motion corresponds to
solving tasks that are prioritized such as grasp an object while keeping the user safe.
In such cases primitive motions corresponding to one task can be subordinated to a
more important task or hard constraints imposed by security. When soft constraints
are considered instead of subordination motion primitives can be competing with one
another. For example while walking and holding a cup of coffee, motions targeted
to maintaining the balance of the body are competing with those to maintain the
balance of the cup. If the coffee is moving too much the walker might modify his
gate to keep the coffee in the cup. If by accident the walker slip on a wet floor he
might not be able to keep the cup balance while correcting his own. Finally more
complex and general interactions between motion primitive might be considered.
High level motions like moving a finger in a straight line, actually involve complex
muscle synergies but also stabilization mechanisms that might use other parts of
the body. Therefore one could represent that by a motion primitive producing the
straight line and plugged into a control mechanisms for a muscle synergy, which can
be seen as a functional approach of motor primitives.
Each of these combinations can account for a subset of complex motions but are
not incompatible. However, it is still a difficult problem to find representations that
are general enough to cover a large range of possible combinations and still enable
efficient algorithms for combining and learning such primitive.
3.1.2 Motion representations
Artificial capture systems perceive motion as a signal, that is to say as a time indexed
sequence of values, and can be represented as such: it leads to what can be called a
signal processing approach to motion representation. Sequences of positions can then40 CHAPTER 3. LEARNING A DICTIONARY OF PRIMITIVE MOTIONS
Figure 3.1: Sequential and parallel combinations of motions are well known from
choreographers and dancers. This example of dance annotation using Rudolph
Laban’s system illustrates such structure. Left and right parts correspond to two
interacting dancers. Each symbol encodes a gesture, vertical axis corresponds to
sequencing of gestures; gestures on the same horizontal line are concurrent. See
http://en.wikipedia.org/wiki/Labanotation for more information.
be cut in subsequences or concatenated. At each time step, body positions can be
the result of the addition of reference body positions encoded as a motion primitives,
and small perturbations (for example avoiding an obstacle) coded as other motion
primitives. Such decompositions are found in work from Li et al. (2010), Hellbach
et al. (2009), Taylor and Hinton (2009a).
The usual way to reproduce on a robot a motion recorded and represented that way
is to use control in position. Such approach actually hides that forces that need to be
applied to body joints to achieve the desired position: they actually transform each
position into a low level mechanisms, for examples, a PID1
, that is used to make sure
the robot follows the targeted trajectory. Similarly one can use the velocity or the
acceleration trajectories to control the robot: for a sufficient sample rate or adequate
smoothing, these quantities can be directly derived from the trajectory.
In other words the previous approach is to represent motion primitives as being
mappings from time to control commands (for example positions, velocities). Let
denote by T an interval of integers or real numbers and by A the control space or
space of actions; following that view, a motion primitive is a mapping m : T −→ A.
Actually this is a naive representation of motion that only account for the way it
is perceived by simple sensors. That a PID or a similar mechanism is needed to
1A proportional integral derivative (PID) controller is control loop designed to minimize the error
between the measured outcome variable and a desired value. It is named after the three terms used
in the feedback function that are proportional to the measured error, its integral, and derivative
(See http://en.wikipedia.org/wiki/PID_controller).3.1. COMBINATION AND DISCOVERY OF MOTION PRIMITIVES 41
actually produce the motions indeed demonstrates that the nature of motion is more
a closed loop interaction between a body and an environment than an open loop
trajectory. Low-level control to following a predefined trajectory is however not the
only aspect of motion that imply closed loop interaction with the environment and
the trajectory approach to motion representation is often too restrictive: it does not
account for the perceived similarity between two grasping motion that may take the
form of completely different body trajectories.
Therefore it is often necessary and useful to represent motion primitives in a way
that takes into account the loop between stimulus, reaction of the agent, and its
effects on the environment. A common model is to represent the mapping between
the state of the world and the agent’s action. The notion of world generally includes
both the agent and the environment, or at least what can be perceived by the agent.
While defining what the world is is made easy by considering it to be ‘everything’, it
is generally more difficult to define precisely and represent in a computational way its
current state. The inclusion of the agent in the world is a way to account for internal
states of the agent (for example short or long term memory) without considering
the whole perceptual history of the agent; in other words, the state representation is
assumed to be rich enough for the agent to have a Markovian behavior.
Mappings from time and current state of the system to actions are often referred to
as deterministic policies. Denoting the state space by S, a deterministic policy is a
mapping π : T × S −→ A. Motion representation are often desired to include some
stochasticity; thus the more general notion of stochastic policy (or simply policy)
arises, that corresponds to a mapping π : T ×S −→ P(A), where P(A) stands for the
set of probability distributions over A, assuming it is defined in a meaningful manner.
A policy is called stationary when it is constant over time; that is a stationary policy
is a mapping π : S −→ P(A).
An important motivation behind stationary policies comes from decision theory and
reinforcement learning (see section 2.2). Reinforcement learning (see Sutton and
Barto, 1998, and section 2.2.1) studies agents interacting with a world, abstracted as
a state in a state space S, through actions in an action space A, and which ultimate
objective is to maximize a reward they get from the world. In the common case
where the world and the reward function are assumed to be Markovian, it is known
that there exist an optimal deterministic stationary policy. Therefore stationary
policies are a relevant representation for the motions of such an agent.
A large set of techniques exist to represent probability distributions and can be
applied to policies. The option framework developed by Sutton et al. (1999), explains
how to build hierarchical policies by extending the space of actions with primitive
policies called actions: such approach both represent sequencing and probabilistic
mixing of primitives. Similarly, hidden Markov models (HMM, Baum et al., 1970,
Rabiner, 1989) are used to encode, as a policy, transitions between the agent’s internal
states and the action they produce; they are also used at a higher level to encode
transitions between polices, that is to say their sequential combination (see Kulic
and Nakamura, 2010, Kruger et al., 2010). In the specific setting where actions are
reduced to velocities (assuming an adequate low level controller), Calinon et al. (2007)
chose to instead of directly representing the policy, represent the joint probability
over time, positions and velocities: given a position (or a distribution over positions),
the policy is obtained as the conditional distribution knowing that position. They
use Gaussian mixture models (GMM, Ghahramani and Jordan, 1994, Bishop, 2006,42 CHAPTER 3. LEARNING A DICTIONARY OF PRIMITIVE MOTIONS
chapter 9) to represent the distribution; the mixture approach is in itself a way
to encode probabilistic mixing of very simple primitives, each corresponding to a
Gaussian. This approach have been extended to also represent sequencing of primitive
by using HMMs to encode transitions between motion primitives (Calinon et al., 2010,
Butterfield et al., 2010), sometimes called experts (Grollman and Jenkins, 2010).
An interesting aspect of the representation of motion primitives as probability
distributions over the position-velocity space is that it is a stochastic version of
the representation of the phase diagram of the dynamics of the agent. Indeed the
agent can be seen as a dynamical system which state s is ruled by a differential
equation of the form s˙ = f(s, t). The two representations are very close but focus
on different aspects of the motion. We have discussed how Mussa-Ivaldi and Bizzi
(2000) put in evidence the decomposition of control in a frog limb into control
primitive. Nori and Frezza (2004b,a) have extended this idea by building a basis
of primitive controller that can be used to provide reaching and tracking abilities
to a robot through simple linear combinations of the primitive controllers. The
coefficients of the linear combination are then obtained through a simple projection.
Williamson (1996) had previously developed a similar architecture with hand-crafted
primitives. Khansari-Zadeh and Billard (2011) and colleagues have studied how the
representation as dynamical systems of motions learnt from demonstration can be
enforced to satisfy some properties such as the stability of the underlying dynamical
system. In Mangin and Oudeyer (2012a), a very simple representation of such a phase
diagram for each body joint is shown to be sufficient to recognize dance gestures, as
further detailed in section 3.2.
The dynamical system approach to motion representation is also illustrated by
Ijspeert et al. (2003), Schaal (2006) who encode motion primitives as a phase2
indexed perturbation over a predefined dynamical system which encode an elastic
attractor dynamics. This representation is called dynamic motion primitives (DMP).
Stulp and Schaal have further demonstrated how to combine in sequence motion
primitive encoded that way (Stulp and Schaal, 2011). Daniel et al. (2012) provide an
algorithm to simultaneously learn several alternative policies, represented as DMPs,
and use them to solve an episodic reinforcement learning problem.
Finally, since motion primitives often are skills to achieve a certain task, a dual point
of view on the problem consist in representing the task itself, eventually together with
the associated skill. Such an approach is exemplified in work such as (Brillinger, 2007,
Hart et al., 2008, Hart and Grupen, 2011, Jetchev and Toussaint, 2011, Mangin and
Oudeyer, 2012b). Hart and colleagues further develop the subordinated composition
of motion represented in such a way. In our work (Mangin and Oudeyer, 2012b)
and further wok developed in chapter 4 we focus on the concurrent and competing
composition of such tasks.
3.1.3 Algorithms to decompose observed motions
Dictionary learning techniques have been applied to the discovery of motion primitives
from sequences. For example, Li et al. (2010) have used orthogonal matching pursuit
to decompose complex motions into simple motion patterns activated briefly along the
2That notion of phase is a flexible abstraction of time that can evolve non-linearly and easily
represent cyclical motions.3.2. HISTOGRAMS OF MOTION VELOCITY 43
time dimension. The decomposition can then be used to perform both compression
and classification. This approach is actually an instance of the sparse coding approach
to signal processing, which has been extensively studied in other fields (Paatero and
Tapper, 1994, Lee et al., 2006, Hoyer, 2002, Aharon et al., 2005). Hellbach et al.
(2009) have also used non-negative matrix factorization to perform a decomposition
of globally unstructured motions in low level components and use it in a prediction
problem. The use of similar algorithms, but to learn simultaneous motion primitives is
detailed in section 3.3. Taylor and Hinton (2009a) showed that conditional restricted
Boltzmann machines can be used to learn a latent representation space for encoding
motion primitives.
Many approaches to representing motion primitives as probability distributions make
use of the expectation maximization (EM, Dempster et al., 1977, Ghahramani and
Jordan, 1994, Bishop, 2006, chapter 9) algorithm and its application to HMMs.
For example, Kulic and Nakamura have proposed in Kulic and Nakamura (2010)
a method that first performs an unsupervised segmentation of the motion signal
into small blocks through a first HMM, and then performs clustering over a HMM
representation of the found blocks, thus learning motion primitive as clusters. Kruger
et al. (2010), have proposed to first discover primitives by clustering action effects on
manipulated objects and then use the found clusters and associated segmentation to
train parametrized hidden Markov models that allow recognition and reproduction of
motions. Finally Calinon et al. (2010) and Butterfield et al. (2010) use EM for GMMs
and HMMs to discover and represent the transitions and sequential combinations
of primitives, while Grollman and Jenkins (2010) use a combination of EM and a
custom clustering algorithm.
3.2 Histograms of motion velocity
In our contribution Mangin and Oudeyer (2012a) we introduced a simple histogram
based representation of motion that can be seen as a rough approximation of the
phase diagram of the dynamics of one body joint, as discussed in previous section.
This representation is applied to choreographies and is shown to enable the discovery
and recognition of primitive gestures.
An important property of such histogram based representation, that makes it usable
with techniques like NMF, is that it represents data with vectors of non-negative
coefficients which can be combined through non-negative weighted sums.
In this section it is assumed that the motions of a human demonstrator are captured
as trajectories in angle and angle velocity spaces of several articulations of the human
body. Each trajectory on a specific body articulation (or degree of freedom) is
considered separately and the entire sequence of angles and velocities is transformed
into a histogram, represented by a fixed length non-negative vector. Vectors obtained
for each degree of freedom are then concatenated into a larger vector.
The velocity trajectories are obtained from an angle trajectory that is actually
captured: a delayed velocity is used to achieve better robustness to noise in the angle
sequences. More precisely x˙ t = xt − xt−d is used to compute the velocities, instead
of being restrained to the case where d = 1. It is not necessary to divide by the fixed
time step since the histogram representation described in the following is invariant44 CHAPTER 3. LEARNING A DICTIONARY OF PRIMITIVE MOTIONS
to scaling all the data by the same amount.
In Mangin and Oudeyer (2012a), we explore different approaches for the transformation
of angles and velocities sequences into histograms. They differ on two modelling
choices:
1. Which data is used to build histograms?
2. Which method is used to build histograms?
Answers to the first question are related to the use of angles and velocities values.
While velocities can bring precious information, there are several ways of integrating
this information in the histogram representation:
1. consider only angles.
2. consider only velocities.
3. treat angles and velocities as separate degrees of freedom.
4. or use the two-dimensional angle-velocity vectors that is to say build histograms
on the joint angle-velocity space (see fig. 3.2).
We study two methods for building histograms. First, smoothed histograms can be
built on regularly distributed bins. More precisely we split the angle, velocity or
joint angle velocity space into a regular grid of bins. Histograms are built by counting
the number of samples from the trajectory falling into each bin and dividing by the
length of the trajectory. A Gaussian smoothing kernel is used to make point by point
comparison of histograms more robust to perturbations (Rubner et al., 2000). These
methods are referred to as Kernel Density Estimation (KDE) in the following.
item An alternative approach is to build histograms over a vector quantization,
which is a more adaptive binning process. Vector quantization (VQ) is performed
through a k-means algorithm. Then a histogram is built by counting the proportion of
samples falling into each cluster. We explore the use of both hard (each histogram is
only counted in one cluster) and softmax (each sample is counted in each cluster with
a weight depending on its distance to the cluster’s centroid) centroid associations.
Representing motion data by separate histograms on each degree of freedom leads to
two approximations:
1. for a given measurement in the trajectory, information about dependency
between different degrees of freedom is dropped.
2. the sequential information between measures for a given degree of freedom is
dropped.
Similar simplification have however been successfully used in two other fields. Ten
Bosch et al. (2008) have demonstrated that, even if sequential information may
appear necessary in language, and especially in speech utterances, very good word
discovery can be achieved without considering this sequential information. Both in
text classification and in computer vision bag-of-words techniques also achieve good
performances by dropping positional information of extracted local features (Joachims,
1997, Sivic and Zisserman, 2008).
Furthermore using histograms built on joint angle positions and velocities is similar
to representing transitions in angle space. By representing the sequence through3.3. DISCOVER SIMULTANEOUS PRIMITIVES BY NMF 45
velocity
angle
DOF 1 DOF 2 DOF 3
}
}
}
frequency
angle
DOF 1 DOF 2 DOF 3
}
}
}
Figure 3.2: Illustrations of concatenated histograms on positions (top) and joint
position and velocities (bottom). For the first one, x axis is associated to different
possible values for each angles and y axis to frequencies. On the second one frequencies
are represented through colors, x and y axis correspond respectively to values of
angles and velocities. (Best seen in color)
its transition we approximate it by a Markovian process. Such an approximation is
quite common in the gesture recognition and motion planning literature (Calinon
and Billard, 2009, Kulic et al., 2009).
The various methods for building the histogram based representation of motions
are compared in the experiment described in next section; relevant results for this
comparison are found in section 3.3.4.
3.3 Discover simultaneous primitives by nonnegative
matrix factorization
In this section we present results published as Mangin and Oudeyer (2012a). We
demonstrate how NMF techniques presented in section 2.1 can enable a system to
discover and learn to recognize gestures that are combined simultaneously to form
complex choreographies.
More precisely we consider a set of demonstrations each of which is a complex
choreography, complex meaning that it is composed of two or three primitive gestures.
Each demonstration is associated with a set of symbols that describe the gestures
composing the demonstration. Such symbols can be interpreted as an equivalent of
the symbols from fig. 3.1 provided to someone unfamiliar with Laban’s notation.
A learning system observes the gestures together with the unknown symbols and
build an internal (or latent) representation of the data. The symbols are said to
be ambiguous since several symbols that describe several gestures demonstrated
together, are always given at the same time. Therefore the system has not only to
learn a good enough representation of gestures to be able to recognize it, but also
has to discover which part of the complex motion is relevant for each symbol.
In a test phase the system is asked, given a new demonstration of a complex dance,
to yield symbols corresponding to that dance. The experiment demonstrates that the
system is capable of providing correct symbolic descriptions of new demonstrations46 CHAPTER 3. LEARNING A DICTIONARY OF PRIMITIVE MOTIONS
L5
?
linguistic
descriptions
choreography
demonstrations The system observes a choreography and is asked
to reconstruct the associated linguistic description.
Task
L2 L4 L
L6
3
Demonstration 1 Demonstration 2
Training
Figure 3.3: In the training phase, the learner observes demonstrations of choreographies
composed of several elementary gestures, and the associated set of linguistic
labels (left). After that the learner has to reconstruct the set of labels associated to
a demonstrated choreography (right). (Best seen in color)
Gesture 1 Gesture 2 Gesture 3 Gesture 4 Gesture 5 Gesture 6
Figure 3.4: A set of the primitive dance movements that are mixed into demonstrated
choreographies is illustrated in this figure.
of choreographies even if the particular combination of gestures was never observed
during training: it therefore demonstrates that the system is capable to capture the
combinatorial aspect of the observed dance motions. The process is illustrated in
fig. 3.3
3.3.1 The choreography data
The data used in these experiments is described in more details in section appendix B.2
and available publicly3
. It has been acquired from a single human dancer through
a KinectTM device and the OpenNITM software4
that enables direct capture of the
subject skeleton. The device and its associated software provides an approximate
3D position of a set of skeleton points. These points are then converted into 16
angle values representing the dancer position at a specific time. This conversion is
achieved through a simple geometrical model of human limbs. It is then converted
to position-velocity histograms with the techniques described in section 3.2.
The primitive dance motions used in our gesture datasets and illustrated in fig. 3.4
and table 3.1 are either associated to legs, as for example squat and walk movements,
to both arms, as clap hands and paddle, or to left or right arm, as punch, wave hand.
Yet this structure is not known by the system initially. They correspond to both
discrete and rhythmic movements. The motions were recorded from a single human
demonstrator in several sessions. Each motion was selected randomly and the names
of the basic gestures that composed it were given to the demonstrator. Recording of
the motions occurred through several sessions.
3Dataset and examples available at http://flowers.inria.fr/choreography_database.html
4http://www.openni.org3.3. DISCOVER SIMULTANEOUS PRIMITIVES BY NMF 47
Id Limb(s) Description
1 right arm hold horizontal
5 raise from horizontal to vertical
6 lower from horizontal to vertical
10 hold horizontal and bring from side to front
19 both arms clap hands (at varying positions)
20 mimic paddling on the left
21 mimic paddling on the right
22 mimic pushing on ski sticks
23 legs un-squat
24 mimic walking
25 stay still
28 right leg raise and bend leg to form a flag (or “P”) shape
30 left arm hold horizontal
38 mimic punching
40 lower forearm from horizontal position
43 swing forearm downside with horizontal upper arm
Table 3.1: Primitive dance motions from the small mixed dataset
Three motion datasets are considered for these experiments. A first dataset is used
to separately study the efficiency of the various representations. In this dataset each
demonstration only includes one primitive dance motion. There are 47 different
dance primitive and the set contains 326 demonstrations. This dataset is referenced
as single primitive dataset.
Two other datasets are composed of demonstrations of complex choreographies,
composed of two or three randomly chosen compatible (that is spanned over separate
degrees of freedom) primitive motions. The first one contains 137 examples of
combinations of 16 distinct primitive dance motions. The second one, contains 277
examples with 47 primitive dance motions (the same as in single primitive dataset).
These datasets are referenced as small and full mixed dataset.
Since the datasets only contain a relatively small number of examples we used leaveone-out
cross validation to build test and train sets. Presented results are averaged
over all possible test sets. With the full mixed dataset examples presented for testing
contain a combination of primitive movements that in 60% of the cases have not
been observed during training (see fig. 3.8).
The language description has the following structure: keywords or labels from a
set L are associated to gestures, and combined into sentences from a set S ⊂ P(L).
In this article we only consider symbolic labels. More precisely when the sentence
s = {l1, l2, l3} ∈ S is used to describe a choreography, the system observes a vector
y
i ∈ R
L (L is the total number of labels, L = |L|) such that for 1 ≤ j ≤ L, y
i
j
takes
value 1 if lj ∈ s, and 0 elsewhere. For example if 5 labels are considered, the sentence
containing labels 1 and 3 would be represented by vector: (1, 0, 1, 0, 0)T
.48 CHAPTER 3. LEARNING A DICTIONARY OF PRIMITIVE MOTIONS
3.3.2 Algorithm
In this section, the NMF algorithm introduced in section 2.1 is applied to the learning
problem that we just introduced. This use of NMF in a multi-modal framework
was introduced by ten Bosch et al. (2008), Driesen et al. (2009), and is extended in
chapter 6.
In the experiments from this section, we used the plain NMF algorithm based on
multiplicative updates, for both errors based on Frobenius norm and Kullback-Leibler
divergence (see section 2.1.1).
We assume that we are given a set of examples represented by vectors v
i ∈ R
m
(1 ≤ i ≤ n), each of which is composed of a part representing a demonstrated
choreography and a part representing a symbolic representation of that choreography
and use NMF to learn a dictionary of atoms W ∈ R
m×k and coefficients H ∈ R
k×n
such as:
V ≃ W · H.
Therefore the data matrix V and the dictionary W are composed of a motion and a
language part:
V =
Vmotion
Vlanguage
W =
Wmotion
Wlanguage
The NMF algorithm only learns, in an unsupervised manner, a transformation of the
original data V into an internal representation H. In these experiments it is used
in two different ways to first learn the transformation from multi-modal examples
to an internal representation, and then use this transformation to reconstruct one
modality from another.
In the learning part NMF is applied to a V
train data matrix and both Wtrain and
Htrain matrices are learned. The Wtrain matrix is the matrix of most interest since
it encodes the structure that has been learned on the data, when Htrain only encodes
the representation of training examples.
The Reconstruction of the linguistic parts associated to demonstrations of motions,
that is classifying motions, corresponds to finding the missing V
test
language given a
V
test
motion. This operation is performed through two steps:
1. reconstructing internal states of the system from demonstrations, which means
finding the best matrix Htest for the approximation: V
test
motion ≃ Wtrain
motion · Htest
.
This step can be performed through NMF algorithms by constraining the W
matrix to be constant.
2. once Htest has been found, the associated linguistic part can be computed
through matrix product: V
test
language ≃ Wtrain
language · Htest
It should be noted here that the reconstructed matrix V
test
language is not constrained to
take only binary values like the provided linguistic matrix. This issue is addressed by
using a thresholding mechanism (where the threshold is learned by cross-validation
on training data), as detailed in section 3.3.3.
The value of k is a parameter of the system that is fixed to 150 for the experiments
presented in this paper. The number of atoms used by the system to represent3.3. DISCOVER SIMULTANEOUS PRIMITIVES BY NMF 49
observed data is quite important to achieve the desired objective. If k is too big, the
algorithm does not have to compress data and can use motion only and language
only atoms. On the other hand, if k is too small, the system cannot represent the
complexity of the data and may focus on representing components that have bigger
effects but less multimodal meaning. In order to demonstrate these capabilities we
perform two kinds of experiment.
1. First the system is tested on simple human motions, each containing only
one primitive dance gesture. These experiments demonstrate that the motion
representation we use is sufficient to perform motion classification, which
corresponds to a simple case of multi-modal learning. We also compare different
aspects of the representation.
2. Then the system is tested on complex full body human motions to demonstrate
its ability to capture the combinatorial structure of the choreographies by
exploiting ambiguous linguistic labels.
3.3.3 Evaluation
In each experiment the method based on NMF described in previous section yields
a vector of keyword activations, which forms the linguistic reconstruction. The
quality of this reconstruction is evaluated by comparison between the reconstructed
yˆ (with continuous values) and y from ground truth (with binary values) through
the following score functions:
Score function for the single gesture experiment
In that case the good linguistic representation only contains a 1 at the position of
the label associated to the demonstrated gesture and 0 elsewhere. The score function
is defined as:
lsingle(ˆy, y) =
1 if arg max iyˆi = arg max iyi
0 else
Score function for mixed gesture: the number of gestures is given
In that case several elementary gestures are present in each example. The reconstructed
vector is tested on the fact that gestures that are actually present in the
experiment have the best activations.
It can be described by the following equation, where #(y) denotes the number of
gestures present in the demonstration and best(n, yˆ) is defined as the set containing
the n labels having the best activation in ˆy.
lgiven number(ˆy, y) =
1 if best(#(y), y) = best(#(y), yˆ)
0 else
In other words the system is given the number of elementary gestures present in the
example and asked which are those gestures.50 CHAPTER 3. LEARNING A DICTIONARY OF PRIMITIVE MOTIONS
Score function for mixed gestures: exact reconstruction
This score function evaluates the exact reconstruction of the linguistic description. It
requires the reconstructed vector to be converted to a discrete one before comparison.
For that purpose an additional thresholding mechanism is added to the system:
after reconstruction of label activations, all values from yˆ above a threshold are
put to 1, and others are put to 0. The function threshold such that for 1 ≤ j ≤ L,
threshold(y, η)
j = δyj≥η encodes that mechanism. The threshold η is evaluated
through cross-validation on the training data.
The score function is then simply defined as:
lfull(ˆy, y) =
1 if y = threshold(ˆy, η)
0 else
In each case the score function defined above for one example is averaged over all
examples from the test set to yield a final score in [0, 1].
3.3.4 Results
Demonstrations with a single primitive
We performed a first set of experiments on the single primitive dataset in order to
evaluate our learning system on a simple multi-modal learning task. In this section
primitive dance movements are presented to the learning system with unambiguous
labels and the recognition performances are evaluated with the lsingle score function.
We focus on comparisons of the various parameters of the motion representation.
The first experiment compares the use of regular binning with Gaussian smoothing
(KDE) and adaptive binning (VQ) with both hard and softmax associations to build
the histograms. The comparisons are performed over a range of total number of bins,
for joint angle-velocity 2D histograms. Results from this experiment in fig. 3.5
outline the advantage of using vector quantization over regular binning (KDE) for
small numbers of bins, which corresponds to a low resolution of the input. This
difference is however less sensitive for larger numbers of bins. A typical issue of
regular binning, that can explain the better results with adaptive binning, is that for
the same grid step (the resolution), the number of required bins grows exponentially
with dimension. Even with two dimensional histograms, a maximum number of ten
bins would lead to a three-by-three (thus low resolution) regular binning. In the
same situation adaptive binning can identify ten relevant clusters.
A second experiment is performed to compare the efficiency of histograms built
either only on angles, only on velocities, on angles and velocities as separate
degrees of freedom, or on the joint angle-velocity space. We compare these
representations of the motion over a range of values for the delay used in velocity
computation, and using KDE histograms with a fixed total number of 15 bins by
degree of freedom. The results of the second experiment, presented in fig. 3.6,
demonstrate that histograms on joint angle and velocities values capture the most
information from the original motions.3.3. DISCOVER SIMULTANEOUS PRIMITIVES BY NMF 51
0 5 10 15 20 25 30
N umber of bins
0.4
0.5
0.6
0.7
0.8
Scor e on test set
H istogr am modes compar ison
KDE
H ar d VQ
Soft VQ
Figure 3.5: When the number of bins is small vector quantization (VQ) offers a clear
advantage over kernel density estimator (KDE) for representing the angle-velocity
distributions (see section 3.2). This advantage however disappear for larger numbers
of bins. (Best seen in color)
Demonstrations with complex choreographies
In this paragraph we evaluate the performance of the learning system on the full
choreographies with ambiguous labels.
Figure 3.7 illustrates the role of the threshold used to transform vectors of scores
produced by the system into vectors with 0, 1 values representing a set of recognized
labels. In the following the threshold (used in lfull) is determined through cross
validation on the training data.
Table 3.2 presents results obtained on the two mixed datasets for both KullbackLeibler
(DKL) and Frobenius versions of NMF algorithm. The reconstructed label
vectors are evaluated by lgiven number and lfull score functions which enables to
understand which part of the error is due to the thresholding mechanism.
For comparison purposes we also tested a method based on support vector machines
(SVM ) on our dataset. More precisely we trained one linear SVM5
for the recognition
of each label. The SVM method directly yields a set of recognized labels, with no
need for thresholding. However this method relies entirely on the symbolic form
of the labels and won’t generalize to other multi-modal settings with continuous
linguistic modalities. There is no such theoretical limitation on our NMF setting (see
discussion in section 3.4).
The results in table 3.2 demonstrates that after being exposed to demonstrations
of mixed primitive dance motions associated with ambiguous labels, the presented
system is able to successfully produce linguistic representations of newly demonstrated
choreographies. The second dataset can be considered difficult since each one of the
47 primitive dance motions only appears in an average of 14 demonstrations, which
labels are ambiguous.
5We used the Scikit-learn implementation of SVMs (see scikit-learn.org/stable/modules/
svm.html).52 CHAPTER 3. LEARNING A DICTIONARY OF PRIMITIVE MOTIONS
0 10 20 30 40 50
Velocity delay
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
Scor e on test set
Velocity modes, single pr imitive exper iment
N o velocities
Velocities as extr a dims
Joint position, velocities
Only velocities
Figure 3.6: For small values of the velocity delay, the representation using jointly the
position and the velocity leads to better performances than using only the positions.
For high values of the delay, the velocity is mostly noise, therefore using only positions
performs better although the noise does not degrade the performance of the joint
representation too much. Using only velocities or considering position and velocity
histograms as separate dimensions leads to worse performances on the classification
task. KDE histograms are used for these results. (Best seen in color)
lfull lgiven number
16 labels (SVM, linear) 0.818 —
16 labels (NMF, Frobenius) 0.854 0.971
16 labels (NMF, DKL) 0.789 0.905
47 labels (SVM, linear) 0.422 —
47 labels (NMF, Frobenius) 0.625 0.755
47 labels (NMF, DKL) 0.574 0.679
Table 3.2: Results on the mixed datasets
Handling unknown combinations of primitives
The combinatorial nature of the demonstrated choreographic motions implies that,
although the primitive gestures are observed many times, each specific combination
of gestures into a choreography is not observed that often. This phenomenon is
illustrated in fig. 3.8. An important consequence is that the performance of the
system cannot be solely explained by the system recognizing full choreographies;
rather the system has captured the combinatorial structure of the data. This ability
is illustrated by its behaviour on unknown combinations of motion primitives. For
instance in the full mixed dataset more than 60% of the examples demonstrates a
combination that is not observed in other examples.
In order to get more precise results for this behaviour we set up a slightly different
experiment where test sets are only composed of combinations of motion primitives3.4. CONCLUDING PERSPECTIVES 53
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
Threshold
0.5
0.6
0.7
0.8
0.9
Score on test set
Threshold on linguistic reconstruction
Figure 3.7: The impact of the threshold value on the selection of active labels is
limited in a central range of values. Extreme values lead to worse performances.These
results are obtained on the small mixed dataset. This experiment is the only one in
which the threshold is not automatically adjusted.
1 2 3 4 5 6 7
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7 Occurences of combinations
47 labels dataset
16 labels dataset
number of occurences
proportion of examples
Figure 3.8: In the big dataset 60% of the choreographies (specific combination
of primitive gestures) are only observed once. This illustrates the necessity for
the system to capture the combinatorial structure of the choreographies instead of
representing them in a holistic manner.
that were not observed during training. The results of this experiment are reported
in table 3.3.
3.4 Concluding perspectives
In a first experiment from previous section, we demonstrated the efficiency of the
position-velocity histogram representation of motion and the NMF algorithm on a
dance motion recognition task. Hellbach et al. (2009) had used NMF to perform
prediction on learnt motions; in contrast, our contribution extends the scope of NMF
usage to a form of structure classification of motions. The motion representation
presented in this section enables the application of the architecture developed by
ten Bosch et al. (2008), Driesen et al. (2009) for speech learning to motion learning.
This constitutes a useful step toward comparison of structural similarities between54 CHAPTER 3. LEARNING A DICTIONARY OF PRIMITIVE MOTIONS
lfull lgiven number
16 labels (NMF, Frobenius) 0.568 0.800
16 labels (SVM, linear) 0.667 —
47 labels (NMF, Frobenius) 0.406 0.653
47 labels (SVM, linear) 0.206 —
Table 3.3: Results for combination of primitive gestures that were not encountered
during training.
language and motion learning. That study is further extended in chapter 6 and
Mangin and Oudeyer (2013).
The motion-velocity histogram representation does not make it possible to produce
the actual motion from the motion representation. Hellbach et al. (2009) have given
an example of motion representation that allows such reproduction. This work may
thus be extended, by changing the motion representation, to an imitation learning
setting, in which the system could be evaluated on producing gestures on a real robot,
corresponding to a given linguistic description. Chapter 4 introduces ideas toward
such motion representations, although they are not illustrated on a real robotic
setting.
In the second experiment we showed that the architecture presented in this paper is
capable of learning to recognize complex gestures, composed of simultaneous motion
primitives, while only observing ambiguous symbolic labels. It is demonstrated in
the third experiment that the system has captured the combinatorial structure of
the observed gestures and is capable of generalization by recognizing combinations
that were never observed in training.
We presented a learning system that is capable, after learning from demonstrations of
complex gestures and linguistic descriptions, to re-construct the linguistic modality
from an example involving only the motion modality. The experiments that we
performed only uses a symbolic representation of speech labels. Interestingly this
corresponds to a degenerated version a talking heads (see section 1.3 Steels, 1999,
Steels and Kaplan, 2002). For this analogy we consider that a first human is
performing the gesture. During training, the agent presented here corresponds to
a hearer from the talking heads, the speaker being another human, who names
the choreographies. In this experiment the communication channel is discrete and
finite and corresponds exactly to the human speaker ontology. The setup we present
describes how the learner builds its own ontology and produces utterances when it,
in the test phase, plays the speaker. It is however possible to replace this symbolic
representation by real acoustic data (for example represented in the same way than
in Driesen et al. (2009)) without changing the learning and reproduction algorithms.
Such experiments are performed in our other contribution Mangin and Oudeyer
(2013) and detailed in chapter 6.
While in this contribution we focused on primitive motions active at the same time,
it is possible to use the same setting to recognize choreographies where motions are
composed in sequence and eventually overlaps. A direct application of our method,
would however only enable reconstructing the set of active motions and not their
order.Chapter 4
Learning a dictionary of
primitive tasks
Despite having potentially many distinct definitions, the notion of task or targeted
effect is very important to apprehend human behaviors or program robots. Actually
the common representation of motions as a sequence of positions or basic actions,
either captured from an acting agent or implemented on a robot, might be very
limiting. For example, in order to grasp an object, an adult would perform some
motion of its arm and hand toward the object while a dog would use its head, a
child would get on tiptoe and use a tool to reach the object if it is too high for him.
Even the same person would use very different motions depending on the position or
accessibility of the object. Although the trajectory of body parts are very different in
each of these examples, the intention of the agent is generally perceived very clearly as
identical in each case by an observer. More generally, the perceived similarity between
two motions is often not explained by the similarity of the underlying motions.
Therefore it is of great interest for objectives like human behaviour understanding
or programming robots capable of complex tasks to be able to take into account
activities at the task or effect level. Learning or perceiving actions at the effect level
was already discussed in section 1.1 as functional level imitation as introduced by
Demiris and Hayes (1997). The motivation behind such representation is to achieve
better generalization to unknown situations while preserving the essence of the task
or to be able to learn and improve from imperfect demonstrations.
The notion of affordances, that is to say the potential actions related to encountered
objects, was introduced by the psychologist Gibson (1979). Its importance in
the perception of objects emphasizes the close relation between the knowledge
of achievable effects on the environment and the perception of that environment.
Similarly, an interesting analogy can be drawn with the field of pragmatics amongst
linguistics: pragmatics emphasizes the importance of the speaker’s intention over pure
semantics for communication (Grice, 1989). That approach suggests that sentences
or language are not produced as a container for meaning but rather as a way to
induce an effect on the person to whom it is directed.
In this chapter several studies related to learning and using the effect space or task
space are presented. Some of them address related issues such as the question of
5556 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
learning the effect of actions or learning relevant aspects of the effects of an action,
denoted task space retrieval. In the context of complex or composite actions that are
studied in this work, we believe that sometime the structure of the behavior is easier
to study at the task level than at the motion or trajectory level; contributions about
learning task components are therefore presented in section 4.3.
The work presented in the following is similar to the one from previous chapter but
study behaviors in the task space instead of the action or motion space. In contrast
to previous chapter, the behavior representation studied below is not as destructive
and enables reproduction of the learnt behaviors with planning algorithms. Finally
the behavior composition introduced in the following can be qualified as ‘concurrent’,
rather than just ‘simultaneous’.
4.1 Previous work
Plan recognition and intention recognition focus on the study of the structure of tasks
abstracted from sequences of symbolic actions (for a review, see Kruger et al., 2007).
These ideas have been applied to teach robots by demonstration in various ways.
Kuniyoshi et al. (1994) use a set of static mechanisms to abstract visual sensory input
into objects and recognize the effect of predefined actions on the environment, as well
as the dependencies between the actions in a given task. From these mechanisms their
robotic system is capable of reproducing a demonstrated task by following a sequence
of sub-tasks that fit the learnt dependency. Ekvall and Kragic (2006), Pardowitz
et al. (2007), and Nicolescu and Matari´c (2002, 2003) have developed similar setups,
but including more advanced dependencies between sub-tasks and hierarchies. Ekvall
and Kragic (2006) present an approach in which a robot is capable, from predefined
primitive behaviors, to learn the precedence relations and dependencies between these
behaviors combined into a solution for a task. The relations are learned following a
specific to generic process: each time a new demonstration is observed, the model of
the task is expanded to account for the new demonstration. Similarly, Nicolescu and
Matari´c (2002, 2003) use a longest common path heuristic to infer a directed acyclic
graph representing the relations between predefined behaviors combined to solve
task. They also explain how teacher feedback can be efficiently used to correct errors
occurring in the learning phase or coming from wrong demonstrations. They also
detail the analogy between their task model and regular expressions or equivalently
finite automata. Pardowitz et al. (2007) also present a similar system that, after
learning a set of basic behaviors in a supervised way, can learn a directed acyclic
graph, called task precedence graph that forms an abstract representation the task
structure. The graph is learnt by successive generalization, similarly to the work of
Ekvall and Kragic (2006).
While the studies presented in previous section mainly focus on methods to learn the
structure of a task, knowing the underlying primitive behaviors, other works focus
on learning the primitive actions that compose complex tasks; for example Kruger
et al. (2010) use clustering on the effects of various actions on the environment to
identify such primitive actions.4.1. PREVIOUS WORK 57
4.1.1 Inverse feedback and reinforcement learning
Inverse reinforcement learning and inverse feedback learning, that are presented in
section 2.2, both study models of an agent behavior and intention as a process to
maximize a reward or feedback function. Both have been developed in order to
yield better models of intention of agents performing tasks. For example, Abbeel
et al. (2010) demonstrate how applying inverse reinforcement learning to expert
demonstrations of aerobatic manoeuvres on a remote controlled helicopter enables a
learning system to succeed in accomplishing manoeuvres on which the experts only
provided failed demonstrations. Similar ideas have also successively been applied to
represent driving styles on a simulator (Neu and Szepesv´ari, 2007) and trajectories
from taxi drivers (Ziebart et al., 2008), pedestrians (Almingol et al., 2013), and wild
animals (Brillinger, 2007).
However, basic inverse reinforcement learning or inverse feedback learning focus on
one simple reward or objective function that explains all the data it observes passively
data. Such setting does not fit many practical situations.
Lopes et al. (2009b) consider the situation in which the robot or learning system
can request demonstrations at specific states in order to make the learning process
require less demonstrations: having human provide demonstrations for robots is
indeed often considered an expensive operation. Lopes and Cakmak also presented
an optimal teaching strategy for inverse reinforcement learning (Cakmak and Lopes,
2012): they provide an algorithm to chose optimal demonstration that are to be
given to an inverse reinforcement learner.
Jetchev and Toussaint (2011) present an approach inspired from inverse optimal
control that learns a feedback function representing demonstrations of a task that is
sparse on some features. They demonstrate how the algorithm is capable to learn a
grasping task and explain why the sparseness of the learnt feedback function provides
a solution to the task space retrieval problem.
An other common issue of inverse reinforcement learning approaches is that it is often
required that adequate features are used to represent the state of the learning agent.
Levine et al. (2010) introduce an algorithm to overcome this issue that both learn
an estimate of the reward optimized by the demonstrator and features to efficiently
represent it. They also demonstrate how the learned features can be transfered to
a new environment. The work presented in the following of this chapter also goes
toward that direction in the more general setup of multi-task demonstrations.
While in the works presented above the expert only demonstrates a single task,
Babes-Vroman et al. (2011) present an EM-based algorithm which, from unlabeled
demonstrations of several tasks, infers a clustering of these demonstrations together
with a set of models. Choi and Kim (2012) have extended this idea into a reward
model based on Dirichlet processes and a Metropolis-Hasting algorithm that represent
the demonstrations as being generated from mixture of reward functions without
requiring the number of reward functions to be fixed. Almingol et al. (2013) also
recently developed similar ideas in the context of inverse feedback learning.
Michini and How (2012) suggest that demonstrated behaviors, even in the single task
setting, might be better modelled by considering non-stationary rewards functions:
they developed an algorithm that learns a set of reward functions such that each
sample action is explained by one of these functions.58 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
Rothkopf and Ballard (2013) have extended the ideas of modular reinforcement
learning for inverse reinforcement learning. This approach targets the issue of the
exponential growth of state space often observed when real world applications are
modelled.
The next sections present two algorithms that extend both inverse reinforcement
learning and some inverse feedback learning techniques to build a dictionary of
primitive tasks. The primitive tasks are modelled as rewards or feedback functions
that can be combined together to model the intention of an expert in demonstrations
of complex tasks. They focus on the question of how to represent demonstrated
behaviors as the combination of simpler primitive behaviors that can be re-used in
other contexts. This approach is similar to feature learning but focus explicitly on
the multi-task setup. We present two algorithms that, by observing demonstrations
of an expert solving multiple tasks, learns a dictionary of primitive behaviors and
combine them to account for the observations. We explain how such an approach can
be beneficial for life long learning capabilities in simple toy experiments. Next section
uses inverse feedback learning to discover task primitives from demonstrations of an
agent in a continuous world. The experiments illustrate the ambiguous nature of the
task and how supervision can be used to accurately recovers the original dictionary.
The following section presents a similar algorithm in the case of inverse reinforcement
learning, in a discrete world. The experiments demonstrate that without supervision
the learner can build a dictionary to represent the demonstrated task. The evaluation
of the experiments focus on the ability of the learner to solve a task after a few
observation of an expert solving that task. The results demonstrate that learning the
common structure of composite tasks can make the agent more efficient in solving
new tasks that share the same structure.
4.2 Factorial inverse control
Brillinger (2007) has developed an algorithm based on least square regression to
learn potential functions modelling the motion of wild animals in natural parks. In
this section, and in the publication Mangin and Oudeyer (2012b), we present an
algorithm that extends Brillinger’s technique to address a new problem: instead of
learning a flat representation of a single task, the learner must infer several primitives
cost functions that can be composed so that their mixture is a good approximation
to the demonstrated task. A very similar behaviour representation is used, but it
introduces dictionary learning for solving the new problem. We discuss the use of
supervision, such as linguistic supervision, to improve and disambiguate the learning
of the dictionary.
4.2.1 Problem definition and algorithm
This section describes a simple synthetic imitation learning experiment in which
an imitator learns to reproduce behaviors observed from a demonstrator: the task
underlying each behavior is modelled as a cost function on states of the agent (either
the demonstrator or the imitator), which can be seen as representing the preferences
of the demonstrator. For example the task of filling a glass of water is represented by
a cost function giving increasing values to increasing levels of water in the glass. In4.2. FACTORIAL INVERSE CONTROL 59
the case where the “filling the glass” behavior is mixed with the “smiling to someone”
behavior, the mixed behavior is be represented by a mixed cost function valuing both
full glass and smiling position of the lips.
Each demonstration consists in a trajectory in the demonstrator state space, from a
specific initial position. The objective of the imitator is to produce a trajectory that
fits the demonstrator preferences, that is minimise the cost function. The imitator
may start from the same initial position than the demonstration or another. The
latter generally defeats strategies that simply mimic the demonstrator gestures; this
issue, that oppose program level imitation to action level imitation, is discussed in
section 1.1.
This setup introduces two important difficulties for the imitator. On the one hand each
demonstration only presents aspects of the cost function locally, around the trajectory.
Each demonstration is thus not sufficient to fully understand the underlying task.
On the other hand, each demonstration presents a mixture of several tasks. Thus,
while the primitive tasks are observed many time, they are never observed alone
and each particular mixture is generally only observed once. It is thus necessary to
leverage the compositional structure of the behaviors to be able to understand them,
and reproduce them with new initial positions.
Agent and demonstrator models
Both the demonstrator and imitator are assumed to have identical bodies and perceptions
of the world. This corresponds for example to the case where demonstrations
are performed on the imitator body (kinesthetic demonstrations). Following Jetchev
and Toussaint (2011), the current configuration of the robotic agent q belongs to a
state space Q ∈ R
S. Each trajectory is denoted by a sequence (qt)
t∈[|1,T|]
.
The model assumes that there exists a cost function f : Q −→ R such that each task
is modeled as the demonstrating agent trying to minimize the cost f(q) to which is
added a penalization on the square norm of ∂q
∂t . The penalization term can be seen
as a penalization of the energy consumed while moving toward an optimum of f(q).
The following focuses on very simple agents whose actions are motions in the state
space and are governed by the local optimization of f(q) + α
∂q
∂t
2
which means
that each action, at each time step, is chosen such that:
qt+1 = arg min
q
f(q) + α
q − qt
δt
2
,
with δt the time elapsed between samples t and t + 1.
The solution of this equation, without additional constraints, and assuming that the
cost function f is differentiable, is well known to be proportional to the gradient of
f, as −
1
α∇f(q).
It can be noticed that since the agent previously defined only follows policies driven
by local optimization it will only achieve local optimization of the cost function.
While this is a simplification of the agent, it also features an important property of
real demonstrators: real demonstrators are in general imperfect and do not always60 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
succeed in reaching the optimal solution of the task. It is thus important for an
imitator to be able to also learn from imperfect demonstrations of behaviors.
Complex tasks are more specifically studied here: each demonstration corresponds
to the minimization of a separate cost function f which is only observed through
one demonstration. However f is composed of parts that also occur in other demonstrations
and are thus observed several time mixed in various way and in various
contexts. We consider N demonstrations, observed as trajectories (q
i
t
)
t
, i ∈ [|1, N|]
in the agent state space. This work assumes that each demonstration corresponds
to a given f
i
. To model complex demonstrations it also assume that there exists a
dictionary of primitive tasks, composed of K cost functions (g
k
)k∈[|1,K|]
, such that,
for all demonstration i, there exist coefficients (a
i
k
)
k∈[|1,K|]
such that, for all state q,
f
i
(q) =
K
k=1
a
i
k
g
k
(q).
In the following, we first present the inverse feedback learning approach from Brillinger
(2007); then we extend it into a learning algorithm which observes one demonstration
associated with each function f
i and learns a dictionary of primitive cost functions
g
k
, and the coefficients of their combinations into demonstrated tasks f
i
.
Inferring a task from a demonstration
The problem of inferring a single task from a demonstration is studied in Brillinger’s
article (Brillinger, 2007). The cost function is represented by a linear parameter
β ∈ R
F on a space of potentially non-linear features ϕ : Q −→ R
F . Its minimization
is modeled by an agent policy such that:
∂q
∂t = −λJ(q)
T
β (4.1)
where J is the Jacobian of ϕ (lines of J are gradients of coordinates of ϕ).
When discrete trajectories are considered, eq. (4.1) may be approximated as: qt+1−qt
δt
=
−λJ(qt)
T
β for all t ∈ [|1, T − 1|]. By denoting yt+1 =
qt+1−qt
δt
, Y ∈ RS×(T −1) the
vector obtained by vertically stacking all yt for t ∈ [|2, T|], and Φ the S × (T − 1) by
F matrix obtained by vertically stacking all −λJ(qt)
T
, we get:
Y = Φβ (4.2)
Equation (4.2) transforms the problem of inferring one task from one demonstration
into a linear regression problem, which constitutes an essential contribution of
Brillinger’s article.
In the case where the Euclidean distance between the vector Y , computed from
observations, and its reconstruction through the task model Φβ is considered, we
get the classical least square regression problem. It is solved, assuming ΦT Φ is
non-singular, by:
β = (ΦT Φ)
−1
ΦT Y (4.3)4.2. FACTORIAL INVERSE CONTROL 61
More details on the associated derivations can be found in Brillinger (2007). The
algorithm presented above is capable, from one demonstration, to infer the cost
function modelling a behavior of the demonstrator. Once the cost function is inferred,
the imitator can in turn produce trajectories that minimize it. Such an agent that
directly infers all the parameters of the cost function is denoted flat imitator in
the following.
Learning a dictionary of primitive tasks from mixed demonstrations
The algorithm presented in previous paragraph only applies to a single demonstration
generated from a single task model. Here we introduce a matrix factorization
algorithm that extends the previous method to a setting where a dictionary of
primitive tasks is learnt form several demonstrations.
Each demonstration corresponds to a mixing of primitive tasks which is modeled by
a β
i
in the feature space. A dictionary that is represented by a F by K matrix D,
such that each column of D is the parameter representing the primitive tasks g
k
in
the feature space, models the concurrent mixing of primitive tasks. The concurrency
between the primitive tasks in a mixing is represented through a weighting coefficient.
Coefficients of the i
th demonstrated task are given by a vector a
i ∈ R
K, β
i = Da
i
.
For each demonstration the vector Y
i and the matrix Φi are associated with the
observed trajectory, by following the method described above. It follows that for
each demonstration:
Y
i = ΦiDa
i
(4.4)
Learning a factored model of the demonstrated tasks that has the minimum Euclidean
distance to the demonstrations is equivalent to solving eq. (4.5).
arg min
D,A
L(D, A) with L(D, a) =
N
i=1
∥Y
i − ΦiDa
i
2
2
(4.5)
We propose an algorithm based on alternate minimisation with respect to D and A
to solve this problem.
Minimisation with respect to A This sub-problem assumes that the dictionary
is known and thus consist in inferring the task decomposition on the dictionary,
from the observation of a demonstration. It is similar to the algorithm presented in
previous section but the K decomposition coefficients (the vectors a
i
) are inferred
instead of all the F coefficients of the cost function.
This problem is separable in one sub-problem for each demonstration i, each of which
is equivalent to the regression problem from Brillinger (2007) presented previously: the
matrix Φ is now replaced by the product ΦiD. Thus the solution of the optimisation
with respect to A is given, for Euclidean distance, by eq. (4.6). Other norms or
penalization could as well be used to solve the regression (for example methods62 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
enforcing non-negativity or sparseness of coefficients).
a
i = (DT ΦiT
ΦiD)
−1
DT ΦiT
Y
i
(4.6)
Minimisation with respect to D The second sub-problem assumes that the
decomposition coefficients of the demonstrated task are known but not the dictionary
D. We use a gradient descent approach to learn D. The differential of the loss with
respect to each of the coefficients of D is given by eq. (4.7).
∇DL(D, A) = −2
N
i=1
ΦiT
Y
i − ΦiDa
i
a
iT
(4.7)
Global algorithm The global algorithm simultaneously learns the dictionary D
and the coefficients A by alternation of the two procedures from previous paragraphs.
Matrices D and A are initiated randomly or according to any heuristic. Then D
is learnt, assuming A contains the correct decomposition coefficients, after which
A is inferred assuming D is the correct dictionary, and so on. This approach to
matrix factorization problems has often proved to be efficient (Lee and Seung, 1999,
Jenatton et al., 2010).
4.2.2 Experiments
To illustrate the algorithm introduced in section 4.2.1 we consider a simple toy
experiment. We define an agent which state q belongs to Q = [0, 1]2
. Cost functions
are parametrized on a 5 by 5 grid of Gaussian radial basis functions, which means
φ(q)
T = (. . . ,
1
2πσ
exp(−
∥x−µf ∥
2
2σ2 ), . . .) where µf are points from a regular 5 by 5
grid on Q and σ is fixed such that the task parameter space is of dimension F = 25.
There is no difference between the demonstrator agent and the learner, except that
the demonstrator fully knows the task to perform.
We use in this experiment a dictionary of 6 primitive tasks that is represented in
fig. 4.1 (first row). Combinations of 2 or 3 concurrent primitive tasks are generated
randomly for training and testing. For a given mixed tasks, a starting point is
randomly chosen inside Q and trajectories are generated by the demonstrator or
imitator from the initial position, according to eq. (4.1). In the remaining of this
section we will describe two separate experiments where a dictionary is learnt by a
agent observing mixed combinations of tasks.
Recovering the dictionary from given coefficients
In this section we consider an experiment in which during training the learner both
observes demonstrations of mixed tasks and the associated mixing coefficients. This
hypothesis models the situation where some labels that describe the task that are
mixed together in the demonstration are given to the learner (for example inferred
from spoken language). This experiment enables the evaluation of the second part of
the algorithm we introduced.4.2. FACTORIAL INVERSE CONTROL 63
Since the mixing coefficients are known by the learner during training, only the
second part of the algorithm presented in section 4.2.1 is used to learn the dictionary
Dˆ . We train such a learner on 200 trajectories generated from a dictionary D. Both
the original dictionary of primitive tasks D and its reconstruction Dˆ are represented
in fig. 4.1.
Figure 4.1: The supervised learner achieves accurate reconstruction of the original
dictionary of primitive tasks while the unsupervised learner acquire its own representation.
Each row present a dictionary of primitive tasks. The tasks are represented
as cost functions over Q = [0, 1]2
. Dark areas corresponds to high positive costs and
light areas to negative costs. First row corresponds to original primitive tasks (as
used by the demonstrator), second row to the one reconstructed by the supervised
learner described in and third row to the unsupervised learner. (Best seen in colors)
Once the imitator has built a dictionary of tasks from observations, it is evaluated
in the following way: for a set of coefficients, corresponding to mixed tasks, and
a random starting position, the imitator and demonstrator yield trajectories. The
demonstrator and imitator trajectories are then compared. Examples of trajectories
from both the learner and the imitator are given in fig. 4.2.
The relative L2 error between the trajectories generated by the demonstrator and
the imitator is used to evaluate the quality of the reconstruction. An average error of
0.001127 is obtained on the train set (tasks observed while learning the dictionary)
and 0.002675 is obtained on the test set (unobserved tasks obtained from the same
dictionary).
Learning both primitive tasks and mixing coefficients from concurrent
demonstrations
We illustrate the full unsupervised algorithm presented in section 4.2.1 on an experiment
where the learner only observes demonstrated trajectories without knowing the
coefficients. The bottom row of fig. 4.1 presents an example of dictionary built by
such a learner.
Once the dictionary has been learnt, we use the following imitation protocol to test64 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
Figure 4.2: The trajectories from the demonstrator are well reproduced by the
supervised learner. First row represents four demonstrated tasks (dark color represent
areas of high cost) and the demonstrated trajectory (the star represent the initial
position and dots further positions). Second row represents the model of the task as
inferred by the imitator and the trajectory followed by the imitator solving its model
of the task, from the same initial position as the demonstrator. (Best seen in colors)
the imitator. A new unobserved combination of primitive tasks is chosen together
with an initial position. Then the demonstrator provides a trajectory corresponding
to that task. From the observation of the demonstrated trajectory and the its learnt
dictionary of primitive tasks, the learner infers the decomposition of the task on
the learnt dictionary. For that it uses the first part of the algorithm presented in
section 4.2.1. Finally the imitator is asked to produce trajectories that solve to the
same task, both from the demonstrator’s initial position and new random initial
positions. Changing the initial position is a way to evaluate how well the imitator’s
model of the task generalizes from the context of the demonstration to new ones.
In order to evaluate the impact of learning the dictionary, that is to say the combinatorial
structure of the demonstrated data, we compare reproductions of the task
by an agent that has learnt the dictionary denoted as full dictionary learner, to
ones by an agent, denoted as flat imitator, that directly infers the parameters of
the tasks without using a dictionary. We also compare the agent described in the
previous section, that has learnt the dictionary from both demonstrated trajectories
and mixed coefficients, denoted dictionary from coefficients learner. Examples of
demonstrated and imitated trajectories are provided in fig. 4.3.
4.2.3 Discussion
The first, supervised, agent is able, by observing motions solving composed tasks
and the mixing coefficients, to learn the dictionary of primitive tasks. The acquired
dictionary is evaluated in different ways: visually from the plots of the associated
cost functions, from trajectories solving a mixed task whose mixing coefficients are
given, and from imitation, in random contexts, of a mixed task that is inferred from a4.2. FACTORIAL INVERSE CONTROL 65
Figure 4.3: Examples of imitated trajectories. First row presents the demonstrated
trajectory (first column) and its imitation by the flat learner, the dictionary learner
from first experiment (coefficients observed while learning the dictionary) and the full
dictionary learner. Second row correspond to imitations of the same task from initial
positions that were not observed (the demonstrator trajectories for those positions
are given for comparison purpose). (Best seen in colors)
single demonstration (this last result is presented together with second experiment).
The second, unsupervised, agent learns a dictionary that enables the factorial representation
of demonstrated tasks, without directly observing neither the dictionary
nor the mixing coefficients. The factorial representation enables imitation of tasks
that are observed through a single demonstration. However the performance evaluation
does not validate quantitatively this capability. In particular the least square
regression from Brillinger (2007) (described in section 4.2.1) is not performing well on
the particular form of mixing of cost functions we have chosen for the illustrative toy
example. However our algorithm is compatible with any regression method. Thus,
interesting further work could use the comparison of performances between various
regression methods, on real human data, to get better insight on the combinatorial
properties of human activities. The next section present similar ideas applied using
the inverse reinforcement framework; more reliable results are obtained on an other
toy experiment.
The dictionary learnt by the agent, illustrated in fig. 4.1, is very different from the
one of the demonstrator: actually chapter 1 already discussed the ambiguity of the
problem of representing a set of demonstrated mixed tasks as linear combinations
of primitive tasks. For example one can scale the primitive cost function by some
factor and associated coefficients by its inverse or change the order of the primitive
and coefficients without changing the linear combination. Mathematically these
difficulties could be solved by adding constraints to the form of the learnt dictionary
(for example normalize primitive costs) or by adapting the way to compare dictionaries
(for example to make it invariant to re-ordering).
To overcome this difficulty, a particular form of factorisation could also be shaped66 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
by information coming from another modality or social interaction. This aspect
is demonstrated both in the study from our previous work (Mangin and Oudeyer,
2012a) that is described in chapter 3 and in the first experiment, see section 4.2.2,
where observing the mixing coefficients, that can be seen as linguistic labels, enables
the learner to adapt its internal model (that is the dictionary) to a communication
channel. Aspects of social learning have already been shown to improve motor
learning by Massera et al. (2010). Solving the ambiguity in the decomposition of
human activities thus constitutes a new application for social learning. Further
illustrations on learning from several modalities are given in chapter 6.
Extending the algorithm presented above to include constraints or evaluating it on
an online learning experiment would help investigating these questions and thus
constitute very interesting future work.
In conclusion, this section studies aspects of the combinatorial structure of behaviors
and of their representation as tasks or objectives. We introduced an algorithm to
learn a dictionary of primitive tasks from demonstrations of concurrently mixed
behaviors. We demonstrated on an illustrative experiment how the dictionary can
be used to represent and generalize new demonstrations. Finally we discussed how
dealing with ambiguities in factorial representation of behaviors might involve social
interactions, multimodality of the sensory experience or intrinsic saliency mechanisms.
However the illustrative experiment from this section did not enable to quantitatively
demonstrate the advantage of the unsupervised factorial approach. Next section
develops similar ideas with inverse reinforcement learning techniques.
4.3 Factorial inverse reinforcement learning
This section present ideas similar to the one introduced above but grounded on
different techniques and models. The algorithm presented in this section extends
the gradient approach from Neu and Szepesv´ari (2007) to learn a dictionary of
primitive reward functions that can be combined together to model the intention
of the expert in each demonstration. It includes both previous ideas on multi-task
inverse reinforcement learning (Babes-Vroman et al., 2011, Choi and Kim, 2012,
Almingol et al., 2013), but also of feature learning and transfer between tasks (Levine
et al., 2010). In its unsupervised study of the multi-task setup, this work is related
to those of Babes-Vroman et al. (2011), Choi and Kim (2012), and Almingol et al.
(2013) but differs for the fact that it not only learns several primitive rewards from
demonstrations of several tasks but also enables transfer of the knowledge from one
task to an other, similarly to what is presented by Levine et al. (2010).
4.3.1 Multi-task inverse reinforcement feature learning
This section presents an extension of the algorithm from Neu and Szepesv´ari (2007),
described in section 2.2.3, to a dictionary learning problem. We assume that the
learner observes demonstrations ξ from an expert, that are sequences (xt, at) of
states xt ∈ X and action at ∈ A, such that ξ = (xt, at)
t∈[|1,T|]
. We call Markov
decision process (MDP) a quintuple (X , A, γ, P, r) where γ is the discount factor.
P, the transition probability, is a mapping from state actions pairs to probability4.3. FACTORIAL INVERSE REINFORCEMENT LEARNING 67
distributions over next states. We denote by P(x
′
|x, a) the probability to transition
to state x
′
from state x, knowing that action a was taken. Finally, r : X × A → R is
the reward function.
In this single task setup presented in section 2.2.3, the objective is to optimize
a parameter θ of the reward function such that the near-optimal policy for the
MDP associated to rθ is as close as possible to the demonstrated policy. This
optimization problem is formalized into For an expert demonstration represented
by ξ = (xt, at)
t∈[|1,T|]
one estimates J by eqs. (2.30) and (2.31). The main result
provided by Neu and Szepesv´ari (2007) and presented as section 2.2.3 is an equation
to compute ∇θJξ, from which the gradient descent algorithm is derived.
In this section we extend there approach to the case where the expert provides several
demonstration of different but related tasks. The demonstrations are denoted ξi with
index i ∈ [|1, n|]. Each demonstration is modeled by a separate parameter θ
(i)
that
represents the tasks solved by the expert. The algorithm presented here focuses on a
generative model of mixtures of behaviors or tasks such that the combination of tasks
can be represented as a reward function that is a linear combination of the reward
functions of the mixed tasks. More precisely, we call dictionary a matrix D ∈ R
d×k
that represents the dictionary and coefficients H ∈ R
k×n a matrix containing mixing
coefficients. The columns of H are denoted h
(i)
such that the parameters of the ith
task are θ
(i) = Dh
(i)
.
The following presents an algorithm to learn the matrix factorization, that is to say,
the dictionary matrix D and associated coefficients H such that θ
(i)
s are represented
as combinations of k elements from a dictionary. The algorithms minimizes the
cumulated cost over all demonstrations denoted by JΞ, where Ξ = (ξi)
i∈[|1,n|]
, and
defined in eq. (4.8). This cost generalizes the average distance from the demonstrator’s
policy to a nearly optimal policy associated to the inferred representation of the task.
JΞ(D, H) = n
i=1
Jξi
(Dh
(i)
) (4.8)
In order to solve the problem arg minD,H JΞ(D, H) the algorithm alternates steps
that minimize the cost with respect to D, H being fixed, and with respect to H, D
being fixed. The second steps actually decomposes in n separate problems similar to
the one from previous section. Both steps uses a gradient descent approach where
the gradients are given by eqs. (4.9) and (4.10).
∇DJΞ(D, H) =
∇θJξi
Dh
(1)
. . .
∇θJξi
Dh
(n)
· HT
(4.9)
∇HJΞ(D, H) = DT
·
∇θJξi
Dh
(1)
. . .
∇θJξi
Dh
(n)
(4.10)
In practice the learner performs a fixed amount of gradient descent on each subproblem
(optimization of H and D), with Armijo step size adaptation before switching
to the other sub-problem. The algorithm stops when reaching convergence. It appears
that this gradient descent algorithm is quite sensitive to initial conditions. A good
empirical initialization of the dictionary is to first learn θ
(i)
s with the flat approach,68 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
perform a PCA on the learnt parameters and use it as an initial guess for the
dictionary.1
4.3.2 Experiments
In these experiments a task refers to a MDP associated to a reward function. We
consider composite tasks which means tasks that correspond to reward functions
obtained by mixing several primitive reward functions.
The algorithm described above is experimented on a simple toy example similar to
the one from Neu and Szepesv´ari (2007): a grid world (typically of size 10 by 10) is
considered in which actions corresponds to moves in four directions. Actions have
the expected result, that is a displacement of one step in the expected direction,
in 70% of the cases and results in a random move in the other cases; except when
the requested move is not possible from current state (for example going up on top
border) in which case the resulting move is drawn uniformly from feasible moves.
The following uses a fixed discount factor γ = 0.9.
Validation
In a first experiment we compare our factorial algorithm to direct learning of the
parameter representing a task with Neu and Szepesvari’s gradient (GradIRL), that
we call flat learner to differentiate from the factorial approach.
More precisely a random dictionary of features is chosen, that is unknown from the
apprentices, together with mixing coefficients that determine n distinct composite
tasks. n experts are then used to generate demonstrations for each tasks (during
training the expert may provide several demonstrations of each task). The demonstrations
obtained are fed to both flat and factorial apprentices. While the flat
learners independently learn a model of each task, the factorial learner reconstructs a
dictionary, shared amongst tasks, together with mixing coefficients. fig. 4.4 illustrates
the dictionary used by the demonstrator to generate tasks as well as the dictionary
reconstructed by the learner.
We evaluate the apprentices on each learnt task by measuring their average performance
on the MDP corresponding to the demonstrated task, referred as MDP(rreal).
More precisely the apprentice can provide an optimal policy π
∗
rlearnt with respect to its
model of the task, that is to say a policy optimal with respect to the learnt reward
rlearnt.
2 This policy is then evaluated on the MDP corresponding to the real task
(MDP(rreal)). To evaluate the average reward that the apprentice would get on the
MDP with random starting positions (not necessarily matching those of the expert)
we compute the average value function:
scorerreal(rlearnt) = 1
|S|
s∈S
V
π
∗
rlearnt
rreal (s) (4.11)
1Experiments presented further shows that the PCA strategy alone does not provide a good
dictionary for our problem, but is an efficient initialization.
2This policy is obtained as a greedy policy on the optimal action value function (with respect to
the model of the task, rlearnt ), computed by value iteration.4.3. FACTORIAL INVERSE REINFORCEMENT LEARNING 69
Figure 4.4: The demonstrators generates new tasks by mixing together the five basic
reward functions which associated optimal Q-values are represented above. The
factorial learner builds its own dictionary by observing the demonstrations; it is
represented on the second row. There is no exact match between the two dictionaries
however they describe similar reward space as illustrated further in the results. (Best
seen in colors)
In the results presented here, the demonstrated tasks were generated from a dictionary
of 5 primitive reward functions. No feature is used to parametrize rewards: they
are represented as deterministic functions from state-action pairs to a real number,
which corresponds to a 400 parameters. The expert provides 10 demonstrations for
each task, each lasting 10 time steps and 100 tasks are demonstrated.
Results presented in fig. 4.5 show that the factorial apprentice is capable of using
information about the common structure of the various tasks to achieve better
performance on each task. The performance of the learner therefore increases with
the number of demonstrated tasks. When only few demonstrations are given for each
task, the demonstrator’s behavior is only observed on a subset of the possible stateaction
pairs. In such cases, the flat learner often fails to achieve good generalization
over all the state space. On the other hand, the factorial learner can benefit from
other tasks to complete this information.
We also compare the results with flat learners trained with specific features: the
ground truth dictionary (flat, ground truth) and a dictionary learnt by performing
PCA on the parameters learnt by the flat learners (flat, PCA features).
Re-use of the dictionary
In order to demonstrate the ability of the factorial algorithm to transfer knowledge
to new tasks we performed a second experiment. Apprentices are trained similarly to
the previous experiment. In the following we call train tasks these tasks. For testing,
a new task is generated randomly from the same dictionary of rewards (denoted as
test task) and apprentices observe a single demonstration of the new task. To get
meaningful results, this step is reproduced on a number of independent test tasks70 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
5 10 15 20 25 30
Number of demonstrations for training tasks
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
Avg. dev. from opt. score on training tasks
Flat
Fact. (rand. init)
Fact. (PCA init)
Flat (PCA features)
Flat (ground truth features)
0 50 100 150 200
Number of training tasks
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Avg. dev. from opt. score on training tasks
Flat
Fact. (rand. init)
Fact. (PCA init)
Flat (PCA features)
Flat (ground truth features)
Figure 4.5: Performance on train tasks The factorial learner overcomes the
flat learner by leveraging the features common to all tasks for high number of
demonstrated tasks and moderate number of demonstrations for each task. The
curves represent the average deviation (lower is better) from the best possible score
(the one obtained with perfect knowledge of the task), that is the average of the
optimal value function, for different values of the number of demonstrations per
training task (top) for a fixed number of training tasks of 100 and for the number of
training tasks (bottom), the number of demonstrations for each tasks being fixed
to 10. The algorithm presented in this section is denoted as Fact. learner ; two
alternative initialization heuristics are presented. (Best seen in colors)4.3. FACTORIAL INVERSE REINFORCEMENT LEARNING 71
(typically 100 in the experiment).
Since the task is different from the previous demonstrations, it is not really meaningful
for the flat learners to re-use the previous samples or the previously learnt parameters,
so the task must be learnt from scratch. On the other hand, the factorial learner
re-uses its dictionary as features to learn mixing coefficients for the new task. We
also experimented two alternative, simpler, strategies to build a dictionary in order to
re-use information from the training tasks. The first one consists in using a random
selection of rewards learnt during training as features for the new tasks (flat, features
from ex.). We use the learnt parameters of 15 training tasks as features. The other
one performs a PCA on the rewards learnt during training and uses the five first
components as features (flat, PCA features). Similarly to previous experiment the
apprentices are evaluated on their score (according to ground truth reward function)
on solving the new task.
Results, presented in fig. 4.6 are compared for various number of training tasks and
demonstration per task. They demonstrate that the factorial learner can re-use its
knowledge about the combinatorial structure of the task to learn the new task more
quickly. The factorial learner also outperforms the other simple feature construction
strategies.
The better ability of the factorial apprentice to generalize over the state space is
increased in this setting since only a single demonstration is observed from the expert.
Often this demonstration only covers a small part of the state-action space. This
phenomenon is illustrated in fig. 4.7 that represents the true optimal value function
together with the expert’s demonstrations, and the learnt value functions by both the
flat learner and the factorial one. A typical situation that can be observed in some
examples, is that the flat learner’s value function is local to expert’s demonstration,
while the factorial learner, that estimates the task in the space of learnt features,
can have a good estimate of the value function in parts of the space where no
demonstration was provided.
4.3.3 Discussion
In this section we presented a gradient descent algorithm to learn a dictionary of
features to represent multiple tasks observed through an expert’s demonstrations
with an inverse reinforcement learning approach. The experiments demonstrate that
the approach enables the learning of the common structure of the tasks by using
transversal information from all the demonstrated tasks. Furthermore it demonstrates
and illustrates the fact that this approach enables more accurate representation of new
tasks from only one short demonstration, where the classical inverse reinforcement
learning approach fails to generalize to unobserved parts of the space due to the lack
of adequate features.
The algorithm is compared with naive approaches trying to learn a dictionary from
task parameters that were inferred through flat inverse reinforcement learning and
showed that these approaches fail to learn the relevant structure of the demonstrated
tasks. A possible interpretation of this difference is that the PCA approach performs
the matrix factorization with respect to the metric of the parameter space, whereas
our algorithm uses the more relevant objective cost function. Due to the particular
structure of the inverse reinforcement learning problem, namely invariance of the72 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
0 5 10 15 20 25 30 35
Number of demonstrations for training tasks
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
Avg. dev. from opt. score on testing tasks
Flat
Fact. (rand. init)
Fact. (PCA init)
Flat (PCA features)
Flat (features from ex.)
Flat (ground truth features)
0 50 100 150 200
Number of training tasks
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
Avg. dev. from opt. score on testing tasks
Flat
Fact. (rand. init)
Fact. (PCA init)
Flat (PCA features)
Flat (features from ex.)
Flat (ground truth features)
Figure 4.6: Performance on test tasks For new task observed through a single
demonstration, the factorial learner outperforms the flat learner by re-using previous
knowledge on task features. The curves represent the average deviation (lower is
better) from the best possible score, for different values of the number of demonstrations
per training task (left) for a fixed number of training tasks of 100, and for the
number of training tasks (right), the number of demonstrations for each tasks being
fixed to 10. (Best seen in colors)4.3. FACTORIAL INVERSE REINFORCEMENT LEARNING 73
Figure 4.7: The factorial learner achieves a better recognition of new tasks from a
single demonstration by using the learnt features. In contrast the flat learner often
build a task representation that is local to the demonstration. First row represents
the optimal value function (blue is high) for the real task, together with the single
demonstration provided by the expert. Second and third row represents the optimal
value function for the model of the task as learnt by respectively the flat learner and
the factorial learner. Each column corresponds to one of the four first test tasks
(from a total of 100). (Best seen in colors)74 CHAPTER 4. LEARNING A DICTIONARY OF PRIMITIVE TASKS
problem with respect to reward scaling, and other transformations (Ng et al., 1999,
Neu and Szepesv´ari, 2007), the metric of the parameter space is not relevant for the
objective of apprenticeship learning.
An important limitation of inverse reinforcement learning is that it assumes the
knowledge of a model of the dynamics of the environment. Therefore it can either
be applied to situations where that model is actually known, meaning it is very
simple, or where it can be learnt. However the latter brings the new question of
the robustness of inverse reinforcement algorithms to errors or gaps in the learnt
model. Furthermore, while regular inverse reinforcement learning outputs both a
model of the task and a policy that solves it, the factorial approach presented in
this section only provides policies for the observed tasks. This means that although
a large variety of tasks may be represented by combining primitive tasks from the
learnt dictionary, it is generally not meaningful to combine the policies in the same
way: the agent has to train a policy for these new tasks.
This algorithm can be considered as a first example of feature learning in the multitask
setup for inverse reinforcement learning. However other approaches should be
explored by further work in order to derive more efficient algorithms, by for example
extending the natural gradient approach from Neu and Szepesv´ari (2007) to the
dictionary learning setup, or adopting a Bayesian approach extending Ramachandran
and Amir (2007).
Finally constraints can be applied to the learnt dictionary to favor some kinds
of solutions. Two examples of such constraints for which many machine learning
algorithms have been developed are non-negativity and sparsity. Non-negativity
of the coefficients would for example focus on representations that allow primitive
behaviors to be added to, but not subtracted from an activity in which they do not
appear. Such constraints have been successful in many fields to yield decompositions
with good properties, in terms of interpretability but also sparsity (see for example
Paatero and Tapper, 1994, Lee and Seung, 1999, ten Bosch et al., 2008, Lef`evre
et al., 2011, Hellbach et al., 2009, Mangin and Oudeyer, 2013, but also chapters 3,
5 and 6). Sparse coding also focuses on a constraint on decompositions to improve
the properties of the learnt elements (Hoyer, 2002, Aharon et al., 2005, Lee et al.,
2006). For example. Jetchev and Toussaint (2011) have shown how enforcing sparsity
of a task representation can make this task focus only on a few salient features,
thus performing task space inference. Other examples are given by Li et al. (2010)
and Hellbach et al. (2009). Exploring the use of these constraints together with
the techniques presented in this chapter constitutes important direction for further
work.Chapter 5
Learning a dictionary of
primitive sounds
This chapter studies the question of the acquisition of language mainly from the
acoustic point of view. More precisely we review and develop techniques that can
model the acquisition by a learning system of basic acoustic components of language,
like phonemes or words. In this chapter we present approaches that use multimodality
or supervision to acquire such components as well as techniques that rely only on
the patterns within the acoustic signals. Many of the techniques from the first
category use a labels or weak supervision to model multimodality and can therefore
be described as symmetric to the experiment presented in chapter 3: instead of
having a real scene and symbolic labels representing language, the language is real
but the scene is represented by symbols. The NMF techniques presented at the end
of this chapter and developed by ten Bosch et al. (2008), Driesen et al. (2009) are
the one that inspired work from chapter 3. Finally this chapter as well as chapter 3
present the two experiments that are joint in next chapter.
5.1 Models of language acquisition
Learning dictionary of primitive sounds is an attempt to model language acquisition
by featuring what Brent (1999) calls cognitive plausibility and therefore differs from
the static approach that take many automatic speech recognition systems. Brent’s
cognitive plausibility requires speech recognition methods to be incremental, selforganized
and start with no prior knowledge on the environment it has to explore:
properties that are observed on infants who learn the language(s) they are exposed
to.
Cognitive plausibility comes with the design of learning processes: a central point
in this design is the definition of the interaction between the system and an outside
word. We already have discussed the central problem of language grounding and
the importance of multimodality for language learning, but also the evidence from
work of Saffran et al. (1996), Saffran and Wilson (2003) that children can discover
patterns in speech signal without relating it to other modalities.
7576 CHAPTER 5. LEARNING A DICTIONARY OF PRIMITIVE SOUNDS
Models of language learning both from multimodal perception and solely from acoustic
perception both exist in the literature. Considering the learning of linguistic elements
without using any social or multimodal cue highlights the importance of internal
regulation systems to develop an internal speech model from extraction of patterns
from observed language. Park and Glass (2008) have performed an experiment in
that direction; it shows that it is possible to extract words or phrases from a set of
recorded lectures by studying occurrences of speech patterns. However such learning
systems develop representations that are not included in a social interaction and
exclude any convention: therefore the models of language that emerges from these
experiment cannot be used to communicate since they lack the essential grounding
property.
Gorin et al. (1994) already underlined the importance of treating the input channel
as a communication channel when dealing with user requests and refers to it as the
“How may I help you” problem: the learning system will develop skills relevant to
the client request classification. Gorin thus made a choice between an information
theoretic approach or a more action oriented one. Other approaches use both
pattern extraction from acoustic perception and multimodal or social information.
As an example Iwahashi (2003) studies language acquisition from speech, visual
and behavioral information. He presents a learning system that includes a first
step where sub-lexical patterns in the speech channel and object recognition in
the visual channel are separately acquired. In other words, that system is used to
bootstrap some preliminary representation before any social interaction. The idea of
bootstrapping internal representations have also been studied by Brandl et al. (2008).
In other works, multimodality is simplified as labels, coding for keywords or more
generally for topics, as in Gorin et al. (1999), ten Bosch et al. (2008).
In order to build larger and more realistic systems, it often is necessary to work with
a model of memory; indeed incremental learning systems often bring growth in data
size, leading to memory usage and computation. The Acorns1
(Aimetti, 2009, ten
Bosch et al., 2008, Altosaar et al., 2008) project have explored some of this issues
by introducing memory levels. The principle is to separate data storage in different
levels, where depth in memory increases with the level of organization of the data.
This may, to a certain extent, be seen as a compression mechanism as data is highly
structured in the long term memory, but it also introduces an attention mechanism,
associated to a model of short term memory.
Pirmitive acoustic elements may be considered at the sub-lexical or lexical level. Ma
and Li (2005) use hidden Markov models (HMM) to achieve sub-lexical classification:
a universal sound recognizer is learnt at the sub-lexical level, in a supervised manner
before being used to recognize spoken language. Aimetti (2009) uses symbolic labels
to build a lexicon of sound segments: similarity measures between sound segments
are used to select prototypical examples of such segments that are stored in a model
of memory, together with their label. The classification of a new lexical entity is
then achieved through a nearest neighbour approach. The experiment from Park
and Glass (2008) uses a similar approach together with a graph clustering method to
group similar sound segments as sub-lexical entities. In the experiment presented
in next section, we use a hierarchical clustering method to achieve unsupervised
sub-lexical classification on the basis of acoustic similarity; in a second step a bag of
word representation is built on top of the sub-lexical units that have been discovered
1Acquisition of Communication and Recognition Skills, http://www.acorns-project.org5.2. HIERARCHICAL CLUSTERING OF BASIC SOUNDS 77
and used to recognize lexical elements learnt in a supervised way.
The exact role of word segmentation is a quite controversial issue in speech recognition:
whereas sentence segmentation is relatively easy through silence recognition, word
segmentation is indeed a difficult task even for standard written text (see Brent, 1999,
Kuhl, 2004). We may distinguish between two approaches: the first one consists on
building language acquisition on the ability to segment words, whereas the second one
does not rely on word segmentation but might lead to the ability to segment word-like
elements as a consequence of word recognition. An example to the first approach is
the segmental dynamic time warping method which uses dynamic programming to
find similar sound segments between speech examples, and defines sub-lexical units
as those segments. Such methods are used in Aimetti (2009), Park and Glass (2008),
Gajjar et al. (2008).
The second approach which ignores segmentation while recognizing speech may
appear less intuitive but also shows great results. Non-negative matrix factorization
methods have been used in such experiments. Ten Bosch et al. (2008, 2009), Driesen
et al. (2009) present a method that builds an internal word representation from whole
utterances with weak supervision. Similarly Stouten et al. (2008) explain how NMF
can be used to learn models of digit names from sentences that are sequences of such
digits. As a consequence, those representations may afterward be used to localize
candidate words in examples, and thus, achieve segmentation as a consequence. The
bag of words approach presented below uses local descriptors based on a completely
arbitrary segmentation. These local descriptors enable a statistical analysis of a
whole utterance which leads to keyword recognition without any lexical segmentation.
Many methods have been tried to match a lexical representation of spoken utterances
to a more structural representation, a process that may be seen as a grammar
extraction. Such methods often use a predefined structure, more or less flexible, to
which the utterance is mapped, and statistical inferences in a goal oriented manner.
For example Farrell et al. (1993), Gorin et al. (1994) use multilayer neural networks
to map the recognition of some words to an action; in their experiment the semantics
of the environment is based on action choices. In Iwahashi’s experiment (Iwahashi,
2003), this semantics consists of (object, action, position) associations and is analyzed
using a graph structure adapted to this semantics. The difficulty for a system of
self extracting such semantics representations, without predefined implementation, is
to find an origin for those representations. Other input channels such as the vision
channel or motor channels, in the case of action oriented goals, are generally part of
this process.
5.2 Hierarchical clustering of basic sounds
In our contribution (Mangin et al., 2010) we use a clustering algorithm to discover
a dictionary of primitive sounds. More precisely, we use a bag-of-words method in
a developmental approach of the learning and bootstrapping of speech recognition
skills.
We built a two levels language acquisition system: first an unsupervised clustering level
discovers multi-scale acoustic representations of speech invariants from unsegmented
speech streams with no prior phonetic knowledge. Then, at a higher level, these78 CHAPTER 5. LEARNING A DICTIONARY OF PRIMITIVE SOUNDS
low-level representations are re-used to learn to predict a semantic tag associated to
whole utterances. The system presented in this section has three main features: there
is no explicit segmentation into words or phonemes, sub-lexical units are discovered
instead of coming from a static phoneme recognizer, and no supervision is used for
the discovery of sub-lexical units.
5.2.1 Background and principle
Our approach is based on the bag-of-words idea, that originated in text classification
applications (Joachims, 1997) and have been used with great success in image
categorization applications as in the work of Sivic and Zisserman (2008). The general
idea of bag-of-words approaches is to represent the text or the image as an unordered
collection of local elements chosen in a dictionary (the words in a text and local visual
features in an image), thus ignoring the global structure. Using this representation,
a classification algorithm can then be used to predict the associated category. In
computer vision applications, this can lead to very compact representations thanks
to the quantization of local features, while preserving the stable local information
and ignoring more unstable global geometry. In most applications, the dictionary is
static and requires an initial training phase. However Filliat (2008) has developed an
incremental approach that is closer to what developmental systems require. We will
therefore transpose this method to the speech recognition problem. Yet, for the sake
of clarity, we will use the terminology “bag-of-features” instead of “bag-of-words”,
since the “words” in the bag-of-words approach are not at all related to “linguistic
words” in the speech stream and which constitute important speech invariants to be
discovered and learnt in our framework.
5.2.2 Presentation of the framework
The language acquisition system uses three distinct layers to transform the sound
representation, as described below.
Continuous Acoustic Feature Vectors (CAF) extraction This layer transforms
the input audio signal into a set of vectors, each associated with some position
information. The goal of this process is to transform the signal into a set of local
descriptors. An important requirement on the used representation is that it must
come with a measure of similarity on the verctors. This first layer typically uses time
windows static sound processing methods (for example MFCC or RASTA-PLP, as
detailed in section 5.2.3).
Unsupervised clustering The role of this layer is to transform each CAF vector
from the set obtained above, into a discrete acoustic event, that is to say a single
number. This transformation is accomplished through a clustering process. More
precisely the clustering builds incrementally a representation of this acoustic event,
using the similarity measure inherent to the CAF space. This representation both
allows retrieval of the acoustic event corresponding to a given CAF vector and the
learning of new acoustic events when a CAF vector does not match any known
feature.5.2. HIERARCHICAL CLUSTERING OF BASIC SOUNDS 79
Higher level semantic analysis The two previous layers may be seen as a preprocessing,
which goal is to transform the input audio signal into a bag of discretized
acoustic features, more precisely we get a set of couples, each composed of an
acoustic event and its position in the stream. This semantic layer introduces a
new representation of the audio signal that allows to efficiently set up higher level
statistical treatment, such as keyword recognition (see following experiments) or
more complex analysis.
Time signal
Seq. of windows
Set of CAF
vectors
Set of acoustic
events
Semantic classes
Train labels
Windowing
MFCC or
RastaPLP
Unsupervised clustering
(codebook)
TF-IDF vote
Figure 5.1: Sequence of transformations from raw (time sequence) acoustic signal to
the classification into semantic classes.
This process may be described mathematically as follows: given an input audio
sequence a ∈ A, a continuous feature vector space F, a set of localization data, such
as time position in the utterance, P, a discrete acoustic feature dictionary D:
• extract CAFs: a ∈ A −→ (vi
, pi) ∈ (F × P)
⋆
• find corresponding acoustic events: (vi
, pi) −→ (fi
, pi) ∈ (D × P)
⋆
Where, i is a free variable, and for any set E, we call E
⋆ =
k∈N
E
k
the set of finite
sequences over E. In the case of tag inference, the statistical process is then, given a
set T of tags, a mapping: (D × P)
⋆ → T .
5.2.3 Implementation
Continuous feature vectors extraction
We use mel-Frequency Cepstral Coefficients (MFCC) and Relative Spectral TransformPerceptual
Linear Prediction (RASTA-PLP) features over a short time window, from
Ellis (2005) implementation. The former feature vectors, which are actually time
sequences of successive feature vectors, are compared with respect to a Dynamic Time
Warping (DTW) distance (Sakoe and Chiba, 1978). Such approaches are known to
yield efficient acoustic similarity measures for word recognition (see Furui, 1986).
Mel-frequency cepstral coefficients These coefficients are computed by first
taking the power spectrum of the signal, that is to say the square of the modulus of
the Fourier transform of the signal, then averaging it over generally 25 filters, taking
the log of the resulting coefficients, and finally applying a cosine transform. The80 CHAPTER 5. LEARNING A DICTIONARY OF PRIMITIVE SOUNDS
power spectrum of a signal s(t) is given by the following formula.
p(ω) = |sˆ(ω)|
2
(where ˆs denotes the Fourier transform of x)
=
1
2π
t
s(t)e
−iωtdt
2
For a set of filters ψi over the frequency domain, the mel frequency spectral coefficients
(MFSC) are computed as follows.
MFSC(s)
i =
ω
|sˆ(ω)|
2
|ψi(ω)|
2
dω
The filters are chosen according to empirical studies of the human perception of
sounds similarities, which is approximated as a transformation of the frequency
scale, denoted mel scale (Stevens and Volkmann, 1940); the mel scale is such that
frequencies that are perceptually similar are evenly spaced in the mel domain. One
then generally use equally spaced triangular filters in the mel domain. Using a finite
set of filters accounts for the fact that close frequency cannot be distinguished by
humans. An approximation function to the empirical curves from psychology is
generally used to convert from the frequency domain to the mel domain. As an
example:
mel(f) = 2595 log10
1 +
f
700
.
The coefficients obtained from this process are meant to model the perception of
sound as processed by the human cochlea. The mel frequency cepstral coefficients
(MFCC) are computed by applying a discrete cosine transform (DCT, Ahmed et al.,
1974) to the logarithm of the MFSC.
MFCC(s) = DCT [log (MFCC(S))]
Dynamic time warping This distance, which inspired from the Levenshtein
distance (Levenshtein, 1966) distance, takes into account possible insertions and
deletions in the feature sequence. It is adapted for sound comparison but does not
correspond to an inner product in CAF space, since it is not an Euclidean distance.
This prevents the use of the classical k-means algorithm.
A practical benefit of using the DTW distance is that it enables to compare sound
feature vectors of different length. However, in our experiments we used fixed length
feature vectors: for each acoustic utterance we first compute the MFCC sequence
corresponding to this audio stream. After extracting this MFCC sequence, we cut it
into fixed length features, using a 80 ms or 150 ms sliding window. The sliding length
used in most of the following experiments is one third of the length of the window.
However, it is also completely possible to mix several lengths in the same vocabulary
or to extract features of random lengths. This would result in more multiscale
approach. The window length is here around the scale of a phoneme length and
gives a good trade-off between sufficiently long sequences of MFCC vectors and the
quadratic complexity in the length of the vectors for DTW computation. Furthermore
limiting the window length is necessary in order to obtain local descriptors.5.2. HIERARCHICAL CLUSTERING OF BASIC SOUNDS 81
Incremental unsupervised clustering
We use a dictionary structure that groups similar CAF vectors according to their DTW
distance into discrete acoustic events. The dictionary implements two operations
that are related to its construction and the retrieval of the acoustic event matching
a specific CAF. Our approach is adapted from the one used for image processing
in Filliat (2008).
The dictionary construction is an incremental hierarchical clustering algorithm that
is to say new CAF vectors are added incrementally to the dictionary, either in an
existing cluster (acoustic event) or by creating a new cluster if the new vector is
too far from existing data. The retrieval of the acoustic event that best matches
a specific CAF is equivalent to find the closest group in the dictionary for a given
vector. Since it is not computationally possible to compare the input vector to each
of the clusters we use a tree structure and an associated efficient search algorithm.
More precisely, the acoustic events are defined as hyperspheres in the continuous
feature space, and their centers are organised in a tree structure inspired by the one of
Nister and Stewenius (2006), where leaves are primitive clusters and nodes represent
hierarchical clusters. The tree structure is organised according to the following rules:
1. each leaf or node is a cluster C represented by its centroid: a vector vC ,
2. each leaf (primitive cluster) is actually a hypersphere of radius rmax around its
centroid. A CAF vector v is therefore part of a primitive cluster C if and only
if d(v, vC ) ≤ rmax
3. each node of the tree has a limited number of children Nmax . The cluster
associated to the node is the union of the clusters associated to the children,
and the centroids nC associated to the cluster is the mean of the vectors it
contains.
A CAF vector is matched to a cluster by recursively following the child of the node
which centroid is the nearest from the searched vector. The dictionary is built by
adding these vectors to the tree: we find the nearest leaf (primitive cluster); if the
vector matches the radius condition regarding to this cluster, it is added inside this
one; if not, a new cluster is created initially containing only this vector. In the case
where a new cluster was created, it is added as a child of the same node as the
previously found nearest cluster. Then we check if the number of children is below
Nmax ; if not, the node is split in k nodes, by a k-means process (see algorithm 2
and Hastie et al., 2001, 14.3.6) on the centroids of the leaves. The leaves are then
distributed to those child nodes. An example of this mechanism, also described by
the following pseudo-code of algorithm 1, is shown in fig. 5.2.
This structure and algorithm implement an approximate nearest neighbour search,
and thus the processes of learning a CAF or retrieving the corresponding acoustic event
are approximative. Since the CAF vectors are themselves noisy, this approximation
is naturally handled by the statistical treatment in layer 3. In order to reduce
the impact of orientation errors while exploring the tree, which may result in an
important final error, for example, if it occurs near the root of the tree, we added
the following improvement to the search algorithm.
The idea is to launch more than one search for each request and then select the best
results. This is close to a branch-and-bound techniques and may be implemented in82 CHAPTER 5. LEARNING A DICTIONARY OF PRIMITIVE SOUNDS
Step 1
Step 2
Step 3
Figure 5.2: Insertion of a new vector in the hierarchical lexicon structure. The nearest
leaf is found, but the vector is too far from the center (first step) so a new leaf is
created (second step). The new leaf father has now too many children (Nmax = 3)
so the node is split in two parts(third step).(k = 2)
many ways. We tried two implementations of this method. In the first one, for each
node reached during the search process, the search is launched again on its b children
closest to the target, instead of just the closest child. By best children we mean
the b children with the lowest distance between their centroid and the requested
vector. b is called the backtracking parameter. This method leads to a complexity
of O
n
logk(b)k
, where n is the number of nodes, k the k-means parameter used
to create the tree and b the backtracking parameter. In practice this backtracking
approach make the search very long compared to the O
k log(n)
original complexity.
The second method uses the same idea, but instead of deciding locally which node
deserves to be explored, it runs full searches, at the end of which it launches again
a search from some node on the tree, where a good candidate path may have been
missed. More precisely, during the search, each time a child node is chosen for the
proximity of its centroid to the requested vector, its siblings are memorized with
some value representing how far they were from the chosen child. When a candidate
leaf is finally found, the system is able to reconsider the choices it has made during
the search and explore the ignored node which are the closest to the target.
By repeating this process b times, and finally choosing the best candidate nearest
neighbor from those found, we are able to minimize the impact of the approximate
nature of our structure. The actual complexity of this method is roughly O(bk log(n)).
The second method gave a better trade-off between the number of explored nodes,
which corresponds to computation complexity, and the quality of the retrieved
approximate nearest neighbor.5.2. HIERARCHICAL CLUSTERING OF BASIC SOUNDS 83
Algorithm 1 Adding a vector to the cluster tree node
: current node is the node where the vector is to be added,
: vector is the vector to add,
: k is the k-means parameter,
: rmax is the threshold distance that is used to decide if two vectors are considered
identical,
: Nmax is the maximum number of vectors that a leaf may contain.
procedure add vector to node(current node, vector , k, rmax , Nmax )
if current node is a leaf then
let v be the nearest vector in current node
if distance (vector , v) ≤ rmax then
add vector to current node
else
let father be the father of current node
create a new leaf from vector and add it to father
let children be the children of f ather and n their number
if n ≥ Nmax then
new nodes ← k means(k, children)
set new nodes as the children of father
end if
end if
else
let child be the nearest child from vector in current node
add vector to node(child, vector , k, rmax , Nmax )
end if
end procedure
Semantic tag inference
While previous steps are able to build an internal representation for the system,
based on topological information, this process had no relation to the final goal of
keyword classification. Actually, all the semantics related to the classification task is
created in the step. We implemented a voting mechanism to score acoustic events
and examples regarding semantic tags.
The idea of the voting mechanism is to associate a weight wi to each acoustic event
i. Let f
t
i be the frequency of acoustic event i regarding tag t, f
t
i =
ni,t
nt
where ni,t is
the number of co-appearances of acoustic event i and tag t and nt the number of
appearances of t. For a query utterance q, where acoustic acoustic event i appears qi
times, i votes as Vi = qi
· f
t
i
· wi
, where wi are weights. A common way of setting
weights wi
is to use a Time Frequency — Inverse Document Frequency (TF-IDF)
approach by setting
wi = log
Ntags
N
(i)
tags
, (5.1)
where Ntags is the total number of tags and N
(i)
tags the one of tags whose examples
contain acoustic event i at least once.
Additional conditions may be considered such as setting all node weights to zero
except from leaves, which rely entirely on the size of clusters, that is to say the rmax
parameter, in our case, which is chosen a priori. One may also choose to allow only
nodes near the leaves to have a nonzero weight or to rely entirely on TF-IDF weights.84 CHAPTER 5. LEARNING A DICTIONARY OF PRIMITIVE SOUNDS
Algorithm 2 The k-means clustering algorithm
: k the number of clusters
: (xi)1≤i≤N the Nvectors to add,
: c is the vector of assignments (in [|1, k|]
N )
procedure k means(k, (xi))
initialize the cluster assignments c
while assignments change do
for each cluster, let mj be its mean
let c be the assignment of each observation to the closest mean:
ci = arg min
1≤j≤k
∥xi − mj∥
2
end while
end procedure
This kind of modifications may bring more scalability and robustness to the system.
It also defines which clusters are acoustic events: either only leaves or all nodes, and
thus the use or not of hierarchical and multi-scale acoustic events.
In order to be able to compute this score we store the number of appearances of
each acoustic event in an utterance associated to a particular semantic tag: this
corresponds to previously introduced ni,t. The following process is used: while
training, for a given utterance with tag t, transformed in a bag of acoustic events,
for each acoustic event i, ni,t is increased by one.
During the test phase, we extract the bag of acoustic events corresponding to the
utterance. Then, for each tag we compute its score on the utterance, by summing the
votes of each acoustic event from the utterance representation. Votes are computed
as explained previously, using only the count of co-occurrences, by simple operations
over the (ni,t)
i,t matrix.
5.2.4 Experimental scenario
As explained above, we adopt a framework where the goal is to allow a robot to
progressively learn to predict semantic tag(s) associated to a given speech utterance.
For example the robot is incrementally provided with examples of associations
between speech utterances and semantic tags, and should accordingly incrementally
update its internal representations in order to predict better these semantic tags in
new utterances. Semantic tags are technically encoded as keywords referring either
to general topic(s) of the utterance, sometimes corresponding to the presence of a
particular word in the utterance or to the speaker style or language.
Databases and protocols
We restricted our work on labeled classification problems, that is to say, sets of
utterances associated with a semantic label. These labels may be words contained in
the utterance as well as levels of speech or speaker identities. The system is trained
with such a learning dataset and then evaluated on its label prediction performance.5.2. HIERARCHICAL CLUSTERING OF BASIC SOUNDS 85
We take a bath
To put it in the bath isn’t funny either
The shoe is a symbol
Now mummy is losing her patience
Daddy comes closer
Angus takes off her shoe
Daddy never calls
She sits on a nappy
Now everybody is in the car
Where is the nappy
Table 5.1: Transcriptions from ten random examples from the Acorns Caregiver
dataset from Altosaar et al. (2008). Keywords are identified in bold font.
During our experiments we worked with two datasets. The first one was a home
made dataset in which utterances were single words. This dataset, which contains
twenty three examples of ten different words, was used to evaluate the performances
of the nearest neighbor retrieval with word-long continuous features. The second one
is the Caregiver dataset (Altosaar et al., 2008) provided by the ACORNS project,
composed of 1000 utterances containing 13 keywords, each spoken by 4 speakers in
English adult directed speech; this makes a total of 4000 utterances. An example of
sentences used in the dataset is Angus is lazy today. where the semantic tag/keyword
is Angus. Examples of transcriptions from utterances from the dataset are given in
table 5.1. More details on the dataset can be found in appendix B.1.
Results
In order to demonstrate the cognitive efficiency of our system we set up the following
experiment: for each speaker we randomly split the database in two sets: a train set
consisting of 900 examples and a separate test set of 100 examples. The system is
trained incrementally with each utterance of the training set; after each 100 train
examples, the system is tested on the whole test set. This protocol, which allows
us to monitor its progress, is represented in fig. 5.3. In order to characterize the
efficiency of the learning process as its improvement through training, that is to say
the convergence speed of the algorithm, we regularly test the process during the
training and visualize its performance at each step.
The same experiment can be made with the 4000 examples coming from all four
speakers, to demonstrate that the method is, in some way, robust to multi-speakers
learning. In this experiment, the training sessions are 200 examples long and after
each training session the process is tested with a constant set of 400 examples: 100
from each speaker. The training set is a succession of 900 examples from each speaker,
presented by order of speakers. Such results are presented in fig. 5.4.
These experiments demonstrate the good accuracy of our system on the keyword
recognition problem. We may compare these results with those from ten Bosch et al.
(2008), whose database we used. Actually our results are quite similar to the ones
they obtained using non-negative matrix factorization, which method is also not
centered on segmentation and proved to reach maximal performances among a variety86 CHAPTER 5. LEARNING A DICTIONARY OF PRIMITIVE SOUNDS
0 100 200 300 400 500 600 700 800 900
0.55
0.6
0.65
0.7
0.75
0.8
0.85
0.9
0.95
1
Speaker 1
Speaker 2
Speaker 3
Speaker 4
Time
Performance
Figure 5.3: Success rate on the utterance classification task with data from a single
speaker: each utterance has to be classified as containing one of the ten keywords.
Results are plotted at various stages during learning (number of training examples for
incremental learning). A separate learner is trained on each speaker; 1000 examples
for each speaker are split into 900 for training and 100 for testing. (80 ms MFCC
features)
of various competing technical approaches. However matrix factorization has other
interesting properties, as discussed in chapters 3, 4 and 6.
Those results demonstrate, first of all, the ability of our system to build an internal
representation of speech units, in an unsupervised manner (information about keywords
is not used in the building of the dictionary), and then to use this internal
representation to achieve a keyword recognition task, performed by a kind of semantic
engine, which in our experiments is the score system.
5.3 HAC representation
This section describes the representation of sound used in the works of ten Bosch et al.
(2008), Van Hamme (2008), Driesen et al. (2012) and that is also used in chapter 6.
Histograms of acoustic co-occurrences (HAC) were introduced as a representation of
sound that is based on acoustic events. It is similar to the bag-of-words approach
from previous section since it discards most of the sequential information of the
acoustic events; it however consider co-occurrences of pairs of acoustic events and
uses a static (instead of incremental) approach to codebook construction. Two
important properties that make HAC representations particularly adapted for the
NMF algorithm are that they involve nonnegative values and approximate the
sequencing of acoustic patterns in an additive manner.
The outline of the transformation from raw sound to HAC representation is given in5.3. HAC REPRESENTATION 87
0 500 1000 1500 2000 2500 3000 3500
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Time
Performance
Global
Speaker 1
Speaker 2
Speaker 3
Speaker 4
Figure 5.4: Behavior of the learner when facing data from several speakers. The plot
displays the success rate on the utterance classification task: each utterance has to
be classified as containing one of the ten keywords. Results are plotted at various
stages during learning (number of training examples for incremental learning). The
same learner is trained on a mixed dataset of 4000 examples from four speakers; 3800
examples are used for training and 200 for testing. The training data is ordered such
that the learner encounters first all data from the first speaker, then from the second
one, etc. One curve represents global accuracy; the other ones represent the accuracy
of the learner on the subset of the test data coming from each speaker. (80 ms MFCC
features)
fig. 5.5. The steps are explained in more details in the remaining of this section. We
start from the representation as sequences of MFCC vectors, which computation is
detailed in section 5.2.3. Additionally we consider dynamic information on top of
the sequence of MFCC vectors (MFCC)t
: time differences are computed with the
time difference ∆ operator defined following Driesen (2012) as
∆ xt = 2xt+2 + xt+1 − xt−1 − 2xt−2
with the convention xi = x1 for i ≤ 0 and xi = xT for i > T. This transformation is
analogous to the delayed velocities used in chapter 3 to represent motions. Similarly
the MFCC vectors are extended with additional dimensions from the ∆ MFCC and
∆ ∆ MFCC. Following Driesen et al. (2012) we keep 22 dimensions from the MFCC
vectors which yields final vectors of 66 dimensions.
5.3.1 Codebooks
There are actually three codebooks, for basic MFCC vectors and there ∆ and ∆∆
transformations. The codebooks are obtained with the k-means algorithm, described
in section 5.2.3. In the following we use the implementation of ten Bosch et al. (2008)
that builds codebooks of size k = 150 for MFCC vectors and ∆ and of size k = 10088 CHAPTER 5. LEARNING A DICTIONARY OF PRIMITIVE SOUNDS
Time signal
Seq. of windows
Seq. of MFCC
vectors
Seq. of acoustic
events
HAC
Windowing
MFCC
Clustering
(codebook)
Co-occurrence
count
Figure 5.5: Sequence of transformations from raw (time sequence) acoustic signal to
histograms of acoustic co-occurrence (HAC) representation.
for the ∆∆ vectors. The codebooks are used to convert the three sequences of MFCC
vectors and their ∆ and ∆∆ transformations into a sequence of acoustic events: each
cluster, that is to say each elements of a codebook defines an acoustic event; each
time window is thus transformed into three discrete events corresponding to the
clusters in which fall the three vectors associated to that time window.
5.3.2 Histograms of co-occurrences
The last step consists in removing most of the temporal information by building
histograms of event occurrences and co-occurrences. This process is used on top of
the three sequences of acoustic events obtained from vector quantization of MFCC
vectors and their derivatives. It is however not at all restricted to these kind of
events: any time indexed sequence of events can be transformed into such histograms.
Van Hamme (2008) gives a presentation of this construction in the more general case
of events not necessarily time indexed but represented in a lattice structure that
accounts for the ordering of the events. Finally the process is straightforward to
extend to continuous event occurrence probabilities.
For a given stream of event (et)
1≤t≤T
the stream of co-occurences with delay δ is
defined as the stream (ct)
1≤t≤T −δ
of pairs ct = (et, et+δ). Co-occurence histograms
are simply histograms of co-occurrences. What is denoted as HAC representation
in the following is actually the concatenation of co-occurence histograms for each
one of the events categories, that is to say MFCC, ∆ MFCC, and ∆∆ MFCC events.
Two such vectors are then concatenated for two values of δ: 2 and 5.
An important consequence if that representation is a property denoted as the additive
property. The additive property directly comes from the use of histograms in the
representation and states that if two words which HAC representation are w1 and
w2 are concatenated into an utterance, which HAC representation is denoted as s,
s ≃ λw1 + (1 − λ)w2
where 0 < λ < 1. The approximation ignores the events coming from the border
between the words. This important property transforms the sequencing operation
into a convex combination. It therefore transforms a sentence into a mixture of its
words, and similarly a word into a mixture of phonemes.5.4. LEARNING WORDS WITH NMF 89
5.4 Learning words with NMF
In this section we introduce the use of nonnegative matrix factorization to learn
words. Ten Bosch et al. (2008), Stouten et al. (2008) have performed experiments
demonstrating the effectiveness of NMF techniques for word learning in both an
unsupervised and a weakly supervised setup.
In their experiment, Stouten et al. (2008) demonstrate that an unsupervised use
of NMF can lead to the learning of words. They use a variation of the HAC
representation, described above, on top of a static phoneme recognizer. More precisely
they consider 43 distinct phonemes and count the co-occurrences of pairs of phonemes.
In their experiment they consider a data matrix V composed of co-occurence vectors
built from phoneme recognition on spoken utterances. The utterances are formed
as the concatenation of names of digits, such as “014”. Each column of the matrix
corresponds to the representation of one such utterance. Stouten et al. (2008)
apply the NMF algorithm to learn matrices W and H such that V ≃ W · H. The
algorithm is actually parametrized to learn 11 atoms, that are the columns of W.
In their article they demonstrate how these atoms are good representation for the
phonemes transitions that are characteristic of the name of each digit. This is done
by interpreting the atoms as probabilities on the phoneme transitions and noticing
that the phoneme transitions that actually occurs for example in the word “one”,
that is to say “AH N”, “W AH”, “ W”, and “N ” have the highest probabilities in
one of the atoms.
The experiments from ten Bosch et al. (2008) have directly inspired the setup
presented in chapter 3 and are therefore very similar. These experiments use NMF in
a weakly supervised setup: a data matrix Vsound is built using the HAC representation
from previous section from spoken utterances. The utterances are simple sentences
in containing one or several keywords. Each sentence is associated to a set of
labels corresponding to the keywords. These labels can be interpreted as a symbolic
representation of objects in a visual scene or basic gestures in a complex motion. A
matrix Vlabels contains binary vectors indicating the presence of each label, as detailed
in section 3.3.1. Similarly to chapter 3 sound and label data are concatenated for
the training into a matrix
V =
Vsound
Vlabels
.
The system is then evaluated on its ability to reconstruct either one or several labels
from new utterances.
5.5 Conclusion
In this chapter we introduce several techniques to represent sound and learn sublexical
or lexical patterns such as phonemes and words. The first technique from
Mangin et al. (2010) accounts for the incremental learning of a phoneme codebook.
A bag of acoustic events representation of sound is built from the codebook; the
efficiency of that representation is illustrated in a supervised classification task using
a simple voting algorithm.
The HAC representation from Van Hamme (2008) shares a lot of similarities with90 CHAPTER 5. LEARNING A DICTIONARY OF PRIMITIVE SOUNDS
the previous techniques: it is based on a static codebook learnt through vector
quantization of an audio stream; in addition to the representation as a bag of acoustic
events, HAC histograms use co-occurences of events, which capture more temporal
information. The bags of paired events are then represented as histograms which
provides a representation well fitted to use nonnegative matrix factorization.
The experiments presented illustrate the efficiency of these representations in unsupervised,
weakly supervised and supervised problems. In next chapter we extend
these use case to multimodal learning as a specific form of unsupervised learning.
The originality of the techniques presented in this chapter is that they discard most
of the temporal information of sound. Interestingly they demonstrate that local
information is sufficient to achieve simple recognition tasks, a result closely related
with similar phenomenon in the field of vision. Therefore these techniques provide
an interesting alternative to other techniques based on the process of high level
segmentation of the sound signal. Also, it is important to notice that sliding windows
can be used for example to locate the recognized words, using only the aforementioned
techniques. However temporal information is crucial for some applications and an
important limitation of the techniques presented above is that they do not represent
it. It is therefore an important direction for future research to extend such techniques
in order to account for the important temporal nature of speech signal.Chapter 6
Multimodal learning
In this chapter we bring together the work on the discovery of motion primitives
presented in chapter 3 and the one on the discovery of sound patterns from acoustic
language introduced in chapter 5: we present a multimodal experiment in which
learning occurs simultaneously from acoustic language and motions, without any
symbolic supervision. That experiment explores aspects of multimodal learning, but
also of the issue of language grounding. Although we have identified important issues
related to the ambiguity of decomposition in both the problems from chapter 3 and
from chapter 5, this chapter demonstrate that the ambiguity that makes each of the
problem difficult when taken separately might be much easier to solve when both
problems are considered simultaneously.
6.1 Multimodality in perception and learning
Most artificial perceptual systems, as well as humans or other animals, include sensors
from various modalities and can therefore take advantage of these multiple modalities
to gather more information on their environment. In some situations, the multimodal
nature of the signal is of great importance and is not limited to the juxtaposition of
information from each modality.
As already mentioned in section 1.3, an important example of multimodality is given
by communication: human communication is not in general reduced to speaking or
writing; instead full featured communication makes extensive use of facial expressions,
physical contact, and eye gaze. A famous evidence of the multimodal nature of
communication was given by McGurk and MacDonald (1976) and is referred as
the McGurk effect: observing lips pronouncing ‘ga’ while hearing ‘ba’ is most often
reported as perceiving the sound ‘da’ (see also Schwartz, 2010). Because human
communication is so naturally multimodal, robots or intelligence systems pursuing
human assistance or collaboration with humans might greatly benefit from taking
into account several modalities. For example, while degraded communication is
always possible, as when using a telephone, that only transmit the acoustic modality,
it is not as efficient and natural as direct communication. Only taking one modality
of communication into account might also make it more difficult to learn.
9192 CHAPTER 6. MULTIMODAL LEARNING
The question of symbol grounding, as introduced by Harnad (1990) and discussed by
Glenberg and Kaschak (2002), points out that learning language is not only about
learning the signs of communication such as words, but also requires to relate them
to their semantic content. Since that semantic content often lies in other modalities,
this problem can be seen as another important instance of multimodal learning.
However multimodal learning is not restricted to language learning. The emergence
of the concept of ‘dog’ is not only related to the ability to recognize pictures of dogs
but also to the sound of a dog barking and the touch of a dog’s fur. Indeed, many
concepts cannot be completely characterized without grounding them on several
modalities: the concept ‘metallic’ cannot be characterized without taking into account
its perceptual expression on several modalities (for example visual aspect, sound,
touch, or taste), together with the recognition of the spoken or written word.
Unlike supervised learning, unsupervised learning, or reinforcement learning, multimodal
learning is not a specific class of algorithm. Indeed, multimodal data can
be treated as unimodal data on which an unsupervised learning is applied (some
examples provided in this chapter fall under this category). It can also bee considered
a supervised regression problem that consist in predicting the signal in one modality,
knowing the others. Thus, we prefer a presentation of multimodal learning as a focus
on several questions or problems. This chapter focuses more precisely on the study
of the mechanisms underlying the self-organization of multimodal perception that
can explain the emergence of concepts. The notion of concept does not necessarily
refers to an explicit representation of that concept but rather on the emergence of
behaviors that are interpreted as mastering of that concept. For example a child is
said to master the concept ‘dog’ not by looking into his brain for a neuron spiking
each time a dog is seen but rather by its ability to relate the sight of a dog with the
sound of a barking dog.
The acquisition of semantic concepts from self-organization of multimodal perception
however raises the question of the drives and cues that enable that organization.
In the case of language learning, experiments on children performed by Akhtar
and Montague (1999), and Smith and Yu (2008) demonstrate that cross-situational
learning, which focuses on elements that are persistent in the environment across
different uses of a word, might be used by children to learn the meaning of words.
Most of the approaches presented in this chapter rely on cross-situational learning to
explain or model the acquisition of lexicons. However mechanism such as the whole
object assumption, mutual exclusivity (see Markman, 1990), and conceptual reasoning
(Landau et al., 1998) are also known to play a role in the process of associating
linguistic labels to concepts.
Another important aspect of multimodal learning is related to ambiguities and their
resolution. As pointed out by Belpaeme and Morse (2012): “The challenge which
cross-situational learning needs to solve is not only one of mapping a word to a
meaning, but of distinguishing that meaning from possible distractors.” Indeed,
Quine’s indeterminacy of reference (Quine, 1960) states that relating words to
meanings when learning a foreign language is intrinsically ambiguous. On the other
hand, many models of learning semantic components from one modality also encounter
similar ambiguity issues. An example is given by the experiments described both
in chapter 3 and section 4.2; another one is encountered with the choice between
thematic and taxonomic association of concepts as explained in Markman (1990)
1
.
1Thematic association refers to the association of concepts that are related because they interact6.2. RELATED WORK 93
Other analogies can be drawn between this phenomenon and the ambiguity of word
segmentation (see Brent, 1999), but also with multistability phenomenon as described
by Blake (1989), Leopold and Logothetis (1999), Schwartz et al. (2012b), and the
cocktail party effect (see Cherry, 1953).
It comes that ambiguity and the means to overcome it are central aspects of multimodal
learning. In a somehow paradoxical manner, many multimodal problems
feature ambiguity in one or several modalities, but, as pointed out in chapter 3 and
section 4.2, integrating information from several modalities can be efficiently used to
overcome such ambiguity. In other words, considering the problem of concept learning
separately in each modality suffers from the presence of ambiguity, but looking at
the same problem in several modalities at the same time might help resolving that
ambiguity instead of increasing it. For example the role of multimodal perceptions
relatively to multistability is discussed by Schwartz et al. (2012b). Similarly Schwartz
et al. (2004) explores the role of vision of the lips for improving intelligibility of
spoken sound. Finally Sodoyer et al. (2004) present an algorithm for source separation
taking advantage of audio-visual information. In the frame of learning language this
emphasises the mutual interaction between the learning of the language itself and
the concepts it describes. On the one hand perceptual knowledge is used to identify
linguistic signs and structures that are by themselves ambiguous. On the other hand
language also plays an essential role in shaping the concepts it describes.
6.2 Related work
Before introducing some works related to the one described later in that chapter, it
is important to notice that the boundaries of what may be considered a multimodal
learning problem are difficult to draw. As an example, any classification or regression
algorithm can be seen as solving a multimodal learning problem, where one modality
plays a special role, either by being constrained to a specific strong structure (labels
in classification), or by having to be reconstructed. That perspective is taken in
chapter 3 and section 4.2 with respect to multi-label classification. Assuming such
structure in the data is however often not compatible with th problem of concept
emergence from sensori-motor perception; our contribution presented in this chapter
thus focuses on the use of unsupervised algorithms.
In their seminal work, Roy (1999), Roy and Pentland (2002) introduce a learning
architecture called Cross-channel early lexical learning (CELL), together with an
example implementation, that demonstrates how the problems of learning linguistic
units, semantic categories, and their relations (in the form of lexical units) can be
achieved at the same time. In CELL, both linguistic information and contextual
information, each of which may come from several sensory channels, are segmented
according to saliency cues such as utterance boundaries or changes in motions. In
a second stage, implemented by a model of short term memory, pairs of recurrent
co-occurring linguistic and contextual events are filtered. Finally models of linguistic
units and semantic categories are built; they combine clustering of similar language
stimuli as well as contextual stimuli and optimize the mutual information between
together, as milk and cow. Taxonomic association refers to concepts that belongs to the same class,
such as cow and pig94 CHAPTER 6. MULTIMODAL LEARNING
language and context. The pairs of linguistic units and semantic categories with the
highest mutual information are kept as lexical units.
Yu and Ballard (2004) have presented work addressing a similar problem but focusing
more precisely on user-centric and multimodal information. They present a learning
architecture that is capable of forming semantic models of both actions and observed
objects by using unsupervised learning techniques. First, models of actions are
formed by fitting a mixture of hidden Markov models on the observations and models
of objects result from an agglomerative clustering algorithm. The models of objects
and actions define concepts and together form the contextual information. Then, this
contextual information is used to extract word-like units related to these concepts
from phoneme transcriptions of the recorded utterances. More precisely longest
phonetic sequences are extracted from all utterances related to the same object
or action. Then an alignment techniques, that comes from the field of automatic
translation, is used to form the lexical units composed of words and concepts.
In Iwahashi (2003) the studied language is related to an (object, action, position)
semantics which appears to be closely related to the language grammar. More
precisely a lexicon is built from data: the lexicon actually represents a mixture of
word and meaning pairs, where meanings can either be objects or actions. Specific
probability models are implemented to represent the acoustic modality as well as the
modality of visual objects and the one of visual actions. The number of elements
in the lexicon is automatically chosen in order to maximize the mutual information
between the speech and contextual modalities. In their model a representation of
the grammar of the language is learnt by identifying in which order the linguistic
elements corresponding to the eventual object, action, and landmark appear. In
another experiment Iwahashi (2004) details how a similar architecture can benefit
from the possibility of asking a user for binary feedback when unsure of the novelty
of an encountered lexicon pair.
Sugita and Tani (2005) introduce a recurrent neural network architecture that learns
to relate a basic language to corresponding behaviors of a robot. The system is
capable of both understanding the words composing the language, that in their
experiment are represented by symbols, and their composition, that is to say the
syntactic structure of the language. Another aspect of learning action related to
language is explored by Tuci et al. (2011) who provide a model of multimodal
learning for symbolic language and real actions. Their experiment demonstrates that
learning a compositional structure shared between action and language can allow
robotic agents to achieve better generalization of the acquired motor knowledge.
More precisely the linguistic input received by the system shapes a model of the
structure of actions and makes the system capable of achieving behaviours that were
not encountered in training. Furthermore Massera et al. (2010) have demonstrated
that providing linguistic instructions can facilitate the acquisition of a behavioral
skill, in comparison to pure motor learning. Although these experiments are limited
to symbolic language, they are good illustrations of the implication of learning
multimodal actions and grammars.
Our experiment (Mangin and Oudeyer, 2012a), presented in section 3.3, can be seen as
a multimodal learning experiment where the language modality is actually symbolic.
Ten Bosch et al. (2008), Driesen et al. (2009) have presented a similar experiment
where the contextual modality is the one that is symbolic and the linguistic one is
continuous. Similarly Lienhart et al. (2009), Akata et al. (2011), BenAbdallah et al.6.2. RELATED WORK 95
(2010) use the NMF or probabilistic latent semantic association (PLSA) algorithm
to learn from a continuous and a symbolic modality. Driesen et al. (2010) have
also used the NMF algorithm to learn from two continuous modalities. However
their evaluation is based on the reconstruction of a third, symbolic, modality. An
interesting aspect of all these approaches is that they use common feature learning
algorithms, that are some kind of unsupervised algorithms, instead of relying on
explicit models of the lexical units and their relations to language and context.
Another example of the use of feature learning techniques is given by Ngiam et al.
(2011) who also present an experiment based on a similar multimodal setup. They
introduce an architecture based on sparse restricted Boltzmann machines that learns
from two continuous modalities: one is acoustic and the other corresponds to the
observation of the speaker’s lips. They demonstrate how in certain conditions the
algorithm reproduces the McGurk effect. Their algorithm actually learns a new
representation of the input in an unsupervised setup and is then evaluated combined
with a standard supervised classifier trained on top of this representation. Their
work can also be described as a sensor-level multimodal fusion: several modalities
are used to build a common representation that is later used to solve a classification
problem. Actually multimodal fusion has already been used to improve supervised
classification: Potamianos et al. (2003) discuss the use of both sensor-level fusion and
decision-level fusion for speech recognition. Saenko and Darrell (2007) also implement
decision-level fusion and demonstrate that it improves the recognition of objects.
In the following we present and extend a multimodal learning experiment (Mangin
and Oudeyer, 2013) based on the use of the NMF algorithm. The setting and the
algorithm are closely related to the one of Driesen et al. (2010); the experimental
setup also shares many similarities with the one from Ngiam et al. (2011). However in
these experiments we do not evaluate the learning through a standard classification
task: instead of testing the reconstruction of symbolic labels, the system is tested on
a behavior based classification task, as encountered by children. We show that fitting
an explicit representation of a lexicon is not necessary to produce behaviors that
are considered on children as evidence of the mastering of lexicons understanding.
That aspect is an important novelty of our work in comparison of the aforementioned
previous work. More precisely we do not build a system with mechanisms for
explicit decomposition into concepts and words, which would make the decomposition
capability a pre-requisite to the learning of words, concepts, and their relation. The
latter approach is described by Wrede et al. (2012) as targeting compositional
understanding first, which they oppose to teleological understanding2
. Indeed the
system presented below self-organizes until it is capable of solving a simple behavioral
classification task; it therefore achieves teleological understanding of sentences without
word segmentation and recognition being implemented as a pre-requisites. We however
illustrate the fact that the compositional understanding also emerges at the same
time. These aspects constitute an important difference between the work presented
in this chapter and the ones from Roy (1999), Roy and Pentland (2002) and Yu and
Ballard (2004).
Similarly to all the aforementioned approaches, ours use the cross-situational heuristic
to discover the semantic concepts: a form of compression is performed on the sensory
2As explained in section 1.2, compositional understanding consists in understanding a complex
concept as the combination of the simple parts that compose it. On the other hand teleological
understanding is the understanding of the concept as a whole, generally with respect to a specific
interaction task.96 CHAPTER 6. MULTIMODAL LEARNING
input that favor the representation of events that occur simultaneously.
6.3 Experimental setup
This chapter presents a system that learns to link elements from one modality of
perception to related elements in other modalities. We perform several experiments
in order to explore the learner’s ability to represent semantic relations between the
modalities. These semantic relations may correspond to either an essential relation
as the one relating the barking to the image of the dog, or conventional relation as
the one relating the name ‘dog’ to images of dogs.
The origin of the essential relation comes from the reality of an object that has
manifestations in several modalities. Their exists such a thing as a dog that has
manifestations in the visual modality as images of the dog, in the touch modality as
the touch of the dog’s fur or its claws, or in the acoustic modality as the sound of
the dog barking. Although not all of these manifestations occur each time the dog is
encountered, they are often perceived simultaneously since they corresponds to the
actual presence of the dog.
On the other side, the conventional relation is characteristic of language: it corresponds
to the fact that the word ‘dog’ is often pronounced when a dog is present
and is the object of attention. It is extensively used by parents to teach new words
to children.
An important element is that both relations are characterized by that cross-situational
property, therefore a mechanism leveraging such information would be able to learn
both. In the following we denote by semantic concept the set of manifestation of
such an object, either related essentially or by convention. Additionally a semantic
concept may have several manifestations in a single modality. For instance a dog is
associated to both the touch of its fur and claws, or to the sound of the dog barking
and the word ‘dog’. When the essential relation is the same as the convention, the
word actually takes the form of an onomatopoeia. Importantly this is an example
of a mechanism for symbol grounding; more generally the semantic relations we
consider actually include Peirce’s icon, index, and symbol (see Steels, 2008, 3.1). In
the following, the semantic relations are only characterized in the stimuli by the
relatively simultaneous occurrence of the related elements in the various modalities,
that is, the cross-situational relation.
In this setup we consider the situation in which objects or motions are perceived by
an intelligent system while sentences describing the scene are pronounced. Such a
setup is illustrated in fig. 6.1.
The modalities presented can vary from one experiment to the other, but a semantic
relation exists between some elements of the different modalities. These elements
might be of several natures: gestures in motions, object in visual scenes, or words
in spoken utterances. We consider semantic relations as mappings between these
elements: for example a word is related to a gesture, or a gesture to an object in
a scene. An example of such a mapping is given in table 6.1. During training the
learning agent observes examples of scenes as observations in several modalities. The
scenes are such that in each of them one multimodal concept is present and observed
in several manner in the modalities. For example a sentence is heard containing the6.3. EXPERIMENTAL SETUP 97
Training The learner observes a set of
examples of gestures each of which is paired
with a spoken descriptions of the gesture.
I make circles with my arm.
I am clapping!
Testing The learner hears a new spoken
utterance and is asked to chose a gesture
from a small set of demonstrated gesture
that best fit to the description.
Look at the circles I do.
?
The learner choses the
gesture best matching
the sentence.
Figure 6.1: Illustration of the cross-modal classification task on which one learner
presented in this chapter is tested. The transcriptions of the spoken utterances are
represented on the figure to illustrate the keyword semantics. However, the learner
does not observe these transcriptions.
word ‘dog’ and a picture of a dog is seen. However not all perceived elements are
meaningful, that is to say related to elements in other modalities. For instance many
words appear in each utterances that are not semantically related to anything in
other modalities. Similarly other objects may appear in the visual scene that are not
related to the subject of the sentence. Therefore the association between elements
of the several modalities is ambiguous in each example and the system has to use
several observations to solve that ambiguity. The learning system is then tested
by observing only one modality and having to chose between several examples in
another modality the best match. For example the system hears a sentence talking
about a dog and has to chose between several pictures the one containing a dog.
Interestingly this experiment is very similar to the one performed by developmental
psychologists to study the role of various heuristics used by children for the acquisition
of words, including cross-situational information, as in the works from Markman
(1990), Yurovsky et al. (2012). Unlike many approaches presented in previous works
on multimodal learning, we do not evaluate the performance of the learner on a
regular classification task. Instead the learner is evaluated on its ability to relate
elements from distinct modalities, in a way similar to the one that would be used
on a children. We also evaluate the emergence of words recognition as well as the
emergence of a representation of the semantic concepts.
The interactions mechanism between the learning agent and the caregiver that
provides the demonstration actually shares many similarities with the one from the
talking heads experiment as described by Steels (1999), Steels and Kaplan (2002)
(see also section 1.3). More precisely the agent we present in this chapter plays the98 CHAPTER 6. MULTIMODAL LEARNING
role of the ‘hearer’ from the talking heads, while the caregiver takes the role of the
‘speaker’. There are however important differences between our setup and the one
from Steels (1999). First, there is no turn in the role taken in our experiment: the
learner only plays the hearer and the caregiver only plays the speakers. Importantly
this means that the language is taught to the learner by the caregiver, instead of
evolving and emerging from their interaction. Also, in our experiments, the naming
game, that consists for the hearer in guessing which object the hearer is talking
about, is only played during the evaluation stage. During the training the learner
passively observes the caregiver teaching and does not receive any other feedback.
Finally, the similarity with the talking head agent is mainly behavioral; our agent
uses a different architecture and mechanisms as the ones implemented in the talking
head, as explained and discussed in more details in next sections.
6.4 NMF for multimodal learning
This section presents the algorithmic tools that are used in the following multimodal
experiments. They are based on the nonnegative matrix factorization algorithm (see
section 2.1), that is used in a very similar way than in the experiments presented in
sections 3.3 and 5.4.
The first part of this section presents the learning of a multimodal dictionary; it is
then explained how the learned dictionary provides a representation of data that
is not bound to any modality; in the following this representation is referred to as
the learner’s internal representation of data. Finally we explain how the learner can
transform data from one or several modalities to an internal representation or to an
expected representation in unobserved modalities.
The following assumes that each input from the modalities is available as a set
of samples, each of which is represented by a nonnegative vector. We consider a
setting in which the learner observes samples in several modalities. For example, the
system visually observes objects while hearing a spoken description of the scene. We
represent the perception of the samples in each modality by a vector va, where a
denotes the modality (for example the system observes the objects as vimage and the
sound description as vsound ). Details about such representations for the modalities
used in the experiments are given in section 6.5.
6.4.1 Learning a dictionary of multimodal components
We call components primitive elements that are mixed together into observations, in
the same way that phonemes can be seen as mixed together into a word or a sentence.
Compared to the common context of clustering, this notion of component is more
general: observations are mixtures of several components at the same time, instead
of being just a noisy observation of one centroid.
The learner presented here builds a dictionary of multimodal components according
to the following model: it searches k components, each represented by a vector wj (j6.4. NMF FOR MULTIMODAL LEARNING 99
from 1 to k), such that each observed example v
i verifies:
v
i ≃
k
j=1
h
j
iw
j
(6.1)
where h
j
i
are coefficients and ≃ denotes a notion of similarity between matrices that
is defined below. This is equivalent to clustering when the wj are the centroids and
for each i only one h
j
i
is nonzero and equals 1. We consider a more general case
where wj and h
j
i
are only constrained to be nonnegative.
In the following, the set of n examples is represented by a matrix V of shape d × n
(each example is a column of V ), the set of components by a matrix W of shape
d × k, called ‘dictionary’, and the coefficients by a matrix H of shape k × n. The
previous equation, that models the objective of our learner, can thus be re-written
as:
V ≃ W · H (6.2)
In the following, the generalized Kullback-Leibler divergence (also known as Idivergence)
is used to characterize the reconstruction error between V and W · H.
The I-divergence is denoted as DI (A∥B), is defined by eq. (2.8). In order to minimize
DI (V ||W · H), the algorithm, based on multiplicative updates of W and H, that was
originally presented in Lee and Seung (1999), is used. A description of the algorithm
is given in section 2.1.2.
6.4.2 NMF to learn mappings between modalities
Previous section explains how, for a given set of observations from several modalities
that is represented by a matrix V , the NMF algorithm can learn a dictionary W and
a coefficient H matrices such that training examples are well approximated by the
product W · H.
We actually consider the case of data coming from several modalities (three in the
example). More precisely we assume the data matrix V is composed of column
vectors v such that:
v =
vmod1
vmod2
vmod3
and thus V =
Vmod1
Vmod2
Vmod3
.
The minimization of the I divergence induces a trade-off between error in one modality
relatively to others. In order for the error in each modality to be treated on a fair
level by the algorithm it is important that the average values in the representations
are of similar magnitude. It can be easily obtained by normalizing data in each
modality. In the following experiment data in from each modality is normalized
according to its average L1 norm.
Since the observations, that is to say the columns of V are composed of several
modalities, the dictionary W can also be split into several parts each corresponding
to one modality. That is to say each components can be seen as the concatenation of
several parts: one for each modality. For example if the data is composed of three100 CHAPTER 6. MULTIMODAL LEARNING
modalities: mod1, mod2, and mod3, there exist matrices Wmod1 , Wmod2 , and Wmod3
such that:
W =
Wmod1
Wmod2
Wmod3
.
In the following we interpret the columns of the matrix H, as an internal representation
of the data by the learner. For example, an internal representation h is induced by
an observation in modality one such that vmod1 = Wmod1 h or one in both modality
one and modality three by:
vmod1
vmod3
=
Wmod1
Wmod3
h.
Also, for a given internal representation h we say that the learner expects the
observations given by the previous formulae.
Interestingly, it is possible to use the learned dictionary to compute an internal
representation of an example, even if the example is only observed in a subset of the
modalities. Given an example observed only in one modality, vmod1 , one can search
for an h such that vmod1 is well approximated as Wmod1 h. More precisely this is
equivalent to finding an h solution of:
arg min
h
DI (vmod1 , Wmod1 h) (6.3)
h
vmod1 vmod2
arg min
h
DI (vmod1 , Wmod1 · h) Wmod2 · h
Actual perception Expected perception
Internal representation
Figure 6.2: Once the system has learnt the dictionary (Wmod1 and Wmod2 ), given
an observation vmod1 in one modality it can reconstruct the corresponding internal
representation as well as the expected perception in another modality.
The NMF algorithm used in these experiments actually alternates steps minimizing
DI (V ||W · H) with respect to W and H. Solving eq. (6.3) is equivalent to the
NMF problem with respect to H only; therefore, it can be obtained with the same
algorithm, but only using the steps that update H. In theory this approach scales to
any number of modalities although the experiments presented here only test it on
numbers from two to four.
Finally it is also possible to reconstruct a representation of the data that the system
would expect in a modality, given observations in other modalities. For that, from6.5. DATA AND REPRESENTATION 101
an observation featuring a subset of the modalities, the system fits an internal
representation h using the method described previously. Then it can reconstruct the
expected representation in an unobserved modality (for example the third modality,
mod3 ) by computing the product Wmod3 h. This forms a framework, illustrated in
fig. 6.2, that uses a learned multimodal dictionary to transform data from modalities
to internal representations or expected data in other modalities. It enables a large
set of experiments as illustrated in section 6.6.
6.5 Data and representation
In the following experiments three raw modalities are used: motion, sound, and
image. For comparison purposes, a symbolic modality is sometime also used. It is
represented in the same way than explained in section 3.3.1. The multimodal data
is obtained by taking examples from three datasets of motions, sounds, and images
as explained in next sections. In some of the experiments time windows are built
from images, that are actually frames from videos, and the recorded utterances. The
process used to obtain these examples is explained in section 6.6.2.
In each experiment an arbitrary random mapping between elements from one modality
to the others is chosen; these elements are objects in images, keywords in sentences,
and gestures in motions. More precisely the semantic concepts occurring in one
modality are associated to the one of the others. For example the keyword ‘shoe’ from
the sound dataset is associated with the gesture ‘squat’ from motion dataset. The
associations are both random and arbitrary, which means they are purely conventional
and do not correspond to intrinsic similarities of the corresponding data.
6.5.1 Motions
The motion dataset was recorded from a single human dancer with a KinectTM device
and the OpenNITM software3
that enables direct capture of the subject skeleton. The
device, accessed using the ROS framework4
, provides an approximate 3D position of
a set of skeleton points together with angle values representing the dancer’s pose at
a given time.
We recorded a motion dataset composed of a thousand examples of ten dance gestures,
similar to the one used in the dataset presented in section 3.3.1. The gestures are
listed in table 6.1. The gestures are either associated to legs as for example squat
and walk movements, to both arms as clap hands and paddle, or to left or right arm
as punch or wave hand. Yet this structure is not known by the learner initially. They
correspond to both discrete and rhythmic movements. This datased named Choreo2
is publicly available at http://flowers.inria.fr/choreo2.
6.5.2 Sounds
The following experiments use the Acorns Caregiver dataset (Altosaar et al., 2008),
that is described in appendix B.1. The acoustic data is represented according to the
3http://www.openni.org
4Robotic Operating System (http://ros.org)102 CHAPTER 6. MULTIMODAL LEARNING
HAC representation presented in section 5.3.
In the following experiments, we use recordings from the first speaker from the
Caregiver dataset; it includes 1000 utterances containing 10 keywords; in English
adult directed speech. An example of sentences used in the dataset is Angus is lazy
today. where the semantic tag/keyword is Angus.
6.5.3 Images and videos
Pictures used in the experiments were acquired as frames from an interaction with
an iCub robot, through an RGBD sensor (red, green, and blue camera coupled with
a depth sensor). Both the acquisition of the frames and their processing is described
in more details by Lyubova and Filliat (2012). The processing of the image stream
goes through the following steps.
1. Proto-objects are segmented using information from motion, depth sensors, and
an agglomerative clustering of local descriptors. From there each proto-object
is processed independently.
2. Two types of local features are extracted: SURF descriptors (Bay et al., 2006)
and HSV (hue, saturation, value) of superpixels (obtained by grouping of
similar adjacent pixels). Once extracted features of each type are quantized by
incrementally learning growing dictionaries of features. This process is very
similar to the one presented for sound in section 5.2.
3. Closest SURF points and superpixels are grouped into pairs or triplets of feature
vectors denoted as mid-features. These mid-features are quantized similarly to
the features.
4. At this point, and following the bag-of-word principle (Joachims, 1997, Filliat,
2008, Sivic and Zisserman, 2008), each view is represented as an histogram
of quantized features or mid-features. A dictionary of object views and their
models are learned incrementally using the TF-IDF score, expressed in eq. (5.1),
to track the probability of a feature to appear in a given view.
5. Finally a dictionary of objects is built from recognition of views and tracking
information.
In the following experiments, one or a combination of several of the representations
computed in the aforementioned process are used. More precisely the representation
used include (always in the quantized form): SURF features (SURF), SURF couples
(SURF mid-couples), HSV superpixels (color), HSV superpixels couples (color midcouples),
and triplets (color mid-triplets).
6.6 Experiments
This section describes several experiments that explore the capacity of the algorithm
from section 6.4 to learn semantic concepts and their grounding in several modalities
in the setting that was introduced by section 6.3.6.6. EXPERIMENTS 103
Name Limb(s) Motion
shoe both legs squat
nappy walk
book right leg make a flag/P on right leg
daddy both arms clap
mummy mimic paddling left
Angus right arm mimic punching with right arm
bath right arm horizontal goes from side to front
bottle left arm horizontal left arm, forearm goes down to form a
square angle
telephone make waves on left arm
car say hello with left arm
Table 6.1: List of associations between keywords from the acoustic dataset (names)
and gestures from the motion dataset. The limbs on which the motions occur are
also mentioned.
6.6.1 Learning semantic associations
In order to investigate the learning of semantic associations between elements of
the acoustic, visual, and motion modalities, we use an artificial mapping between
acoustic words, visual objects, and gestures. An example of such a mapping is given
in table 6.1. Each triplet of word, gesture, object forms a semantic concept. The
data used to train the system is composed of sentences, motions, and images; each
sentence contains one of the keywords, each motion features one gesture, each image
an object. Finally the gesture, the word, and the object from an example belong to
the same semantic concept, which implements the cross-situational manifestation of
the semantics.
The system is trained on various combinations of either two or three modalities. The
modalities might be denoted as Motion or M, Sound or S, and Image or I. After being
exposed to a set of training multimodal examples, the system is tested as follows: it
observes a new example, called test example in a subset of its modalities and has to
chose the best match among several examples observed in other modalities, which
are denoted as reference examples. An illustration of that process is given by fig. 6.1.
For example, the system is trained on sound and image and tested by hearing a
sentence (the test example) and having to chose among a set of images (the reference
examples) the one that is best described by the heard sentence. Another possibility is
to train the system on motions, sounds, and images, and test it on its ability to chose
from several sentences the one that best describes a pair of a motion and an image
that it observes. We denote such settings by the notation: M1 → M2, where M1
represent the modality or modalities in which the test example is observed, called
test modalities, and M2 the modality or modalities, denoted as reference modalities,
in which a best matching example must be chosen among a set of reference examples.
For example hearing a sentence and choosing the best matching object from images
is denoted by Sound → Image or S → I. Viewing an object and a gesture and finding
the best matching sentence amongst examples is denoted by M,I → S. The testing
process is illustrated in fig. 6.3. As mentioned above, the testing process is analogous
to an instance of the language game from the talking head experiment form Steels104 CHAPTER 6. MULTIMODAL LEARNING
(1999).
vM1 v
(2)
M2
v
(1)
M2
v
(3)
M2
M1 M2
Test modality Reference modality
Test example Reference examples
Same semantic class as
test example.
Different semantic class.
Different semantic class.
chose best match
Figure 6.3: The learner is tested on its ability to relate an observation of a test
example in one modality to the right reference example in another modality.
Section 6.4.2 explains how to use NMF on multimodal data, to learn a dictionary and
the associated internal representation and finally how to transform data either from
one modality to another, or from a modality to the internal representation (see also
fig. 6.2). We use that mechanism as a basis to implement a classification behavior for
the learner. For a given example the system uses the learned multimodal dictionary
to produce an internal representation of the example (coefficients h) and eventually
also an expected transcription of this example in another modality. It then compares
an example from the test modalities to those in the reference modalities. To perform
the comparison the system can either:
• compute an internal representation of the test example, compute internal
representations of the reference examples, and then compare these internal
representations.
h
h
(1)
h
(2)
vtest
v
(1)
ref v
(2)
ref
Internal coefficients
Test modality
Reference modality
compare
compare
• compute an internal representation of the test example, use it to generate
an expected representation in the reference modality, and compare it to the
reference examples.
h
vtest
vref
v
(1)
ref
v
(2)
ref
Internal coefficients
Test modality
Reference modality compare
compare6.6. EXPERIMENTS 105
• compute internal representations of reference examples, for each of them compute
an expected representation in the test modality, and compare them to the
test example.
vtest
v
(1)
test
v
(2)
test
h
(1) h
(2)
v
(1)
ref v
(2)
ref
Internal coefficients
Test modality
Reference modality
compare
compare
The choice of one of these methods is referred as the modality of comparison. In
the following we mainly use the comparison on internal representation. The main
interest of proceeding that way is that the comparison is the same, regardless of what
the test and reference modalities are.
Choosing the modality of comparison is not sufficient to fully define the system: in
order to be able to chose a best matching reference example, the system needs a
metric to perform the comparison. Several alternative metric could be chosen to
perform the comparison. More importantly, the choice of the metric and its efficiency
is highly dependant on the modality of comparison, as shown by the following results.
We considered the following common metrics.
• Euclidean distance
• Kullback-Leibler or I-divergence The Kullback-Leibler and I-divergences
are introduced by eq. (2.8). In the following we denote its usage as KullbackLeibler
(KL), although when the data is not normalized we use the I-devergence.
By default the divergence from the test example to a reference example is
computed; however since it is not symmetrical, we also experimented with the
reversed divergence (that is to say the divergence from a reference example to
the test example) and a symmetrized divergence obtained as: Dsym(x∥y) =
1
2
D(x∥y) + D(y∥x)
. None of the three approaches was systematically better
in our experimentation.
• Cosine similarity5 The cosine similarity is no a metric but can be used to
compare vectors; it ranges between −1 and 1 and the biggest the value is, the
most similar the vectors are. It is defined for two vectors x and y ∈ R
d
, as:
cosine similarity(x, y) = x · y
∥x∥∥y∥
Other choices are possible. In our experiments, many modalities are represented by
histograms, or concatenation of histograms, that are of high dimension. In these
modalities the Euclidean norm is not necessary meaningful, this is why we use other
measures of similarity such as the I-divergence and the cosine similarity.
In the following, the system is evaluated on its recognition success rate. It is defined
as the proportion of correct recognition of the system; a recognition is correct when
the system choses a reference example matching semantic concept from the test
5http://en.wikipedia.org/wiki/Cosine_similarity106 CHAPTER 6. MULTIMODAL LEARNING
Modality Success rate
Test Reference Comparison KL Euclidean Cosine
Sound Motion Internal 0.608 0.612 0.646
Motion 0.552 0.379 0.444
Sound 0.238 0.126 0.208
Motion Sound Internal 0.610 0.704 0.830
Sound 0.106 0.090 0.186
Motion 0.676 0.642 0.749
Table 6.2: Success rates of recognition of the right reference example from a test
example. The values are given for many choices of the reference test and comparison
modalities and various measures of similarity. The results are obtained by averaging
on a ten fold cross-validation, baseline random is in that case 0.11.
example. In the following the system is always presented with one reference example
per class.
In the following experiments we consider 10 semantic classes; when not specified
otherwise, we use a default value of k = 50 as the number of atoms for the NMF
algorithm with 50 iterations, although a number of 10 is generally already close to
convergence.
Motion and spoken utterances
Table 6.2 compares the influence of the modality of comparison and metric on the
classification success. These result show for example that the sound modality, mainly
because of its very high dimension, is not a good choice for the comparison, specially
when the comparison is performed with the Euclidean metric. Indeed the choice of
the metric to use is highly dependant on the nature of the data in the modality;
therefore, using the internal representation is a way to only chose one metric.
The results from table 6.2 demonstrate that the system is capable of learning aspects
of the semantic associations. If the system is trained on a dataset where no semantic
semantic association exists between the two modalities (such a dataset can be obtained
by choosing a random motion and a random utterance for each demonstration), it
generally scores around 0.116
.
Table 6.3 presents very similar results in the case were symbolic labels are included
in the training data. This is done similarly to the experiments from section 3.3 and
Mangin and Oudeyer (2012a): the label of each example is transformed to a vector of
10 binary values with zeros everywhere except for a one at the index corresponding to
the label. The binary vector is concatenated to the vector representing the example.
This setup is equivalent to adding a third modality, which contains unambiguous
symbols, in order to improve the learning. The symbols are said to be unambiguous
in comparison to utterances that contains several sounds where only some sequences
of specific sounds form words, and generally only one word per sentence is relevant.
The results from table 6.3 illustrate the fact that the system does not clearly takes
6This is not 0.1 because the distribution of sound examples from the Caregiver dataset is not
exactly uniform.6.6. EXPERIMENTS 107
Modality Success rate
Test Reference Comparison KL Euclidean Cosine
Sound Motion Internal 0.387 0.699 0.721
Motion 0.543 0.261 0.424
Sound 0.136 0.089 0.131
Motion Sound Internal 0.573 0.620 0.702
Sound 0.114 0.090 0.122
Motion 0.519 0.469 0.552
Table 6.3: There is no significant improvement of the recognition rate when unambiguous
symbols are added to the training data. The table represents the same
success rates as previously (see table 6.2) but with a learner that observed symbolic
labels representing the semantic classes during training. The results are obtained by
averaging on a ten fold cross-validation, baseline random is in that case 0.11.
advantage of this additional information. An interpretation of these results is that
the system is already capable of dealing with the ambiguity and is not helped by
such additional symbolic information. However the relevance of such comments is
limited to the current algorithm and its implementation.
Images and sound: comparison of the image representations
In this section we perform similar experiments with the image and sound modalities.
In order to get more meaningful results, the experiments are run several times for
various combinations of train, test examples, and reference examples. The latter
being always taken outside the two previous sets.
Figure 6.4 presents results each using a different subset of image descriptors. For
each of them, results are given both for the I → S and S → I settings. The results
indicate that on the dataset, the color and color-pairs representations work best. It
also demonstrates that the system is rather robust to adding information: in the
results, the concatenation of several representations generally behaves nearly as well
as the best of the representations, taken alone.
Other modalities
In this section we present similar results using various combinations of the motion,
sound, and image modalities. Results are presented together with box plots corresponding
to 20 repetitions of the experiment with random label associations, test set,
train set, and reference examples. For the image modality, the color descriptors (see
section 6.5.3) are used, that give the best results, as illustrated in previous section
and fig. 6.4.
More precisely several setup are presented, including learning from motion and sound,
as well as from image and sound, as previously, but also learning from motion and
image, and finally learning from the three modalities at the same time. For each
of these choices of learning modalities, several setup are possible for the test phase,
specially when the three modalities are present during training: these include testing108 CHAPTER 6. MULTIMODAL LEARNING
0.0
0.2
0.4
0.6
0.8
1.0
Cross-modal association score
SURF color SURF-pairs color-pairs color-triplets SURF, color
SURF-pairs,
color-pairs
SURF-pairs,
color-triplets
SURF, color,
SURF-pairs,
color-pairs,
color-triplets
image → sound sound → image
Figure 6.4: Box plot of classification success rates for various image features in the
experiments I → S and S → I. Each plot corresponds to the use of a subset of image
features, each plot contains two boxes representing the average success as well as
quantiles and extreme values through cross-validation. The features used for each
experiment are presented on top of the figure. The random success rate are around
0.1.
on the recognition of one modality from another (for example I → S) but also from
two modalities to another (for example I, M → S), or conversely one modality to two
(as in M, S → I).
Figure 6.6 compares various one modality to one modality setups for the case where
only the two modalities that are used for testing are present in the training and
the case where an additional modality was also present during testing. The results
demonstrate that the system is capable of learning the semantic concepts event when
more than two modalities are present. There is no significant difference between the
cases of two and three modalities: the system neither benefit noticeably from the third
modality nor does it suffer from the increased dimensionality of the data. However,
since the number of atoms k is fixed, the results could come from the fact that when
the system is trained on three modalities, the dimension of the dictionary becomes
insufficient to encode non-meaningful aspects of the three modalities. Therefore
fig. 6.6 present the same experiment for various values of k in order to interpret
more precisely the previous result. The comparison confirms the fact that the system
mainly behaves similarly with two or three modalities.6.6. EXPERIMENTS 109
0.0
0.2
0.4
0.6
0.8
1.0
Cross-modal association score
image, motion motion, sound image, sound motion, sound, image
motion → sound
motion → image
sound → motion
sound → image
image → motion
image → sound
Figure 6.5: Box plot of classification success rates for various experiments where two
or three modalities are used for training. Each plot corresponds to the use of a subset
of modalities during training: the first three plots use two modalities and the last
one use three modalities. Each plot contains boxes representing the average success
as well as quantiles and extreme values through cross-validation for various testing
setups, using only two modalities. There are only two testing setups when only two
modalities are used for training, and six when three modalities are used for training.
Figure 6.7 present the results on many possible test setups int the case where all
modalities are present during training. The results demonstrate that the system
is capable of using information contained in more than one modality in the test
or reference example. Although the results are slightly better when using more
modalities as input (as in M,I → S in comparison to M → S or I → S), the
improvement in performance is not really significant in the experiment.
Regular classification with the symbolic modality
This section leaves the non-symbolic setup considered previously, in order to compare
properties of the system described above with results obtained in previous works,
such as the one of Ngiam et al. (2011).
Ngiam et al. (2011) present a learner that is trained on multimodal examples of
phonemes, either perceived through their acoustic manifestation or through the
motions of the lips that pronounce them. In their experiment they show that the
learner can benefit the observation of several modalities and improve its recognition110 CHAPTER 6. MULTIMODAL LEARNING
0 50 100 150 200
k
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
Cross-modal association score
Cosine
image → sound
motion → image
motion → sound
image → motion
sound → motion
sound → image
Trained on two modalities.
Trained on all three modalities.
Figure 6.6: With both two (full lines) and three (dashed) modalities during training,
the classification success rates are similar and good for high enough value of the
number of atoms k. The plots demonstrate that the success rate is quite stable above
a minimum value of k.
success in comparison to the case where only one modality is observed.
We consider a regular classification setup, similar to the one presented in section 3.3
but also in Mangin and Oudeyer (2012a), Driesen et al. (2012). More precisely we
introduce a symbolic modality represented by a binary vector as already explained
in previous section and in section 3.3. The system is trained by observing examples
both in the symbolic modality and in one or several other modalities. Then results
are compared between various testing setups to explore the ability of the learner to
improve its classification performance in the case where several modalities are observed.
Such an experiment can be described as a classification task with multimodal input
unified through sensor fusion.
Table 6.4 present the results for such an experiment for the sound and motion
modalities. The symbolic modality is denoted as L. Interestingly training with the
two modalities (sound and motion) does not significantly change the performance of
the learner, and that when tested on sound, motion or both. In that case the benefit
of having two non-symbolic modalities is not an increase in performance, but rather
that the same learner can use either acoustic perception or motion perception to
classify an example.6.6. EXPERIMENTS 111
0.0
0.2
0.4
0.6
0.8
1.0
Cross-modal association score
motion, sound, image
motion → sound
motion → image
sound → motion
sound → image
image → motion
image → sound
sound, image → motion
motion, image → sound
motion, sound → image
Figure 6.7: The system is capable of relating information from many modalities to
one. There is however no substantial improvement in performance from the use of two
modalities as input for the recognition. The figure presents box plots of classification
success rates for various experiments where three modalities are used for training.
There are boxes representing the average success as well as quantiles and extreme
values through cross-validation for various testing setups.
6.6.2 Learning words in sentences
The previous experiments demonstrate that the artificial learner studied in this
chapter is capable of learning the semantic connection between utterances and the
objects or motions they describe. The meaning of the sentences is modelled in our
experiment by the presence of a keyword; more precisely the association between
sentences and images of objects or motions are based on the presence of keywords in
the utterances. However the learner is not aware of the fact that all the meaning
of the sentence is actually localized in one word; instead it only exploits crosssituational
learning to discover relations between modalities. The task solved by the
learner actually only involve holistic understanding and classification of the sentences.
Therefore it is not completely clear what information the learner actually exploits
in the sentence and whether the learner discovers word-like units from the acoustic
stream. Indeed the previous experiments only demonstrate that the learner achieves
teleological understanding of the sentences; however the question remains to know
if it starts to understand compositionally the sentences. We further explore this
question in the experiment presented in this section.
Actually the grammar used to generate the utterances, as described quickly by
Altosaar et al. (2008) and in more details by Driesen (2012, chap. 2), introduces112 CHAPTER 6. MULTIMODAL LEARNING
Training Testing Success rates
S + L S → L 0.916 ± 0.034
M + L M → L 0.906 ± 0.052
S + M + L S → L 0.896 ± 0.043
S + M + L M → L 0.910 ± 0.054
S + M + L S + M → L 0.917 ± 0.055
Table 6.4: Success rate for the label recognition experiment. In this experiment an
additional modality containing labels, L, is considered. The results are computed on
average for a cross-validation of the train and test sets; standard deviations are also
given.
additional structure. For example the utterance: ‘Now mummy is losing her patience.’,
which meaning is related to the word ‘mummy’ also contains the pronoun ‘her’ which
makes it more likely that the sentence is about a feminine keyword (considering that
the sentences are quite short). Furthermore it appears that the expression ‘losing her
patience’ is always used in the dataset in the aforementioned sentence. Therefore the
expression is also a relevant cue of the presence of the keyword ‘mummy’, although
the keyword is also used in many other sentences. That example shows that it is
not completely clear what cues the learner is using to recognize the meaning of
sentences, and whether this cues are localized, as words, or unlocalized elements. In
order to explore this question, another experiment was designed that uses sliding
windows taken from a video-like stream composed as explained in next section. In
that experiment we take a closer look to the recognition along time in the utterance
of each of the semantic concept. It is somehow an extension to the multimodal setup
of the experiment presented by Stouten et al. (2008, 4.C).
Sliding windows
We consider simulated video streams, generated in the following way: acoustic records
of utterances are concatenated and images are sequenced at a fixed frame rate such
that the semantic concept associated to the image is the same as the one of the
utterance at the starting time of the image. This construction simulates the setting
where a caregiver shows objects to a learner and at the same time pronounces a
sentence that describes the object.
In order to build the videos, utterances from the Caregiver dataset are concatenated
in a random order. Then pictures are chosen from the dataset presented in previous
section, in order to form a sequence of frames that verifies two conditions. First the
sequence has a fixed frame rate close to the one used for the capture of the pictures.
Also the pictures are chosen such that they represent the object corresponding to the
subject of the current sentence. Actually the frames having a fixed duration they may
start during one utterance and end during another. This property actually introduces
additional ambiguity in the data, since a sentence may start while a different object
than the one described in the sentence is observed.
The learning algorithm does not directly operate on the sound and frame streams
that compose the video. Instead sliding windows of given length are extracted from
the video. The sliding windows extraction process actually takes two parameters:6.6. EXPERIMENTS 113
0 t
Sentence 1 Sentence 2
Window 1
Window 2
Window 3
Figure 6.8: Illustration of the process used to generate video data and split into
sliding windows.
the width of the windows and the shift between two windows. The latter is often
expressed as a fraction of the former. Once a sliding window has been extracted, it is
represented using similar features than regular sound and pictures. For the acoustic
part, the subsequence of sound corresponding to the time window is extracted and
converted to the HAC representation using exactly the same process as previously.
Regarding the visual part, an histogram representation is first extracted for each
frame intersecting with the time window. Then the representations of these frames
are mixed using a weighted averaged with weights proportional to the duration of
the intersection between the frame and the time window of interest. The length of
the sliding windows is typically between 0.05 s and 1 s, therefore between the length
of a phoneme and a short sentence. One important aspect of this experimental
setting is that for windows of small length, with a sliding amount of the same
magnitude than the window length, one word or less is contained in the acoustic
stream from the window: thus many windows contain only a part of the keyword
or even do not intersect at all with the keyword. Finally many sliding windows are
actually across the utterance boundaries and thus are associated with a mixture of
the representation of several objects. These elements make the learning in such a
context more ambiguous and more noisy since a lot of the sliding window do not
contain meaningful associations.
Results
The behavior of the recognition of the system on sliding windows taken inside
utterances is very interesting on a qualitative point of view. In the following, acoustic
sliding windows are computed on utterances outside the training set and the system
is evaluated on the value of similarity it returns between each acoustic sliding window
and an image. The results of this experience, as presented in fig. 6.9 provide a
better insight of which parts of the utterances are more strongly associated with
the underlying semantic concepts. Actually the results show that the recognition of114 CHAPTER 6. MULTIMODAL LEARNING
the object are often localized in the sentence around the temporal occurrence of the
keyword.
Figure 6.9: Examples of similarity to images around a time window sliding through
the utterance. The similarity is represented at the time index of the beginning of
each window. Interestingly this example demonstrates an association between the
pronoun ‘her’ and the concept ‘mummy’, since ‘her’ is only used as a synonymous of
‘mummy’ in the set of utterances.
The results also illustrate the fact that in some sentences, as the example ‘Now
mummy is losing her patience’, the keyword is not the only part of the sentence
that is meaningful regarding the semantic concept, but other elements such as the
expression ‘is losing her patience’ or the pronoun ‘her’ are also associated to the
semantic concept. Figure 6.9 illustrate this effect.
6.6.3 Emergence of concepts
In previous sections we evaluated the learner on concrete tasks that emphasis its
ability to relate information from one modality to another. A natural question that
follows is whether the learner develops an internal representation of the semantic
concepts from the data, although it does not observe the symbolic information. The
question is actually non-trivial since it is not immediate to interpret the internal
representation that the system builds, that is to say, the role of the various components
of the dictionary matrix. However some insight can be gained that suggests that at
least some components are more specialized into some of the semantic classes.
In order to investigate that aspect we quantified the mutual information between
the semantic concepts and the coefficients of the internal representations of samples6.6. EXPERIMENTS 115
featuring the concepts. For each semantic concept l and sample i we consider the
random variables Xl such that Xi
l = 1 if and only if the concept l appears in
sample i. For each dimension j of the internal representation and each sample i we
define the random variable Yj = h
i
j
. We then assume that (Xi
l
)i are independent
and identically distributed, as well as the (Y
i
j
)i
. In the following we quantify the
dependency between these two variables by looking at the mutual information between
them. In information theory, the mutual information I is an information theoretic
measure defined for two random variables X and Y as “the relative entropy [or
Kullback-Leibler divergence] between the joint distribution [p(x, y)] and the product
distribution p(x)p(y)” by Cover and Thomas (1991).
I(X; Y ) = DKL (p(x, y)∥p(x)p(y))
The Xl variables takes binary values but the Yj are continuous. Therefore we use a
discrete approximation of the values of the coefficients h with 10 bins in order to be
able to compute the mutual information by estimating the probability distributions
p(Xl), p(Yj ), and p(Xl
, Yj ) by using the samples for 1 ≤ i ≤ N. From this process
we obtain a value I(Xl
; Yj ) for each pair (l, j) that quantifies how much information
the coefficient j captures from the concept l.
Figure 6.10: Illustration of the specialisation of some components with respect to some
semantic labels. The figure represents the mutual information between (vertically)
semantic classes (that are not observed by the learner) and (horizontally) each
internal coefficient used by the learner to represent pairs of motion demonstration
and acoustic descriptions from the training set. A value of k = 15 was used in this
experiment.
Figure 6.10 represents, for each semantic class and each coefficient of the internal
representation, the mutual information between the belonging of examples to that116 CHAPTER 6. MULTIMODAL LEARNING
class and the value of a given coefficient of the internal representations of these
examples. To emphasis the specialisation of some internal coefficients we re-ordered
internal coefficients so that classes and coefficients that have high mutual information
are aligned. More precisely, the best alignment was computed by a Kuhn-Munkres
algorithm and we plotted first the coefficients that are highly associated to one class
and then the one that are less meaningful. The figure does not display a perfect
one to one relationship between labels and coefficients; however some coefficients
are highly specialized, the information about other labels is spread over several
coefficients, and some information is not clearly localized.
6.7 Conclusion
This chapter presents a truly multimodal learning experience in the sense that a learner
is trained from several subsymbolic modalities and demonstrates a classification
behavior similar to the one that would be expected to a young child. More precisely it
is shown that the result can be obtained from the auto-organization of the multimodal
perception driven by the compression mechanism on which nonnegative matrix
factorization is based. These experiments demonstrate the effective exploitation by
the learner of the cross-situational information from the data.
The behavior of the learner is explored on several setups such as learning from
three modalities or with a symbolic modality. It is also explored whether, when
it is used as a regular classifier, additional modalities during training and testing
improve the results (as in Ngiam et al., 2011). It is also shown that the system
can be implemented, using sliding time windows, in a more realistic setting where
utterances do not need to be segmented beforehand. This setting demonstrates
the robustness of the system to demonstrations that are not meaningful, that is
that do not feature the cross-situational semantic association between modalities.
Furthermore the setting is also used to gain better insight on the temporal localization
of the learnt concept among sentence. It is illustrated that the meaning of sentences,
regarding the semantic objects, is localized mainly around keywords but also around
other meaningful grammatical elements that where in the training set associated
with the concepts. Finally the experiment show that the system not only learns
semantic associations between words, visual objects, and gestures, but also that a
representation of the semantic classes, although never observed directly, emerges in
the system’s representation.
The learner presented in this chapter specifically targets and is tested on the crosssituational
learning setup. Although cross-situational information is not the only one
that might be involved in the learning of multimodal concepts. Indeed children have
been shown to rely on other important elements in the process of word acquisition.
For example, Samuelson et al. (2011) have shown that children might rely on spatial
localization of objects and words to relate words to their meanings. Belpaeme and
Morse (2012) provided a computational model to compare cross-situational learning
to social learning and shown that the latter outperforms the former. The interaction
of the learner with the caregiver or other agents is indeed an important aspect of word
learning. Actually the word learning process used in the Talking heads experiment
(Steels, 1999) mainly rely on the interaction between the agents. Finally Markman
(1990), Landau et al. (1998) details various aspect of conceptual thinking that seems6.7. CONCLUSION 117
to play an important role learning words by using additional heuristics such as the
whole object assumption, taxonomic assumption, or mutual exclusivity.
With regard to the question of the precedence of teleological or holistic understanding
over compositional understanding as discussed by Wrede et al. (2012), the experiments
presented in this chapter do not assume that the sentences and more generally the
semantic concepts has to be understood first in compositional manner. Indeed it
instead focuses more on global understanding: the learner we present does not include
mechanism to segment the perception in parts and then try to relate these parts from
one modality to the other, as in previous works from Roy (1999), Roy and Pentland
(2002), Yu and Ballard (2004, 2007). Instead the system learns a representation of
whole sentences and the main task demonstrates that the representation is efficient.
We further refine the learning process to demonstrate that representation learnt by
the system actually focuses on recognizing the keywords that concentrate the crossmodal
information. Therefore aspects of compositional understanding also emerge
from the learning process. The compositional aspect of the semantics presented in
our experiment is actually quite limited; in order to investigate more these aspects, as
well as the question of grammar learning, experiments including a more complex and
structure semantics are required. One such experiment results from the combination
of several concepts in each samples: this corresponds to the semantics used in the
experiment from chapter 3 but presented with real sentences instead of symbolic
labels. Finally such an experiment would also explore aspects of the similarities
between the grammar of language the grammar of motions as described by Roy and
Arbib (2005).
As already mentioned, the learner presented in this chapter can be seen as an agent
from the Talking heads experiment from Steels (1999), Steels and Kaplan (2002).
The main difference between our implementation and the original one is that our
agent uses cross-situational information instead of feedback from the other agent.
As studied by Belpaeme and Morse (2012) these two approaches are both valid to
explain the learning of words and might be used complementary. For example using
cross-situational information to exploit language exposure when no interaction is
available. The system we present in this chapter features other important differences
with the original talking head: one is that the algorithm does not rely on a preliminary
process of word segmentation and concept segmentation ; this opens new perspectives
on the study of the interaction between the formation of concepts and the formation
of words as acoustic units instead of symbolic entities.
From a technical point of view, the algorithm and setup presented above could however
be improved in many ways. One direction for further work is the development of
algorithm more adapted to the setup. Indeed the NMF algorithm is built to take
independent samples as input and therefore information must be sliced into such
samples in order to be learned by the system. On way to slice the data is to detect
utterance boundaries or manually annotate them. Another is to use sliding windows
of fixed or varying lengths. However, other algorithms could be used that directly
model the temporal dynamics of the signal. Such algorithms could be derived from
existing models, as hidden Markov models, or more recent work by F´evotte et al.
(2013) that extends NMF.
The NMF algorithm used in these experiment implements the optimization of one
specific criterion, namely reconstruction error under the constraint of the factorization.
Many other properties of the learnt representation could be used to improve the118 CHAPTER 6. MULTIMODAL LEARNING
results. For example, sparsity of the representation have been shown to provide more
meaningful results in many application fields (as Hoyer, 2002, Aharon et al., 2005,
Lee et al., 2006, Li et al., 2010). Interestingly other metrics have been explicitly
developed in the past that target multimodal learning. Such examples are given by
extensions of independent component analysis to multimodal settings by Akaho et al.
(1999), Karhunen and Ukkonen (2007). Actually these technical aspects introduce
the deeper question of the mechanism that drive the learning of multimodal concepts:
the experiment we present demonstrate that an algorithm based on a compression
mechanism can capture semantic information by exploiting the cross-situational
information from the data. Many other heuristics could eventually be used to capture
that information. Would they behave similarly? Would they enable the extraction of
other information than the cross-situational one? Several important questions are
actually raised by these possibilities, that might help to model more precisely what
it means to achieve multimodal learning.Chapter 7
Discussion and perspectives
In this thesis we explore the problem of learning lexicons of primitive elements
from perception and their association across modalities. This study involves the
question of the definition of ‘simple’, in particular with respect to what complex
is, more specifically through mechanisms that enable the discovery or emergence of
such simple elements from perception, and how these mechanisms can handle the
ambiguity often inherent to the definition of simple elements.
It is explained in chapter 1 that the notion of ‘motion primitive’ is far from being
straight-forward and unique. Then, the example of dance motions is given in
which choreographies are composed of parts combined simultaneously. We have
thus explored the question of learning simple elements from observation of complex
motions, where the simple elements are active at the same time. Learning this kind
of combination of motion primitives is actually an instance of the source separation
problem, in the fields of imitation learning and human behavior understanding. The
approach developed in chapter 3 therefore uses nonnegative matrix factorization, a
technique commonly used on source separation problems (for example for sound in
Lef`evre et al., 2011). A lot of work related to learning motion primitives actually
focus on learning sequences of motion primitives. However the experiments presented
in this thesis demonstrates that it is also possible to decompose motions in simpler
parts that are active simultaneously. This question is actually orthogonal to the
sequence decomposition but less addressed in the literature. In this work we explained
the ambiguity issues deriving from this problem and demonstrate that NMF can
handle such ambiguity, as appearing in the motion dataset, when it is coupled with
weak supervision in the form of linguistic data.
Chapter 4 explores the use of similar ideas to decompose observations of humans
solving complex tasks into a dictionary of simple tasks. In that chapter, the novel idea
is to consider the combinatorial properties of human actions not in the policy space,
that is the space of actions, but in the task space, that is the space of objectives the
actions are pursuing. Chapter 4 demonstrates on synthetic problems that it is possible
to exploit the combinatorial structure of tasks modelled by objective functions from
the observation of artificial agents solving these tasks. Interestingly the new matrix
factorization algorithm derived in these experiments are based on mechanism very
similar to the ones behind nonnegative matrix factorization algorithm.
119120 CHAPTER 7. DISCUSSION AND PERSPECTIVES
Chapter 5 reviews mechanisms that can be used to learn primitive elements from
sound. More precisely we introduce an unsupervised algorithm based on clustering
and bag-of-words representation, that can be used to learn primitive elements. On
top of these primitive elements, interpreted as phonemes, words can be learnt in a
supervised manner, using a voting technique based on TF-IDF score. We also detail
how nonnegative matrix factorization have been used on top of similar basic primitive
elements in an unsupervised setup by Stouten et al. (2008) and in a supervised
manner by ten Bosch et al. (2008), Driesen et al. (2012) to also achieve word learning.
Finally, in chapter 6 we explain how the mechanisms used for learning words from
acoustic observation of utterances or gestures from observation of motions can be
extended to a multimodal learning setting. More precisely we demonstrate that
a NMF based algorithm is capable of learning simultaneously primitive elements
in a multimodal setting without any symbolic input nor explicit models of words
and meanings. Actually a learner is shown to yield the same classification behavior
that would be expected from a child after being exposed only to subsymbolic data.
The learner presented in chapter 6 exploits cross-situational learning to relate words
to gestures and/or visual objects. The presented learner is further analysed in
order to show that the semantic relations it learns between modalities make it
able to localize the information contained by keywords among utterances. The
representation of multimodal data learnt with NMF is also shown to yield, to some
extent, a specialisation of some of the dimensions to the recognition of semantic
concepts from the training data. In these experiments the semantic concepts that
the system learns are the result of a convention, that maps keywords in utterances
to objects in visual scenes and gestures demonstrated through a motion acquisition
system. The experiment therefore demonstrates to what extent the mechanisms of
nonnegative matrix factorization can recover the correlations that characterize these
semantic concepts, when embodied in a cross-situational learning setup. These results
comfort those of Roy and Pentland (2002), Smith and Yu (2008); we however use a
setup in which a single algorithm treats all modalities in a unified way. Furthermore
the setup we present starts from a representation that does not involve explicit
segmentation and static phoneme recognition. Finally chapter 6 discuss how other
cues might be included in similar synthetic learners, such as spatial localization of
objects (see Samuelson et al., 2011), interaction with the caregiver or other agents
(see Belpaeme and Morse, 2012), or conceptual thinking (see Markman, 1990, Landau
et al., 1998).
The contribution of this thesis can be summarized as using matrix factorization
techniques to model the emergence and acquisition of primitive elements in the
perception of motions, complex behaviors, objects vision, and spoken language. First
this thesis illustrates the similarity of the problem in various fields of perception by
using the same family of algorithm in all of them. It then shifts to the specific study
of the language grounding problem and more generally the question of multimodal
learning. More particularly multimodal learning is not only a way of solving the same
problem in several modalities at the same time, but to make less ambiguous, in the
multimodal setting, several problems that, taken alone, are ambiguous. Regarding
the three questions that were asked in the introduction of this thesis, this works
provides the following answers and new questions.121
How can the intuition about simple and complex be made explicit and
implemented on a robot or artificial system? For developmental roboticists
an appealing aspect of the concept of motion primitives is that they can implement
the gradual growing of complexity observed for example in tasks executed by children.
This corresponds to intuitions such as: mastering grasping and placing of objects
is a prerequisite to being able to assemble cubes into towers. However an explicit
representation of motion primitives is not required to explain such increase of
complexity; also, as explained previously, it is very difficult to formulate a definition
of these motion primitives: the intuition of motion decomposition may lead to many
different approaches, each of which is not necessarily useful or even well defined. An
alternative is proposed that identifies and represent the combinatorial properties of
motion skills without explicit definition of what the basic motions are. The work
presented in chapter 3 is actually introducing three important ideas on that subject,
that are then followed in different directions. First, many work have been done to
represent motion primitives and their combination in sequence. Thus we introduced
similar work for the simultaneous combination, using the NMF algorithm. Then,
although the NMF algorithm is based on the linear combination of elements from a
dictionary into observed examples, it is not claimed that these atoms corresponds as
motion primitives as perceived by humans. Actually our preliminary experiments
following that idea show that it is often not the case, one reason for that being the
intrinsic ambiguity or indeterminacy of the decomposition problem. In other words,
the system learns and represents motions in a form that implements simultaneous
combination, but do not presuppose the ability to segment or separate basic motions,
as perceived by humans amongst the data. Indeed, building motion representations
that are compatible with some notion of combination is a distinct approach from
trying to first represent parts of motions and then implement their combination.
Both enable the representation of composite motions but the former does not involve
the pre-requisite of motion segmentation. As discussed in next paragraph the former
approach is more compatible with the idea that holistic understanding may emerge
before compositional understanding (see Wrede et al., 2012). Finally, in order to
evaluate the system, we chose to test its ability to represent similar combinations
than a human does, at the behavioral level. For that, we use a tasks based on a
communication channel modelled by the symbols. In other words the ambiguity is
only addressed by the addition of a linguistic channel that models social interaction
and provides an input for social conventions. The other experiments explore similar
ideas. For example, the experiment on tasks decomposition gives a visual example of
the multiplicity of the solution and the non-explicit representation of tasks that where
used to generate the examples. However the learning of the structure is demonstrated
at the behavior level by the score on imitating the demonstrator task.
This thesis however does not treat other combinatorial properties that are central
both for motion or language. Examples of such combinations have already been
discussed in section 3.1.1 and includes time sequences and hierarchies of primitives.
As these have often been explored individually in previous works, the main challenge
is to be able to combine several forms of combinations, which requires the development
of representations and algorithms that implement them as well as new experimental
setup. For example on possibility is relax the hypothesis of sample independence in
NMF to represent the temporal dynamics of the data, following work from F´evotte
et al. (2013).122 CHAPTER 7. DISCUSSION AND PERSPECTIVES
How can primitive elements emerge or be discovered through interaction
of the agent with its physical and social environment? The experiments
developed in this thesis are based on matrix factorization or clustering algorithms.
These algorithms can all be interpreted as the minimization of a form of reconstruction
error of the perceived signal, under the constraint of compression. That mechanism
is the one that yields the emergence of primitive elements, at the behavioral level.
While this mechanism is the only one studied through the experiments from this
thesis, many other candidates exist. First structural constraints can be added to the
compression performed in the algorithms. For example, sparsity inducing constraints
were already combined with matrix factorization approaches (Hoyer, 2002, 2004,
Mairal et al., 2009, Lee et al., 2006). Interestingly Jenatton et al. (2010) also achieve
both sparsity and hierarchy of dictionary elements. The work on deep belief nets
achieve experiments that are conceptually similar to the one presented here, both in
the field of motion composition (see Taylor et al., 2006, Taylor and Hinton, 2009b,a),
and multimodal learning (Ngiam et al., 2011). However the mechanisms behind
the learning of such representations are not exactly the same as the one underlined
matrix factorization. Other metrics that have been explicitly developed to target
multimodal learning were already given as examples in previous chapter, such as
extensions of independent component analysis to multimodal settings by Akaho et al.
(1999), Karhunen and Ukkonen (2007). The comparison of these technical approaches
with the one taken in this work on a unique multimodal setup actually constitutes an
interesting direction for future research. We explain in chapter 6 that an important
novelty of our approach in comparison to previous work on similar questions is that
it does not presuppose the decomposition of perception in concepts and words to the
learning of their relation. More precisely we present a system that learns to relate
words to concepts without explicit segmentation of acoustic input into phonemes or
words, nor images into relevant objects. It thus demonstrate that a task of language
grounding can be solved in holistic way, thus featuring teleological understanding
without requiring compositional understanding. Indeed in previous work from Yu
and Ballard (2004, 2007), Roy (1999), Roy and Pentland (2002) but also in the
Talking head experiment from Steels (1999), Steels and Kaplan (2002) the algorithm
include explicit mechanism to segment the sensor input into either phonemes and
then words or concepts. Even if the segmentation is in some cases learnt by the
system, these architecture encode compositional understanding as a prerequisite to
language grounding and more generally multimodal learning. In our work we provide
an alternative which open new perspectives on the kind of questions introduced by
Wrede et al. (2012). It is important to notice that an important shortcoming of
our approach with respect to the study of emergence is that it is not incremental.
However there exist online versions of the NMF algorithms on which we base our
experiments that can be used to study the framework presented in this thesis in a
more incremental manner.
What mechanisms can overcome the intrinsic ambiguity and indeterminacy
that is characteristic of many approaches regarding the learning and
emergence of these primitive elements? In chapter 3 the mechanisms used to
learn motion representation do not alone solve the indeterminacy of decomposition.
However we show that adding weak supervision to the perception through a linguistic
channel, symbolic in that experiment, resolve the ambiguity at the behavioral level.
Chapter 6 actually demonstrates the same idea from real multimodal perception;123
the learner can then exploit cross-situational and cross-modal information to achieve
word grounding or the learning of other kinds of multimodal concepts. Many other
mechanisms can be implemented at the data collection level and the way to represent
it. The multimodal experiment represents data in such a way that makes learning
possible from cross-situational information; however, as mentioned previously, other
sources of information are available such as localization of objects or interactions
with the caregiver. Furthermore, in the experiments in this thesis we use data coming
from three distinct dataset to simulate multimodal perception. This constitute an
important limitation of this work which hides important questions. For example
whether the object is shown by the caregiver or the learning system is an important
aspect that may greatly change the structure of the collected visual data. Other
questions include the differences between infant and adult directed speech as discussed
by Yurovsky et al. (2012), or the process of autonomous acquisition of data (see
Gottlieb et al., 2013).
This thesis presents the simultaneous combination of motion primitives as an
important aspect of imitation learning and human behavior understanding. Following
that idea, an experiment demonstrating such learning is performed, where symbolic
linguistic input is used to relate the motion representations learned by the system
to a human based representation. In chapter 6 the symbolic linguistic modality is
replaced by a continuous acoustic input. However theses last experiments only study
the learning of gestures demonstrated alone. An important extension of the work
presented here is therefore to bring together multimodality from only continuous
perception and fully ambiguous demonstrations: which means relating gestures that
are observed combined in complex motions to words that are observed combined in
complex sentences. Such an experiment actually is a very interesting first approach
to the question of similarities between the combinatorial structure of words and
motions, that is to say the grammar of language and the grammar of motions and
actions. It would be even more interesting to relate that experience to the analysis
and hypothesis from Roy and Arbib (2005).
The experiments presented in this thesis are performed either on simple toys problems
or on fixed datasets. It is therefore important, in order to consolidate the results,
to experiment similar ideas both on more diverse and advanced datasets, and in
more interactive setups. Indeed, while the issues addressed by this work are clearly
grounded in developmental robotics, no real robotic experiment was performed in this
thesis. This aspect actually corresponds to the fact that this work focusses specifically
on a perception based point of view. We actually believe that many of these questions
are also very relevant to action but the link is still to be made. Although chapter 4
introduces the ideas of task decomposition in a way that enables the generation of
motions to solve new tasks, it is limited to simple toy problems and suffers from the
weaknesses of the inverse reinforcement learning approach it is based on: the relative
novelty of the field and the algorithmic cost that still makes it a challenge to reach the
complexity of real robotic environment. Also, the algorithm we propose focuses on the
problems of learning by imitation and human behavior understanding: a demonstrator
is required to be able learn tasks; this leaves apart the important mechanisms for
autonomous discovery of new motor skills and new goals. Other interesting questions
emerge from the duality between goals or tasks and the skills that solve them.
For example, is one of them explicitly represented and the other inferred or both
represented simultaneously? Is the autonomous discovery of skills motor based or124 CHAPTER 7. DISCUSSION AND PERSPECTIVES
task based? This question is for example related to the study of motor babbling and
goal babbling by Baranes and Oudeyer (2013). Can the learning of primitive tasks
model the emergence of affordances in perception? Regarding language learning, the
work we present also focusses mainly on perception and word recognition. Extending
this work to language production is also an interesting direction for future research,
specially through the studies of the interactions between the learning of language
perception and language production. Aspects of this interaction have already been
studied by Serkhane et al. (2005), Moulin-Frier (2011).Appendix A
Non-negative matrices and
factorization
A.1 Non-negative matrix theory
This section summarizes some result from the Perron-Frobenius theory that are useful
to study theoretical aspects of the non-negative matrices and factorization.
Its purpose is to present main properties of these matrices, centered on PerronFrobenius
theorem, that enables basic theoretical discussions. These elements are
adapted from presentation given by Boyle, Meyer (2000). These references might be
looked into for proofs and more detailed presentations of this theory.
A.1.1 Base definitions and notations
We only consider square matrices in this part.
We call positive (resp. non-negative) a matrix whose coefficients are all positive (resp.
non-negative), we use notations A > 0 for positivity and A ≥ 0 for non-negativity.
We denote by σ(A) the set of all A’s eigenvalues. We call spectral radius, denoted
ρ(A), the quantity defined as follows:
ρ(A) = max
λ∈σ(A)
|λ| (A.1)
We also denote by χA(X) the characteristic polynomial of A.
Multiplicities The algebraic multiplicity of an eigenvalue refers to its multiplicity
as root of the charateristic polynomial whereas geometric multiplicity refers
to the dimension of the associated eigenspace. In general the algebraic multiplicity is
greater or equal to the geometric multiplicity. When these two quantities are equal
the eigenvalue is said to be semi-simple. When both are equal to 1, the eignevalue
is said to be simple.
125126 APPENDIX A. NON-NEGATIVE MATRICES AND FACTORIZATION
Two matrices A and B are said equivalent if and only if there exists an invertible
matrix P such that B = P
−1AP.
A.1.2 Taxonomy of non-negative matrices
Amongst all non-negative matrices, a few categories are of great importance regarding
the Perron-Frobenius theory. These are positive, primitive and irreducible
matrices.
Definition (Primitivity). A square non-negative matrix is said to be primitive if
and only if some power of it is positive
i.e. ∃k ∈ N, Ak > 0 (A.2)
i.e. ∃k ∈ N, ∀(i, j) ∈ [|1, n|]
2
, (A
k
)i,j > 0 (A.3)
Definition (Irreducibility). A square non-negative matrix is said to be irreducible if
and only if
∀(i, j) ∈ [|1, n|]
2
, ∃k ∈ N, (A
k
)i,j > 0 (A.4)
Given a square non-negative matrix A let G(A) be the directed graph with n vertices
and such that an array exists between vertex i and vertex j if and only if Ai,j > 0.
Then for some k ∈ N, (Ak
)i,j > 0 is equivalent to the existence of a path of length k
between i and j in G(A).
Definition (Period of a square non-negative matrix). The period of a square nonnegative
matrix A, is the greatest common divisor of all length of loops in G(A).
For an irreducible matrix A of period p, we define the relation:
i ∼A j if and only if ∃k ∈ N, (A
kp)i,j > 0 (A.5)
Following this definition, i ∼A j if and only if p divides all path lengths between i
and j in G(A). That this relation is an equivalence easily follows the irreducibility of
A. Using the partition of [|1, n|] into equivalence classes for i ∼A j, we can re-order
the columns of A, which makes it equivalent to B where:
B =
0 A1 0 · · ·
0 0 A2 · · ·
.
.
.
.
.
.
.
.
.
.
.
.
Ap 0 0 · · ·
(A.6)
This form is referred as cyclic block form or Frobenius form. This formulations
makes it easy to get the following results.
Proposition 2. A is primitive if and only if A is irreducible of period 1.
Proposition 3. Let A be an irreducible matrix of period p. Then Ap
is equivalent
to a block diagonal matrix which blocks are all primitive. Moreover all blocks have
the same non-zero spectrum.A.1. NON-NEGATIVE MATRIX THEORY 127
Proposition 4. Let A be an irreducible matrix of period p and ξ a primitive p
th
root of unity. Then
• A and ξA are similar,
• if r is a root of the characteristic polynomial of A, with multiplicity α, then rξ
is a also a root of A of multiplicity α.
Theorem 4. Let A be an irreducible matrix of period p and D a diagonal block from
Bp where B is a cyclic block form of A. Then, χA(X) = χD(Xp
). More precisely if
ξ is a primitive p
th root of unity and
χD(X) =
k
j=1
X − λ
p
j
,
χA(X) = p
i=1
k
j=1
X − ξ
iλj
.
Those results enable to relate the spectrum of any irreducible matrix of period p to
the spectrum of primitive matrices. This relation makes it possible to generalize some
of the results for primitive matrices to irreducible matrices, as stated in Section A.1.3.
A.1.3 Perron-Frobenius theorem
Case of positive matrices
Theorem 5 (Perron theorem). Let A be a positive matrix, then,
(i) ρ(A) is a simple eigenvalue of A,
(ii) there exists a unique unit norm positive eigenvector u,
(iii) it is associated with ρ(A) and called the Perron vector of A,
(iv) ρ(A) is the unique eigenvalue of A of norm ρ(A).
Case of irreducible matrices
When generalized to irreducible matrices the previous result takes the following form.
Theorem 6 (Perron-Frobenius theorem). Let A be an irreducible matrix of period
p, then,
(i) ρ(A) is a simple eigenvalue of A,
(ii) there exists a unique unit norm positive eigenvector u,
(iii) it is associated with ρ(A) and called the Perron vector of A,
(iv) A has exactly p eigenvalues of norm ρ(A), furthermore A is similar to e
2iπ
p A
and thus σ(A) is invariant by rotation of angle 2π
p128 APPENDIX A. NON-NEGATIVE MATRICES AND FACTORIZATION
Perron projection
Previous results does not change when a matrix A is replaced by AT
since all the
considered properties are invariant by transposition. However the Perron vectors of
A and AT are in general not the same. It is thus useful to distinguish between left
(v > 0) and right (u > 0) Perron vectors of matrix A such that:
Au = ρ(A)u and v
T A = ρ(A)v
T
(A.7)
Proposition 5. Let A be a primitive matrix with left and right Peron vectors v and
u.
A
ρ(A)
n
−→n→∞
uvT
u
T v
This quantity is a projection onto the eigenspace associated to ρ(A), which is called
Perron projection.
Collatz-Willandt formula
Proposition 6. Let A be an irreducible matrix and f(x) = min
i∈[|1,n|], xi̸=0
[Ax]i
xi
, then
ρ(A) = max
x≤0, x̸=0
f(x).
A.2 Ambiguity in the problem definition
A.2.1 Generative model
A geometric interpretation of the non-negative matrix factorization has been presented
by Donoho and Stoden Donoho and Stodden (2003), it is based on the notion of
simplicial cones and the following link to non-negative factorization.
Definition (Simplicial cone). The simplicial cone generated by the vectors (wk)k∈[|1,K|]
is defined as:
ΓW =
K
k=1
hk · wk : hk ≥ 0
(A.8)
For a given factorization W ·H that generates exactly the data, W yields K generators
such that all data vectors (xi)i∈[|1,N|]
lie in the simplicial cone ΓW .
The factorization of a non-negative matrix is thus equivalent to providing such a
simplicial cone as a generative model of the data. It is however not true in general
that, even if the data is generated filling a simplicial cone, there is uniqueness of such
a model. In such a situation one would like to chose the simplest or the smallest
fitting model. In some cases even defining such a simplicity is ambiguous.
In the following we analyse separately various sources of ambiguity in the problem of
finding a factorization:
• ambiguity in the representation of simplicial cones,A.2. AMBIGUITY IN THE PROBLEM DEFINITION 129
• ambiguity in notions of simplest solution.
• ambiguity from lack of data.
Since the data is non-negative it lies in the positive orthant P which is the convex
simplicial cone generated by the canonical basis vectors, the problem thus always
admit P as a solution.
Furthermore it also lies in Span
(wi)i∈[|1,K|]
, and P ∩ Span(W) is also a solution.
A.2.2 Representation of simplicial cones
Definition (Extreme rays). An extreme ray of a convex cone Γ is a line Rx =
{ax : a ≥ 0} such that x ∈ Γ\{0} and there is no x1 and x2, linearly independent
such that x = x1 + x2.
When the generators are linearly independent, the set of generators corresponds to
the set of extreme ray, thus a convex simplicial cone is uniquely defined by its set of
extreme rays.
This shows that solving non-negative matrix factorization is equivalent to finding a
set of extreme rays generating a simplicial cone containing the data. The set of rays
is represented by a list of generators. Scaling of the generators and re-numbering of
the rays does not change the found simplicial cone, which is another formulation of
the invariance introduced in section 2.1.1.
Definition (Primal simplicial cone). Given a set of points X and an integer r,
a primal simplicial cone associated with r, X is a simplicial cone Γ such that
X ⊂ Γ ⊂ P.
The invariance by scaling and permutation is thus a representation invariance of the
simplicial cone underlying the factorization.
Dual formulation This formulation of the NMF problem can equivalently be
made in the dual space (in terms of complex duality, see Boyd and Vandenberghe
(2004)).
Definition (Dual simplicial cone). Given a set of points Y and an integer r, a dual
simplicial cone associated with r, Y is a simplicial cone Γ such that P ⊂ Γ ⊂ Y.
Proposition 7. Every primal simplicial cone is the dual of a dual simplicial cone
and reciprocally.
A.2.3 First case: linearly independent generators
We first consider the somehow simpler case in which the generators of X are linearly
independent, which is a sufficient condition for these generators to be extreme rays
of X .130 APPENDIX A. NON-NEGATIVE MATRICES AND FACTORIZATION
However, if ΓX ∈ P ∩Span(X) where X = (xi)i∈[|1,r|]
is such that ΓX ̸= P ∩Span(X),
there are an infinity of simplicial cones Γ′ with r generators such that ΓX ⊂ Γ
′ ⊂ P
(P ∩ Span(X) is one of them).
The following lemma from Donoho and Stodden (2003), however limits the solution
of such simplicial cones inclusion.
Proposition 8. If Γ and G are convex cones such that Γ ⊂ G ⊂ Rn where Γ is a
simplicial cone with r generators and Γ ∩ G contains exactly r extreme rays of G,
Rxi
i∈[|1,r|]
, then:
• the
Rxi
i∈[|1,r|]
are extreme rays of Γ,
• there is no simplicial cone Γ
′ with r generators such that Γ
′ = Γ ̸ and Γ ⊂ Γ
′ ⊂ G.
So in general such a cone might be widened towards P and is thus not unique.
However under some conditions the cone is already maximal, such a case happens
under sufficient conditions given in Donoho and Stodden (2003). In that case the
primal simplicial cone is unique and so is the solution to the NMF problem (still
with invariance by dilatation and permutations).
A.2.4 Second case: rk(W) < K
This case arises even when all generators are extreme rays, for example in three
dimensional space when the simplicial cone section (for example section by a plan
orthogonal to first diagonal) is a convex polygon with more than three vertices.
In that case two extreme points of view can be taken:
• searching a simplicial cone minimal regarding inclusion, which in the 3D case
means which section has minimal area, i.e. finding the convex hull of the section
of the projection (in the conic sense) of the data on some plane,
• searching a simplicial cone with the minimum number of generators, which
leads to chose the rank of W as the number of generators, thus in our example
choosing a cone too big since the whole first octant is chosen.Appendix B
Datasets
B.1 The Acorns Caregiver dataset
The Caregiver dataset (Altosaar et al., 2008) provided by the ACORNS project, is
composed of 1000 utterances containing 13 keywords, each spoken by 4 speakers in
English adult directed speech; this makes a total of 4000 utterances. An example of
sentences used in the dataset is Angus is lazy today. where the semantic tag/keyword
is Angus. Examples of transcriptions from utterances from the dataset are given in
table B.1.
We take a bath
To put it in the bath isn’t funny either
The shoe is a symbol
Now mummy is losing her patience
Daddy comes closer
Angus takes off her shoe
Daddy never calls
She sits on a nappy
Now everybody is in the car
Where is the nappy
Table B.1: Transcriptions from ten random examples from the Acorns Caregiver
dataset from Altosaar et al. (2008). Keywords are identified in bold font.
B.2 The first choreography dataset
The first choreography dataset contains choreography motions recorded through
a kinect device. These motions have a combinatorial structure: from a given
set of primitive dance motions, choreographies are constructed as simultaneous
execution of some of these primitive motions. The data is publicly available at
http://flowers.inria.fr/choreography_database.html.
131132 APPENDIX B. DATASETS
Primitive dance motions are chosen from a total set of 48 motions and are spanned
over one or two limbs, either the legs (for example walk, squat), left or right arm (for
example wave hand, punch) or both arms (for example clap in hands, paddle).
Complex choreographies are produced as the simultaneous demonstration of two or
three of these primitive motion: either one for legs and one for both arm, or one
for legs and one for each arm. Each example (or record) contained in the dataset
consists in two elements: the motion data and labels identifying which primitive
motions are combined to produce the choreography.
The dataset actually contains three separate sets of examples:
1. primitive: in each example, only one primitive motion is demonstrated, the
set of labels associated to each example is thus a singleton (326 examples).
2. mixed small: demonstrations of complex choreographies composed of primitive
motions taken in a subset of 16 possible motions (137 examples).
3. mixed full: demonstrations of complex choreographies composed of primitive
motions taken in all the possible motions (277 examples).
B.2.1 Description of the data
The data has been acquired through a kinect camera and the OpenNI drivers1
, which
yields a stream of values of markers on the body. Each example from the dataset
is associated to a sequence of 3D positions of each of the 24 markers. Thus for a
sequence of length T, the example would corresponds to T ∗ 24 ∗ 3 values.
The kinect device recognizes and provides positions of the following list of markers:
head, neck, waist, left hip, left shoulder, left elbow, left hand, left knee, left foot,
left collar, left wrist, left fingertip, left ankle, right hip, right shoulder, right elbow,
right hand, right knee, right foot, right collar, right wrist, right hand, right fingertip,
right ankle.
These markers are however not tracked with the same accuracy and it might be better
to filter to keep only a subset of these markers. In the experiments from chapter 3
we use: head, neck, left hip, left shoulder, left elbow, left hand, left knee, left foot,
right hip, right shoulder, right elbow, right hand, right knee, right hand, right foot.
B.3 The second choreography dataset
The second choreography dataset contains choreography motions recorded through a
kinect device. It contains a total of 1100 examples of 10 different gestures that are
spanned over one or two limbs. The data is publicly available at http://flowers.
inria.fr/choreo2.
1http://openni.orgB.3. THE SECOND CHOREOGRAPHY DATASET 133
Id Limb(s) Description
1 right arm hold horizontal
2 right arm hold vertical (down)
3 right arm hold vertical (up)
4 right arm from horizontal on side, bend over the head
5 right arm raise from horizontal to vertical
6 right arm lower from horizontal to vertical
7 right arm from horizontal side, bend in front of the torso
8 right arm from horizontal side, bent elbow to get vertical forearm toward up
9 right arm mimic punching
10 right arm hold horizontal and bring from side to front
11 right arm from horizontal side, bend elbow to get vertical forearm toward down
12 right arm from horizontal side, bring hand to shoulder (elbow moving vertically)
13 right arm hold horizontal and bring from right side to left side
14 right arm swing forearm downside with horizontal upper arm
15 right arm draw circles with arm extended on the right
16 right arm wave motion of the arm held, horizontal on the side
17 right arm wave hand (shoulder level)
18 right arm wave hand (over the head)
19 both arms clap hands (at varying positions)
20 both arms mimic paddling on the left
21 both arms mimic paddling on the right
22 both arms mimic pushing on ski sticks
23 legs un-squat
24 legs mimic walking
25 legs stay still
26 legs step on the right
27 legs step on the left
28 right leg raise and bend leg to form a flag (or ‘P’) shape
29 left leg raise and bend leg to form a flag (or ‘P’) shape
30 left arm hold horizontal
31 left arm hold vertical (down)
32 left arm hold vertical (up)
33 left arm from horizontal on side, bend over the head
34 left arm raise from horizontal to vertical
35 left arm lower from horizontal to vertical
36 left arm from horizontal side, bend in front of the torso
37 left arm from horizontal side, bent elbow to get vertical forearm toward up
38 left arm mimic punching
39 left arm hold horizontal and bring from side to front
40 left arm from horizontal side, bend elbow to get vertical forearm toward down
41 left arm from horizontal side, bring hand to shoulder (elbow moving vertically)
42 left arm hold horizontal and bring from left side to right side
43 left arm swing forearm downside with horizontal upper arm
44 left arm draw circles with arm extended on the left
45 left arm wave motion of the arm held, horizontal on the side
46 left arm wave hand (shoulder level)
47 left arm wave hand (over the head)
Table B.2: List of gestures composing the motions of the first choreography
dataset. The small dataset only uses the following subset of labels:
1, 5, 6, 10, 19, 20, 21, 22, 23, 24, 25, 28, 30, 38, 40, 43.134 APPENDIX B. DATASETS
Id Limb(s) Description
1 both legs squat
2 both legs walk
3 right leg make a flag/P on right leg
4 both arms clap
5 both arms mimic paddling left
6 right arm mimic punching with right arm
7 right arm right arm horizontal goes from side to front
8 left arm horizontal left arm, forearm goes down to form a square angle
9 left arm make waves on left arm
10 left arm say hello with left arm
Table B.3: List of gestures composing the motions of the second choreography dataset.
B.3.1 Description of the data
The data has been acquired through a kinect camera and the OpenNI drivers through
its ROS2
interface, which yields a stream of values of markers on the body. Each
example from the dataset is associated to a sequence of 3D positions of each of the
15 markers. Thus for a sequence of length T, the example would corresponds to
T ∗ 15 ∗ 7 values. The 7 successive values for each marker are there 3D coordinates
together with a representation of the rotation of the frame between previous and
next segment. The rotation is encoded in quaternion representation as described on
the ROS time frame page3
.
The position of the following list of markers was recorded: head, neck, left hip,
left hip, left shoulder, left elbow, left hand, left knee, left foot, right hip, right shoulder,
right elbow, right hand, right knee, right foot, right hand.
2Robotic operating system, http://ros.org
3http://www.ros.org/wiki/tfAppendix C
Code
The code used in the experiments from Mangin and Oudeyer (2013) is available
publicly on http://github.com/omangin/multimodal. It consists in a set of tools
and experimental scripts used to achieve multimodal learning with nonnegative
matrix factorization (NMF). This code is distributed under the new BSD license.
135136 APPENDIX C. CODEBibliography
P. Abbeel, A. Coates, and A. Y. Ng. Autonomous helicopter aerobatics through
apprenticeship learning. The International Journal of Robotics Research, 29(13):
1608–1639, June 2010. ISSN 0278-3649. doi: 10.1177/0278364910371999.
Pieter Abbeel and Andrew Y Ng. Apprenticeship learning via inverse reinforcement
learning. In International conference on Machine learning, 2004.
Michal Aharon, Michael Elad, and Alfred Bruckstein. K-svd: Design of dictionaries
for sparse representation. In Proceedings of SPARS, number 5, pages 9–12, 2005.
Nasir Ahmed, T Natarajan, and Kamisetty R Rao. Discrete cosine transform.
Computers, IEEE Transactions on, 100(1):90–93, 1974.
Guillaume Aimetti. Modelling early language acquisition skills: Towards a general
statistical learning mechanism. In EACL (Student Research Workshop), pages 1–9,
2009.
S. Akaho, Y. Kiuchi, and S. Umeyama. Mica: multimodal independent component
analysis. In International Joint Conference on Neural Networks, (IJCNN 99),
volume 2, pages 927–932, 1999. doi: 10.1109/IJCNN.1999.831077.
Zeynep Akata, Christian Thurau, and Christian Bauckhage. Non-negative matrix
factorization in multimodality data for segmentation and label prediction. In
Computer Vision Winter Workshop, number 16, Mitterberg, Autriche, 2011.
Nameera Akhtar and Lisa Montague. Early lexical acquisition: The role of crosssituational
learning. First Language, 19(57):347–358, 1999.
Javier Almingol, Luis Montesano, and Manuel Lopes. Learning multiple behaviors
from unlabeled demonstrations in a latent controller space. In International
conference on Machine learning (ICML), 2013.
Toomas Altosaar, Louis ten Bosch, Guillaume Aimetti, Christos Koniaris, Kris
Demuynck, Henk van den Heuvel, Signal Proc, P O Box, and Fi Tkk. A speech
corpus for modeling language acquisition: Caregiver. In Language Resources and
Evaluation - LREC, pages 1062–1068, 2008.
Pierre Andry, Philippe Gaussier, Sorin Moga, Jean-Paul Banquet, and Jacqueline
Nadel. Learning and communication via imitation: An autonomous robot perspective.
Systems, Man and Cybernetics, Part A: Systems and Humans, IEEE
Transactions on, 31(5):431–442, 2001.
137138 BIBLIOGRAPHY
Minoru Asada, Koh Hosoda, Yasuo Kuniyoshi, Hiroshi Ishiguro, Toshio Inui, Yuichiro
Yoshikawa, Masaki Ogino, and Chisato Yoshida. Cognitive developmental robotics:
A survey. Autonomous Mental Development, IEEE Transactions on, 1(1):12–34,
2009.
Monica Babes-Vroman, Vukosi Marivate, Kaushik Subramanian, and Michael Littman.
Apprenticeship learning about multiple intentions. In International conference on
Machine learning (ICML), number 28, 2011.
Adrien Baranes and Pierre-Yves Oudeyer. Active learning of inverse models with
intrinsically motivated goal exploration in robots. Robotics and Autonomous
Systems, 61(1):49–73, January 2013. doi: 10.1016/j.robot.2012.05.008.
Leonard E. Baum, Ted Petrie, George Soules, and Norman Weiss. A maximization
technique occurring in the statistical analysis of probabilistic functions of markov
chains. The annals of mathematical statistics, 41(1):164–171, 1970.
Herbert Bay, Tinne Tuytelaars, and Luc Van Gool. Surf: Speeded up robust features.
In Computer Vision–ECCV 2006, pages 404–417. Springer, 2006.
Richard Bellman. Dynamic Programming. Princeton University Press, Princeton,
NJ, USA, 1 edition, 1957a.
Richard Bellman. A markovian decision process. Indiana University Mathematics
Journal, 6:679–684, 1957b. ISSN 0022-2518.
Tony Belpaeme and Anthony Morse. Word and category learning in a continuous
semantic domain: Comparing cross-situational and interactive learning. Advances
in Complex Systems, 15(03n04), 2012. doi: 10.1142/S021952591200312.
Jaafar BenAbdallah, Juan C. Caicedo, Fabio A. Gonzalez, and Olfa Nasraoui. Multimodal
image annotation using non-negative matrix factorization. In International
Conference on Web Intelligence and Intelligent Agent Technology, pages
128–135. IEEE / WIC / ACM, August 2010. ISBN 978-1-4244-8482-9. doi:
10.1109/WI-IAT.2010.293.
Christopher M. Bishop. Pattern Recognition and Machine Learning (Information
Science and Statistics). Springer-Verlag New York, Inc., 2006.
Randolph Blake. A neural theory of binocular rivalry. Psychological review, 96(1):
145–167, 1989.
Sofiane Boucenna, Philippe Gaussier, Pierre Andry, and Laurence Hafemeister. Imitation
as a communication tool for online facial expression learning and recognition. In
Intelligent Robots and Systems (IROS), 2010 IEEE/RSJ International Conference
on, pages 5323–5328. IEEE, 2010.
Stephen Boyd and Lieven Vandenberghe. Convex optimization. Cambridge University
Press, 2004. ISBN 978-0521833783.
M. Boyle. Notes on the perron-frobenius theory of nonnegative matrices. Technical
report.
Holger Brandl, Frank Joublin, and Christian Goerick. Towards unsupervised online
word clustering. In IEEE International Conference on Acoustics, Speech, and
Signal Processing, pages 5073–5076, Las Vegas, NV, 2008.BIBLIOGRAPHY 139
Michael R. Brent. Speech segmentation and word discovery: A computational
perspective, 1999.
David R. Brillinger. Learning a potential function from a trajectory. IEEE Signal
Processing Letters, 14(11):867–870, November 2007. ISSN 1070-9908. doi: 10.1109/
LSP.2007.900032.
Rodney Brooks. Intelligence without representation. Artificial Intelligence, 47:
139–159, 1991.
Jesse Butterfield, Sarah Osentoski, Graylin Jay, and Odest Chadwicke Jenkins.
Learning from demonstration using a multi-valued function regressor for timeseries
data. In International Conference on Humanoid Robots, number 10, Nashville,
2010. IEEE Comput. Soc. Press.
Richard W. Byrne and Anne E. Russon. Learning by imitation: a hierarchical
approach. Behavioral and brain sciences, 21(5):667–721, 1998.
Maya Cakmak and Manuel Lopes. Algorithmic and human teaching of sequential
decision tasks. In AAAI Conference on Artificial Intelligence (AAAI-12), 2012.
S. Calinon and A. Billard. A probabilistic programming by demonstration framework
handling skill constraints in joint space and task space. In Proc. IEEE/RSJ Intl
Conf. on Intelligent Robots and Systems (IROS), September 2008.
Sylvain Calinon and Aude G Billard. Statistical learning by imitation of competing
constraints in joint space and task space. Advanced Robotics, 23:2059–2076, 2009.
Sylvain Calinon, Florent Guenter, and Aude Billard. On learning, representing,
and generalizing a task in a humanoid robot. IEEE transactions on systems,
man, and cybernetics. Part B, Cybernetics : a publication of the IEEE Systems,
Man, and Cybernetics Society, 37(2):286–98, April 2007. ISSN 1083-4419. doi:
10.1109/TSMCB.2006.886952.
Sylvain Calinon, Florent D’Halluin, Eric L Sauser, Darwin G Caldwell, and Aude G
Billard. Learning and reproduction of gestures by imitation: An approach based
on hidden markov model and gaussian mixture regression. IEEE Robotics and
Automation Magazine, 17(2):44–54, 2010.
Angelo Cangelosi, Giorgio Metta, Gerhard Sagerer, Stefano Nolfi, Chrystopher
Nehaniv, Kerstin Fischer, Jun Tani, Tony Belpaeme, Giulio Sandini, Francesco Nori,
Luciano Fadiga, Britta Wrede, Katharina Rohlfing, Elio Tuci, Kerstin Dautenhahn,
Joe Saunders, and Arne Zeschel. Integration of action and language knowledge: A
roadmap for developmental robotics. IEEE Transactions on Autonomous Mental
Development, 2(3):167–195, September 2010. ISSN 1943-0604. doi: 10.1109/TAMD.
2010.2053034.
Luigi Cattaneo and Giacomo Rizzolatti. The mirror neuron system. Archives of
Neurology, 66(5):557, 2009.
Thomas Cederborg and Pierre-Yves Oudeyer. From language to motor gavagai:
Unified imitation learning of multiple linguistic and non-linguistic sensorimotor
skills. Transactions on Autonomous Mental Development (TAMD), 5, 2013.140 BIBLIOGRAPHY
E. Colin Cherry. Some experiments on the recognition of speech, with one and with
two ears. The Journal of the acoustical society of America, 25:975, 1953. doi:
10.1121/1.1907229.
Jaedeug Choi and Kee-Eung Kim. Nonparametric bayesian inverse reinforcement
learning for multiple reward functions. In Advances in Neural Information Processing
Systems 25, pages 314–322, 2012.
Thomas M Cover and Joy A. Thomas. Elements of information theory. John Wiley
& Sons, 1991.
Christian Daniel, Gerhard Neumann, and Jan Peters. Learning concurrent motor
skills in versatile solution spaces. In Proceedings of the International Conference
on Robot Systems (IROS), 2012.
John Demiris and Gillian Hayes. Do robots ape. In AAAI Fall Symposium, pages
28–30. American Association for Artificial Intelligence, November 1997.
Arthur P Dempster, Nan M Laird, and Donald B Rubin. Maximum likelihood from
incomplete data via the em algorithm. Journal of the Royal Statistical Society.
Series B (Methodological), pages 1–38, 1977.
Chris Ding, Tao Li, and Michael I Jordan. Convex and semi-nonnegative matrix
factorizations. IEEE Transactions on Pattern Analysis and Machine Intelligence,
32(1):45–55, January 2010. ISSN 1939-3539. doi: 10.1109/TPAMI.2008.277.
David Donoho and Victoria Stodden. When does non-negative matrix factorization
give a correct decomposition into parts ? Advances in neural information processing
systems, 16, 2003.
Joris Driesen. Discovering words in speech using matrix factorization. PhD thesis,
KU Leuven, ESAT, 2012.
Joris Driesen, Louis ten Bosch, and Hugo Van Hamme. Adaptive non-negative matrix
factorization in a computational model of language acquisition. In Interspeech,
pages 1–4, 2009.
Joris Driesen, Hugo Van Hamme, and Bastiaan W. Kleijn. Learning from images and
speech with non-negative matrix factorization enhanced by input space scaling.
In IEEE Spoken Language Technology Workshop (SLT), pages 1–6, Berkeley,
California, USA, 2010. IEEE. doi: http://dx.doi.org/10.1109/SLT.2010.5700813.
Joris Driesen, Jort F. Gemmeke, and Hugo Van Hamme. Data-driven speech representations
for nmf-based word learning. In SAPA-SCALE, Portland, USA,
2012.
Staffan Ekvall and Danica Kragic. Learning task models from multiple human
demonstrations. ROMAN 2006 - The 15th IEEE International Symposium on
Robot and Human Interactive Communication, pages 358–363, September 2006.
doi: 10.1109/ROMAN.2006.314460.
Daniel P. W. Ellis. Plp and rasta (and mfcc, and inversion) in matlab, 2005.
K. Farrell, R.J. Mammone, and A.L. Gorin. Adaptive language acquisition using
incremental learning. In International Conference on Acoustics, Speech, and Signal
Processing (ICASSP 1993), volume 1, pages 501–504. IEEE, 1993.BIBLIOGRAPHY 141
David Filliat. Interactive learning of visual topological navigation. In International
Conference on Intelligent Robots and Systems (IROS 2008), pages 248–254. IEEE,
2008.
Sadaoki Furui. Speaker-independent isolated word recognition using dynamic features
of speech spectrum. Acoustics, Speech and Signal Processing, IEEE Transactions
on, 34(1):52–59, 1986.
C´edric F´evotte and J´erˆome Idier. Algorithms for nonnegative matrix factorization
with the β-divergence. Neural Computation, 29(9):2421–2456, 2011. doi: http:
//dx.doi.org/10.1162/NECO a 00168.
C´edric F´evotte, Jonathan Le Roux, and John R. Hershey. Non-negative dynamical
system with application to speech and audio. In IEEE International Conference
on Acoustics, Speech and Signal Processing (ICASSP), May 2013.
Mrugesh R. Gajjar, R. Govindarajan, and T. V. Sreenivas. Online unsupervised
pattern discovery in speech using parallelization. In InterSpeech, pages 2458–2461.
ISCA, 2008.
Zoubin Ghahramani and Michael I. Jordan. Supervised learning from incomplete
data via an em approach. In Advances in Neural Information Processing Systems
6, pages 120–127. Morgan Kaufmann, 1994.
James Jerome Gibson. The Ecological Approach To Visual Perception. Taylor &
Francis, 1979. ISBN 9781135059729.
Arthur M Glenberg and Michael P Kaschak. Grounding language in action. Psychonomic
bulletin & review, 9(3):558–65, September 2002. ISSN 1069-9384.
Rebecca L. Gomez and Lou-Ann Gerken. Artificial grammar learning by 1-year-olds
leads to specific and abstract knowledge. Cognition, 70(2):109–135, 1999.
A L Gorin, D Petrovska-Delacretaz, J Wright, and G Riccardi. Learning spoken
language without transcription, 1999.
Allen L. Gorin, Stephen E. Levinson, and Ananth Sankar. An experiment in spoken
language acquisition. Speech and Audio Processing, IEEE Transactions on, 2(1):
224–240, January 1994. ISSN 1063-6676. doi: 10.1109/89.260365.
Jacqueline Gottlieb, Pierre-Yves Oudeyer, Manuel Lopes, and Adrien Baranes.
Information-seeking, curiosity, and attention: computational and neural mechanisms.
Trends in cognitive sciences, 17(11):585–593, 2013.
Herbert Paul Grice. Studies in the Way of Words. Harvard University Press, 1989.
Daniel H Grollman and Odest Chadwicke Jenkins. Incremental learning of subtasks
from unsegmented demonstration. In IROS, Taipei, Taiwan, 2010.
Stevan Harnad. The symbol grounding problem. Physica D: Nonlinear Phenomena,
42(1):335–346, 1990.
Stephen Hart and Roderic Grupen. Learning generalizable control programs. Autonomous
Mental Development, IEEE Transactions on, 3(3):216–231, 2011.142 BIBLIOGRAPHY
Stephen Hart, Shijaj Sen, and Roderic A. Grupen. Intrinsically motivated hierarchical
manipulation. In International Conference on Robotics and Automation (ICRA),
pages 3814–3819, Pasadena, California, USA, 2008.
Trevor J. Hastie, R. Tibshirani, and J. Friedman. The elements of statistical learning.
Springer, second edi edition, 2001.
Sven Hellbach, Julian P Eggert, Edgar K¨orner, and Horst-michael Gross. Basis
decomposition of motion trajectories using spatio-temporal nmf. In Int. Conf.
on Artificial Neural Networks (ICANN), pages 597–606, Limassol, Cyprus, 2009.
Springer.
Ronald A. Howard. Dynamic Programming and Markov Processes. Published jointly
by the Technology Press of the Massachusetts Institute of Technology and Wiley
and Sons, 1960.
Patrik O Hoyer. Non-negative sparse coding. Technical report, February 2002.
Patrik O Hoyer. Non-negative matrix factorization with sparseness constraints.
Journal of Machine Learning Research, 5:1457–1469, 2004.
Auke Jan Ijspeert, Jun Nakanishi, and Stefan Schaal. Learning attractor landscapes
for learning motor primitives. In Advances in neural information processing systems,
pages 1547–1554, Cambridge, 2003. MIT Press.
Naoto Iwahashi. Language acquisition through a human–robot interface by combining
speech, visual, and behavioral information. Information Sciences, 156(1):109–121,
2003.
Naoto Iwahashi. Active and unsupervised learning for spoken word acquisition
through a multimodal inteface. In IEE International Workshop on Robot and
Human Interactive Communication, 2004.
Rodolphe Jenatton, Julien Mairal, Guillaume Obozinski, and Francis Bach. Proximal
methods for sparse hierarchical dictionary learning. In Proceedings of the
International Conference on Machine Learning (ICML), 2010.
Nikolay Jetchev and Marc Toussaint. Task space retrieval using inverse feedback
control. In Lise Getoor and Tobias Scheffer, editors, International Conference on
Machine Learning, number 28 in ICML ’11, pages 449–456, New York, NY, USA,
June 2011. ACM. ISBN 978-1-4503-0619-5.
Thorsten Joachims. Text categorization with support vector machines: Learning
with many relevant features. Technical Report 23, UniversUniversit¨at Dortmund,
LS VIII-Reportit¨at Do, 1997.
Fr´ed´eric Kaplan and Pierre-Yves Oudeyer. The progress-drive hypothesis: an interpretation
of early imitation. Models and mechanims of imitation and social
learning: Behavioural, social and communication dimensions, pages 361–377, 2007.
Juha Karhunen and Tomas Ukkonen. Extending ica for finding jointly dependent
components from two related data sets. Neurocomputing, 70:2969–2979, 2007. ISSN
0925-2312. doi: 10.1016/j.neucom.2006.10.144.BIBLIOGRAPHY 143
S Mohammad Khansari-Zadeh and Aude Billard. Learning stable non-linear dynamical
systems with gaussian mixture models. IEEE Transactions on Robotics2, 27
(5):943–957, 2011.
Jens Kober and Jan Peters. Policy search for motor primitives in robotics. In
Advances in Neural Information Processing Systems, pages 849–856, Red Hook,
NY, USA, 2009. Curran.
J¨urgen Konczak. On the notion of motor primitives in humans and robots. In
International Workshop on Epigenetic Robotics: Modeling Cognitive Development
in Robotic Systems, volume 123, pages 47–53. Lund University Cognitive Studies,
2005. ISBN 91-974741-4-2.
V Kruger, Danica Kragic, Aleˇs Ude, and Christopher Geib. The meaning of action:
a review on action recognition and mapping. Advanced Robotics, 21(13):1473–1501,
2007.
Volker Kruger, Dennis Herzog, Sanmohan Baby, Ales Ude, and Danica Kragic.
Learning actions from observations. Robotics and Automation Magazine, 17(2):
30–43, 2010.
Patricia K Kuhl. Early language acquisition: cracking the speech code. Nature
reviews. Neuroscience, 5(11):831–43, November 2004. ISSN 1471-003X. doi:
10.1038/nrn1533.
Patricia K. Kuhl. Brain mechanisms in early language acquisition. Neuron, 67(5):
713–727, 2010.
Patricia K. Kuhl, Karen A. Williams, Francisco Lacerda, Kenneth N. Stevens, and
Bj¨orn Lindblom. Linguistic experience alters phonetic perception in infants by 6
months of age. Science, 255(5044):606–608, 1992.
D Kulic, Hirotaka Imagawa, and Yoshihiko Nakamura. Online acquisition and
visualization of motion primitives for humanoid robots. Symposium on Robot and
Human, pages 1210–1215, 2009.
Dana Kulic and Yoshihiko Nakamura. Incremental learning of human behaviors
using hierarchical hidden markov models. In IEEE International Conference on
Intelligent Robots and Systems, pages 4649–4655. IEEE Comput. Soc. Press, 2010.
Yasuo Kuniyoshi, Masayuki Inaba, and Hirochika Inoue. Learning by watching:
Extracting reusable task knowledge from visual observation of human performance.
Robotics and Automation, IEEE Transactions on, 10(6):799–822, 1994.
Barbara Landau, Linda Smith, and Susan Jones. Object perception and object
naming in early development. Trends in cognitive sciences, 2(1):19–24, 1998.
Daniel D. Lee and H Sebastian Seung. Learning the parts of objects by non-negative
matrix factorization. Nature, 401(6755):788–91, October 1999. ISSN 0028-0836.
doi: 10.1038/44565.
Daniel D. Lee and H. Sebastian Seung. Algorithms for non-negative matrix factorization.
In Advances in Neural Information Processing Systems, pages 556–562. MIT
Press, 2001.144 BIBLIOGRAPHY
Honglak Lee, Alexis Battle, Rajat Raina, and Andrew Y. Ng. Efficient sparse
coding algorithms. In Advances in Neural Information Processing Systems (NIPS),
number 19, 2006.
Augustin Lef`evre, Francis R. Bach, and C´edric F´evotte. Itakura-saito nonnegative
matrix factorization with group sparsity. In Acoustics, Speech and Signal Processing
(ICASSP), 2011 IEEE International Conference on, number 1, pages 21–24. IEEE,
2011.
David A. Leopold and Nikos K. Logothetis. Multistable phenomena: changing views
in perception. Trends in cognitive sciences, 3(7):254–264, 1999. doi: 10.1016/
S1364-6613(99)01332-7.
Vladimir I Levenshtein. Binary codes capable of correcting deletions, insertions and
reversals. In Soviet physics doklady, volume 10, page 707, 1966.
Sergey Levine, Zoran Popovic, and Vladlen Koltun. Feature construction for inverse
reinforcement learning. Advances in Neural Information Processing Systems, (24):
1–9, 2010.
Yi Li, Cornelia Fermuller, Yiannis Aloimonos, and Hui Ji. Learning shift-invariant
sparse representation of actions. In 2010 IEEE Computer Society Conference on
Computer Vision and Pattern Recognition, pages 2630–2637, San-Francisco, June
2010. IEEE. ISBN 978-1-4244-6984-0. doi: 10.1109/CVPR.2010.5539977.
Rainer Lienhart, Stefan Romberg, and Eva H¨orster. Multilayer plsa for multimodal
image retrieval. In International Conference on Image and Video Retrieval -CIVR,
number April, page 1, New York, New York, USA, 2009. ACM Press. ISBN
9781605584805. doi: 10.1145/1646396.1646408.
Chih-Jen Lin. Projected gradient methods for nonnegative matrix factorization.
Neural computation, 19(10):2756–79, October 2007. ISSN 0899-7667. doi: 10.1162/
neco.2007.19.10.2756.
Manuel Lopes, Francisco S. Melo, Ben Kenward, and Jos´e Santos-Victor. A computational
model of social-learning mechanisms. Adaptive Behavior, 17(6):467–483,
2009a.
Manuel Lopes, Francisco S. Melo, and Luis Montesano. Active learning for reward
estimation in inverse reinforcement learning. In European Conference on Machine
Learning (ECML), 2009b.
Max Lungarella, Giorgio Metta, Rolf Pfeifer, and Giulio Sandini. Developmental
robotics: a survey. Connection Science, 15(4):151–190, 2003.
Natalia Lyubova and David Filliat. Developmental approach for interactive object
discovery. In Proceedings of the 2012 IJCNN International Joint Conference on
Neural Networks, 2012.
Bin Ma and Haizhou Li. Spoken language identification using bag-of-sounds. In
International Conference on Computational Cybernetics. IEEE, 2005.
Julien Mairal, Francis Bach, Jean Pnce, and Guillermo Sapiro. Online dictionary
learning for sparse coding. In International Conference on Machine Learning
(ICML), number 26, pages 689–696, 2009.BIBLIOGRAPHY 145
Olivier Mangin and Pierre-Yves Oudeyer. Learning to recognize parallel combinations
of human motion primitives with linguistic descriptions using non-negative matrix
factorization. In International Conference on Intelligent Robots and Systems (IROS
2012), Vilamoura, Algarve (Portugal), 2012a. IEEE/RSJ.
Olivier Mangin and Pierre-Yves Oudeyer. Learning the combinatorial structure of
demonstrated behaviors with inverse feedback control. In International Workshop
on Human Behavior Understanding, number 3, Vilamoura, Algarve (Portugal),
2012b.
Olivier Mangin and Pierre-Yves Oudeyer. Learning semantic components from
subsymbolic multimodal perception. In the Joint IEEE International Conference
on Development and Learning an on Epigenetic Robotics (ICDL-EpiRob), number 3,
August 2013.
Olivier Mangin, David Filliat, and Pierre-Yves Oudeyer. A bag-of-features framework
for incremental learning of speech invariants in unsegmented audio streams. In
Birger Johansson, Erol Sahin, and Christian Balkenius, editors, Tenth International
Conference on Epigenetic Robotics, pages 73–80, Ooren¨aas Slott, Sweden, 2010. ¨
Ellen M. Markman. Constraints children place on word meanings. Cognitive Science,
14:57–77, 1990.
Gianluca Massera, Elio Tuci, Tomassino Ferrauto, and Stefano Nolfi. The facilitatory
role of linguistic instructions on developing manipulation skills. IEEE
Computational Intelligence Magazine, 5(3):33–42, 2010.
Harry McGurk and John MacDonald. Hearing lips and seeing voices. Nature, 264
(5588):746–748, December 1976. ISSN 0028-0836. doi: 10.1038/264746a0.
C.D. Meyer. Matrix analysis and applied linear algebra: solutions manual. Society
for Industrial and Applied Mathematics, 2000. ISBN 0-89871-454-0.
Bernard Michini and Jonathan P How. Bayesian nonparametric inverse reinforcement
learning. In Machine Learning and Knowledge Discovery in Databases, pages
148–163. Springer, 2012.
Benjamin Franklin Miessner. The electric dog. Scientific American Supplement,
(2267):376–377, June 14th 1919.
Cl´ement Moulin-Frier. Rˆole des relations perception-action dans la communication
parl´ee et l’´emergence des syst`emes phonologiques : ´etude, mod´elisation computationnelle
et simulations. PhD thesis, Universit´e Pierre Mendes-France, Grenoble,
2011.
Ferdinando A. Mussa-Ivaldi and Emilio Bizzi. Motor learning through the combination
of primitives. Philosophical transactions of the Royal Society of London. Series
B, Biological sciences, 355(1404):1755–69, December 2000. ISSN 0962-8436. doi:
10.1098/rstb.2000.0733.
Jacqueline Nadel. Imitation et communication entre jeunes enfants, volume 13.
Presses Universitaires de France - PUF, 1986.
Yukie Nagai. Joint attention learning based on early detection of self-other motion
equivalence with population codes. Journal of the Robotics Society of Japan, 25
(5):77, 2007.146 BIBLIOGRAPHY
C Nehaniv and K Dautenhahn. Of hummingbirds and helicopters: An algebraic
framework for interdisciplinary studies of imitation and its applications. World
Scientific Series in Robotics and, pages 1–26, 2000.
Gergely Neu and Csaba Szepesv´ari. Apprenticeship learning using inverse reinforcement
learning and gradient methods. In Conference on Uncertainty in Artificial
Intelligence (UAI), number 23, pages 295–302, Vancouver, Canada, 2007. AUAI
Press, Corvallis, Oregon. ISBN 0-9749039-3-00-9749039-3-0.
Andrew Y. Ng and Stuart Russell. Algorithms for inverse reinforcement learning.
International Conference on Machine Learning, 2000.
Andrew Y. Ng, Daishi Harada, and Stuart Russell. Policy invariance under reward
transformations: Theory and application to reward shaping. In International
Conference on Machine Learning (ICML), number 16, pages 278–287, 1999.
Jiquan Ngiam, Aditya Khosla, Mingyu Kim, Juhan Nam, and Andrew Y. Ng.
Multimodal deep learning. In International Conference on Machine Learning,
number 28, Bellevue, Washington, USA, 2011.
Monica N. Nicolescu and Maja J. Matari´c. A hierarchical architecture for behaviorbased
robots. Proceedings of the first international joint conference on Autonomous
agents and multiagent systems part 1 - AAMAS ’02, page 227, 2002. doi: 10.1145/
544741.544798.
Monica N. Nicolescu and Maja J. Matari´c. Natural methods for learning and
generalization in human-robot domains. In Second International Joint Conference
on Autonomous Agents and Multi-Agent Systems, Melbourne, Australia, 2003.
David Nister and Henrik Stewenius. Scalable recognition with a vocabulary tree.
In CVPR ’06: Proceedings of the 2006 IEEE Computer Society Conference on
Computer Vision and Pattern Recognition, pages 2161–2168, Washington, DC,
USA, 2006. IEEE Computer Society. ISBN 0-7695-2597-0. doi: http://dx.doi.org/
10.1109/CVPR.2006.264.
Francesco Nori and Ruggero Frezza. Biologically inspired control of a kinematic chain
using the superposition of motion primitives. In Decision and Control (CDC),
volume 1, pages 1075–1080. IEEE Comput. Soc. Press, 2004a.
Franceso Nori and Ruggero Frezza. Nonlinear control by a finite set of motion
primitives. In Nolcos, 2004b.
Pierre-Yves Oudeyer. On the impact of robotics in behavioral and cognitive sciences:
From insect navigation to human cognitive development. IEEE Transactions on
Autonomous Mental Development, 2(1):2–16, March 2010. ISSN 1943-0604. doi:
10.1109/TAMD.2009.2039057.
P Paatero and U Tapper. Positive matrix factorization: A non-negative factor model
with optimal utilization of error estimates of data values. Environmetrics, 5(2):
111–126, 1994.
Michael Pardowitz, Steffen Knoop, Ruediger Dillmann, and Raoul D Z¨ollner. Incremental
learning of tasks from user demonstrations, past experiences, and vocal
comments. IEEE transactions on systems, man, and cybernetics. Part B, Cybernetics
: a publication of the IEEE Systems, Man, and Cybernetics Society, 37(2):
322–32, April 2007. ISSN 1083-4419.BIBLIOGRAPHY 147
Alex S. Park and James R. Glass. Unsupervised pattern discovery in speech. IEEE
Transactions on Audio, Speech and Language Processing, 16(1):186–197, 2008.
Jean Piaget. La construction du r´eel chez l’enfant. Delachaux & Niestl´e, 1937.
RJ Plemmons and RE Cline. The generalized inverse of a nonnegative matrix. Proc.
Amer. Math. Soc, 31(1):46–50, 1972.
Gerasimos Potamianos, Chalapathy Neti, Guillaume Gravier, Ashutosh Garg, and
Andrew W Senior. Recent advances in the automatic recognition of audiovisual
speech. Proceedings of the IEEE, 91(9):1306–1326, 2003.
Willard Van Orman Quine. Word and object. MIT press, 1960.
Lawrence R. Rabiner. A tutorial on hidden markov models and selected applications
in speech recognition. Proceedings of the IEEE, 77(2):257–286, 1989.
Deepak Ramachandran and Eyal Amir. Bayesian inverse reinforcement learning. In
International Joint Conference on Artificial Intelligence (IJCAI’07), number 20,
pages 2586–2591, 2007.
Nathan D. Ratliff, J. Andrew Bagnell, and Martin A. Zinkevich. Maximum margin
planning. In International conference on Machine learning - ICML ’06, number 23,
pages 729–736, New York, New York, USA, 2006. ACM Press. ISBN 1595933832.
doi: 10.1145/1143844.1143936.
Constantin A. Rothkopf and Dana H. Ballard. Modular inverse reinforcement learning
for visuomotor behavior. Biological cybernetics, pages 1–14, 2013.
Alice C. Roy and Michael A. Arbib. The syntactic motor system. Gesture, 5(1):7–37,
January 2005. ISSN 15681475. doi: 10.1075/gest.5.1.03roy.
Deb Roy. Learning from Sights and Sounds: A Computational Model. PhD thesis,
Massachussetts Institute of Technology, September 1999.
Deb K. Roy and Alex P. Pentland. Learning words from sights and sounds: A
computational model. Cognitive science, 26(1):113–146, January 2002. ISSN
03640213. doi: 10.1207/s15516709cog2601 4.
Yossi Rubner, Carlo Tomasi, and Leonidas J Guibas. ”the earth mover’s distance as
a metric for image retrieval”: None. International Journal of Computer Vision, 40
(2):99–121, 2000.
Stuart Russell. Learning agents for uncertain environments. In Proceedings of the
eleventh annual conference on Computational learning theory, pages 101–103. ACM,
1998.
Kate Saenko and Trevor Darrell. Object category recognition using probabilistic fusion
of speech and image classifiers. In Joint Workshop on Multimodal Interaction and
Related Machine Learning Algorithms - MLMI, number 4, Brno, Czech Republic,
2007.
Jenny R. Saffran and Diana P. Wilson. From syllables to syntax: Multilevel statistical
learning by 12-month-old infants. Infancy, 4(2):273–284, April 2003. ISSN 15250008.
doi: 10.1207/S15327078IN0402 07.148 BIBLIOGRAPHY
Jenny R. Saffran, Richard N. Aslin, and Elissa L. Newport. Statistical learning by
8-month-old infants. Science, 274(5294):1926–1928, 1996.
H. Sakoe and S. Chiba. Dynamic programming algorithm optimization for spoken
word recognition. IEEE Transactions on Acoustics, Speech, and Signal Processing,
26(1):43–49, February 1978. ISSN 0096-3518. doi: 10.1109/TASSP.1978.1163055.
Larissa K. Samuelson, Linda B. Smith, Lynn K. Perry, and John P. Spencer. Grounding
word learning in space. PloS one, 6(12):e28095, 2011.
Stefan Schaal. Dynamic movement primitives-a framework for motor control in
humans and humanoid robotics. In Adaptive Motion of Animals and Machines,
pages 261–280, Los Angeles, 2006. Springer.
Jean-Luc Schwartz. A reanalysis of mcgurk data suggests that audiovisual fusion in
speech perception is subject-dependent. The Journal of the Acoustical Society of
America, 127:1584–1594, 2010. doi: 10.1121/1.3293001.
Jean-Luc Schwartz, Fr´ed´eric Berthommier, and Christophe Savariaux. Seeing to
hear better: evidence for early audio-visual interactions in speech identification.
Cognition, 93(2):B69–B78, 2004.
Jean-Luc Schwartz, Anahita Basirat, Lucie M´enard, and Marc Sato. The perceptionfor-action-control
theory (pact): A perceptuo-motor theory of speech perception.
Journal of Neurolinguistics, 25(5):336–354, 2012a. ISSN 0911-6044. doi: 10.1016/j.
jneuroling.2009.12.004.
Jean-Luc Schwartz, Nicolas Grimault, Jean-Michel Hup´e, Brian C.J. Moore, and
Daniel Pressnitzer. Multistability in perception: binding sensory modalities, an
overview. Philosophical Transactions of the Royal Society B: Biological Sciences,
367(1591):896–905, 2012b.
Jihene Serkhane, Jean-Luc Schwartz, and Pierre Bessiere. Building a talking baby
robot: A contribution to the study of speech acquisition and evolution. Interaction
studies, 6(2):253–286, 2005.
Ajit P. Singh and Geoffrey J. Gordon. A unified view of matrix factorization models.
In ECML PKDD, pages 358–373, 2008.
Josef Sivic and Andrew Zisserman. Efficient visual search for objects in videos.
Proceedings of the IEEE, 96(4):548–566, 2008.
Linda Smith and Chen Yu. Infants rapidly learn word-referent mappings via crosssituational
statistics. Cognition, 106(3):1558–1568, 2008.
David Sodoyer, Laurent Girin, Christian Jutten, and Jean-Luc Schwartz. Developing
an audio-visual speech source separation algorithm. Speech Communication, 44(1):
113–125, 2004.
Luc Steels. The Talking Heads Experiment, volume 1. Laboratorium, 1999.
Luc Steels. The symbol grounding problem has been solved. so what’s next? In
Manuel de Vega, Arthur M. Glenberg, and Arthur C. Graesser, editors, Symbols and
Embodiment: Debates on Meaning and Cognition, chapter 12. Oxford University
Press, Oxford, 2008.BIBLIOGRAPHY 149
Luc Steels and Frederic Kaplan. Bootstrapping grounded word semantics. In Ted
Briscoe, editor, Linguistic Evolution through Language Acquisition: Formal and
Computational Models, chapter 3. Cambridge University Press, 2002.
Stanley S. Stevens and John Volkmann. The relation of pitch to frequency: A revised
scale. The American Journal of Psychology, 53(3):329–353, 1940.
Veronique Stouten, Kris Demuynck, et al. Discovering phone patterns in spoken
utterances by non-negative matrix factorization. Signal Processing Letters, IEEE,
15:131–134, 2008.
Freek Stulp and Stefan Schaal. Hierarchical reinforcement learning with movement
primitives. 2011 11th IEEE-RAS International Conference on Humanoid Robots,
pages 231–238, October 2011. doi: 10.1109/Humanoids.2011.6100841.
Y. Sugita and J. Tani. Learning semantic combinatoriality from the interaction
between linguistic and behavioral processes. Adaptive Behavior, 13(1):33, 2005.
Richard S Sutton and Andrew G Barto. Reinforcement Learning: An Introduction.
MIT Press, 1998. ISBN 978-0-262-19398-6.
Richard S Sutton, Doina Precup, and Satinder Singh. Between mdps and semimdps:
A framework for temporal abstraction in reinforcement learning. Artificial
intelligence, 112(1):181–211, 1999.
Graham W. Taylor and Geoffrey E. Hinton. Factored conditional restricted boltzmann
machines for modeling motion style. In International Conference on Machine
Learning (ICML 2009), number 26, pages 1–8, New York, New York, USA, 2009a.
ACM Press. ISBN 9781605585161. doi: 10.1145/1553374.1553505.
Graham W. Taylor and Geoffrey E. Hinton. Products of hidden markov models :
It takes n ¿ 1 to tango. In Twenty-fifth Conference on Uncertainty in Artificial
Intelligence, pages 522–529. AUAI Press, 2009b.
Graham W. Taylor, Geoffrey E. Hinton, and Sam Roweis. Modeling human motion
using binary latent variables. Advances in neural information processing systems
(NIPS), 19:1345–1352, 2006. ISSN 1049-5258.
Matthew E Taylor and Peter Stone. Transfer learning for reinforcement learning
domains : A survey. Journal of Machine Learning Research, 10:1633–1685, 2009.
Louis ten Bosch, Lou Boves, Hugo Van Hamme, and Roger K. Moore. A computational
model of language acquisition: the emergence of words. Fundamenta Informaticae,
90(3):229–249, 2009.
Louis F.M. ten Bosch, Hugo Van Hamme, and Lou W.J. Boves. Unsupervised
detection of words questioning the relevance of segmentation. In Speech Analysis
and Processing for Knowledge Discovery, ITRW ISCA. Bonn, Germany : ISCA,
2008.
Edward L. Thorndike. Animal intelligence; experimental studies. New York, The
Macmillan company, 1911.
Sebastian Thrun and Tom M. Mitchell. Lifelong robot learning. Robotics and
autonomous systems, 15(1):25–46, 1995.150 BIBLIOGRAPHY
Michael Tomasello. Origins of human communication. MIT press Cambridge, 2008.
Matthew C Tresch and Anthony Jarc. The case for and against muscle synergies.
Current opinion in neurobiology, 19(6):601–7, December 2009. ISSN 1873-6882.
doi: 10.1016/j.conb.2009.09.002.
Elio Tuci, Tomassino Ferrauto, Arne Zeschel, Gianluca Massera, and Stefano Nolfi.
An experiment on behaviour generalisation and the emergence of linguistic compositionality
in evolving robots. IEEE Transactions on Autonomous Mental
Development, 3(2):1–14, 2011.
Alan Mathison Turing. Computing machinery and intelligence. Mind, 59(236):
433–460, 1950.
Hugo Van Hamme. Hac-models: a novel approach to continuous speech recognition.
In Interspeech ISCA, pages 2554–2557, 2008.
Juyang Weng, James McClelland, Alex Pentland, Olaf Sporns, Ida Stockman, Mriganka
Sur, and Esther Thelen. Autonomous mental development by robots and
animals. Science, 291(5504):599–600, 2001.
Andrew Whiten and R. Ham. On the nature and evolution of imitation in the animal
kingdom: reappraisal of a century of research. Advances in the Study of Behavior,
21:239–283, 1992.
Matthew M. Williamson. Postural primitives: Interactive behavior for a humanoid
robot arm. In International Conference on Simulation of Adaptive Behavior,
number 4, pages 124–131, 1996.
Britta Wrede, Katharina Rohlfing, Jochen Steil, Sebastian Wrede, Pierre-Yves
Oudeyer, and Jun Tani. Towards robots with teleological action and language
understanding. In Emre Ugur, Yukie Nagai, Erhan Oztop, and Minoru Asada,
editors, Humanoids 2012 Workshop on Developmental Robotics: Can developmental
robotics yield human-like cognitive abilities?, Osaka, Japon, November 2012.
Chen Yu and Dana H Ballard. A multimodal learning interface for grounding spoken
language in sensory perceptions. Transactions on Applied Perception, (1):57–80,
2004.
Chen Yu and Dana H. Ballard. A unified model of early word learning: Integrating
statistical and social cues. Neurocomputing, 70(13-15):2149–2165, August 2007.
ISSN 09252312. doi: 10.1016/j.neucom.2006.01.034.
Daniel Yurovsky, Chen Yu, and Linda B. Smith. Statistical speech segmentation
and word learning in parallel: scaffolding from child-directed speech. Frontiers in
psychology, 3, 2012.
Brian D Ziebart, Andrew Maas, J Andrew Bagnell, and Anind K Dey. Maximum
entropy inverse reinforcement learning. In AAI Conference on Artificial Intelligence,
number 23, pages 1433–1438, 2008.
Quality Assessment of Fingerprints with Minutiae
Delaunay Triangulation
Z Yao, Jean Marie Le Bars, C Charrier, C Rosenberger
To cite this version:
Z Yao, Jean Marie Le Bars, C Charrier, C Rosenberger. Quality Assessment of Fingerprints with
Minutiae Delaunay Triangulation. International Conference on Information Systems Security
and Privacy , Feb 2015, Angers, France.
HAL Id: hal-01096174
https://hal.archives-ouvertes.fr/hal-01096174
Submitted on 16 Dec 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Quality Assessment of Fingerprints
with Minutiae Delaunay Triangulation
Z. Yao, J. Le bars, C. Charrier and C. Rosenberger
Universite de Caen Basse Normandie; ENSICAEN; UMR 6072 GREYC, Caen, France.
{jean-marie.lebars; christophe.charrier}@unicaen.fr {zhigang.yao; christophe.rosenberger}@ensicaen.fr
Keywords: Fingerprint, minutiae template, quality assessment, evaluation.
Abstract: This article proposes a new quality assessment method of fingerprint, represented by only a set of minutiae
points. The proposed quality metric is modeled with the convex-hull and Delaunay triangulation of the minutiae
points. The validity of this quality metric is verified on several Fingerprint Verification Competition (FVC)
databases by referring to an image-based metric from the state of the art (considered as the reference). The
experiments of the utility-based evaluation approach demonstrate that the proposed quality metric is able to
generate a desired result. We reveal the possibility of assessing fingerprint quality when only the minutiae
template is available.
1 INTRODUCTION
The purpose of fingerprint quality assessment is to
improve or guarantee the performance of a biometric
system (Grother and Tabassi, 2007) by forbidding
bad quality fingerprint samples, especially during
the enrollment session. Existing studies of this issue
mostly define the quality in terms of the clarity of
ridge-valley pattern, contrast between foreground
and background, smoothness of orientation and etc
(Ratha and Bolle, 1999; Bolle et al., 1999; Chen et al.,
2004). No matter how many aspects are considered
by a fingerprint quality assessment approach, it is all
about features employed for generating the quality
metric. Prior studies in estimating fingerprint quality
had proposed several features (Alonso-Fernandez
et al., 2007), among which some are carried out by
using an unique feature, while some others combine
multiple features together. For instance, Chen et al.
proposed the Fourier spectrum-based quality metric
with the Butterworth function, Zhao el al. (Zhao
et al., 2010) concluded that the orientation certainty
level (OCL) (Lim et al., 2002) also performs well
for high resolution fingerprint image and Tabassi
et al. (Tabassi et al., 2004) proposed NFIQ with
multiple features including minutiae quality. To
standardize the quality metric of biometric sample,
the quality has been defined as a utility property
(Staff, 2009), i.e. sample quality reflects its impact
on the performance of the system. However, system
performance fully relies on the matching approach
such as minutiae-based system which is employed
most in actual deployments. In this case, it is
reasonable to consider qualifying fingerprint with
only minutiae information, particularly when using
for embedded applications.
There are very few quality assessment approaches
that take into account minutiae information, such
as NFIQ. Moreover, none of the state-of-the-art approaches
qualifies a fingerprint from the minutiae
template alone. The main contribution of the proposed
study is a black box algorithm that computes
quality score from a minutiae template associated to
the fingerprint. In another word, it could be viewed as
a quality metric for assessing the quality of a minutiae
template. The benefit of having this type of metric
is related to embedded biometric systems in smart
cards or smart objects where only the minutiae template
is available due to computational and storage
constraints.
This paper is organized as follows. Section 2
presents the proposed quality metric. Details of the
experimental results are given in section 3. Section 4
concludes the paper and discusses the perspectives.
2 METRIC DEFINITION
Fingerprint matching approaches, according to the literature
(Maltoni et al., 2009), are broadly classifiedas minutiae-based, correlation-based or image-based,
among which minutiae-based is the most widely studied
solution. A minutiae template generally provides
three kinds of information: 1) minutia location, 2)
the orientation and 3) the type of minutia point (ridge
ending and bifurcation), see figure 1.
Figure 1: A fingerprint and its minutiae template.
These features are sufficient to reconstruct a synthetic
fingerprint from a given template (Feng and
Jain, 2011) as the orientation field can be estimated.
Another kind of information is the amount of detected
minutiae points, which has been used as one factor
(Tabassi et al., 2004) for quality assessment of fingerprint
samples. However, this information is far from
being enough for generating an effective quality metric.
In order to do so, the minutiae template is related
with the foreground of fingerprint because the area of
minutiae indicates an available and useful region for
the so-called ’extractability’ of features. In this case,
this paper proposed to estimate fingerprint quality by
modeling the associated minutiae template with the
convex-hull and Delaunay triangulation (Cf. figure
2).
Figure 2: A convex hull (left) and Delaunay Triangulation.
The 2D convex hull (Andrew, 1979)
Ci = {(xj
, y j)| j = 1,··· ,Ni} (where Ni
is the
minutiae number of the i
th fingerprint) is defined as
the smallest convex set that contains all the points of
a given set of minutiae Fi
in this case (Cf. figure 2).
The Delaunay Triangulation of a set of points P in 2D
plane is defined as a triangulation DT(P) (Delaunay,
1934) that none of the points of the given set are
inside the circumcircle of any triangle of DT(P), as
illustrated in figure 2.
With the respective properties of these two geometric
structures, an area of the smallest informative
region of the fingerprint and a set of areas and
perimeters of triangles composed by each 3 minutiae
points are obtained. By doing so, one unavoidable
problem is observed that almost all the templates
of bad quality fingerprints contain both correctly
detected minutiae point and spurious points. Based
on this observation, we proposed a quality metric as
described below.
Let a minutiae template Fi of a fingerprint containing
a set of detected minutiae points represented
by mj = (xj
, yj
,θj), where (xj
, yj) is the location
and θj
is the orientation of the j
th minutia point;
A convex hull denoted by Ci and a set of triangles
(Tk) formed by Delaunay triangulation, formulated
as DT(Fi) = {Tk|k = 1,2,··· ,Li} where Li (< 2Ni)
is the number of triangles can be constructed from
Fi
. Correspondingly, the convex hull encloses all the
minutiae of Fi with the smallest area represented by
Ai
, and a set of areas Sk and perimeters Pk of DT(Fi)
are respectively obtained.
In the experiments, we observed that bad quality
samples generate tiny and extremely narrow triangles
(considered as unreasonable) due to spurious minutiae
points. The quantitative values of their area and
perimeter are (visually) not proportional to each other,
as observed in Figure 3.
Figure 3: Example of minutiae Delaunay triangulations of 3
different FVC images. NFIQ values are 2, 2 and 1, respectively.
In figure 3, triangles drew by the pink color indicates
the unreasonable minutiae structures. Based on
these observations, the quality metric (abbreviated asMQF afterwards) is calculated with several steps, as
described by algorithm 1. In the computation of the
proposed quality metric, three thresholds are set for
triangle perimeter, triangle area and the ratio between
the perimeter and area of the triangle, which are represented
by Yp, Ya and Yr
, respectively. The details
for choosing the most appropriate parameters are discussed
in section 3. The quality value q is dependent
on the size of the minutiae region so that it is normalized
into the range of [0, 100] on each database.
Algorithm 1 Computation of the quality score.
Input:
Minutiae Template Fi
.
Output:
Quality index, q;
1: Calculate the area of the convex hull Ci
, denoted
as Ai
;
2: Calculate perimeter and area for each triangle Tk,
denoted as Pk and Sk;
3: AYp = area(Search(Pk < Yp));
4: AYa = area(Search(Sk < Ya));
5: AYpa = area(Search(Pk < Yp & Sk < Ya));
6: AYr = area(Search(PkSk) > Yr);
7: Sarea =
Ai −AYp −AYa −AYr −AYpa
;
8: return q = Sarea;
Obviously, this algorithm relates the minutiae
template with the area of a region for matching operations
as it has just been mentioned before. However,
this factor is not sufficient so that we consider to remove
a part of potentially useless area from the informative
region due to the lack of image information.
Delaunay triangulation gives a relatively ideal solution
to this problem thanks to the spurious minutiae of
bad quality images. For example, as it is depicted in
figure 3, some unreasonable triangles formed by spurious
minutiae on the border enable us to remove the
corresponding area. Another case is the tiny triangle
which is mostly happened to the area where the quality
of ridge-valley pattern is relatively bad. The study
also noted that some fingerprint images have several
genuine minutiae clustering in a very small area. This
case is not specially considered in the proposed algorithm
just because of the limitation of the template.
The area of each triangle is obtained by using Heron’s
formula (Aufmann et al., 2007).
3 EXPERIMENTAL RESULTS
In order to validate the MQF, we adopt several
approaches to estimate the performance of the quality
metric: 1) the Pearson correlation coefficients between
the MQF and several others (from the state-ofthe-art)
are calculated and 2) the MQF is evaluated
by using an utility-based evaluation approach (Yao
et al., 2014). The experiment is performed with a
laptop driving by an Intel Celeron dual-core CPU of
1.73GHz. The experimental protocol is presented at
first.
3.1 Protocol et Database
In this study, several FVC databases with different
resolutions (Maio et al., 2004) have
been used for experiments: FVC2000DB2A,
FVC2002DB2A, FVC2004DB1A, FVC2004DB2A
and FVC2004DB3A. The first database is established
by a low capacitive sensor and the last one relies on a
thermal sweeping sensor, while others are established
by several optical sensors, see table 1 for details.
Table 1: Details of databases.
DB Sensor Type Resolution Image Dim
00DB2A Capacitive 500dpi 256×364
02DB2A Optical 569dpi 296×560
04DB1A Optical 500dpi 480×640
04DB2A Optical 500dpi 328×364
04DB3A Thermal 512dpi 300×480
Each of these databases involves 100 fingerprints,
and 8 samples for each fingerprint. In this case,
the matching scores involved in the experiment have
been calculated by using the NBIS tool (Watson
et al., 2007), Bozorth3. The intra-class scores contain
7×100 = 700 genuine scores, and the interclass
scores consist of 7×99×100 = 69300 impostor
scores for the whole database. Minutiae templates
used in the experiment were also extracted by using
the NBIS tool, MINDTCT. This software generates
a quadruple representation of minutia point,
mi = {x, y,o,q}, where (x, y) is the location of minutia
point, o indicates orientation and q is a quality score
of minutia point. In the experiment, the location has
been used only for calculating the proposed quality
metric.
3.2 Parameter Settings
Fernandez et al. (Alonso-Fernandez et al., 2007)
and Olsen (Olsen et al., 2012) respectively calculated
Pearson and Spearman correlation coefficients
between different quality metrics to observe their
behavior. Similarly, we investigate the behavior of
the proposed quality metric through the Pearson
correlation coefficients, by which the parameters areappropriately selected as well.
The three thresholds (Yp, Ya and Yr) are all empirical
values observed in the experiments and they are
all dependent on the resolution of the image which is
supposed to be over 500 dpi in this study. With the
experiment, we noted that the smallest area of the triangles
of each template is generally less than 70 (considering
a histogram of 100 bins). This value is only
a scalar without considering the unit of the measurement.
In this case, we firstly preferred to choose a
value of the area over 70. In addition, it is easy to
observe that a threshold larger than 80 may loose the
significance of this parameter. The variation of the
correlation values (larger than 0.3) demonstrates this
problem, see figure 4.
Figure 4: The variation of correlation between the proposed
metric and OCL as the parameter changes.
Likewise, the smallest perimeter value of the triangles
of each template is mostly within the interval
[10, 80], and generally lies around 35 (according to
the histogram). In this case, we further consider the
relation between the area and the perimeter of those
triangles that seemed abnormal. Without considering
the unit of the two measurements (one is 1-D and
another is 2-D), we observed that the value of the
perimeter is generally smaller than the area. In this
case, inspiring by the Heron’s formula, we choose
a threshold to represent the ratio between these two
measurements. We observed that the triangle is
extremely narrow if the ratio between a perimeter
and an area is close to 1. Besides, similarly, it is
also not necessary to consider larger values for the
perimeter. We first choose a reference quality metric
among all the others. The correlation of OCL doesn’t
vary so much on variant databases. Therefore, we
simply choose the OCL in the experiment. Figure 4
provides only the graphical result of the variation of
correlation value between OCL and the quality metric
obtained with a series values of two parameters. In
the experiments, the thresholds of the area and
perimeter vary in the range of [40, 100] and [30, 80]
with an interval of 1, respectively.
According to figure 4, we also observed that the
variation of Yp leads to more impacts on the correlation
coefficient than Ya when other parameters had
been set approximately. In order to achieve a generality
of the proposed quality metric, the values of Yp, Ya
and Yr
in this study are 75, 70 and 0.8, respectively.
At last, the behavior of these parameters were estimated
by using performance validation approach, and
the variation of the performance measurement (EER)
obtained in a small interval of each of them tends to be
stagnant. With this empirical analysis, the parameters
are set as what had just been mentioned.
3.3 Feature Analysis
To validate the MQF, we calculate the correlation coefficients
between several quality metrics we have
studied including the MQF. In addition to the two
orientation-based indexes, OCL and the orientation
flow (OF) (Lim et al., 2002), we also employ a
wavelet domain feature carried out via the Pet Hat’s
continuous wavelet (PHCWT) (Nanni and Lumini,
2007). In the literature, it is said that the Pet Hat
wavelet is sensitive to the sharp variations of features
such as fingerprint ridges. Nevertheless, we also use a
pixel-based quality metric which is the standard deviation
(STD) of fingerprint local block indicating pixel
information of the image (Lee et al., 2005). The NFIQ
is also involved in this section. Table 2 presents the
correlation results of the trial quality metrics.
Table 2: Inter-class Pearson correlation coefficients.
FVC2002DB2A
OCL OF PHCWT STD MQF NFIQ
1 0.013 0.932 0.892 0.781 -0.503
0.013 1 0.092 0.122 0.070 0.061
0.932 0.092 1 0.954 0.788 -0.474
0.892 0.122 0.954 1 0.678 -0.374
0.781 0.070 0.788 0.678 1 -0.422
-0.503 0.061 -0.474 -0.374 -0.422 1
Table 2 provides only an inter-class correlation result
of the employed quality metrics obtained from
FVC2002DB2A. According to the coefficient values
indicated with the highlighted cells, one can observe
that MQF demonstrates the correlated behavior with
the others except the OF. The correlation coefficientsbetween the proposed metric and others calculated
from the remaining databases are given in table 3
Table 3: Pearson correlation coefficients between MQF and
others.
MQF of OCL OF PHCWT STD NFIQ
00DB2 0.409 -0.131 0.291 0.301 -0.081
04DB1 0.899 0.253 0.905 0.817 -0.201
04DB2 -0.050 -0.489 0.722 0.650 -0.378
04DB3 0.863 0.021 0.818 0.811 -0.363
According to the results, in addition to
FVC2000DB2A, one can note that MQF shows
a relatively stable correlation with other metrics, i.e.
it exhibits an usability to variant databases. The correlation
value between the proposed metric and OCL
for FVC2004DB2A shows an odd value because
a lot of over-inked samples are contained in this
database. This problem results in some difficulties
for calculating the OCL and leads to a lot of singular
values. Note that the proposed metric uses only the
set of minutiae location, and the fingerprint image is
considered as unavailable.
3.4 Evaluation
According to the literature (Grother and Tabassi,
2007), the quality measure of a biometric sample
is generally employed within 3 different cases: 1)
including enrollment phase, 2) verification task
and 3) identification. Enrollment is known as a
supervised task for getting relatively good quality
samples. The purpose for doing so is to guarantee the
performance or reduce the recognition error as much
as possible, i.e. the typical quality control operation.
However, if the purpose is to validate a quality metric
without considering the testing type (i.e. algorithm
testing, scenario testing and so on.), the variation
of the quality of enrollment sample would generate
distinctive impacts on matching performance and the
result is repeatable in the experiments. In this case,
to estimate the validity of the MQF, an enrollment
phase evaluation approach is applied to the quality
metric (Yao et al., 2014).
We computed the EER values of all the trial
databases by choosing the best quality samples as the
enrollments (in terms of quality value generated by
MQF and NFIQ). A valid quality metric for choosing
the enrollment samples should reduce error rates.
Two graphs with the logarithmic curves and the EER
values of two different cases are given in figure 5 to
illustrate the enrollment selection strategy.
(a) FVC2002DB2A
(b) FVC2004DB2A
Figure 5: The DET curves and global level EER values
obtained by using the evaluation approach. 5a is
FVC2002DB2A; 5b is FVC2004DB2A.
In figure 5, the EER values of the two datasets
based on NFIQ are 13.2% (02DB2A) and 12.4%
(04DB2A), while the values corresponding to MQF
are: 10.5% (02DB2A), and 13.6% (04DB2A), respectively.
Table 4: The average EER values based-on enrollment selection.
QM
DB 00DB2A 04DB1A 04DB3A
MQF 5.05% 15.03% 6.96%
NFIQ 4.98% 15.33% 7.48%
According to this result, the performance of MQF
is validated with the property that a good quality index
reduces the matching error. However, a further
validation needs to be acquired for making a conclusion
that the global EER value is a statistically objective
measurement of the performance. To do so,
we calculate a confidence interval (CI) (Giot et al.,2013) at 95% level for the global EER values based
on different quality metrics. In biometrics, the CI of
two different measurements are able to indicate the
statistical difference between them if their confidence
intervals do not overlap each other. The CI values of
the EER for each quality metric is calculated via a set
of randomly selected intra-class and inter-class score
samples after enrollment selection. The size of each
kind of randomly selected matching scores is 500, and
hence the 95% CI is obtained with 1000 samples of
the EER values, i.e. this random selection has been
performed for 1000 iterations to calculate EER samples.
Table 4 provides the average EER values of the
other 3 databases.
Table 5: The 95% confidence interval of the EERs.
DB
QM MQF NFIQ
00DB2A (CI) [0.0498 0.0510] [0.0492 0.0502]
02DB2A (CI) [0.1101 0.1118] [0.1323 0.1337]
04DB1A (CI) [0.1493 0.1509] [0.1531 0.1548]
04DB2A (CI) [0.1509 0.1535] [0.1318 0.1340]
04DB3A (CI) [0.0683 0.0694] [0.0742 0.0754]
In table 5, the CI of the EER values based on the
two quality metrics statistically illustrates the validity
of the proposed quality metric. The overlap happened
to FVC2000DB2A, for the EER values obtained from
this database is nearly the same. Moreover, we simply
choose several images to illustrate the differences
between the two quality metrics and their drawbacks.
For instance, the MQF values of the samples given in
figure 6 are (2.94, 38.61, 38.46, 64.11, 61.2), and
their NFIQ values are all level 2. According to sample
(a), one can find that it contains only a partial of
the fingerprint image which is not suitable for matching.
In addition, the samples with MQF values under
40 are not as good as a level 2 sample in this example.
The samples (b) and (c) would result in spurious
minutiae. On the other hand, an obvious shortage of
MQF is the area measurement which would generate
outliers in many cases, such as the samples illustrated
by figure 6 (d) and (e).
Figure 6: Illustration of the different between MQF and
NFIQ.
The experiments are implemented via Matlab
7.12. The computation takes approximately 0.423
seconds per sample according to a calculation of 1600
samples when the input is image, and 0.122 seconds
for template inputs.
4 CONCLUSION
This study mainly focuses on estimating fingerprint
quality simply with a minutiae template.
By investigating the relation between image-based
quality criteria and the structure of minutiae template,
we calculate the area of minutiae region via a convex
hull and the Delaunay triangulation. The uniqueness
of Delaunay triangulation provides a possibility
that some unreasonable minutiae could be further
eliminated from template, and the particular rules
for calculating convex hull enables estimating a
relatively minimum area of the detected minutiae.
Accordingly, we define a simple yet efficient quality
metric for fingerprint and minutiae template. In
another aspect, the quality metric could be affected
by some bad samples with large minutiae region. The
lack of image information makes this problem inevitable.
Correspondingly, we analyzed the proposed
quality metric via Pearson correlation coefficients
and evaluated its performance with an enrollment
phase approach. Therefore, it is reasonable to conclude
that the proposed quality metric is an effective
measurement for assessing the quality of a various of
fingerprint samples when their associated templates
are available only.
As fingerprint quality metric is generally defined
with multiple features, this quality metric therefore
could be a candidate for those composite metrics. The
future work of this study tends to concentrate on combining
this quality metric with some others extracted
from minutiae template to obtain better performance.REFERENCES
Alonso-Fernandez, F., Fierrez, J., Ortega-Garcia, J.,
Gonzalez-Rodriguez, J., Fronthaler, H., Kollreider,
K., and Bigun, J. (2007). A comparative study of
fingerprint image-quality estimation methods. Information
Forensics and Security, IEEE Transactions on,
2(4):734–743.
Andrew, A. M. (1979). Another efficient algorithm for convex
hulls in two dimensions. Information Processing
Letters, 9(5):216–219.
Aufmann, R., Barker, V., and Nation, R. (2007). College
Trigonometry. Cengage Learning.
Bolle, R. M., Pankanti, S. U., and Yao, Y.-S. (1999). System
and method for determining the quality of fingerprint
images. US Patent 5,963,656.
Chen, T., Jiang, X., and Yau, W. (2004). Fingerprint image
quality analysis. In Image Processing, 2004. ICIP ’04.
2004 International Conference on, volume 2, pages
1253–1256 Vol.2.
Delaunay, B. (1934). Sur la sphere vide. Izv. Akad.
Nauk SSSR, Otdelenie Matematicheskii i Estestvennyka
Nauk, 7(793-800):1–2.
Feng, J. and Jain, A. K. (2011). Fingerprint reconstruction:
from minutiae to phase. Pattern Analysis and Machine
Intelligence, IEEE Transactions on, 33(2):209–223.
Giot, R., El-Abed, M., and Rosenberger, C. (2013). Fast
computation of the performance evaluation of biometric
systems: Application to multibiometrics. Future
Gener. Comput. Syst., 29(3):788–799.
Grother, P. and Tabassi, E. (2007). Performance of biometric
quality measures. Pattern Analysis and Machine
Intelligence, IEEE Transactions on, 29(4):531–543.
Lee, B., Moon, J., and Kim, H. (2005). A novel measure
of fingerprint image quality using the Fourier spectrum.
In Jain, A. K. and Ratha, N. K., editors, Society
of Photo-Optical Instrumentation Engineers (SPIE)
Conference Series, volume 5779 of Society of PhotoOptical
Instrumentation Engineers (SPIE) Conference
Series, pages 105–112.
Lim, E., Jiang, X., and Yau, W. (2002). Fingerprint quality
and validity analysis. In Image Processing. 2002.
Proceedings. 2002 International Conference on, volume
1, pages I–469–I–472 vol.1.
Maio, D., Maltoni, D., Cappelli, R., Wayman, J. L., and J.,
A. K. (2004). Fvc2004: Third fingerprint verification
competition. In Biometric Authentication, pages 1–7.
Springer.
Maltoni, D., Maio, D., Jain, A. K., and Prabhakar, S. (2009).
Handbook of fingerprint recognition. Springer.
Nanni, L. and Lumini, A. (2007). A hybrid waveletbased
fingerprint matcher. Pattern Recognition,
40(11):3146–3151.
Olsen, M., Xu, H., and Busch, C. (2012). Gabor filters as
candidate quality measure for NFIQ 2.0. In Biometrics
(ICB), 2012 5th IAPR International Conference
on, pages 158–163.
Ratha, N. K. and Bolle, R. (1999). Fingerprint image quality
estimation. IBM TJ Watson Research Center.
Staff, B. S. I. (2009). Information Technology. Biometric
Sample Quality. Framework. B S I Standards.
Tabassi, E., Wilson, C., and Watson, C. (2004). NIST fingerprint
image quality. NIST Res. Rep. NISTIR7151.
Watson, C. I., Garris, M. D., Tabassi, E., Wilson, C. L.,
Mccabe, R. M., Janet, S., and Ko, K. (2007). User’s
guide to nist biometric image software (nbis).
Yao, Z., Charrier, C., and Rosenberger, C. (2014). Utility
validation of a new fingerprint quality metric.
In International Biometric Performance Conference
2014. National Insititute of Standard and Technology
(NIST).
Zhao, Q., Liu, F., and Zhang, D. (2010). A comparative
study on quality assessment of high resolution fingerprint
images. In Image Processing (ICIP), 2010 17th
IEEE International Conference on, pages 3089–3092.
IEEE.
Fingerprint Quality Assessment Combining Blind Image
Quality, Texture and Minutiae Features
Z Yao, Jean Marie Le Bars, C Charrier, C Rosenberger
To cite this version:
Z Yao, Jean Marie Le Bars, C Charrier, C Rosenberger. Fingerprint Quality Assessment
Combining Blind Image Quality, Texture and Minutiae Features. International Conference on
Information Systems Security and Privacy , Feb 2015, Angers, France.
HAL Id: hal-01096170
https://hal.archives-ouvertes.fr/hal-01096170
Submitted on 16 Dec 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Fingerprint Quality Assessment Combining Blind
Image Quality, Texture and Minutiae Features
Z. Yao, J. Le bars, C. Charrier and C. Rosenberger
Universite de Caen Basse Normandie; ENSICAEN; UMR 6072 GREYC, Caen, France.
{jean-marie.lebars; christophe.charrier}@unicaen.fr {zhigang.yao; christophe.rosenberger}@ensicaen.fr
Keywords: Fingerprint, minutiae template, quality assessment, evaluation.
Abstract: Biometric sample quality assessment approaches are generally designed in terms of utility property due to the
potential difference between human perception of quality and the biometric quality requirements for a recognition
system. This study proposes a utility based quality assessment method of fingerprints by considering
several complementary aspects: 1) Image quality assessment without any reference which is consistent with
human conception of inspecting quality, 2) Textural features related to the fingerprint image and 3) minutiae
features which correspond to the most used information for matching. The proposed quality metric is obtained
by a linear combination of these features and is validated with a reference metric using different approaches.
Experiments performed on several trial databases show the benefit of the proposed fingerprint quality metric.
1 INTRODUCTION
Fingerprint systems, among biometric modalities,
are the most deployed solution due to the invariability,
usability and user acceptance of fingerprints (Jain
et al., 2004). So far, the application of fingerprint
is no longer limited to traditional public security
area (official applications), but spread into the daily
life, smart phone authentication and e-payment, for
instance. Because of the continuous developments,
fingerprint quality assessment has become a crucial
task in the deployment of systems in real applications.
There is no doubt that a good quality sample
during the enrollment process can reduce recognition
errors. The good quality of a fingerprint sample is
also beneficial to matching operations (Grother and
Tabassi, 2007) in addition to the clarity of human
intuition and feature extractability of the image
(Chen et al., 2005). In this case, most previously
proposed fingerprint quality approaches have been
implemented in terms of utility of biometric sample’s
quality rather than fidelity (Alonso-Fernandez
et al., 2007), i.e. biometric sample’s quality should
be related to system performance. Tabassi et al.
(Tabassi et al., 2004) defined their quality metric
as a predictor of system performance by considering
the separation of genuine matching scores
(GMS) and impostor matching scores (IMS). Chen
et al. (Chen et al., 2005) later proposed one quality
metric by considering authentication performance.
As we can see in the literature, features are very
important to make a reliable judgment of the quality
of a fingerprint. Moreover, a fingerprint can be
considered as an image or a set of minutiae we could
extract many features. This study proposes a quality
metric of fingerprint image based on the utility
property by considering two aspects in general: 1)
the fingerprint image itself and 2) the corresponding
minutiae template which is rarely taken into account
for this issue. The validation of the proposed quality
metric is carried out by using two approaches based
on the prediction of authentication performance.
The main contribution of the paper is to propose a
continuous quality index of a fingerprint integrating
different points of view (brought by the used features)
and providing a better assessment.
This paper is organized as follows: Section 2 details
the features for computing the proposed quality
metric. Section 3 presents the computation approach
of the proposed quality metric. Experimental results
are given in 4. Conclusion is given in section 5.
2 QUALITY FEATURES
The general purpose of this work is to qualify
original fingerprint samples and to analyze the proposed
quality metric through different validation ap-proaches. The proposed quality metric is based on a
former method in (El Abed et al., 2013). That work
evaluated altered fingerprint image quality with two
kinds of quality features, one is universal (no reference
image quality assessment) and another is related
to the fingerprint modality. We employ this framework
for the original fingerprint samples.
2.1 NR-IQA and Prior Features
In (El Abed et al., 2013), 11 features have been used
to obtain the quality metric, including one derived
from a NR-IQA algorithm (Saad et al., 2012) and the
others are image-based features. Details of the feature
are not presented again in this paper. A general
description is given in table 1.
Table 1: List of quality features in (El Abed et al., 2013)
Feature Description NO.
NR-IQA BLIINDS (Saad et al., 2012) 1-N1
SIFT point
number
Number of SIFT keypoints 2-S1
SIFT DC coef-
ficient
DC coefficient of SIFT features 3-S2
SIFT Mean Mean measure related to SIFT keypoints 4-S3
SIFT STD
Standard deviation related to SIFT keypoints
5-S4
Block number Number of blocks (17×17) 6-P1
Patch RMS
Mean
Mean of blocks RMS1 values. 7-P2
Patch RMS
STD
Standard deviation of RMSs 8-P3
Patch RMS
Median
Median of blocks RMSs. 9-P4
Patch RMS
skewness
Skewness of blocks RMSs. 10-P5
Median LBP 256-level MBP histogram 11-P6
1. ’RMS’ is the abbreviation of Root Mean Square.
Salient features are extracted by using Scale Invariant
Feature Transform (SIFT) operator. For
patched features, it firstly divide images into blocks of
17×17, and then the root mean square (RMS) value of
each block is computed to obtain the quality features.
2.2 Texture-based Quality Features
Texture features are widely used for image classifi-
cation and retrieval applications. There is not study
observed that whether some of them are able to contribute
distinctive results for quality assessment of fingerprint
image. In this study, 11 texture features have
been selected as the components for generating the
proposed quality metric, cf. 2. These features have
been classified into four classes:
1) The first class of textural features embeds local binary
pattern (LBP) features and its extensions or
transforms. LBP features have been proposed by
Ojala et al (Ojala et al., 2002) for image classifi-
cation. This feature is simple yet efficient so that
it is widely used for texture analysis. The idea of
LBP operator was that the two-dimensional surface
textures can be described by two complementary
measures: local spatial pattern and gray scale
contrast (Pietikainen, 2011). Basic LBP operator ¨
generates a binary string by thresholding each 3-
by-3 neighborhood of every pixel of the image.
Table 2: List of texture features.
Feature Format NO.
LBP 256-level LBP histogram vector 1-C1
Four-patch
LBP
Descriptor code vector 2-C1
Completed
LBP
512-bit 3D joint histogram vector 3-C1
GLCM measures
8-bit GLCM vector 4-C2
LBP H-FT LBP histogram FT1 vector 5-C1
2S 16O1 Gabor 64-bit Gabor response vector 6-C3
4S 16O Gabor 128-bit Gabor response vector 7-C3
8S 16O Gabor 256-bit Gabor response vector 8-C3
16S 16O Gabor
512-bit Gabor response vector 9-C3
LRS 81-bit LRS motif histogram vector 10-C4
Median LBP 256-level MBP histogram 11-C1
1. ’S’, ’O’ and ’FT’: abbr. of scale, orientation and Fourier Transform.
The transforms of LBP involved in this study
include four-patch LBP (FLBP), completed
LBP (CLBP), LBP histogram Fourier transform
(LBPHFT) (Nanni et al., 2012) and median LBP
(MLBP) (Hafiane et al., 2007).
2) Second class is Haralick feature or gray level
co-occurrence matrix (GLCM) (Haralick et al.,
1973). In this study, 4 statistic measures generated
from the GLCM matrix in 4 directions combination
of neighbor pixels are computed, including
energy, entropy, moment and correlation.
3) The 2D Gabor decomposition is a sinusoidal function
modulated by a Gaussian window. In this
case, the basis of a Gabor function is complete
but not orthogonal. In the last few decades, it has
been widely applied to fingerprint image and other
biometric data to perform classification and segmentation
tasks. Shen et al. (Shen et al., 2001)
proposed using Gabor response to evaluate fingerprint
image quality, in which it is said that one
or several Gabor features of 8-direction Gabor response
are larger than that of the others. Olsen etal. (Olsen et al., 2012) proposed a quality index
based on 4-direction Gabor response and it is said
that 4-direction is sufficient to qualify fingerprint.
However, in this study, it is observed that 2-scale
4-direction Gabor filters do not bring out distinctive
regularity for fingerprint images of a specified
database.
4) The last one concerns local relational string (LRS)
(Hafiane and Zavidovique, 2006) which is an illumination
invariant operator and it reflects variation
of local gray level of the image. The operator
is based on the local pixels relation in a specified
scale, and it uses 3 relations to generate local relation
motif histogram for measuring local spatial
variations of the image.
2.3 Minutiae-based Quality Features
Feng et al. (Feng and Jain, 2011) proposed to
reconstruct a fingerprint image from the triplet
representation of minutia point. Such a result demonstrates
the significance of minutiae template. In this
study, we relate the minutiae template to the quality
assessment of fingerprint by defining several quality
features based on minutiae number and DFT of the
three components of minutiae point, as shown in
table 3.
Table 3: Minutiae number-based measures related to fingerprint
quality.
Measure Description NO.
Minutiae number
(MN)
Minuitiae number of fingerprint. 1-M1
Mean of minutiae
DFT
Defined as equation (1b) 2-M1
STD of minutiae
DFT
Equation (1c) 3-M1
MN in ROI1 MN in a rectangle region. 4-M1
MN in ROI 2 MN in a circle region. 5-M1
Region-based
RMS
Root mean square (RMS) value of
MN based on two blocks of the template.
6-M1
Region-based median
Median value of MN obtained by dividing
the template into 4 blocks.
7-M1
Block-based measure
A block-based score for the template.
14-M1
1. region of interest.
Minutiae-based measures given in table 3 are
calculated based on a the template of detected
minutiae extracted by using NBIS tool (Watson
et al., 2007). This template contains a quadruple
representation of minutia point which consists of
1) the position (x, y) of detected minutiae, 2) the
orientation θ of detected minutiae, and 3) a quality
score of detected minutiae. In the experiment,
only the minutiae positions and orientations are
used for calculating these measures. In the following,
the details of some of the measures are presented.
In the experiment, both measure 2 and 3 are
derived from the magnitude of the Fourier transform
of the linear combination of 3 minutia components
after eliminating DC component, as described in
equation 1.
F (x, y,θ) =
N−1
∑
n=0
xn·µ
kn +yn·ν
kn +θ·ω
kn
. (1a)
where µ, ν, and ω are frequency samples. Measures
M2 and M3 are finally computed as follows:
M2 = |F (x, y,θ)|, (1b)
M3 =
s
1
N
N
∑
i=1
(Fi −M2). (1c)
DC component was eliminated when computing these
two measures because there is no valuable information
in this element.
For measure 4, the size of rectangle region is determined
by the maximum value of both x and y coordinates
of minutiae, for which there is no useful information
outside the foreground of the fingerprint in
this case. This choice also ensures that the region of
interest will not go over the effective area of minutiae.
An example of rectangle region is shown in figure 1
(a).
Figure 1: Example of circle region (a), rectangle region (b),
and template block partition in the size of fingerprint (c).
The radius of the circle region for measure 5
is also determined by the maximum and minimum
location value of minutiae along the horizontal direction
of fingerprint, for minutiae lie around fingerprint
center are said to be those who contribute most to
fingerprint matching, i.e. they are considered as the
most informative. As the quadruple representation
does not provide information of fingerprint corepoint, an estimated point was used as the center’s
location of the fingerprint. A comparison has been
made between the estimated center point and a core
point detected by another approach, and it is found
that the result does not vary too much. The estimated
center position was determined by considering the
maximum and minimum minutiae location as well.
An example of the circular region is shown in figure
1 (b).
For measures 6 and 7, the whole fingerprint
region is divided into 2 and 4 blocks, and minutiae
number in each block is considered to generate a
measure. Another block-based measure is calculated
by dividing the whole fingerprint region into several
blocks in the size of 64×64. The blocks are classified
into 3 classes, reasonable block, vague block, and
unreasonable block. At last, a quality index is
assigned to each block in terms of the minutiae
number in the block, for which a threshold is used
for determining the index of each block. An example
of block partition is shown by figure 1 (c). In
addition, features proposed in (Ross et al., 2005) are
calculated in terms of minutiae distribution and orientations,
and they are rotation and translation invariant.
We analyse in section 4.2 the behavior of these
quality features. Based on all these quality features,
we generate a quality metric using the method described
in the next section.
3 QUALITY METRIC
DEFINITION
The quality metric of fingerprint (QMF) image in
this study is computed by an approach using a Genetic
Algorithm (GA) proposed in (El Abed et al., 2013).
It uses a weighted linear combination of the quality
features, formulated as
Q =
N
∑
i=1
αiFi
, (2)
where N is the number of quality features Fi (i =
1,··· ,N), αi are the weighted coefficients. The
weighted coefficients are computed via optimizing
a fitness function of GA which is composed by the
Pearson correlation between combined quality results
defined by equation 2 and corresponding GMS of fingerprints
samples. This approach realizes a learning
of quality assessment and optimizes the weighted
coefficients to generate a continuous quality metric
combining different features.
4 EXPERIMENTAL RESULTS
In order to validate the behavior of the quality
metric (denoted as QMF) of this study, an analysis
of the proposed features is realized. The validation
of QMF is implemented by observing the evaluation
results of both QMF and NFIQ (Tabassi et al., 2004).
4.1 Protocol and Databases
In this study, three FVC databases (Maio et al., 2004)
have been used for experiments: FVC2002DB2A,
FVC2004DB1A, and FVC2004DB3A. The first two
databases are established by optical sensor and the
last one is thermal sweeping sensor. The resolutions
and image dimensions of all 3 databases are
500dpi, 500dpi, 512dpi, and 296×560, 480×640, and
300×480, respectively. Each database involves 100
fingertips, and 8 samples for each fingertip. The intraclass
and inter-class matching scores involved in the
experiment have been calculated by using NBIS tool
(Watson et al., 2007) namely Bozorth3 and a commercial
SDK (IDt, ). Minutiae template used in the experiment
were also extracted by using the corresponding
MINDTCT and the SDK. The minutiae-based features
involve in only the location (x, y) and the orientation
o of minutia so that we don’t consider the quality
value of the points (generated by MINDTCT) and
the type of them (given by SDK).
4.2 Feature Analysis
Fernandez et al. (Alonso-Fernandez et al., 2007)
and Olsen (Olsen et al., 2012) respectively calculated
Pearson and Spearman correlation coefficients
between different quality metrics to observe the
behaviour of them. We use the same approach in this
study by computing the Pearson correlation between
several quality metrics and the QMF. Quality metrics
used for this analysis include OCL (Lim et al., 2002),
orientation flow (OF) (Chen et al., 2004), standard
deviation (STD) (Lee et al., 2005), Pet Hat’s wavelet
(PHCWT) (Nanni and Lumini, 2007) and NFIQ.
Figure 5, 7, 6 presents the correlation results obtained
from the trial databases for all quality features.
In table 5, highlighted columns (with yellow)
demonstrated a relatively stable correlation for all
the three databases, and some others marked with
green illustrated their feasibility for certain data sets.
According to this observation, we could make an
attempt to reduce some redundant features in next
study. Table 7 presents only 11 of the minutiae-based
features, for the correlation of them is not very dis-tinctive. Some of them demonstrate good correlated
behavior with the quality metrics, but greatly vary
among the data sets and even not correlated with
any of the quality metrics. Likewise, the correlation
results of the image-based features are given in table
6. We use all these features to calculate the quality
metric which enables qualifying fingerprint samples
with complemental information. Note that the last
columns denote relatively good correlation between
the NR-IQA and the quality metrics.
4.3 Metric validation
The validation involves in two sections, one is the impact
of enrollment selection (YAO et al., 2014) and
another is a utility evaluation (Chen et al., 2005).
4.3.1 Impact on the enrollment process
Authors in (Grother and Tabassi, 2007) discussed on
quality values used for three different cases, including
enrollment phase, verification task and identification.
Enrollment is generally a supervised task for getting
relatively good quality samples, and one main
difference between verification and identification
tasks is the existence of enrollment which directly
impacts on how FNMR and FMR acts. However, if
the purpose is to validate a quality metric without
considering the testing type (i.e. algorithm testing,
scenario testing and etc.), the variation of enrollment
samples quality would generate distinctive impacts
on matching performance and the result is repeatable
in the experiments.
We computed the EER values of 3 databases by
choosing the best quality samples as the reference
(by using NFIQ and QMF). A good quality metric for
the choice of the references should reduce matching
error rate. The ROC curves and EER values of
FVC2004DB1A based on this strategy are presented
as an illustration, see figure 2.
The EER values by using NFIQ (for the enrollment
process) is 14.8%, and 14.1% with the QMF
metric. For FVC2002DB2A and FVC2004DB3A, the
EER values are 13.2% (NFIQ), 10.6% (QMF), 8.3%
(NFIQ) and 6.7% (QMF). These results show the benefit
of QMF face to NFIQ as it permits to optimize the
enrollment process.
Figure 2: Enrollment selection result of FVC2004DB1A.
In addition, such EER values are calculated via
the commercial SDK, results obtained via NFIQ
are 3.99% (02DB2A), 9.39% (04DB1A) and 4.76%
(04DB3A), while the values obtained by using QMF
are 3.39% (02DB2A), 5.35% (04DB1A) and 4.64%
(04DB3A), respectively. This result demonstrates
whether the QMF is possible for dealing with interoperability.
However, in practical, this property relies
on both the performance of matching algorithm and
the quality metric. We employ this result simply for
validating the QMF.
4.3.2 Quality and performance evaluation
The second approach is based on the isometric bins of
samples sorted in an ascending order the quality values
and is more strict for the distribution of the quality
values. In order to validate the QMF by referring to
NFIQ, instead of dividing quality values of NFIQ into
5 isometrics bins, we divided them into 5 bins which
correspond to its 5 quality labels. The reason for doing
so is that NFIQ fails to satisfy the isometric-bin
evaluation criteria, as given in figure 3.
Figure 3: Example of 5-bin evaluation for NFIQ on
FVC2002DB2A.Then, the EER values of the divided bins are calculated.
For NFIQ-based quality values, it is easier to
calculate the EER values of the 5 label bins, as it is
depicted in figure 4.
Figure 4: Monotonic increasing matching performance validation
of FVC2002DB2A for NFIQ, calculated by dividing
quality values into 5 isometric bins (no sample of quality 5
for this database).
Figure 5: Monotonic increasing matching performance validation
of FVC2002DB2A for QMF, calculated by dividing
quality values into 5 isometric bins.
We are able to observe that the matching performances
on FVC2002DB2A and FVC2004DB3A are
monotonically increased by pruning bad quality samples
gradually. NFIQ generated quality levels from 1
to 4 for FVC2002DB2A, and no samples of level 5
were figured out for this database. This might be due
to the minutiae points detected on the images of this
database, because NFIQ algorithm involves in minutia
quality of the fingerprint image. This situation was
observed when calculated the correlation between
14 minutiae quality features and genuine matching
scores in the experiment of this study. It shows
a relatively higher correlation on FVC2002DB2A,
while the values of two other databases are relatively
lower. For FVC2004DB1, both the proposed quality
metric and the reference algorithm showed certain
difficulties. Here, only the graphical results on
FVC2002DB2A are presented, while the 5 bins’ EER
values based on proposed approach and NFIQ of
FVC2004DB1A and FVC2004DB3A are given in table
4. The quality values of QMF are normalized into
[0, 100] on each database where small value denotes
bad quality (bin 1). The NFIQ has 5 quality levels
where level 1 represents the best quality and level 5 is
the worst one.
Table 4: 5 bins EER values based on QMF and NFIQ of
FVC2004DB1A and FVC2004DB3A.
Bin No. B1 B2 B3 B4 B5
Q
1
. (04DB1) 22.2% 16.6% 17.2% 17.8% 13.3%
N
1
. (04DB1) 15.8% 18.1% 17.7% 23.2% 26.5%
Q. (04DB3) 14.2% 8.9% 7.4% 5.8% 4.2%
N. (04DB3) 7.5% 8.1% 13.4% 12.9% 29.8%
1. ’Q’ and ’N’ are abbreviation of ’QMF’ and ’NFIQ’, respectively.
5 CONCLUSION
This study first propose a fingerprint quality
metric by considering image-based quality features
and those derived from minutiae template. Second,
the quality metric has been validated by using
different validation approaches. In the study, the
proposed quality metric was evaluated on 3 different
FVC databases, FVC2002 DB2 A, FVC2004 DB1 A,
and FVC2004 DB3 A. Among the validation result,
it can be observed that the performance of quality
metric shows a great variation between different
databases, where both the reference quality algorithm
and proposed quality metric obtain relatively good
result on FVC 2004 DB3 A. This is due to several
factors impacted on image quality and matching
performance. In addition to external factors such as
sensor type (Ross and Jain, 2004) and environment, it
might be involved in image factors, such as contrast,
image size, pixel density, foreground and background
area; and correspondingly the factors caused by
minutiae template, such as minutiae location, minutiae
reliability, and other minutiae properties if they
are considered.
In this study, a lot of quality features were adopted
for generating quality metric. In this case, it is necessary
to analyze the redundancy of quality feature
in the future work. Besides, in order to improve the
current quality metric, future works of this study will
also focus on feature processing for the quality metric.REFERENCES
User friendly toolkit for easy integration of state of the art
fingerprint recognition technology.
Alonso-Fernandez, F., Fierrez, J., Ortega-Garcia, J.,
Gonzalez-Rodriguez, J., Fronthaler, H., Kollreider,
K., and Bigun, J. (2007). A comparative study of
fingerprint image-quality estimation methods. Information
Forensics and Security, IEEE Transactions on,
2(4):734–743.
Chen, T., Jiang, X., and Yau, W. (2004). Fingerprint image
quality analysis. In Image Processing, 2004. ICIP ’04.
2004 International Conference on, volume 2, pages
1253–1256 Vol.2.
Chen, Y., Dass, S. C., and Jain, A. K. (2005). Fingerprint
quality indices for predicting authentication performance.
In Audio-and Video-Based Biometric Person
Authentication, pages 160–170. Springer.
El Abed, M., Ninassi, A., Charrier, C., and Rosenberger,
C. (2013). Fingerprint quality assessment using a noreference
image quality metric. In European Signal
Processing Conference (EUSIPCO), page 6.
Feng, J. and Jain, A. K. (2011). Fingerprint reconstruction:
from minutiae to phase. Pattern Analysis and Machine
Intelligence, IEEE Transactions on, 33(2):209–223.
Grother, P. and Tabassi, E. (2007). Performance of biometric
quality measures. Pattern Analysis and Machine
Intelligence, IEEE Transactions on, 29(4):531–543.
Hafiane, A., Seetharaman, G., and Zavidovique, B. (2007).
Median binary pattern for textures classification. In
Image Analysis and Recognition, pages 387–398.
Springer.
Hafiane, A. and Zavidovique, B. (2006). Local relational
string for textures classification. In Image Processing,
2006 IEEE International Conference on, pages 2157–
2160.
Haralick, R. M., Shanmugam, K., and Dinstein, I. H.
(1973). Textural features for image classification. Systems,
Man and Cybernetics, IEEE Transactions on,
(6):610–621.
Jain, A. K., Ross, A., and Prabhakar, S. (2004). An introduction
to biometric recognition. Circuits and Systems
for Video Technology, IEEE Transactions on, 14(1):4–
20.
Lee, B., Moon, J., and Kim, H. (2005). A novel measure
of fingerprint image quality using the Fourier spectrum.
In Jain, A. K. and Ratha, N. K., editors, Society
of Photo-Optical Instrumentation Engineers (SPIE)
Conference Series, volume 5779 of Society of PhotoOptical
Instrumentation Engineers (SPIE) Conference
Series, pages 105–112.
Lim, E., Jiang, X., and Yau, W. (2002). Fingerprint quality
and validity analysis. In Image Processing. 2002.
Proceedings. 2002 International Conference on, volume
1, pages I–469–I–472 vol.1.
Maio, D., Maltoni, D., Cappelli, R., Wayman, J. L., and
Jain, A. K. (2004). Fvc2004: Third fingerprint verification
competition. In Biometric Authentication,
pages 1–7. Springer.
Nanni, L. and Lumini, A. (2007). A hybrid waveletbased
fingerprint matcher. Pattern Recognition,
40(11):3146–3151.
Nanni, L., Lumini, A., and Brahnam, S. (2012). Survey on
lbp based texture descriptors for image classification.
Expert Systems with Applications, 39(3):3634 – 3641.
Ojala, T., Pietikainen, M., and Maenpaa, T. (2002). Multiresolution
gray-scale and rotation invariant texture
classification with local binary patterns. Pattern Analysis
and Machine Intelligence, IEEE Transactions on,
24(7):971–987.
Olsen, M. A., Xu, H., and Busch, C. (2012). Gabor filters
as candidate quality measure for nfiq 2.0. In Biometrics
(ICB), 2012 5th IAPR International Conference
on, pages 158–163. IEEE.
Pietikainen, M. (2011). ¨ Computer vision using local binary
patterns, volume 40. Springer.
Ross, A. and Jain, A. (2004). Biometric sensor interoperability:
A case study in fingerprints. In Biometric
Authentication, pages 134–145. Springer.
Ross, A., Shah, J., and Jain, A. K. (2005). Toward reconstructing
fingerprints from minutiae points. In Defense
and Security, pages 68–80. International Society for
Optics and Photonics.
Saad, M., Bovik, A. C., and Charrier, C. (2012). Blind image
quality assessment: A natural scene statistics approach
in the DCT domain. IEEE Transactions on
Image Processing, 21(8):3339–3352.
Shen, L., Kot, A., and Koo, W. (2001). Quality measures of
fingerprint images. In IN: PROC. AVBPA, SPRINGER
LNCS-2091, pages 266–271.
Tabassi, E., Wilson, C., and Watson, C. (2004). Nist fingerprint
image quality. NIST Res. Rep. NISTIR7151.
Watson, C. I., Garris, M. D., Tabassi, E., Wilson, C. L.,
Mccabe, R. M., Janet, S., and Ko, K. (2007). User’s
guide to nist biometric image software (nbis).
YAO, Z., Charrier, C., and Rosenberger, C. (2014). Utility
validation of a new fingerprint quality metric.
In International Biometric Performance Conference
2014. National Insititure of Standard and Technology
(NIST).Table 5: Inter-class Pearson correlation for textural features. 02DB2A (top), 04DB1A (middle) and 04DB3A (bottom).
OCL -0.6826 0.3002 -0.7037 -0.7895 -0.4462 -0.3294 0.3806 0.5864 0.6832 0.8699 -0.7593
OF -0.1938 0.1783 0.0098 -0.0396 -0.0452 -0.0700 0.1685 0.2016 0.1590 -0.0012 0.0593
PHC -0.6926 0.2864 -0.6665 -0.8805 -0.3391 -0.1957 0.3552 0.6329 0.7507 0.8476 -0.7807
STD -0.6230 0.3958 -0.5590 -0.8796 -0.3016 -0.3037 0.5620 0.8066 0.8940 0.7668 -0.7438
NFIQ 0.3919 0.1240 0.3483 0.4675 0.1617 -0.0057 0.0401 -0.0676 -0.1307 -0.4569 0.2731
OCL -0.6899 -0.7979 -0.7798 0.2582 0.7151 0.0456 0.4071 0.6708 0.7223 -0.7416 0.7125
OF -0.2642 -0.3263 -0.3057 0.1580 0.2073 0.1087 0.3968 0.4206 0.4539 -0.2281 0.2057
PHC -0.7060 -0.8206 -0.8416 0.2832 0.7535 0.0373 0.4722 0.7548 0.7964 -0.7701 0.7426
STD -0.5920 -0.7066 -0.7286 0.2249 0.6471 0.0554 0.4669 0.6930 0.7264 -0.6646 0.6297
NFIQ 0.1634 0.1607 0.1775 -0.0683 -0.2101 -0.0412 0.0897 -0.0254 -0.0157 0.2295 -0.2143
OCL -0.5001 -0.6394 -0.7460 0.0406 0.5144 0.0842 0.5301 0.6505 0.6948 -0.3814 0.5536
OF -0.2510 -0.1842 -0.1539 0.1097 0.0814 -0.2304 -0.1348 -0.1148 -0.0539 -0.1537 0.1566
PHC -0.1648 -0.2758 -0.4495 0.1015 0.1439 0.1660 0.6947 0.7992 0.7450 -0.1928 0.1726
STD -0.2401 -0.3447 -0.5029 0.0839 0.2221 0.1201 0.6398 0.7359 0.7037 -0.2161 0.2550
NFIQ -0.0532 -0.0886 0.0316 0.0183 0.0518 -0.2360 -0.3640 -0.4005 -0.2608 -0.0805 0.0907
Table 6: Inter-class Pearson correlation for image-based features. 02DB2A (top), 04DB1A (middle) and 04DB3A (bottom).
OCL 0.4816 0.2370 0.2931 0.1775 0.3659 -0.9137 0.6643 -0.8818 0.4179 -0.5538 -0.8443
OF 0.0386 -0.0438 0.1038 0.0733 0.2487 0.0391 0.0875 -0.0197 0.0840 -0.1092 0.0452
PHCWT 0.4720 0.3650 0.3149 0.1234 0.4921 -0.7480 0.5860 -0.7129 0.4031 -0.5316 -0.8469
STD 0.3169 0.2133 0.4788 0.2037 0.5805 -0.7170 0.6608 -0.6660 0.4149 -0.5252 -0.8023
NFIQ 0.4434 0.4445 0.1735 0.0971 0.1164 0.4017 0.2510 0.4088 0.1409 0.2598 0.3907
OCL 0.4689 0.0418 0.3839 0.4307 0.5980 -0.9129 0.8823 N 0.2666 -0.3423 0.8753
OF 0.1908 0.0065 0.1216 0.0284 0.1347 -0.1971 0.1586 NaN -0.1877 0.2351 0.3396
PHC 0.5126 0.2468 0.4225 0.3492 0.7118 -0.7046 0.6858 N 0.2085 -0.2800 0.8687
STD 0.4070 0.2177 0.4946 0.3752 0.8112 -0.6632 0.6887 N 0.1722 -0.2416 0.7591
NFIQ -0.1890 -0.3808 0.1444 0.0117 -0.3420 0.0132 -0.0121 N 0.0175 0.0069 -0.0719
OCL 0.3414 0.2499 0.2271 -0.0788 0.6927 -0.2067 0.6544 -0.5836 0.0446 -0.0068 0.7988
OF -0.0558 -0.0645 -0.1039 -0.0052 0.0883 -0.0079 -0.1368 0.0741 -0.0361 -0.0017 0.0122
PHC 0.3580 0.4141 0.5300 -0.1290 0.5679 0.2351 0.8933 -0.2086 0.0303 0.0515 0.6215
STD 0.4175 0.4266 0.4661 -0.1211 0.6575 0.1858 0.9157 -0.2545 0.0262 0.0575 0.6319
NFIQ -0.2256 -0.3925 -0.1761 0.2087 -0.2670 -0.2824 -0.4156 -0.0671 0.0335 0.0112 -0.1193
Table 7: Inter-class Pearson correlation for minutiae-based features. 02DB2A (top), 04DB1A (middle) and 04DB3A (bottom).
OCL 0.4077 0.3768 0.4040 0.2780 0.0826 0.3166 0.4214 -0.3196 -0.2799 -0.1930 -0.2568
OF 0.0327 0.0391 0.0442 -0.0096 0.0019 -0.0035 0.0491 -0.0040 -0.0987 0.0874 -0.0521
PHC 0.3717 0.3445 0.3735 0.2306 0.0298 0.2787 0.3829 -0.3230 -0.2704 -0.1934 -0.2791
STD 0.2391 0.2267 0.2376 0.1247 -0.0615 0.1630 0.2490 -0.2389 -0.2027 -0.1304 -0.1832
NFIQ -0.6052 -0.5393 -0.5949 -0.4783 -0.4639 -0.5807 -0.5554 0.4461 0.3544 0.2975 0.3198
OCL 0.5576 0.5290 0.5570 0.4649 0.5088 0.4505 0.5536 -0.3599 -0.3677 -0.3178 -0.3986
OF 0.0835 0.0946 0.0859 0.1661 0.0721 0.1334 0.0128 0.0159 0.1975 -0.1621 -0.0372
PHC 0.4036 0.4153 0.4150 0.3462 0.3731 0.3124 0.4184 -0.2908 -0.3245 -0.2718 -0.3121
STD 0.3876 0.4017 0.4003 0.3275 0.3446 0.3149 0.3865 -0.2992 -0.3093 -0.2611 -0.3095
NFIQ -0.1532 -0.1840 -0.1796 -0.1175 -0.1457 -0.1058 -0.1603 0.1778 0.1040 0.1771 0.1825
OCL 0.2447 0.2362 0.2521 0.1304 -0.0361 0.2280 0.2630 -0.2231 -0.1557 -0.1659 -0.2140
OF 0.2929 0.2577 0.2724 0.2786 0.3218 0.3043 0.2854 -0.0661 0.1458 -0.0830 -0.1077
PHC -0.1438 -0.1170 -0.1215 -0.1919 -0.3633 -0.1563 -0.1144 -0.1132 0.0373 0.0158 0.0406
STD -0.0421 -0.0243 -0.0220 -0.1007 -0.2618 -0.0561 -0.0130 -0.1491 -0.0271 -0.0423 -0.0281
NFIQ 0.3195 0.2497 0.2741 0.3971 0.4406 0.3391 0.2953 -0.0524 -0.0716 -0.0840 -0.0885
The Power of Polynomials
Paul Feautrier
To cite this version:
Paul Feautrier. The Power of Polynomials . 5th International Workshop on Polyhedral Comilation
Techniques, Jan 2015, Amsterdam, Netherlands.
HAL Id: hal-01094787
https://hal.inria.fr/hal-01094787
Submitted on 13 Dec 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.The Power of Polynomials
Work in Progress
Paul Feautrier
ENS de Lyon, LIP, INRIA, CNRS, UCBL
Paul.Feautrier@ens-lyon.fr
ABSTRACT
Every component in the program development chain uses a
model to represent and reason about its source. The model
must be as expressive as possible without compromising its
efficiency and tractability. This paper proposes a slight extension
to the polyhedral model by allowing polynomial constraints
and relations. Recent mathematical results by Handelman
and Schweighofer on the Positivstellensatz allow one
to devise algorithms similar to familiar emptiness tests or the
Farkas algorithm. This paper presents applications of these
ideas to three use-cases: dependence tests, scheduling and
transitive closure approximation. It then points to unsolved
problems and future work.
1. MOTIVATION
Every compiler first starts by building an intermediate
representation (IR) for the given source program. Most IRs
are syntactical: the Abstract Syntax Tree, for instance, is a
data structure which closely represents the input program,
while abstracting away details like text layout or syntactical
variations. In contrast, the polyhedral model represents
the program as it will run, and considers the operations to
be executed and their execution order. Since with present
day processors the number of operations is to be counted in
billions, the set of operations has to be represented in intention,
and all operations on this set have to be executed
symbolically. Hence the search for representations in which
expressive power has to be traded against effectiveness.
The polyhedral model is such a representation: every set –
operations, execution order, dependences, memory accesses,
memory footprints footprints, schedules – are represented as
Z-polyhedra (sets of integer solutions to a system of affine
inequalities). This model has met with a fair measure of
success; however its expressive power is limited. The time
has come to search for more powerful representations.
In this search, one is guided by the following observation:
many algorithms of the polyhedral model have been implicitly
or explicitly devised in order to avoid using polynomials.
IMPACT 2015
Fifth International Workshop on Polyhedral Compilation Techniques
Jan 19, 2015, Amsterdam, The Netherlands
In conjunction with HiPEAC 2015.
http://impact.gforge.inria.fr/impact2015
This work has been partially supported by the ManycoreLabs project PIA-
6394 led by Kalrays.
A case in point is the recourse to multidimensional schedules
when a one dimensional schedule cannot fit. In [8] I proved
(see Theorem 1), that a multidimensional schedule can be
converted to a unidimensional one by counting clock ticks.
This count can be computed using the theory of Ehrhart
polynomials [4], and the result is a polynomial or quasipolynomial
schedule. The same remark applies to array and
channels: in CRP, I have introduced multidimensional channels
in order to avoid linearization functions, which, despite
their name, are polynomials [9].
This paper is organized as follows: I will first review recent
mathematical results for the PositivStellenSatz, which
play the same role for polynomials as Farkas lemma does
for affine inequalities. I will then present a very preliminary
implementation of the corresponding algorithm. I will apply
it to several common use-cases: dependence calculations,
scheduling and transitive closure. I will then review related
work, and point to extensions and improvements.
2. MATHEMATICAL BACKGROUND
Let p1, . . . , pn be polynomials in d variables. The set:
S = {x ∈ IRd
| p1(x) ≥ 0, p2(x) ≥ 0, . . . pn(x) ≥ 0} (1)
is a semi-algebraic set. Polyhedra are special cases of semialgebraic
sets where all pis are of first degree. Such sets arise
in program analysis and optimization. Important questions
are: is S empty, and, given a polynomial (or polynomial
template) p, is p positive in S? A succession of recent results,
starting with a paper by Krivine [14], has provided answers
to some of these questions.
Theorem 1 (Handelman [12]). Let S be a compact
polyhedron as defined by (1), where all pi are of first degree.
A polynomial p is strictly positive in S if and only if
it can be represented as
p(x) = λ0 +
X
~e∈INn
λ~ep
e1
1
(x). . . p
en
n (x), (2)
where the λ~e are non-negative and not all of them are zero.
One should notice that Farkas lemma is the special case
of this result when p is affine.
Theorem 2 (Schweighofer [16]). Assume now that
some of the pi in (1) are polynomial of higher degree. A
polynomial p is strictly positive in S if it has a representation
(2), provided that the pi of degree one define a compact
polyhedron.
1In the words of Schweighofer, the representation (2) is
valid “if there are enough polynomials of degree one” in S.
Their formal similarity notwithstanding, these results have
a different status than Farkas lemma. In the later case, one
knows exactly to which terms the sum in (2) extends, and
if no solution exists, one may assert that p is not positive in
S. If no solution is found when applying Theorem 1 or 2, it
may be that p is not positive, or that the sum (2) has not
been extended far enough. From a pragmatic point of view,
if a representation (2) has been found, it can be checked by
elementary algebra, and acquires the same status as the elementary
identities we all learned in high-school, whether the
hypotheses of either theorem are satisfied or not. If no solution
is found, one can either conclude conservatively that
p may not be positive in S, or try to increase the number of
terms in (2), or reformulate the problem, e.g. by trying to
prove that −p or p + a, a a constant, is positive.
3. IMPLEMENTATION
It is easy to see that, when p and the set of products in (2)
are given, the solution can be found by Linear Programming:
solving a system of linear equations in positive unknowns,
the λs. The usefulness of the method can be augmented by
the following trick: instead of a polynomial p, use a polynomial
template, i.e. a polynomial which depends on additional
parameters. To fit into the above method, parameters must
occur linearly in p. The parameters can then be considered
as additional unknowns in the LP problem, and solved for
at the same time. The corresponding algorithm is not only
able to prove that a polynomial is positive in a given set, but
also to find a polynomial of a given shape that is positive.
Algorithm H
1. Given
• A set of polynomials P = {p1(x), . . . , pn(x)} on
d variables x = (x1, . . . , xd), including the trivial
polynomial 1.
• a template p(µ, x) depending linearly on a set of
parameters µ.
• an “order” M
2. Generate all products of M polynomials from P.
3. Compute the “master equation”:
E = p(µ, x) −
X
~e∈INn,
Pn
i=1 ei=M
λep
e1
1
(x). . . p
en
n (x) = 0
4. In the fully distributed form of E, each monomial x
f1
1
. . . x
fd
d
may occur several times with coefficients linear in the
λ and µ. Sum these coefficients and equate the result
to zero.
5. Solve the resulting system for the λ and µ by any convenient
LP software.
In step 2, since multiplication is commutative, one should
be careful to avoid duplicate products. Notice also that
since polynomials can be multiplied whatever their degree,
this algorithm covers both the Handelman and Schweighofer
cases.
A proof-of-concept implementation of this algorithm has
been realized, using a home-made algebraic library which is
part of the Syntol1 project and the LP tool PIP2
.
The examples in the following section have been solved by
writing, for each use case, a front end which sets up the list
of the pi and the unknown polynomial p, call algorithm H,
and edit the result in proper form.
4. USE CASES
4.1 Dependences
Dependence testing requires to decide whether two array
accesses touch the same memory cell or not. This is
usually formulated as deciding if a set of constraints built
from the iteration domains of two (not necessarily distinct)
statements, an execution order predicate, and the equality
of two subscript vectors is empty or not. If subscripts are
affine in the surrounding loop counters, the answer can be
obtained by linear programming. However, in some cases,
subscripts are polynomials. For instance, a many dimensional
array may have been linearized, either by an overeager
compiler, or by the programmer because there is no
way in C to dynamically allocate a multidimensional array.
In other cases, several mathematical objects with disjoint
supports may have been compacted in only one array. Consider
for instance the following code:
for(i=0; i
HAL Id: hal-01092040
https://hal.archives-ouvertes.fr/hal-01092040
Submitted on 8 Dec 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Minkowski sum of polytopes defined by their vertices
Vincent Delos∗ and Denis Teissandier∗∗
University of Bordeaux
CNRS, National Center for French Research
I2M, UMR 5295
Talence, F-33400, France
∗E-mail: v.delos@i2m.u-bordeaux1.fr
∗∗E-mail: d.teissandier@i2m.u-bordeaux1.fr
Abstract
Minkowski sums are of theoretical interest and have applications in fields related to industrial backgrounds.
In this paper we focus on the specific case of summing polytopes as we want to solve the
tolerance analysis problem described in [1]. Our approach is based on the use of linear programming and
is solvable in polynomial time. The algorithm we developped can be implemented and parallelized in a
very easy way.
keywords: Computational Geometry, Polytope, Minkowski Sum, Linear Programming, Convex Hull.
1 Introduction
Tolerance analysis is the branch of mechanical design dedicated to studying the impact of the manufacturing
tolerances on the functional constraints of any mechanical system. Minkowski sums of polytopes are useful
to model the cumulative stack-up of the pieces and thus, to check whether the final assembly respects such
constraints or not, see [2] and [3]. We are aware of the algorithms presented in [4], [5], [6] and [7] but we
believe that neither the list of all edges nor facets are mandatory to perform the operation. So we only
rely on the set of vertices to describe both polytope operands. In a first part we deal with a “natural way”
to solve this problem based on the use of the convex hulls. Then we introduce an algorithm able to take
advantage of the properties of the sums of polytopes to speed-up the process. We finally conclude with
optimization hints and a geometric interpretation.
2 Basic properties
2.1 Minkowski sums
Given two sets A and B, let C be the Minkowski sum of A and B
C = A + B = {c ∈ R
n, ∃a ∈ A, ∃b ∈ B/c = a + b}
2.2 Polytopes
A polytope is defined as the convex hull of a finite set of points, called the V-representation, or as the bounded
intersection of a finite set of half-spaces, called the H-representation. The Minkowski-Weyl theorem states
that both definitions are equivalent.
13 Sum of V-polytopes
In this paper we deal with V-polytopes i.e. defined as the convex hull of a finite number of points. We note
VA, VB and VC the list of vertices of the polytopes A, B and C = A + B. We call VC the list of Minkowski
vertices. We note k = Card(VA) and l = Card(VB).
3.1 Uniqueness of the Minkowski vertices decomposition
Let A and B be two R
n-polytopes and VA, VB their respective lists of vertices. Let C = A+B and c = a+b
where a ∈ VA and b ∈ VB.
c ∈ VC ⇔ the decomposition of c as a sum of elements of A and B is unique (1)
We recall that in [4], we see that the vertex c of C, as a face, can be written as the Minkowski sum of a
face from A and a face from B. For obvious reasons of dimension, c is necessarily the sum of a vertex of A
and a vertex of B. Moreover, in the same article, Fukuda shows that its decomposition is unique.
Reciprocally let a ∈ VA and b ∈ VB be vertices from polytopes A and B such that c = a + b is unique.
Let c1 ∈ C and c2 ∈ C such as c =
1
2
(c1 + c2) = 1
2
(a1 + b1 + a2 + b2) = 1
2
(a1 + a2) + 1
2
(b1 + b2) = a + b
with a =
1
2
(a1 + a2) and b =
1
2
(b1 + b2) because the decomposition of c in elements from A and B is unique.
Given that a and b are two vertices, we have a1 = a2 and b1 = b2 which implies c1 = c2. As a consequence c
is a vertex of C.
3.2 Summing two lists of vertices
Let A and B be two R
n-polytopes and VA, VB their lists of vertices, let C = A + B.
C = Conv({a + b, a ∈ VA, b ∈ VB}) (2)
We know that VC ⊂ VA + VB because a Minkowski vertex has to be the sum of vertices from A and B
so C = Conv(VC ) ⊂ Conv({a + b, a ∈ VA, b ∈ VB}).
The reciprocal is obvious as Conv({a + b, a ∈ VA, b ∈ VB}) ⊂ Conv({a + b, a ∈ A, b ∈ B}) = C as
C = A + B is a convex set.
At this step an algorithm removing all points which are not vertices of C from VA + VB could be applied
to compute VC . The basic idea is the following: if we can build a hyperplane separating (au + bv) from the
other points of VA + VB then we have a Minkowski vertex, otherwise (au + bv) is not an extreme point of
the polytope C. The process trying to split the cloud of points is illustrated in Figure 1.
To perform such a task, a popular technique given in [8] solves the following linear programming system.
In the case of summing polytopes, testing whether the point (au + bv) is a Minkowski vertex or not, means
finding (γ, γuv) ∈ R
n × R from a system of k × l inequalities:
< γ, ai + bj > −γuv ≤ 0 ; ∀(i, j) ∈ {1, .., k} × {1, .., l} ; (i, j) 6= (u, v)
< γ, au + bv > −γuv ≤ 1
f
∗ = max(< γ, au + bv > −γuv)
So if we define the matrix Γ =
a1,1 + b1,1 · · · a1,n + b1,n −1
.
.
.
.
.
.
.
.
.
.
.
.
ak,1 + bl,1 · · · ak,n + bl,n −1
au,1 + bv,1 · · · au,n + bv,n −1
then Γ
γ
γuv
≤
0
.
.
.
0
1
2Figure 1: Computing the vertices of the sum of two V-polytopes through a convex hull algorithm
The corresponding method is detailed in Algorithm 1. Now we would like to find a way to reduce the
size of the main matrix Γ as it is function of the product k × l.
Algorithm 1 Compute C = A + B with A and B two R
n-polytopes
Require: A V-representation: list of vertices VA
Require: B V-representation: list of vertices VB
for all au ∈ VA and bv ∈ VB do
Compute f
∗ = max(< γ, au + bv > −γuv) with Γ
γ
γuv
≤
0
...
0
1
, Γ ∈ R
k×l × R
n+1
if f
∗ > 0 then
(au + bv) ∈ VC
else
(au + bv) ∈ V / C
end if
end for
3.3 Constructing the new algorithm
In this section we want to use the basic property 1 characterizing a Minkowski vertex. Then the algorithm
computes, as done before, all sums of pairs (au, bv) ∈ VA × VB and checks whether there exists a pair
(a
0
, b0
) 6= (au, bv) with a
0 ∈ A, b
0 ∈ B such as (a
0 + b
0
) = (au + bv). If it is the case then (au + bv) ∈ V / C ,
otherwise (au + bv) ∈ VC .
a
0 =
X
k
i=1
αiai with ∀i, αi ≥ 0 and X
k
i=1
αi = 1
3b
0 =
X
l
j=1
βj bj with ∀j, βj ≥ 0 and X
l
j=1
βj = 1.
We get the following system:
X
k
i=1
αiai +
X
l
j=1
βj bj = au + bv
X
k
i=1
αi = 1
X
l
j=1
βj = 1
∀i, αi ≥ 0
∀j, βj ≥ 0
That is to say with matrices and under the hypothesis of positivity for both vectors α and β:
a1,1 a2,1 · · · ak,1 b1,1 b2,1 · · · bl,1
a1,2 a2,2 · · · ak,2 b1,2 b2,2 · · · bl,2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
a1,n a2,n · · · ak,n b1,n b2,n · · · bl,n
1 1 · · · 1 0 0 · · · 0
0 0 · · · 0 1 1 · · · 1
α1
.
.
.
αk
β1
.
.
.
βl
=
au,1 + bv,1
au,2 + bv,2
.
.
.
au,n + bv,n
1
1
We are not in the case of the linear feasibility problem as there is at least one obvious solution:
pu,v = (α1, · · · , αk, β1, · · · , βl) = (0, · · · , 0, αu = 1, 0, · · · , 0, 0, · · · , 0, βv = 1, 0, · · · , 0)
The question is to know whether it is unique or not. This first solution is a vertex pu,v of a polyhedron
in R
k+l
that verifies (n + 2) equality constraints with positive coefficients. The algorithm tries to build
another solution making use of linear programming techniques. We can note that the polyhedron is in fact
a polytope because it is bounded. The reason is that, by hypothesis, the set in R
k of convex combinations
of the vertices ai
is bounded as it defines the polytope A. Same thing for B in R
l
. So in R
k+l
the set of
points verifying both constraints simultaneously is bounded too.
So we can write it in a more general form:
P
α
β
=
au + bv
1
1
, P ∈ R
n+2 × R
k+l
, α ∈ R
k
+, β ∈ R
l
+, au ∈ R
n, bv ∈ R
n
where only the second member is function of u and v.
It gives the linear programming system:
P
α
β
=
au + bv
1
1
α
β
≥ 0
f
∗ = max(2 − αu − βv)
(3)
Thanks to this system we have now the basic property the algorithm relies on:
au ∈ VA, bv ∈ VB,(au + bv) ∈ VC ⇔ f
∗ = 0 (4)
f
∗ = 0 ⇔ there exists only one pair (αu, βv) = (1, 1) to reach the maximum f
∗ as Pk
i=1 αi = 1 and
Pl
j=1 βj = 1 ⇔ the decomposition of c = (au + bv) is unique ⇔ c ∈ VC
It is also interesting to note that when the maximum f
∗ has been reached:
αu = 1 ⇔ βv = 1 ⇔ f
∗ = 0
4Algorithm 2 Compute C = A + B with A and B two R
n-polytopes
Require: A V-representation: list of vertices VA
Require: B V-representation: list of vertices VB
for all ai ∈ VA and bj ∈ VB do
Compute f
∗ = max(2 − αi − βj ) with P
α
β
=
ai + bj
1
1
P ∈ R
n+2 × R
k+l and
α
β
≥ 0
if f
∗ = 0 then
(ai + bj ) ∈ VC
else
(ai + bj ) ∈ V / C
end if
end for
3.4 Optimizing the new algorithm and geometric interpretation
The current state of the art runs k×l linear programming algorithms and thus is solvable in polynomial time.
We presented the data such that the matrix P is invariant and the parametrization is stored in both the
second member and the objective function, so one can take advantage of this structure to save computation
time. A straight idea could be using the classical sensitivity analysis techniques to test whether (au + bv) is
a Minkowski vertex or not from the previous steps, instead of restarting the computations from scratch at
each iteration.
Let’s switch now to the geometric interpretation, given a ∈ VA, let’s consider the cone generated by all
the edges attached to a and pointing towards its neighbour vertices. After translating its apex to the origin
O, we call this cone CO(a) and we call CO(b) the cone created by the same technique with the vertex b in
the polytope B.
The method tries to build a pair, if it exists, (a
0
, b0
) with a
0 ∈ A, b
0 ∈ B such that (a + b) = (a
0 + b
0
).
Let’s introduce the variable δ = a
0 − a = b − b
0
, and the straight line ∆ = {x ∈ R
n : x = tδ, t ∈ R}.
So the question about (a + b) being or not a Minkowski vertex can be presented this way:
a ∈ VA, b ∈ VB,(a + b) ∈ V / C ⇔ ∃∆ = {x ∈ R
n
: x = tδ, t ∈ R} ⊂ CO(a) ∪ CO(b) (5)
The existence of a straight line inside the reunion of the cones is equivalent to the existence of a pair
(a
0
, b0
) such that (a + b) = (a
0 + b
0
) which is equivalent to the fact that (a
0 + b
0
) is not a Minkowski vertex.
This is illustrated in Figure 2. The property becomes obvious when we understand that if (a
0
, b0
) exists in
A × B then (a
0 − a) and (b
0 − b) are symmetric with respect to the origin. Once a straight line has been
found inside the reunion of two cones, we can test this inclusion with the same straight line for another pair
of cones, here is the geometric interpretation of an improved version of the algorithm making use of what
has been computed in the previous steps.
We can resume the property writing it as an intersection introducing the cone −CO(b) being the symmetric
of CO(b) with respect to the origin.
a ∈ VA, b ∈ VB,(a + b) ∈ VC ⇔ CO(a) ∩ −CO(b) = {O} (6)
4 Conclusion
In this paper, our algorithm goes beyond the scope of simply finding the vertices of a cloud of points.
That’s why we have characterized the Minkowski vertices. However, among all the properties, some of them
5Figure 2: (a2 + b4) is not a vertex of C=A+B as ∆ ⊂ CO(a2) ∪ CO(b4)
are not easily exploitable in an algorithm. In all the cases we have worked directly in the polytopes A
and B, i.e. in the primal spaces and only with the polytopes V-descriptions. Other approaches use dual
objects such as normal fans and dual cones. References can be found in [6], [7] and [9] but they need more
than the V-description for the polytopes they handle. This can be problematic as obtaining the double
description can turn out to be impossible in high dimensions, see [4] where Fukuda uses both vertices and
edges. Reference [6] works in R
3
in a dual space where it intersects dual cones attached to the vertices, and
it can be considered as the dual version of property 6 where the intersection is computed with primal cones.
It actually implements Weibel’s approach described in [9]. Such a method has been recently extended to any
dimension for HV-polytopes in [7].
5 Special thanks
We would like to thank Pr Pierre Calka from the LMRS in Rouen University for his precious help in writing
this article.
References
[1] Denis Teissandier and Vincent Delos and Yves Couetard, “Operations on Polytopes: Application to
Tolerance Analysis”, 6th CIRP Seminar on CAT, 425-433, Enschede (Netherlands), 1999
[2] Lazhar Homri, Denis Teissandier, and Alex Ballu, “Tolerancing Analysis by Operations on Polytopes”,
Design and Modeling of Mechanical Systems, Djerba (Tunisia), 597:604, 2013
[3] Vijay Srinivasan, “Role of Sweeps in Tolerancing Semantics”, in ASME Proc. of the International Forum
on Dimensional Tolerancing and Metrology, TS172.I5711, CRTD, 27:69-78, 1993
[4] Komei Fukuda, “From the Zonotope Construction to the Minkowski Addition of Convex Polytopes”,
Journal of Symbolic Computation, 38:4:1261-1272, 2004
6[5] Komei Fukuda and Christophe Weibel, “Computing all Faces of the Minkowski Sum of V-Polytopes”,
Proceedings of the 17th Canadian Conference on Computational Geometry, 253-256, 2005
[6] Denis Teissandier and Vincent Delos, “Algorithm to Calculate the Minkowski Sums of 3-Polytopes
Based on Normal Fans”, Computer-Aided Design, 43:12:1567-1576, 2011
[7] Vincent Delos and Denis Teissandier, “Minkowski Sum of HV-Polytopes in R
n”, Proceedings of the
4th Annual International Conference on Computational Mathematics, Computational Geometry and
Statistics, Singapore, 2015
[8] Komei Fukuda, “Frequently Asked Questions in Polyhedral Computation”, Swiss Federal Institute of
Technology Lausanne and Zurich, Switzerland, 2004
[9] Christophe Weibel, “Minkowski Sums of Polytopes”, PhD Thesis, EPFL, 2007
7
Effective Reproducible Research with Org-Mode and Git
Luka Stanisic, Arnaud Legrand
To cite this version:
Luka Stanisic, Arnaud Legrand. Effective Reproducible Research with Org-Mode and Git. 1st
International Workshop on Reproducibility in Parallel Computing, Aug 2015, Porto, Portugal.
.
HAL Id: hal-01083205
https://hal.inria.fr/hal-01083205
Submitted on 16 Nov 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´esLuka Stanisic and Arnaud Legrand
firstname.lastname(à)imag.fr
In the last decades, both hardware and software of modern computers became
so complex that even experts have troubles fully understanding their behavior.
Therefore, it could be argued that these machines are no longer deterministic,
especially when measuring execution times of programs running on a large
distributed computer systems or hybrid platforms. Controlling every relevant
sophisticated component during such measurements is almost impossible, making
the full reproduction of the experiments extremely difficult. Consequently,
studying computers has become very similar to studying a natural phenomena
and it should thus use the same principles as other scientific fields that had them
defined centuries ago. Although many conclusions are based on experimental results
in this domain of computer science, surprisingly articles generally poorly
detail the experimental protocol. Left with insufficient information, readers have
generally trouble to reproduce the study and possibly build upon it. Yet, as reminded
by Drummond [1], reproducibility of experimental results is the hallmark
of science and there is no reason why this should not be applied to computer
science as well.
Hence, a new movement promoting the development of reproducible research
tools and practices has emerged, especially for computational sciences. Such tools
generally focus on replicability of data analysis [5]. Although high performance
computing or distributed computing experiments involve running complex codes,
they do not focus on execution results but rather on the time taken to run a
program and on how the machine resources were used. These requirements call
for different workflows and tools, since such experiments are not replicable by
essence. Nevertheless in such cases, researchers should still at least aim at full
reproducibility of their work.There are many existing solutions partially addressing these issues, but none
of them was completely satisfying our needs and therefore we developed an
alternative approach that is based on two well-known and widely-used tools:
Org-mode and Git. We present our contributions in Section 3, where we first describe
a specific use of Org-mode for doing the provenance tracking of the entire
projects. Then, we propose a unique way to use Git for keeping synchronized experiment
results and code that generated them. Finally, it will be demonstrated
in Section 4 how the proposed methodology helped us conducting two very different
studies in the High Performance Computing (HPC) domain. We will also
state limits of our approach, together with some open questions.
✷ ❘❡❧❛t❡❞ ❲♦r❦
In the past few years, the field of reproducibility research tools has been very
active, various alternatives emerging to address diverse problematic. However,
in the HPC domain most of them are concentrated on platform accessibility,
setting up environments and running the experiments on large clusters. Even
though such tools are very useful in general, we could not benefit from them
due to the specific nature of our research projects. The machines we needed
to study are recent prototypes, with ever-changing libraries, set up by expert
administrators and we do not have neither the permission nor the interest to do
any modifications to the environment.
However, when conducting experiments and analysis, there are more aspects
that need to be considered. We detail the ones related to software, methodology
and provenance tracking, which are often neglected by researchers in our
community.
Accessibility It is widely accepted that tools like Git or svn are indispensable in
everyday work on software development. Additionally, they help at sharing
the code and letting other people contribute. Making data accessible, file
hosting services, such as Dropbox, Google Drive and many others, became
very popular among all scientists that want to collaborate. There is another
group of services that is more oriented on making data publicly available
and easily understandable to everyone, e.g., figshare✶
.
Provenance tracking Knowing how data was obtained is a complex problem.
The first part involves collecting meta-data, such as system information, experimental
conditions, etc., and it is often managed by experimental engines.
The second, frequently forgotten in our domain, part is to track any applied
transformation to the data, i.e., moving the objects from one state to another.
Moreover, there is a question of storing both data and meta-data. Classical
approach to solve these issues involves using a database. However, this solution
has its limits, as managing source codes or comments in a database is
not convenient and is handled in much better way by using version control
systems and literate programming.
✶ ❤tt♣✿✴✴✜❣s❤❛r❡✳❝♦♠Documenting While provenance tracking is focused on how data was obtained,
it is not concerned with why the experiments were run and what the observations
on the results are. These things have to be thoroughly documented,
since even the experimenters tend to quickly forget all the details. One way
is to encourage users to keep notes when running experiment (e.g., in Sumatra
[5, chap. 3]), while the other one consists in writing a laboratory notebook
(e.g., with IPython✷
).
Extendability It is hard to define good formats for all project components in
the starting phase of the research. Some of the initial decisions are likely to
change during the study, so system has to be flexible. In such a volatile context,
integrated tools with databases, such as Sumatra, are too cumbersome
for everyday extentions and modifications.
Replicable analysis Researchers should only trust figures and tables that can
be regenerated from raw data. Therefore, ensuring replicable analysis is essential
to any study. Popular solution nowadays for this problem is to rely
on open-source statistical software like R and knitr that simplify figure generation
and embedding in final documents [5, chap. 1].
To address the previous problems, we propose to rely on a minimalist set
of simple, lightweight, and well-known tools. We use Org-mode [2], initially an
Emacs mode for editing and organizing notes, that is based on highly hierarchical
plain text files which are easy to explore and exploit. Org-mode has also been
extended to allow combining plain text with small chunks of executable code
(Org-babel snippets). Such features follow the literate programming principles
introduced by Donald Knuth three decades ago, and for which there is a renewed
interest in the last years. In addition, for version control system we decided to
rely on Git, a distributed revision control tool that has an incredibly powerful
branch management system.
✸ ❚✐♣s ❛♥❞ ❚r✐❝❦s ❢♦r ❘❡♣r♦❞✉❝✐❜❧❡ ❘❡s❡❛r❝❤
In this section, we provide guidelines on best practices and hints on pragmatic
ways to implement them. First, we illustrate how to handle provenance tracking
issues with literate programming, in particular with Org-mode. The approach
we propose is lightweight, to make sure the experiments are performed in a
clean, coherent and hopefully reproducible manner without being slowed down
by a rigid framework. However, it is tempting to sometimes break one of these
rules, which hinders reproducibility in the end. This is why we harden these
guidelines with a particular usage of Git that forces the user to keep data and
code synchronized.
3.1 Provenance Tracking Through Literate Programming
As described in Section 2, there are many tools that can help to automatically
capture environment parameters, to keep track of experimentation process, to
✷ ❤tt♣✿✴✴✐♣②t❤♦♥✳♦r❣organize code and data, etc. However, it is not easy to understand how they work
exactly, and additionally each of them creates new dependencies on specific libraries
and technologies. Instead, we propose a solution based on plain text files,
written in the spirit of literate programming, that are self-explanatory, comprehensive
and portable. We do not rely on a huge cumbersome framework, but
rather on a set of simple, flexible scripts, that address the following challenges.
Environment Capture Environment capture consists in getting all the details
about the code, used libraries and system configuration. It is necessary to gather
as much useful meta-data as possible, to allow to compare experiment results
with the previous ones and inspect if there were any changes to the experimental
environment. This process should not be burdensome, but automatic and transparent
to the researcher. Additionally, it should be easy to extend or modify,
since it is generally difficult to anticipate relevant parameters before performing
numerous initial experiments.
Once meta-data is captured, it can be stored either individually or accompanying
results data. Some prefer keeping these two separated, making their
primary results unpolluted and easier to exploit, but they soon run into diffi-
culties when they need to retrieve information from meta-data. Therefore, we
strongly believe that the experiment results should stay together with the information
about the system they were obtained on. Moreover, keeping them in
the same file makes the access straightforward and simplifies the project organization,
as there are less objects to handle. Consequently, even if data sustains
numerous movements and reorganizations, one would never doubt which environment
setup corresponds to which results.
In order to permit users to easily examine any of their information, these
files have to be well structured. The Org-mode format is a perfect match for
such requirements as its hierarchical organization is simple and can be easily
explored. A good alternative might be to use the yaml format, which is typed
and easy to parse but we decided to stay with Org-mode (which served all our
needs) to keep our framework minimalist.
A potential issue of this approach is raised by large files, typically containing
several hundreds of MB and more. Opening such files can temporary freeze a text
editor and finding a particular information can then be tedious. We haven’t yet
met with such kind of scenario, but obviously it would require some adaptations
to the approach.
Note that all the data and meta-data are gathered automatically using
scripts, finally producing a read-only Org-mode document. Why the experiments
were performed and what are the observations on its results is stored elsewhere,
more precisely in a laboratory notebook of the project.
Laboratory Notebook A paramount asset of our methodology is the laboratory
notebook (labbook), similar to the ones biologist, chemists and scientist
from other fields use on a daily basis to document the progress of their work. For
us, this notebook is a single file inside the project repository, shared between allcollaborators. The main motivation for keeping a labbook is that anyone, from
original researchers to external reviewers, can later use it to understand all the
steps of the study and potentially reproduce and improve it. This self-contained
unique file has multiple purposes. Indeed, the labbook should not only serve as
journal but also play the following software development roles to ensure that it
can be exploited by others:
1. README: The labbook should explain ideas behind the whole project purpose
and methodology, i.e., what the workflow for doing experiments is and
how the code and data are organized in folders. It should state the conventions
on how the labbook should be used. This part serves as a starting point
for newcomers and is also a good reminder for experienced users.
2. Documentation: The labbook should detail what are the different programs
and scripts, and what is their purpose. This documentation concerns source
code for the experimentation as well as tools for manipulating data and
analysis code for producing plots and reports. Additionally, there should be
explanations on the revision control usage and conventions.
3. Examples: The labbook should contain example usages of how to run scripts,
displaying the most common arguments and format. Although such information
might seem redundant with the previous documentation part, in practice
such examples are indispensable even for everyday users, since some scripts
require lots of environment variables, arguments and options.
4. Log: It is important to keep track of big changes to the source code and
the project in general inside a log section. Since all modifications are already
captured and commented in Git commits, the log section should offer a much
more coarse grain view of the code development history. There should also be
a list with descriptions of every Git tag in the repository as it helps finding
the latest stable, or any other specific, version of the code.
5. Experiment results: Every set of experiment should be carefully noted here,
together with the key input parameters, the motivation for running such
experiment and finally observations on the results. Inside the descriptive
conclusions, Org-mode allows to use both links and git-links connecting the
text to the actual files in the Git repository. These hyperlinks point to the
crucial data and the analysis reports that illustrate a newly discovered phenomena.
Managing efficiently all these different information in a single file requires a
solid hierarchical structure, which once again motivated our use of Org-mode. We
also took advantage of the Org-mode tagging mechanism, which allows to easily
extract information, improving labbook’s structure even further. Org tags can
be used to distinguish which collaborator conducted a given set of experiments
or to list expertise requests. Although many of these information may already
be present in the experiment files, having it at the journal level revealed very
convenient. Experiments can also be tagged to indicate on which machine they
were performed and whether the results were important or not. Again, although
such tagging is not required it is very handy in practice and make the labbook
much easier to understand and exploit.Several alternatives exist for taking care of experiment results and progress on
a daily basis. We think that a major advantage of Org-mode compared to many
other tools is that it is just a plain text file that can thus be read and modified
on any remote machine without requiring to install any particular library. Using
a plain text file is also the most portable format across different architectures
and operating systems.
Data File Organization Having a clear, coherent and hierarchical organization
of all the files is a good practice for a proper scientific work, especially when
external collaborators are involved. Once again, the approach we propose is
lightweight and flexible but is motivated by the three following important points:
1. There should never be any critical information in file organization. Important
information should be in the files themselves. Indeed, we could as well
have blobs rather than files but managing data and extracting important
information would probably not be very convenient. Thus, we do not recommend
to impose much on file organization so that users can organize their
data in a way that is natural to them. We think this lack of rules is not an
issue as long as this organization is explained in the labbook.
2. The file organization should be flexible enough to be changed and adapted
as the experimental data set grows. Such reorganization could seemingly
break the labbook hyperlinks. However, as we briefly mentioned, we recommend
to use git-links in the labbook, which are Org-mode hyperlinks that
store links to specific revisions of files (typically when they were created).
So reorganizing the data files will not break the labbook information.
3. The naming convention should not impede the activity of the researcher, so
here we used almost no convention at all. According to our experience, all experiment
results could simply be saved in folders, each of them representing
one set of measurements and having a unique characteristic name, e.g., the
name of the machine on which it was performed. Inside a folder, file names
could be prefixed by additional key characteristics of the experiment set, followed
by an ordinal number indicating in which order experiments were run.
This idea seemed the most natural one to adopt, but we are reconsidering
alternatives for the future projects.
Conclusion The approach we described implicates a partial redundancy of
some data and meta-data, typically saved in both experiment result files and
in the laboratory notebook. However, such information are never entered twice
manually. Most data should always be automatically tracked, although when
some data convey key information, they should be manually added to other
places as well, since it provides a better overview of the whole project.
We think that following the proposed guidelines is sufficient to conduct a
clean, comprehensible and reproducible research while having a very fluid work-
flow. However, not all scientists are rigorous enough to always follow such conventions
and even those who are, occasionally have the need to bend the rulesin order to quickly get some results in a dirty way. This sometimes pollutes the
whole project organization, often breaking the chains of the workflow processes
and making some parts incoherent.
In order to force researchers to be more disciplined and help them doing their
work in a reproducible manner, we propose to combine the previous approach
with a particular usage of Git.
3.2 Using Git for Improving Reproducible Research
Even when the project is well organized, meta-data tracked, all the collaborators
follow the conventions and take notes in the laboratory notebook, several
practical issues may still arise:
1. Although a svn revision or a Git sha1 of the source code is captured, this
does not guarantee that the experiment was run correctly and that the results
can easily be reproduced. There could exist some uncommitted differences
between the tracked and the current version of the code or the compilation
could be out-of-date, i.e., code was compiled with an old revision.
A solution proposed for example by Davison [5, chap. 3] and which we applied
as well, is to force recompilation and systematically verify that everything is
fully committed before running any experiment. The only exception to this
rule are the tests performed to validate the workflow.
2. Even with the complete and correct meta-data and code revisions, it is not
always easy to reconstruct the experimental setup, especially if it consists
of the code from numerous external repositories. Multiplying repositories
hinders provenance tracking, coherency and experimental reproduction. The
solution we propose is to increase the reproducibility confidence level by using
only revision control and a collection of simple scripts that automatically
track information. Additionally, we suggest to store both code and experimental
data in the same Git repository, so that they are always perfectly
synchronized, which eases the obtainment of the code that produced a particular
data set. Nevertheless, this introduced the following new challenges.
3. Unlike source code, data files can be large, thus keeping them together in
the same repository can rapidly increase its size. Moreover, doing code modifications,
analysis and experiments in the same Git branch complicates its
history and makes experimental setup reproduction slightly ambiguous.
4. Another difficulty comes from managing several external beta source codes
that should now coexist in the same repository. Since these codes are also
under development, they are regularly upgraded by their developers and
these changes need to be propagated to local project as well. Additionally,
these codes typically have their own revision control, which rises many issues
with potential local code modifications and commits that concern now both
local and external projects.
Proposal To solve aforementioned problems we propose an approach that uses
Git with two parallel interconnected branches, displayed in Figure 1. The firstsrc data
exp1
✭❛✮ ❉❡✈❡❧♦♣♠❡♥t
src data
exp1
Adding data
Analysis
✭❜✮ ❊①♣❡r✐♠❡♥t❛t✐♦♥
src data
exp2
exp1
✭❝✮ ▼❡r❣✐♥❣ r❡s✉❧ts
❋✐❣✳ ✶✳ ❉✐✛❡r❡♥t ♣❤❛s❡s ✐♥ ❣✐t ✇♦r❦✢♦✇
branch, named src, includes only the source code, i.e., code and scripts for running
the experiments and the analysis. The second, data, branch consists of all
the source code as well as all the data and analysis reports (statistical analysis
results, figures, etc.). These two branches live in parallel and are interconnected
through a third type of branches, the exp# branches, where the experimentation
is performed. All these together form a "ladder like" Git repository, depicted in
Figure 1(c).
We now explain the typical workflow usage of such branching scheme:
1. Development phase: Researchers work on a code development inside the
src branch, committing the changes, as shown on Figure 1(a). These modifications
can impact local or external code, analysis or even the scripts for
running the experiments. Later, such modifications should be tested and the
correctness of the whole workflow should be validated. Only then can one
start doing real useful experiments.
2. Experimentation phase: Researcher creates a new branch from the src
branch containing and a new folder to store the results. We used the convention
that these two (branch and directory) should always have equal names,
which eases the usage of both Git and labbook. In the example of Figure
1(a), this new branch for doing the measurements is called exp1. Next,
new experiments are executed running the scripts and generate results. The
resulting data, together with the captured environment meta-data, are then
committed to the Git. After that, one might want to do some basic analysis
of the data, investigating the results, which may later trigger another round
of experimentation and so on, as it is showed on the Figure 1(b). Finally,
only when all desired measurements are finished, exp1 will be merged with
the data branch.
3. Merging and reports phase: All experimental exp# branches are in the
end merged with data, as it can be seen on Figure 1(c). In addition, result
observations for each exp# branch are written to the labbook. Afterwards,
comparison of different experiments can be performed by generating figures,
tables and clear explanations, to describe the newly discovered phenomena.
Since the changes to the source code from src branch are also propagated
through exp#, the head of the data branch will always contain the latest code
together with all the data. Nevertheless, the older version of code responsiblefor producing a particular data or analysis can always be found in the Git
history.
A peculiar situation occurs when there are source modifications inside the
experimental branches. They have to be committed (as measurements are never
done with an uncommitted code), even though in most cases they represent an ad
hoc change, specific to an individual machine and its installation. These minor,
local hacks would pollute the data branch and thus it has to be ensured that they
are not propagated. It is done by using a special script for merging the branches
instead of classical Git merge command. At the end of the exp# branch, all source
code changes (not the data) have to be invalidated by using git revert, i.e., the
"anti-commit" of all the previously committed modifications inside that branch.
This way modifications remain local for that exp# branch and the experimental
setup can still be reproduced by pulling the revision before the revert operation,
i.e., the one used to generate the data.
If the researcher eventually realizes that some of the source code modifications
done inside exp# branch could be useful for the whole project, there are two
ways to inserted them in the src branch. The first one involves rewriting Git
history and it is not advised as it leads to incoherences between Git repositories.
The second option is to cherry-pick the desired commits. Although this approach
produces some redundancy, it is very easy and safe and keeps the Git history
clear and coherent.
External software One more challenge arises when there are external software
repositories imported inside a local project. For example, one could have external
source code B that is a part of a bigger local project A. Since B is also under
development, one occasionally needs to pull the updates from its server, which
can cause conflicts with local modifications to the code. Resolving these conflicts
manually can sometimes be very tedious.
Even bigger problem occurs if one wants to push such local changes, as they
can be committed to either our project A, or external project B, or even to both
of them together. We decided to propagate, by default, these modifications only
to the project A, keeping the Git sha1 of A always valid and up-to-date. Later if
necessary, they can be pushed to B as well, but this has to be done by explicitly
calling the necessary commands.
Dealing with described challenges is error-prone, thus we started using
git-subrepo tool for cleaner and semi-automated management of external Git
projects inside our local one. However, we still have to do everything manually
when working with codes that are using other version control systems, notably
svn.
Analysis We now analyze the proposed solution and investigate how it addresses
the stated problematic.
First, a complete synchronisation of code, data and analysis is ensured. The
convention to use the same name for Git experiment branches and folders containing
experiment results, additionally carefully noting it in the labbook, makesexploration of project history very smooth. This way one can easily find when
a particular data or a figure was created, pull the revision used to generate it,
inspect the code, reconstruct the environment and finally reproduce the object.
Using experimental branches also allows some local source modifications, that
are specific for the remote machine or some other part of the experimentation
setup. These changes stay local for that exp# branch avoiding to pollute main
src and data branches, elegantly making the project easier to read while still
keeping it coherent. Additionally, Git permits to put tags on certain commits,
which can be used to annotate an important revision, such as the ones with the
stable source code or the ones with some specific adjustments. With the evolution
of the study, Git history becomes large and harder to explore, thus these
tags can help to quickly find a desired state of the project.
By using Git as proposed, it is extremely easy to set up an experimental
platform on a remote machine by pulling only the head of the src branch. This
solves the problem of long and memory consuming retrieving of the entire data
and Git history, as the src branch is typically very small.
On the other hand, one might want to gather all the experimental data at
once, which can be easily done by pulling only the data branch. This is the case
for the researchers that are not interested in the experimentation process, but
only at the analysis of the whole set of results. For them, src and exp# branches
are completely transparent, as they will retrieve only the latest version of the
source code (including needed analysis scripts) and the entire data.
Another use case is when someone wants to write an article or a report based
on the experiment results. A completely new branch can be created from data,
selecting from the repository only the data and analysis code needed for the
publication and deleting the rest. This way complete history of the study behind
the article is preserved for the reviewers.
Holding external projects inside a local one allows to do git pull or svn
checkout in sub-directories, keeping them up-to-date. Small problems arise when
some modifications to the external code are done. These changes de facto influence
both external and local repository but our solution ensures that they are
committed only to the local revision control. Therefore in the meta-data part
of the experiment files, tracked revision of the external code corresponds to the
version pulled before any of the local changes, which is not strictly legitimate.
Nevertheless, this small issue is not critical, since the revision in local project is
stored in meta-data as well, and this value is always perfectly correct. Pulling
this version will bring the right code, keeping the research reproducible.
✹ ❊✈❛❧✉❛t✐♦♥
We used the described methodology in two very different use cases. The first
one is a part of the study of CPU cache performance on various Intel and ARM
micro-architectures [4]. The developed source code was very simple, containing
only a few files, but there were numerous input parameters to be taken into
account. Probably the critical part of this study is about the environment setup,
which proved to be unstable, and thus, responsible for many unexpected phenomena.
Therefore, it was essential to capture, understand and easily compareas much meta-data as possible. Although it did not lead to a reproducible article
as we were only discovering such tools, we used this workflow and can still
track the whole history of these experiments. The second use case [3] aims at
providing accurate performance predictions for dense linear algebra kernels, using
the StarPU runtime on top of the SimGrid simulator. By contrast, input
parameters and environment here are fixed, but the source code is very complex
and in constant evolution. Moreover, we had to manage code from two external
repositories as well many of our own scripts.
The proposed solution proved generally successful in both use cases. We have
determined several good and bad sides, while for some aspects still remain rather
uncertain.
Pros Our approach is fast and efficient for a daily usage. It provides reasonable
boundaries without taking away too much flexibility from the users. It offers
good code modification isolation, which is important for ad hoc changes. Perfect
provenance tracking, which was painless to extend and explore, was crucial for
the cache measurement study. Although these two use cases are very different,
most of the captured environment meta-data is the same for both projects:
date and time, hostname, Linux and gcc version, users logged on the machine,
environment variables, used external libraries, code revisions, memory hierarchy
of the machine, CPU governor and frequency, compilation outputs, etc. Since
all the source code and data is in Git repository, reconstructing experimentation
setup is straightforward. One could argue that not all elements are completely
captured, since operating system and external libraries can only be reviewed
but not reconstructed. To handle this, researchers would have to use virtual
machines to run the experiments, which would introduce many new performance
issues. Finally, after applying such a methodology throughout the whole research
process, it was extremely easy to write an article [3] in Org-mode that was
completely reproducible as well. Along with the text, this Org-mode document
contains all the analysis scripts and the raw data is provided as the article
companion [6] and can be inspected by reviewers.
Cons The biggest disadvantage of our approach is that it has many not so
common conventions along with a steep learning curve workflow, hence it is
difficult for new users. Moreover, it requires an expertise in Org-mode, preferably
using Emacs text editor, together with a good understanding of Git. However,
we believe that these tools provide benefits that are worth investing time.
Additionally, we find current way of managing external source repositories
slightly cumbersome, and we are searching for a better solution. One path could
be to use recipes or experiment engines, that would do the checkout of external
sources for us and would only apply the right modifications before compiling.
The problem of storing large data files in repositories is well-known to the
community. It has been already solved for the Mercurial revision control tool,
but even after an thorough research we could not find a satisfactory solution for
Git. Git repositories can quickly reach a few Gigabytes, which does not hinderdaily committing but significantly slows down rebase operations to move back
to previous experimental conditions of a specific dataset.
Open questions It is still unclear how this approach would scale for multiple
users working simultaneously, doing code modifications and experiments in parallel.
In theory it should work if everyone has sufficient experience of the tools
and workflow, but we have never tried it with more than two persons.
Another interesting feature that we haven’t yet experienced is collaboration
with external users. These researchers could clone our project, work on it on
their own, try to reproduce the results and build upon our work, potentially
improving the code and contribute data sets back. Even though such utilization
should work smoothly, there could be some pitfalls that we haven’t anticipated.
These are only few of the unknown, and as there are certainly many more,
we are hoping for the audience suggestions and remarks.
✺ ❈♦♥❝❧✉s✐♦♥
In this paper, we did not intend to propose new tools for reproducible research,
but rather investigate whether a minimal combination of existing ones can prove
useful. The approach we described is a good example of using well-known,
lightweight, open-source technologies to properly perform a very complex process
like computer science experimentation. Although our methodology is undoubtedly
improvable and similar results could be obtained with other frameworks,
we nonetheless find it very smooth for a daily usage and extremely beneficial
to our work. We can only encourage people to build on such simple workflows
to conduct their own studies, as it is clearly a very effective way to produce a
reproducible research.
Continuity Editing for 3D Animation
Quentin Galvane, R´emi Ronfard, Christophe Lino, Marc Christie
To cite this version:
Quentin Galvane, R´emi Ronfard, Christophe Lino, Marc Christie. Continuity Editing for 3D
Animation. AAAI Conference on Artificial Intelligence, Jan 2015, Austin, Texas, United States.
AAAI Press.
HAL Id: hal-01088561
https://hal.inria.fr/hal-01088561
Submitted on 3 Dec 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Continuity Editing for 3D Animation
Quentin Galvane
INRIA
Univ. Grenoble Alpes & LJK
Remi Ronfard ´
INRIA
Univ. Grenoble Alpes & LJK
Christophe Lino
INRIA
Univ. Grenoble Alpes & LJK
Marc Christie
IRISA
University of Rennes I
Abstract
We describe an optimization-based approach for automatically
creating well-edited movies from a 3D animation.
While previous work has mostly focused on
the problem of placing cameras to produce nice-looking
views of the action, the problem of cutting and pasting
shots from all available cameras has never been addressed
extensively. In this paper, we review the main
causes of editing errors in literature and propose an editing
model relying on a minimization of such errors. We
make a plausible semi-Markov assumption, resulting in
a dynamic programming solution which is computationally
efficient. We also show that our method can generate
movies with different editing rhythms and validate
the results through a user study. Combined with
state-of-the-art cinematography, our approach therefore
promises to significantly extend the expressiveness and
naturalness of virtual movie-making.
Introduction
The wide availability of high-resolution 3D models and the
facility to create new geometrical and animated contents, using
low-cost input devices, opens to many the possibility of
becoming digital 3D storytellers. A convincing illustration
is the rise of the machinima1
community, consisting in creating
movies by relying on contents and rendering engines
borrowed from computer games through ad-hoc techniques
or dedicated modeling tools2
.
To date there is however a clear lack of accessible tools
to easily create the cinematography (positioning the cameras
to create shots) and perform the editing of such stories
(selecting appropriate cuts between the shots created by
the cameras). Creating a movie requires the knowledge of
a significant amount of empirical rules and established conventions.
In particular continuity editing – the creation of
a sequence of shots ensuring visual continuity – is a complex
endeavor. Most 3D animation packages lack continuity
editing tools, calling the need for automatic approaches that
would, at least partially, support users in their creative process
(Davis et al. 2013).
1
contraction of machine and cinema
2
see iClone http://www.reallusion.com/iclone/
or Moviestorm http://www.moviestorm.co.uk/ tools
Previous contributions in automatic film editing have focused
on generative methods mixing artificial intelligence
and computer graphics techniques. However, evaluating the
quality of film editing (whether generated by machines or by
artists) is a notoriously difficult problem (Lino et al. 2014).
Some contributions mention heuristics for choosing between
multiple editing solutions without further details (Christianson
et al. 1996) while other minimize a cost function which
is insufficiently described to be reproduced (Elson and Riedl
2007). Furthermore, the precise timing of cuts has not been
addressed, nor the problem of controling the rhythm of cutting
(number of shots per minute) and its role in establishing
film tempo (Adams, Dorai, and Venkatesh 2002). Most
approaches yield a reactive style of editing known by professional
editors as the dragnet style (Murch 1986), which
mechanically cuts to new speakers or actions.
In this paper, we propose a continuity editing model for
3D animations that provides a general solution to the automated
creation of cinematographic sequences. Our model
encodes the continuity editing process as a search for the optimal
path through an editing graph. In this editing graph, a
node represents a time-step (a temporal fragment of a shot),
and an arc represents a transition between two cameras, going
from a camera to either the same camera (no cut) or another
camera (cut).
Our optimization uses dynamic programming to minimize,
under a semi-Markovian hypothesis, the errors made
along three criteria (see Figure 1): the quality of the shots
(with respect to the unfolding actions), the respect of continuity
editing rules and the respect of a well-founded model
of rhythm (cutting pace). Semi-Markov models (Murphy
2002; Yu 2010) have been used before in the context of
information extraction (Sarawagi and Cohen 2004), speech
generation (Zen et al. 2007) and computer vision (Shi et al.
2008). To the best of our knowledge, this is the first time they
are suggested as a computational model for film editing.
Our contributions are: (i) a detailed formalization of continuity
editing for 3D animation, encompassing a thorough
number of visual properties and continuity rules (ii) an optimal
algorithm for automatic editing in which parameters
such as pacing can be controlled, thereby significantly increasing
the expressiveness of editing tools, and (iii) a validation
of our model through a user evaluation comparing the
original edit of an existing movie with our optimal edit andJump Cuts
Continuity errors
Non-motivated shots and cuts
Our solution
Jump Cut Jump Cut
left-to-right screen gaze direction
Figure 1: Editing errors in a short sequence of a movie. From top
to bottom: jump cut errors; breaking the continuity errors; nonmotivated
shots and cuts. The last edit is the output of our system.
with degraded approaches.
Related work
The problem of generating movies from 3-D animation can
be decomposed into the problems of (i) choosing shots and
placing cameras (the cinematography problem), and (ii) deciding
when to assemble those shots into a movie (the film
editing problem). In this section, we review previous work
on the film editing problem chronologically.
(Christianson et al. 1996) introduce the declarative camera
control language (DCCL) as a general framework for
generating idiom-based solutions to cinematography and
film editing problems. Film idioms (He, Cohen, and Salesin
1996) are recipes for obtaining good cinematography and
editing in any given situation, similar to cases in case-based
reasoning. As a result, DCCL uses a conversation idiom for
filming conversations, a fighting idiom for filming fights, etc.
DCCL then builds a film tree, as a result of filming each
scene in all available idioms, and includes a heuristic evaluator
for checking the visual quality of sequences, choosing
the one with the highest quality. The evaluation criteria are
only briefly mentioned, and in comparison, we offer a full
description of a scoring function that can be used to find optimal
editing solutions using all available cameras in a principled
and reproducible fashion.
(Tomlinson, Blumberg, and Nain 2000) propose a fully
automatic method for generating expressive cinematography.
Their system uses autonomous cameras with emotional
states and goals, that choose between a number of visual
targets – such as a specific character, or two characters interacting
with each other, or one character interacting with
its environment. Though their system interestingly motivates
the shots both emotionally and visually, the rules of montage
(editing) are not enforced, and the pacing of the shots is resolved
by ad hoc rules. (Kennedy and Mercer 2002) directly
address the problem of planning a complete sequence of
shots for a given sequence of actions which must be known
in advance. Users can choose between fast or slow editing
in two different styles. Authors use a depth-first forward
chained planner which can only evaluate a small number of
possible plans and enforce a single continuity editing rule
(”not crossing the line of action”).
Unlike previous work, Darshak (Jhala and Young 2011)
takes as input an explicit declarative representation of the
story goals, including all actions, causal links between actions,
and ordering constraints. Story goals are defined in
terms of a small number of dramatic situations, and a hierarchical
partial-order causal link planner computes a camera
plan, consisting of a sequence of shots that achieves
the desired story goals. Darshak goes a long way into motivating
the shots, but the actual cinematography and editing
are not evaluated. Cambot (Elson and Riedl 2007) is a
movie-making system where the choice of shots is found as
a solution to an optimization problem using dynamic programming.
The scene is expressed as a sequence of nonoverlapping
dramatic beats and their approach evaluates
different placement of characters (blockings) and camera
choices for each beat. Though we also make use of dynamic
programming, our method is very different from (Elson and
Riedl 2007). Firstly, we search a much larger set of possible
solutions, by evaluating a higher number of shot transitions
at a finer level of granularity (every frame, rather than every
beat). As a result, our method makes it possible to choose
the precise cutting point between shots, and to maintain control
over the rate of shot changes (cutting pace). Secondly,
we describe in detail a cost function which implements an
extensive set of film editing rules. Our cost function has a
semi-Markov property which allows to efficiently optimize
over this larger solution space. Thirdly, our method does not
require the scene to be decomposed into a linear sequence of
beats, and works equally well with overlapping actions and
dialogues.
(Assa, Wolf, and Cohen-Or 2010) propose a fully automated
editing process that performs cuts in real-time between
multiple cameras viewing human motions. The ranking
between shots is computed by measuring for each camera
the correlation between human motions in the 3D scene,
and the on-screen 2D projection of these motions (the larger
the correlation, the better the shot). A measure of erosion of
the current view is employed to motivate the cuts between
the viewpoints, while enforcing continuity rules (jump-cut
and crossing the line of action). In a similar context of realtime
cinematography, (Lino et al. 2010) propose a system
that automatically computes for each frame a collection of
distinct viewpoints through spatial partitions. The editing
process is then performed by encoding continuity rules as
filtering operators that remove inconsistent viewpoints.
(Markowitz et al. 2011) extend the film idiom approach
by replacing finite state machines with behavior trees. They
enforce the 180 degree rule and the 30 degree rule, assuming
a single line of interest at any given time in the scene. Similar
to film idioms, their approach remains reactive, resulting
in an editing style that immediately follows the action andcannot easily control the pacing or style of the editing.
System overview
In this paper, we cast the problem of film editing as an optimization
problem over a space of semi-Markov chains. Our
system takes as input a 3D animation scene, comprising a
flow of world events, and a set of rushes taken from different
cameras and covering the whole scene. We then rank
possible edits on three key aspects: (i) how much shots convey
unfolding actions, (ii) how much continuity editing rules
are enforced and (iii) how much an input cutting rhythm is
respected.
Given a 3D animated scene with arbitrarily complex actions
a and a choice of rushes (i.e. unedited footage) from
M cameras, a semi-Markov chain is a sequence of states
(shots) sj with durations dj , chosen according to a probability
model over sj , dj and a. The probability of the next
shot sj+1 of duration dj+1 and starting at time tj+1 depends
only on the previous shot sj and the actions a in the segment
[tj+1, tj+1 + dj+1].
We here introduce the notion of editing graph, the graph
of all possible shots and transitions. In this graph, a node
represents a time-step (one frame) of a rush and an arc represents
a transition from frame i of a rush (camera) to frame
i + 1 of a rush (same or different). The output of our system
is then a full edit list of the scene, computed as the continuous
path through our editing graph minimizing the errors on
these three key aspects.
The first input of our system is an ordered list of durative
world events (that we refer to as actions), expressed in
the form (subject, verb, object). In the following, we consider
that the subject and object of all actions are characters,
and we refer to the set of all characters as C. We
use four main categories of actions: speaking actions performed
by the character’s mouth, reacting actions performed
by the character’s eyes, manipulating actions performed by
the character’s hands, and moving actions performed by the
character’s feet. As a result, a character can be the subject
of at most four different actions at any given time and the
object of an unlimited number of actions.
The second input of our system is a list of M rushes from
different cameras filming the scene for a total duration of
N video frames. We are agnostic about how the rushes are
obtained. Though in this paper a number of cameras were
placed manually by a human expert, they could equally be
computed by an automatic camera planner such as (Drucker
and Zeltzer 1995; He, Cohen, and Salesin 1996; Markowitz
et al. 2011; Elson and Riedl 2007) or any other method.
The output of our system is a movie, described as an edit
decision list (EDL) defined as a sequence of shots sj in
the form of triplets (rj , tj , dj ). Note that in this paper, we
only consider chronological EDLs where time is preserved
(tj+1 = tj + dj ). In this limited context, the EDL can be
reconstituted using the rush selection function r(t) which
gives the rush index as a function of time.
We here propose to cast the editing process into a mathematical
model accounting for three criteria: (i) how much
shots convey unfolding actions, (ii) the continuity editing
principles and (iii) the cutting rhythm of the movie. To do so,
we use a log-linear model where the probability of choosing
a particular sequence of shots sj is taken to be the exponential
of a linear cost function C(s, a). The cost function
C(s, a) is further decomposed into three terms which separately
measure (i) errors in conveying unfolding actions in
each shot, (ii) violations of continuity editing rules in each
cut and (iii) errors in choosing shot durations.
C(s, a) =X
j
X
tj≤t≤tj+dj
C
A(rj , t)
+
X
1≤j
C
T
(rj−1, rj , tj ) +X
j
C
R(dj )
In this equation, the first term is a sum over all frames
of all shots of a cost function C
A related to actions in
the scene. The second term is a sum over all cuts of
a cost function C
T
related to transitions between shots.
Those two term are further decomposed into weighted
sums of features, i.e. C
A(rj , t) = P
k w
A
k C
A
k
(rj , t) and
C
T
(ri
, rj , t) = P
k w
T
k C
T
k
(ri
, rj , t). The third term is a
sum over all shots of a cost function C
R related to editing
rhythm. In the following sections, we explain each of those
terms, and refer to the Appendix for mathematical details.
Symbolic projection
During the shooting of a virtual scene, all cameras capture
images which are perspective projections of the world scene
into their own frame of reference. In parallel to the computation
performed by the graphics pipeline, we perform a
symbolic projection of the actions which keeps a record of
how much of the action is visible in each rush at every single
frame.
This is performed as follows. First, each action is decomposed
into its constituents – verb, subject and object. Based
on the verb category (speaking, reacting, moving or manipulating),
we then compute the bounding boxes of involved
body parts (e.g. mouth, eyes, hands and feet) of the subject
and object characters. We then compute the screen size of
their projection in each frame of a rush. 0 Second, to evaluate
how much of these actions are visible, we compute the
visible and occluded areas of characters. To do so, for each
face f of each body part b of a character, we compute its projected
size (or area) S(f, r, t) at time t in rush r. This projected
size is measured relatively to the screen size, and comprises
both the on-screen and off-screen projections of f. We
then define the visible and occluded sizes of f as follows.
Its occluded size O(f, r, t) corresponds to the cumulative
size of its areas that are either occluded or appear off-screen,
while its visible size V (f, r, t) is the complementary value
computed such that S(f, r, t) = V (f, r, t) + O(f, r, t). We
finally define the projected size and the visible size of each
character c as the sum of corresponding values on each face
of its body parts: V (c, r, t) = P
b∈c
P
f∈b
V (f, r, t)
This method is further easily extended to the case of
non-character objects (we use their bounding boxes) and
multiple-characters.Marty
George
Goldie
Lou
0% 20% 40% 60% 80% 100%
(a) Narrative importance per character per frame
Marty
George
Goldie
Lou
(b) On-screen character sizes in Zemeckis movie
Marty
George
Goldie
Lou
(c) On-screen character sizes in our solution
Figure 2: The relative narrative importance of a character is computed
from all actions where it plays a role. It correlates with the
screen size of the characters in both the Zemekis movie (linear correlation
coefficient of 0.56) and our solution (0.73).
Narrative importance
To each action a holding at time t, a narrative importance
I(a) is attributed depending on whether a is a foreground
or a background action. We then firstly distribute the importance
according to the different roles in the action (subject
and object). Note that this defines the narrative importance
of each character I(c, t) at time t. We secondly distribute
the importance given to each role proportionally into the individual
body parts of the character filling the role. For instance,
in a speak action the subject’s and object’s visual
targets are their heads; in a manipulate action the subject’s
visual target is its head and chest; in a move action, the subject’s
visual target is its full body. We finally non-uniformly
distribute the importance of a body part on its front, back
and side faces to obtain the narrative importance of each face
I(f, t) of a character at time t.
Shot selection
Based on the symbolic and geometric data related to unfolding
actions of a given frame, we rank every frame of every
shot on three aspects: the action visibility, the action proximity
and the action ordering (also known as the Hitchcock
principle).
The action visibility term evaluates how much of unfolding
actions is visible. To fully satisfy this criteria, each important
body part of a character taking part in an unfolding
action should be on-screen and fully visible. The cost associated
to action visibility is computed as the sum, on each face
f of each body part b of each character c, of the occluded
proportion of the face weighted by its narrative importance:
C
A
V
(r, t) = X
c∈C
X
b∈c
X
f∈b
I(f, t) ·
O(f, r, t)
S(f, r, t)
The action proximity term evaluates how immersed the
camera is in the unfolding actions, i.e. how much the screen
is filled by actions. The cost (or penalty) associated to poor
action proximity is then given by the proportion of the screen
filled by the characters:
C
A
P (r, t) = 1 −
X
c
V (c, r, t)
The action ordering term evaluates how much the onscreen
importance of a character matches its narrative importance.
This is also known as the Hitchcock principle,
which states that the size of a character should be proportional
to its narrative importance in the story (Truffaut and
Scott 1967; Hawkins 2005; DeLoura 2009). Our implementation
considers all characters present in the scene, not just
the characters present in each shot, or the characters participating
in the main action. This has the benefit to easily
rule out prominent shots of unimportant characters and favor
prominent shots of important characters, focusing on its
important body parts (mouth while speaking, eyes while reacting,
hands while manipulating, feet while moving). The
cost associated to the Hitchcock principle is computed as the
sum of all deviations of the on-screen visibility of a character
compared to its narrative importance:
C
A
H(r, t) = X
c∈C
I(c, t)
P
c
0
I(c
0
, t)
−
V (c, r, t)
P
c
0
V (c
0
, r, t)
Continuity editing
We rank all possible transitions between rushes based on
a computational model of continuity-editing. Continuityediting
is the most commonly used editing style in filmmaking.
It relies on a set of well established rules: avoiding jump
cuts, enforcing the screen, motion and gaze continuity and
maintaining the left-to-right ordering of on-screen characters
(Dmytryk 1984; Thompson and Bowen 2009).
Jump cuts When the same character appears in two consecutive
shots (i.e. before and after a cut), there must be suf-
ficient change in either its apparent size or its profile angle
in the two shots, so that the audience perceives the cut as
a change in viewpoint, rather than a sudden change in the
character’s pose, also known as a jump cut. To prevent such
cuts, we penalize such errors through a cost function over
all characters appearing in successive shots, whose formula
is detailed in Section Jump cuts of the appendix.
Screen, motion and gaze continuity The main goal of
continuity editing is to enforce continuity on screen positions,
motion directions and gaze directions of all characters
across the cut. To prevent discontinuities, we penalize
them through a non-linear combination of the differences in
screen position, gaze direction and motion direction of all
characters appearing in successive shots. The formulas of
these cost functions are detailed in Sections Screen continuity,
Motion continuity and Gaze continuity of the appendix.Left-to-right ordering The left-to-right ordering of characters
is another important factor to enforce visual continuity.
Characters whose relative screen positions are reversed
after a cut appear to be jumping around, which attracts attention
to the cut (Smith 2005) – this criteria is also known
as the 180 degree rule. For every pair of character (c, c0
)
appearing on-screen before and after the cut, we then penalize
the reversion (cost=1) iff their oriented difference of onscreen
position ∆Px(c, c0
) (taken on the x axis) is of opposite
sign. The overall cost on left-to-right continuity is then
computed as the sum of this penalty on all pairs of character
appearing on-screen before and after the cut. The formula of
this cost function is detailed in Section Left-to-right ordering
of the appendix.
Cutting rhythm
Cutting rhythm is an important element of film editing style
(Bordwell 1998). Cutting between cameras produces visual
rhythm. Fast cutting as in an action scene can change
cameras as often as every half second. The cutting rhythm
has been studied extensively by film scholars (Salt 2009;
Cutting, DeLong, and Nothelfer 2010) who have shown that
it is well approximated with a time-varying log-normal distribution
of shot durations (Limpert, Stahel, and Abbt 2001).
Parameters of the log-normal distribution are the mean µ
and standard deviation σ of the log-transformed durations
log dj , which result in a skewed distribution of durations
with average shot length ASL = exp
µ +
σ
2
and variance
V ar = exp
2µ + σ
2
(exp σ
2 −1) . Rather than making
automatic decisions, our system is designed to let the
user/director choose the average shot length (ASL) which
dictates the rhythm of editing, and hence the editing style.
To enforce those values, we compute a cost measuring, for
each shot sj of duration dj , the deviation of its duration from
the log-normal distribution
C
R(dj ) = (log dj − µ)
2
2σ
2
+ log dj
Optimization-based film editing
We evaluate the cost of an arbitrary edit decision list of
shots sj with a weighted sum of simple feature functions.
To do so, we use a dynamic programming approach to
find the minimum cost solution by storing partial solutions
(Mitchell, Harper, and Jamieson 1995; Murphy 2002).
We define B(r, t) to be the cost of the best sequence of
shots ending at time t with a shot using rush r. One important
result that follows from our choice of cost functions is
the following recurrence relation
B(r, t) = min
t0 < t
r0 6= r
➉
B(r0, t0) + C
T
(r0, r, t0 + 1)
+
Xt
t
0=t0+1
C
S
(r, t0
) + C
R(t − t0)
➌
In plain words, the best sequence ending on rush r at time
(frame) t can be computed by comparing all combinations
Rush 1
Rush 2
Rush 3
Rush 4
Rush M ...
t0 t2t1 t3 t
B(3,t)
Figure 3: Illustration of our dynamic programming algorithm, using
semi-Markov decisions. The best edit in which a shot ends in
Rush 3 at time t is computed as the best combination (drawn in
red) of an edit in which a shot ends in Rush r0 6= 3 at a prior time
ti < t then a shot using Rush 3 between ti and t.
of a shot ending on rush r0 at time t0 < t, followed by a cut
from rush r0 to rush r between frames t0 and t0+1, followed
by a shot of duration t − t0 using rush r (see Figure 3).
Using the above recurrence, we build the table of B(r, t)
in time M2N2
and space MN, where M is the number
of rushes and N is the number of video frames. We additionally
store a back-pointer to retrieve the actual path
yielding the minimum-cost solution. Note that the method
can also be used to retrieve sub-optimal solutions ending
in other cameras. This can be useful in cases where the
final shot is chosen by the director. To improve our system
efficiency, we further restrain the search in our algorithm
to a constant horizon H (longest allowable shot duration)
of 30 seconds. This leads to compute a solution
in time M2NH (Mitchell, Harper, and Jamieson 1995;
Murphy 2002), which is sufficient for our purpose. For
longer sequences with more rushes, an algorithm by (Datta,
Hu, and Ray 2008) can be used to compute an exact and
unbounded solution in time MN(M + N).
Experimental results
To validate our approach, we have recreated the animation
of a well-known scene from Robert Zemeckis’ movie “Back
to the future”. The average shot length (ASL) in the original
version is 6.6 seconds. The distribution of shot lengths in
the original version is well approximated with a log-normal
law of mode m = 2.28 and standard deviation σ = 0.82.
This short (80 seconds) scene is a moderately complex interior
scene, with four main characters, all engaging in a
variety of actions, including two-way and three-way dialogues,
physical contacts, and everyday activities such as
sweeping the floor and serving food. All animations were
manually annotated to provide (subject, verb, object) descriptions
at the right time-codes. Twenty-five cameras were
manually placed for the whole duration of the sequence (sixteen
of them closely approximating the actual cameras from
the original movie, and nine providing alternative angles).
The evaluation of editing is a general and challenging
problem (Lino et al. 2014) since no ground truth is availableFigure 4: The scores obtained by the five stimuli, each represented
with a whisker plot. The central point represents the
median score, the box represent the scores between the first
and third quartiles, and the bottom and top lines represent
the minimum and maximum scores.
for objective comparisons. As a consequence, the quality of
an edit can only be measured subjectively through indirect
user evaluations. Therefore, to demonstrate the soundness
of our model, we have experimentally compared our method
(O) to the original edit of the scene (Z) reproduced from Zemeckis’
movie (which serves as a reference for comparison
with expert cinematographers) and to three degraded versions:
a degraded version (Ds) where the content of shots
is not considered (i.e. the shot cost is removed), a degraded
version (Dp) where the enforcement of the specified cutting
rhythm is not considered (i.e. the rhythm cost is removed), a
degraded version (Dc) where visual discontinuities are enforced
(i.e. the cut cost is reversed).
We performed a subjective evaluation of our method by
designing a perceptual user-study. Twenty-one participants
volunteered for this experiment. They were 27.5 (± 5.7)
years old (range: 20 to 42). They were naive with respect to
the purpose of the experiment. All had normal or correctedto-normal
vision. They gave written and informed consent
and the study conformed to the declaration of Helsinki. We
prepared 5 stimuli (a fully edited version of 80 seconds per
method). Participants were asked to observe the video stimuli
while seated in front of a desk. After each stimulus viewing,
participants were asked to rank the global film-making
quality3 on a discrete scale ranging from 0 (very bad) to 10
(very good). In total, they repeated this task 20 times (5×4
repetitions). Stimuli were presented in a randomized order.
The total duration of the experiment was about 30 minutes.
We tested three hypotheses. H1: editing has an impact on
the perceived quality of the observed video stimulus; H2:
each of the three terms in our cost function (shot content,
continuity rules and cutting rhythm) has a positive impact on
perceived quality; H3: the perceived quality of the version
done by an expert cinematographer is significantly higher
than our method. The dependent variable in this study was
the participants’ score given to each version. Figure 4 illus-
3We additionally proposed a number of criteria that participants
could consider to score each version: the enhancement of characters
performance, the synchronization of cuts with the scene content,
the aesthetic of shots.
trates the scores obtained for each version.
Hypothesis H1 was confirmed using a non-parametric
Friedman test (p < 0.05). Post-hoc comparisons summarized
in Figure 4 confirm hypothesis H2 that the consideration
of each of the three key aspects has a positive impact
on subjective quality, but discard hypothesis H3 that the version
done by an expert cinematographer is significantly better
scored than the one generated by our system (though Zemeckis’
version globally obtained better scores).
To further illustrate and validate our method, we have
also generated two new versions of the scene with ASLs
of resp. 2 seconds (fast cutting style) and 10 seconds (slow
cutting style). The choice of shots is very different in those
different styles. In fast cutting style, there is a preference for
close-ups and medium shots. In slow cutting style, there is
a preference for medium long shots and full shots. For evaluation
purposes, we are making our experimental data (including
rushes and their annotations) and our experimental
results publicly available 4
.
Limitations and future work
Our model is currently limited to the case of linear editing,
where the chronology of events is maintained. In future
work, we would like to remove this limitation by allowing
temporal ellipses and re-ordering of events. Another limitation
is that we are restricted to a limited choice of cameras.
Future work is needed to optimize over camera positions and
framings. In addition, the proposed model only enables to
control the pacing. Other style parameters such as shot composition
(flat vs. deep staging), camera movements (static
shots, dolly shots, crane shots), transitions (reverse shots)
and lighting preferences would favor user creativity. Our
model of shot selection is based on bounding boxes of the
character’s body parts and a primitive classification of their
actions. Objects and places in the scene, as well as character’s
moods and intentions, should also play a part. Finally,
we should note that the semi-Markov assumption has limitations
of its own. Important film editing patterns such as
book-ending, separation or parallel action (Sharff 1982) cannot
be taken into account by such a memory-less model. The
investigation of higher-order Markov models or context-free
grammars will be pursued to overcome such limitations.
Conclusion
In this paper, we have presented a continuity-editing approach
to the automated creation of cinematographic sequences
for 3D animations. We have introduced the notion
of editing graph and showed how dynamic programming can
be used to compute an optimal edit under a semi-Markov hypothesis.
We have provided a thorough description of means
to rank shots and edits, and to measure the distance to a
specified cutting rhythm. Our solution is supported by subjective
evaluations obtained in a perceptual user study. The
proposed approach performs a clear shift from existing techniques
such as idiom-based representations, with a level of
expressiveness not addressed by previous contributions. Finally,
this work provides the foundations to address novel
4
https://team.inria.fr/imagine/continuity-editing/challenges in automated cinematography, such as learning
and reproducing cinematic styles from real-movies.
Acknowledgments
The research presented in this paper benefited from the assistance
of many people. Laura Paiardini and Estelle Charleroy
created the assets and the animation for the example sequence.
Adela Barbulescu helped create the facial animation.
Anne-Hel´ ene Olivier and Michael Gelicher gave pre- `
cious help on experimental design and evaluation of the user
study. We also thank the volunteers who participated in the
user study.
A preliminary version of this work was developed by the
second author as part of the patented Text-to-Movie application
by Xtranormal Technologies 5
.
This work has been funded by the French Agency for Research
(ANR) through projects CHROME and CINECITTA
and the European Research Council (ERC) through the
project EXPRESSIVE.
Appendix
We here provide the formulas of our cost functions related to
continuity-editing rules. We first introduce v(c), a weighting
factor defined as the minimum visible area of character c in
two consecutive frames. In details, it is computed as follows
v(c) = min(V (c, i, t − 1), V (c, j, t))
This factor is used to weight costs on each single character.
We then give no importance to off-screen characters, little
importance to background characters, and more importance
to foreground characters (since they are the focus of attention).
Jump cuts
An illustration of the avoidance of jump cuts is given in Figure
5. We penalize a jump cut by summing, on each single
character, the degree of similarity between the two frames
before and after the cut. Practically, this penalty is computed
as follows
C
T
J
(i, j, t) = X
c
v(c) · φJ (∆S(c), ∆θ(c))
where ∆S(c) and ∆θ(c) are the differences in resp. apparent
size and view angle of character c between the two frames.
φJ is a non-linear function taking these two parameters as
input. It considers a minimum acceptable change in apparent
size ∆Smin, as well as a minimum acceptable change
in view angle θmin (often set to 30 degree). φJ then returns
the maximum penalty when no change occurs neither in apparent
size nor view angle of character c, and the penalty
decreases as the change in either apparent size or view angle
increases.
Screen continuity
An illustration of the screen continuity rule is given in Figure
6. We penalize such a discontinuity by summing, on each
5Remi Ronfard, automated cinematographic editing tool, Xtra- ´
normal Technologies, May 2009.
(a) Change in apparent size
(b) Change in view angle
(c) Insufficient change in both size and view angle
Figure 5: Examples of cuts with sufficient change in size
(top), sufficient change in view angle (middle), and an example
of jump cut (bottom).
(a) Screen continuity
(b) Screen discontinuity
Figure 6: Examples of cuts respecting (top) or violating (bottom)
the screen continuity.
single character, its screen position change. Practically, this
penalty is computed as follows
C
T
S
(i, j, t) = X
c
v(c) · φS (P(c, j) − P(c, i))
where P(c, i) and P(c, j) represent the 2D screen position
of character c resp. before and after the cut. φS is a nonlinear
function which takes as input the distance between
both positions. It then returns the minimum penalty (0) for
two identical positions, and the penalty increases with their
distance.Motion continuity
An illustration of the motion continuity rule is given in Figure
7. We penalize such a discontinuity by summing, on
each single character, its change of apparent motion direction.
Practically, this penalty is computed as follows
C
T
M(i, j, t) = X
c
v(c) · φM (M(c, i), M(c, j))
where M(c, i) and M(c, j) are 2D vectors representing the
on-screen motion direction of character c resp. before and
after the cut. φM is a non-linear function which takes as input
these two consecutive motion directions. It then returns
the minimum penalty (0) when the two vectors are close
enough (e.g. a character moving in a given direction keeps
moving in a similar direction after the cut), and the penalty
increases as these vectors differ from each other.
Gaze continuity
An illustration of the gaze continuity rule is given in Figure
8. In a similar way to the motion continuity, we penalize
such a discontinuity by summing, on each single character,
its change of apparent gaze direction. Practically, this
penalty is computed as follows
C
T
G(i, j, t) = X
c
v(c) · φG (G(c, i), G(c, j))
where G(c, i) and G(c, j) are 2D vectors representing the
on-screen gaze direction of character c resp. before and after
the cut. φG is a non-linear function which takes as input
these two consecutive gaze directions. It then returns the
minimum penalty (0) when the two vectors are close enough
(e.g. a character looking in a given direction keeps looking
in a similar direction after the cut), and the penalty increases
as these vectors differ from each other.
Left-to-right ordering
An illustration of the left-to-right continuity rule is given in
Figure 9. We penalize such a discontinuity by summing, on
each pair of characters (c, c0
), their change in relative onscreen
position (from left to right, this is also known as the
180 degree rule). To do so, we define a new weighting factor
v(c, c0
) computed as the product v(c) · v(c
0
) of the weights
of both characters. We then give no importance to a pair of
characters where at least one is off-screen either before or
after the cut, little importance to a pair of background characters,
and much importance to a pair of foreground characters.
Practically, this penalty is computed as follows
C
T
L (i, j, t) = X
c,c0
v(c, c0
) · φL (L(c, c0
, i), L(c, c0
, j))
where L(c, c0
, i) and L(c, c0
, j) are two real values representing
the relative position of characters c and c
0
resp. before
and after the cut (practically, this relative position is
computed as the signed difference of their on-screen horizontal
coordinates). φL is a non-linear function taking as
input these two reals. It then returns the minimum penalty
(0) when both values are of same sign (i.e. the relative position
of characters is enforced) and the maximum penalty
(1) when the two values are of opposite sign (i.e. the relative
position of characters is reversed).
(a) Motion continuity
(b) Motion discontinuity
Figure 7: Examples of cuts respecting (top) or violating (bottom)
the motion continuity.
(a) Gaze continuity
(b) Gaze discontinuity
Figure 8: Examples of cuts respecting (top) or violating (bottom)
the gaze continuity.
(a) Left-to-right ordering continuity
(b) Left-to-right ordering discontinuity
Figure 9: Examples of cuts respecting (top) or violating (bottom)
the left-to-right ordering continuity (also known as 180
degree rule).References
Adams, B.; Dorai, C.; and Venkatesh, S. 2002. Toward automatic
extraction of expressive elements from motion pictures:
tempo. IEEE Transactions on Multimedia 4(4):472–
481.
Assa, J.; Wolf, L.; and Cohen-Or, D. 2010. The virtual director:
a correlation-based online viewing of human motion.
Computer Graphics Forum 29(2):595–604.
Bordwell, D. 1998. On the History of Film Style. Harvard
University Press.
Christianson, D. B.; Anderson, S. E.; He, L.-W.; Weld, D. S.;
Cohen, M. F.; and Salesin, D. H. 1996. Declarative camera
control for automatic cinematography. In AAAI, 148–155.
Cutting, J. E.; DeLong, J. E.; and Nothelfer, C. E. 2010. Attention
and the Evolution of Hollywood Film. Psychological
Science 21(3):432–439.
Datta, R.; Hu, J.; and Ray, B. 2008. On efficient viterbi
decoding for hidden semi-markov models. In 19th International
Conference on Pattern Recognition., 1–4.
Davis, N.; Zook, A.; O’Neill, B.; Headrick, B.; Riedl, M.;
Grosz, A.; and Nitsche, M. 2013. Creativity support for
novice digital filmmaking. In SIGCHI Conference on Human
Factors in Computing Systems, 651–660. ACM.
DeLoura, M. 2009. Real Time Cameras, A Guide for Game
Designers and Developers. Morgan Kaufman.
Dmytryk, E. 1984. On Film Editing: An Introduction to the
Art of Film Construction. Focal Press.
Drucker, S. M., and Zeltzer, D. 1995. Camdroid: A system
for implementing intelligent camera control. In Symposium
on Interactive 3D Graphics, I3D ’95, 139–144. ACM.
Elson, D. K., and Riedl, M. O. 2007. A lightweight intelligent
virtual cinematography system for machinima generation.
In Artificial Intelligence and Interactive Digital Entertainment
(AIIDE ’07).
Hawkins, B. 2005. Real-Time Cinematography for Games.
Charles River Media.
He, L.-w.; Cohen, M. F.; and Salesin, D. H. 1996. The virtual
cinematographer: a paradigm for automatic real-time camera
control and directing. In SIGGRAPH, 217–224. ACM.
Jhala, A., and Young, R. M. 2011. Intelligent machinima
generation for visual storytelling. In Artificial Intelligence
for Computer Games. Springer New York. 151–170.
Kennedy, K., and Mercer, R. E. 2002. Planning animation
cinematography and shot structure to communicate theme
and mood. In Smart Graphics, 1–8. ACM.
Limpert, E.; Stahel, W. A.; and Abbt, M. 2001. Log-normal
distributions across the sciences: Keys and clues. BioScience
51(5):341–352.
Lino, C.; Christie, M.; Lamarche, F.; Schofield, G.; and
Olivier, P. 2010. A real-time cinematography system for
interactive 3d environments. In Symposium on Computer
Animation, 139–148. ACM.
Lino, C.; Ronfard, R.; Galvane, Q.; and Gleicher, M. 2014.
How Do We Evaluate the Quality of Computational Editing
Systems? In AAAI Workshop on Intelligent Cinematography
And Editing.
Markowitz, D.; Jr., J. T. K.; Shoulson, A.; and Badler, N. I.
2011. Intelligent camera control using behavior trees. In
Motion in Games (MIG), 156–167.
Mitchell, C.; Harper, M.; and Jamieson, L. 1995. On the
complexity of explicit duration hmm’s. IEEE Transactions
on Speech and Audio Processing 3(3):213–217.
Murch, W. 1986. In the blink of an eye. Silman-James Press.
Murphy, K. P. 2002. Hidden semi-markov models. Technical
report, MIT AI Lab.
Salt, B. 2009. Film Style and Technology: History and Analysis
(3 ed.). Starword.
Sarawagi, S., and Cohen, W. W. 2004. Semi-markov conditional
random fields for information extraction. In Advances
in Neural Information Processing Systems.
Sharff, S. 1982. The elements of cinema. Towards a theory
of cinesthetic impact. Columbia University Press.
Shi, Q.; Wang, L.; Cheng, L.; and Smola, A. 2008. Discriminative
human action segmentation and recognition using.
semi-markov model. In IEEE Conference on Computer
Vision and Pattern Recognition (CVPR).
Smith, T. J. 2005. An Attentional Theory of Continuity Editing.
Ph.D. Dissertation, University of Edinburgh.
Thompson, R., and Bowen, C. 2009. Grammar of the Edit.
Focal Press.
Tomlinson, B.; Blumberg, B.; and Nain, D. 2000. Expressive
autonomous cinematography for interactive virtual environments.
In International Conference on Autonomous Agents,
AGENTS ’00, 317–324. ACM.
Truffaut, F., and Scott, H. G. 1967. Truffaut/Hitchcock. Simon
& Schuster.
Yu, S.-Z. 2010. Hidden semi-markov models. Artificial
Intelligence 174(2):215 – 243.
Zen, H.; Tokuda, K.; Masuko, T.; Kobayasih, T.; and Kitamura,
T. 2007. A hidden semi-markov model-based speech
synthesis system. IEICE - Trans. Inf. Syst. E90-D(5):825–
834.
Rester statique pour devenir plus rapide, plus pr´ecis et
plus mince
Arvid Jakobsson, Nikolai Kosmatov, Julien Signoles
To cite this version:
Arvid Jakobsson, Nikolai Kosmatov, Julien Signoles. Rester statique pour devenir plus rapide,
plus pr´ecis et plus mince. David Baelde; Jade Alglave. Vingt-sixi`emes journ´ees francophones
des langages applicatifs, Jan 2015, Le Val d’Ajol, France. Actes des vingt-sixi`emes journ´ees
francophones des langages applicatifs, .
HAL Id: hal-01096352
https://hal.inria.fr/hal-01096352
Submitted on 17 Dec 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
✶✺
Double WP : Vers une preuve automatique d’un
compilateur
Martin Clochard, L´eon Gondelman
To cite this version:
Martin Clochard, L´eon Gondelman. Double WP : Vers une preuve automatique d’un compilateur.
Journ´ees Francophones des Langages Applicatifs, Jan 2015, Val d’Ajol, France.
.
HAL Id: hal-01094488
https://hal.inria.fr/hal-01094488
Submitted on 12 Dec 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es
Fondements de l’Informatique: Logique, Mod`eles,
Calculs
Olivier Bournez
To cite this version:
Olivier Bournez. Fondements de l’Informatique: Logique, Mod`eles, Calculs. Ecole Polytechnique,
2011.
HAL Id: hal-00760775
https://hal-polytechnique.archives-ouvertes.fr/hal-00760775
Submitted on 4 Dec 2012
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Fondements de l’informatique
Logique, mod`eles, et calculs
Cours INF423
de l’Ecole Polytechnique
Olivier Bournez2Table des mati`eres
1 Introduction 9
1.1 Concepts math´ematiques . . . . . . . . . . . . . . . . . . . . . . 11
1.1.1 Ensembles, Fonctions . . . . . . . . . . . . . . . . . . . . 11
1.1.2 Alphabets, Mots, Langages . . . . . . . . . . . . . . . . . 12
1.1.3 Changement d’alphabet . . . . . . . . . . . . . . . . . . . 13
1.1.4 Graphes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.1.5 Arbres . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.2 La m´ethode de diagonalisation . . . . . . . . . . . . . . . . . . . 16
1.3 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 18
2 R´ecursivit´e et induction 19
2.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2 Raisonnement par r´ecurrence sur l’ensemble N . . . . . . . . . . 20
2.3 D´efinitions inductives . . . . . . . . . . . . . . . . . . . . . . . . 20
2.3.1 Principe g´en´eral d’une d´efinition inductive . . . . . . . . . 21
2.3.2 Formalisation : Premier th´eor`eme du point fixe . . . . . . 21
2.3.3 Diff´erentes notations d’une d´efinition inductive . . . . . . 22
2.4 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.4.1 Quelques exemples . . . . . . . . . . . . . . . . . . . . . . 23
2.4.2 Arbres binaires ´etiquet´es . . . . . . . . . . . . . . . . . . . 23
2.4.3 Termes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.5 Preuves par induction . . . . . . . . . . . . . . . . . . . . . . . . 25
2.6 D´erivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.6.1 Ecriture explicite des ´el´ements : Second th´eor`eme du point ´
fixe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.6.2 Arbres de d´erivation . . . . . . . . . . . . . . . . . . . . . 27
2.7 Fonctions d´efinies inductivement . . . . . . . . . . . . . . . . . . 28
2.8 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 29
3 Calcul propositionnel 31
3.1 Syntaxe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.2 S´emantique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.3 Tautologies, formules ´equivalentes . . . . . . . . . . . . . . . . . . 33
3.4 Quelques faits ´el´ementaires . . . . . . . . . . . . . . . . . . . . . 34
34 TABLE DES MATIERES `
3.5 Remplacements d’une formule par une autre ´equivalente . . . . . 35
3.5.1 Une remarque simple . . . . . . . . . . . . . . . . . . . . . 35
3.5.2 Substitutions . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.5.3 Compositionnalit´e de l’´equivalence . . . . . . . . . . . . . 36
3.6 Syst`eme complet de connecteurs . . . . . . . . . . . . . . . . . . 36
3.7 Compl´etude fonctionnelle . . . . . . . . . . . . . . . . . . . . . . 37
3.8 Formes normales . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.9 Th´eor`eme de compacit´e . . . . . . . . . . . . . . . . . . . . . . . 39
3.9.1 Satisfaction d’un ensemble de formules . . . . . . . . . . . 39
3.10 Exercices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.11 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 41
4 D´emonstrations 43
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.2 D´emonstrations `a la Frege et Hilbert . . . . . . . . . . . . . . . . 44
4.3 D´emonstrations par r´esolution . . . . . . . . . . . . . . . . . . . . 46
4.4 D´emonstrations par la m´ethode des tableaux . . . . . . . . . . . 47
4.4.1 Principe . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.4.2 Description de la m´ethode . . . . . . . . . . . . . . . . . . 50
4.4.3 Terminaison de la m´ethode . . . . . . . . . . . . . . . . . 51
4.4.4 Validit´e et compl´etude . . . . . . . . . . . . . . . . . . . . 52
4.4.5 Compl´etude . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.4.6 Une cons´equence du th´eor`eme de compacit´e . . . . . . . . 54
4.5 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 54
5 Calcul des pr´edicats 55
5.1 Syntaxe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.1.1 Termes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.1.2 Formules atomiques . . . . . . . . . . . . . . . . . . . . . 57
5.1.3 Formules . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.2 Premi`eres propri´et´es et d´efinitions . . . . . . . . . . . . . . . . . 58
5.2.1 D´ecomposition / Lecture unique . . . . . . . . . . . . . . 58
5.2.2 Variables libres, variables li´ees . . . . . . . . . . . . . . . 59
5.3 S´emantique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.3.1 Interpr´etation des termes . . . . . . . . . . . . . . . . . . 61
5.3.2 Interpr´etations des formules atomiques . . . . . . . . . . . 61
5.3.3 Interpr´etation des formules . . . . . . . . . . . . . . . . . 62
5.4 Equivalence. Formes normales . . . . . . . . . . . . . . . . . . . . 63 ´
5.4.1 Formules ´equivalentes . . . . . . . . . . . . . . . . . . . . 63
5.4.2 Forme normale pr´enexe . . . . . . . . . . . . . . . . . . . 64
5.5 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 65TABLE DES MATIERES ` 5
6 Mod`eles. Compl´etude. 67
6.1 Exemples de th´eories . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.1.1 Graphe . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.1.2 Egalit´e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 ´
6.1.3 Petite parenth`ese . . . . . . . . . . . . . . . . . . . . . . . 68
6.1.4 Groupes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.1.5 Corps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.1.6 Arithm´etique de Robinson . . . . . . . . . . . . . . . . . . 71
6.1.7 Arithm´etique de Peano . . . . . . . . . . . . . . . . . . . 71
6.2 Compl´etude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.2.1 Cons´equence . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.2.2 D´emonstration . . . . . . . . . . . . . . . . . . . . . . . . 72
6.2.3 Enonc´e du th´eor`eme de compl´etude . . . . . . . . . . . . 72 ´
6.2.4 Signification de ce th´eor`eme . . . . . . . . . . . . . . . . . 73
6.2.5 Autre formulation du th´eor`eme . . . . . . . . . . . . . . . 73
6.3 Preuve du th´eor`eme de compl´etude . . . . . . . . . . . . . . . . . 73
6.3.1 Un syst`eme de d´eduction . . . . . . . . . . . . . . . . . . 73
6.3.2 Th´eor`eme de finitude . . . . . . . . . . . . . . . . . . . . 74
6.3.3 Deux r´esultats techniques . . . . . . . . . . . . . . . . . . 75
6.3.4 Validit´e du syst`eme de d´eduction . . . . . . . . . . . . . . 76
6.3.5 Compl´etude du syst`eme de d´eduction . . . . . . . . . . . 76
6.4 Compacit´e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6.5 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 79
7 Mod`eles de calculs 81
7.1 Machines de Turing . . . . . . . . . . . . . . . . . . . . . . . . . 82
7.1.1 Ingr´edients . . . . . . . . . . . . . . . . . . . . . . . . . . 82
7.1.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . 83
7.1.3 Programmer avec des machines de Turing . . . . . . . . . 87
7.1.4 Techniques de programmation . . . . . . . . . . . . . . . . 90
7.1.5 Applications . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.1.6 Variantes de la notion de machine de Turing . . . . . . . 93
7.1.7 Localit´e de la notion de calcul . . . . . . . . . . . . . . . . 97
7.2 Machines RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.2.1 Mod`ele des machines RAM . . . . . . . . . . . . . . . . . 99
7.2.2 Simulation d’une machine RISC par une machine de Turing100
7.2.3 Simulation d’une machine RAM par une machine de Turing102
7.3 Mod`eles rudimentaires . . . . . . . . . . . . . . . . . . . . . . . . 102
7.3.1 Machines `a k ≥ 2 piles . . . . . . . . . . . . . . . . . . . . 102
7.3.2 Machines `a compteurs . . . . . . . . . . . . . . . . . . . . 103
7.4 Th`ese de Church-Turing . . . . . . . . . . . . . . . . . . . . . . . 105
7.4.1 Equivalence de tous les mod`eles consid´er´es . . . . . . . . 105 ´
7.4.2 Th`ese de Church-Turing . . . . . . . . . . . . . . . . . . . 105
7.5 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 1056 TABLE DES MATIERES `
8 Calculabilit´e 107
8.1 Machines universelles . . . . . . . . . . . . . . . . . . . . . . . . . 107
8.1.1 Interpr´eteurs . . . . . . . . . . . . . . . . . . . . . . . . . 107
8.1.2 Codage d’une machine de Turing . . . . . . . . . . . . . . 108
8.1.3 Existence d’une machine de Turing universelle . . . . . . 109
8.1.4 Premi`eres cons´equences . . . . . . . . . . . . . . . . . . . 110
8.2 Langages et probl`emes d´ecidables . . . . . . . . . . . . . . . . . . 111
8.2.1 Probl`emes de d´ecision . . . . . . . . . . . . . . . . . . . . 111
8.2.2 Probl`emes versus Langages . . . . . . . . . . . . . . . . . 112
8.2.3 Langages d´ecidables . . . . . . . . . . . . . . . . . . . . . 112
8.3 Ind´ecidabilit´e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
8.3.1 Premi`eres consid´erations . . . . . . . . . . . . . . . . . . . 113
8.3.2 Est-ce grave ? . . . . . . . . . . . . . . . . . . . . . . . . . 113
8.3.3 Un premier probl`eme ind´ecidable . . . . . . . . . . . . . . 114
8.3.4 Probl`emes semi-d´ecidables . . . . . . . . . . . . . . . . . . 115
8.3.5 Un probl`eme qui n’est pas semi-d´ecidable . . . . . . . . . 115
8.3.6 Sur la terminologie utilis´ee . . . . . . . . . . . . . . . . . 117
8.3.7 Propri´et´es de clˆoture . . . . . . . . . . . . . . . . . . . . . 118
8.4 Autres probl`emes ind´ecidables . . . . . . . . . . . . . . . . . . . . 118
8.4.1 R´eductions . . . . . . . . . . . . . . . . . . . . . . . . . . 119
8.4.2 Quelques autres probl`emes ind´ecidables . . . . . . . . . . 120
8.4.3 Th´eor`eme de Rice . . . . . . . . . . . . . . . . . . . . . . 121
8.4.4 Le drame de la v´erification . . . . . . . . . . . . . . . . . 123
8.4.5 Notion de compl´etude . . . . . . . . . . . . . . . . . . . . 123
8.5 Probl`emes ind´ecidables naturels . . . . . . . . . . . . . . . . . . . 124
8.5.1 Le dixi`eme probl`eme de Hilbert . . . . . . . . . . . . . . . 124
8.5.2 Le probl`eme de la correspondance de Post . . . . . . . . . 124
8.6 Th´eor`emes du point fixe . . . . . . . . . . . . . . . . . . . . . . . 124
8.7 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 126
9 Incompl´etude de l’arithm´etique 129
9.1 Th´eorie de l’arithm´etique . . . . . . . . . . . . . . . . . . . . . . 129
9.1.1 Axiomes de Peano . . . . . . . . . . . . . . . . . . . . . . 129
9.1.2 Quelques concepts de l’arithm´etique . . . . . . . . . . . . 130
9.1.3 La possibilit´e de parler des bits d’un entier . . . . . . . . 130
9.1.4 Principe de la preuve de G¨odel . . . . . . . . . . . . . . . 131
9.2 Th´eor`eme d’incompl´etude . . . . . . . . . . . . . . . . . . . . . . 131
9.2.1 Principe de la preuve de Turing . . . . . . . . . . . . . . . 131
9.2.2 Le point facile . . . . . . . . . . . . . . . . . . . . . . . . 132
9.2.3 Lemme crucial . . . . . . . . . . . . . . . . . . . . . . . . 132
9.2.4 Construction de la formule . . . . . . . . . . . . . . . . . 133
9.3 La preuve de G¨odel . . . . . . . . . . . . . . . . . . . . . . . . . . 135
9.3.1 Lemme de point fixe . . . . . . . . . . . . . . . . . . . . . 135
9.3.2 Arguments de G¨odel . . . . . . . . . . . . . . . . . . . . . 136
9.3.3 Second th´eor`eme d’incompl´etude de G¨odel . . . . . . . . . 137
9.4 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 137TABLE DES MATIERES ` 7
10 Bases de l’analyse de complexit´e d’algorithmes 139
10.1 Complexit´e d’un algorithme . . . . . . . . . . . . . . . . . . . . . 140
10.1.1 Premi`eres consid´erations . . . . . . . . . . . . . . . . . . . 140
10.1.2 Complexit´e d’un algorithme au pire cas . . . . . . . . . . 140
10.1.3 Complexit´e moyenne d’un algorithme . . . . . . . . . . . 141
10.2 Complexit´e d’un probl`eme . . . . . . . . . . . . . . . . . . . . . . 142
10.3 Exemple : Calcul du maximum . . . . . . . . . . . . . . . . . . . 142
10.3.1 Complexit´e d’un premier algorithme . . . . . . . . . . . . 142
10.3.2 Complexit´e d’un second algorithme . . . . . . . . . . . . . 143
10.3.3 Complexit´e du probl`eme . . . . . . . . . . . . . . . . . . . 143
10.3.4 Complexit´e de l’algorithme en moyenne . . . . . . . . . . 144
10.4 Asymptotiques . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
10.4.1 Complexit´es asymptotiques . . . . . . . . . . . . . . . . . 145
10.4.2 Notations de Landau . . . . . . . . . . . . . . . . . . . . . 145
10.5 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 146
11 Complexit´e en temps 147
11.1 La notion de temps raisonnable . . . . . . . . . . . . . . . . . . . 148
11.1.1 Convention . . . . . . . . . . . . . . . . . . . . . . . . . . 148
11.1.2 Premi`ere raison : s’affranchir du codage . . . . . . . . . . 148
11.1.3 Deuxi`eme raison : s’affranchir du mod`ele de calcul . . . . 149
11.1.4 Classe P . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
11.2 Comparer les probl`emes . . . . . . . . . . . . . . . . . . . . . . . 151
11.2.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . 151
11.2.2 Remarques . . . . . . . . . . . . . . . . . . . . . . . . . . 151
11.2.3 Notion de r´eduction . . . . . . . . . . . . . . . . . . . . . 152
11.2.4 Application `a la comparaison de difficult´e . . . . . . . . . 153
11.2.5 Probl`emes les plus durs . . . . . . . . . . . . . . . . . . . 154
11.3 La classe NP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
11.3.1 La notion de v´erificateur . . . . . . . . . . . . . . . . . . . 154
11.3.2 La question P = NP ? . . . . . . . . . . . . . . . . . . . . 156
11.3.3 Temps non d´eterministe polynomial . . . . . . . . . . . . 156
11.3.4 NP-compl´etude . . . . . . . . . . . . . . . . . . . . . . . . 157
11.3.5 M´ethode pour prouver la NP-compl´etude . . . . . . . . . 158
11.3.6 Preuve du th´eor`eme de Cook-Levin . . . . . . . . . . . . . 158
11.4 Quelques autres r´esultats de la th´eorie de la complexit´e . . . . . 162
11.4.1 D´ecision vs Construction . . . . . . . . . . . . . . . . . . 162
11.4.2 Th´eor`emes de hi´erarchie . . . . . . . . . . . . . . . . . . . 163
11.4.3 EXPTIME and NEXPTIME . . . . . . . . . . . . . . . . 164
11.5 Que signifie la question P = NP ? . . . . . . . . . . . . . . . . . 165
11.6 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 1668 TABLE DES MATIERES `
12 Quelques probl`emes NP-complets 167
12.1 Quelques probl`emes NP-complets . . . . . . . . . . . . . . . . . . 167
12.1.1 Autour de SAT . . . . . . . . . . . . . . . . . . . . . . . . 167
12.1.2 Autour de STABLE . . . . . . . . . . . . . . . . . . . . . 169
12.1.3 Autour de CIRCUIT HAMILTONIEN . . . . . . . . . . . 171
12.1.4 Autour de 3-COLORABILITE . . . . . . . . . . . . . . . 174
12.1.5 Autour de SOMME DE SOUS-ENSEMBLE . . . . . . . . 175
12.2 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 177
13 Complexit´e en espace m´emoire 179
13.1 Espace polynomial . . . . . . . . . . . . . . . . . . . . . . . . . . 179
13.1.1 Classe PSPACE . . . . . . . . . . . . . . . . . . . . . . . 179
13.1.2 Probl`emes PSPACE-complets . . . . . . . . . . . . . . . 180
13.2 Espace logarithmique . . . . . . . . . . . . . . . . . . . . . . . . . 180
13.3 Quelques r´esultats et d´emonstrations . . . . . . . . . . . . . . . . 181
13.3.1 Pr´eliminaires . . . . . . . . . . . . . . . . . . . . . . . . . 182
13.3.2 Relations triviales . . . . . . . . . . . . . . . . . . . . . . 182
13.3.3 Temps non d´eterministe vs d´eterministe . . . . . . . . . . 183
13.3.4 Temps non d´eterministe vs espace . . . . . . . . . . . . . 183
13.3.5 Espace non d´eterministe vs temps . . . . . . . . . . . . . 184
13.3.6 Espace non d´eterministe vs espace d´eterministe . . . . . . 184
13.3.7 Espace logarithmique non d´eterministe . . . . . . . . . . . 185
13.4 R´esultats de s´eparation . . . . . . . . . . . . . . . . . . . . . . . 186
13.4.1 Th´eor`emes de hi´erarchie . . . . . . . . . . . . . . . . . . . 186
13.4.2 Applications . . . . . . . . . . . . . . . . . . . . . . . . . 187
13.5 Notes bibliographiques . . . . . . . . . . . . . . . . . . . . . . . . 188Chapitre 1
Introduction
Ce cours est un cours sur les fondements de l’informatique : il se focalise sur
trois domaines centraux en informatique : la logique, les mod`eles de calculs et
la complexit´e.
Tous ces domaines sont reli´es par la question suivante : quelles sont les
capacit´es et les limites des ordinateurs ?
Mˆeme un t´el´ephone est maintenant capable de r´esoudre tr`es rapidement
certains probl`emes, comme trier un r´epertoire de plus d’un million d’entr´ees. Par
contre, certains probl`emes s’av`erent beaucoup plus lents et difficiles `a r´esoudre :
par exemple, r´esoudre un probl`eme d’emploi du temps, ou affecter les choix
d’affectations des ´el`eves de l’´ecole polytechnique en fonction de leurs pr´ef´erences
ordonn´ees.
Au cœur de ce cours est la compr´ehension de ce qui fait qu’un probl`eme,
comme le tri, est simple `a r´esoudre informatiquement, alors qu’un probl`eme
comme un probl`eme d’emploi du temps peut prendre des si`ecles `a r´esoudre avec
seulement un millier de donn´ees en entr´ees.
Autrement dit, au cœur de nos interrogations est aussi la question suivante :
qu’est-ce qui rend certains probl`emes difficiles, et d’autres faciles ?
C’est la question centrale de la complexit´e, et de la calculabilit´e.
Pourquoi s’int´eresser `a comprendre les probl`emes difficiles, plutˆot que d’essayer
de r´esoudre des probl`emes tr`es concrets ? Premi`erement, parce que des
probl`emes tr`es simples et concrets, et aux enjeux ´economiques consid´erables,
s’av`erent faire partie des probl`emes difficiles.
Deuxi`emement, parce que comprendre qu’un probl`eme ne peut pas ˆetre r´esolu
facilement est utile parce que cela signifie que le probl`eme doit ˆetre simplifi´e
ou modifi´e pour pouvoir ˆetre r´esolu. Ce cours permet r´eellement de comprendre
les pistes pour ´eviter les probl`emes difficiles `a r´esoudre informatiquement.
Enfin et surtout parce que les probl`emes difficiles ont r´eellement des implications
dans la conception de nombreux syst`emes actuels.
Par exemple, pour la v´erification, l’analyse, et la conception de syst`emes :
lorsqu’on con¸coit un syst`eme, on souhaite en g´en´eral qu’il se comporte au minimum
selon la sp´ecification avec laquelle on l’a con¸cu. On aimerait que le pro-
910 CHAPITRE 1. INTRODUCTION
cessus de v´erification puisse s’automatiser, c’est-`a-dire que l’on puisse garantir
informatiquement qu’un syst`eme donn´e v´erifie une/sa sp´ecification. Surtout,
lorsque le syst`eme en question est d’une complexit´e ´enorme, comme les processeurs
actuels, et qu’un unique ˆetre humain n’est plus capable d’en comprendre
seul tous les composants.
Les r´esultats de ce cours montrent pr´ecis´ement que le processus de v´erification
ne peut pas s’automatiser facilement. Tout l’art de la v´erification de syst`emes,
et donc de la conception de syst`emes, est de tenter d’´eviter ces difficult´es
pour la rendre praticable, ce qui n´ecessite d’avoir compris ces difficult´es.
D’autres domaines sont fortement impact´es par la complexit´e. Un des premiers
qui l’a ´et´e historiquement est la cryptographie : dans la plupart des domaines,
on cherche plutˆot `a privil´egier les probl`emes faciles `a r´esoudre aux probl`emes
difficiles. La cryptographie est originale de ce point de vue, car elle
cherche plutˆot `a comprendre des probl`emes difficiles `a r´esoudre plutˆot que
simples, car un code secret doit ˆetre dur `a casser sans la cl´e secr`ete.
On peut aussi se demander : pourquoi autant de logique dans un cours sur
les fondements de l’informatique ?
Une premi`ere raison est parce que les programmes informatiques et les langages
informatiques sont essentiellement bas´es sur la logique. Les processeurs
sont d’ailleurs essentiellement compos´es de portes logiques. Les programmes sont
essentiellement faits d’instructions logiques, et de tests logiques. Comprendre
cette logique permet de bien comprendre ce que font les programmes informatiques.
Plus fondamentalement, les programmes et les syst`emes informatiques obligent
bien souvent `a d´ecrire tr`es pr´ecis´ement les objets sur lesquels ils travaillent : pour
r´esoudre un probl`eme d’emploi du temps, le syst`eme va obliger `a d´ecrire toutes
les contraintes. Pour faire une requˆete sur une base de donn´ees, le syst`eme va
obliger `a formuler tr`es pr´ecis´ement cette requˆete. Il s’av`ere que la logique math´ematique
est un outil tr`es naturel pour d´ecrire le monde qui nous entoure,
et `a vrai dire, le mod`ele le plus naturel que nous connaissons pour le faire.
Comprendre les concepts de la logique, permet de bien comprendre nombre
de concepts informatiques. Par exemple, pour d´ecrire le syst`eme d’information
d’une entreprise, ou tout syst`eme complexe, le meilleur outil reste bien souvent
la logique math´ematique.
Une troisi`eme raison est historique, et au cœur en fait de la naissance de
l’informatique. Durant la premi`ere moiti´e du si`ecle dernier, des math´ematiciens
comme Kurt G¨odel, Alonzo Church ou Alan Turing ont d´ecouvert que certains
probl`emes ne pouvaient pas se r´esoudre par des dispositifs informatiques ou
automatiques comme les ordinateurs. Par exemple, le probl`eme de d´eterminer
si un ´enonc´e math´ematique est vrai ou non. Cette tˆache, qui est le quotidien du
math´ematicien, ne peut pas ˆetre r´esolue par aucun ordinateur, quelle que soit
sa puissance.
Les cons´equences de ces r´esultats profonds ont permis la naissance d’id´ees
sur des mod`eles d’ordinateurs qui ont men´e `a la conception des ordinateurs
actuels.
Au cœur de ces d´ecouvertes sont des liens tr`es forts qui unissent algorithmes1.1. CONCEPTS MATHEMATIQUES ´ 11
et d´emonstrations : une d´emonstration logique correspond `a un algorithme. A
partir d’hypoth`eses, on d´eduit des nouvelles assertions `a l’aide de r`egles logiques.
R´eciproquement, un programme correspond `a une d´emonstration dans
un certain sens.
C’est ces liens forts entre algorithmes et d´emonstrations qui ont fait naˆıtre
l’informatique et ses concepts et ce bien avant l’existence mˆeme de machines
aussi puissantes que celles que nous connaissons actuellement. Historiquement,
la premi`ere question ´etait : “qu’est-ce qu’une d´emonstration”? Elle est maintenant
devenue : “qu’est-ce qu’un ordinateur”?
Ils ont par ailleurs r´evolutionn´e notre conception des math´ematiques, de
l’informatique, et plus g´en´eralement du monde qui nous entoure.
En math´ematiques, ils ont men´e `a une crise des fondements, avec le retour
sur des questions aussi fondamentales que celle-ci : qu’est-ce qu’un ensemble,
qu’est-ce qu’une d´emonstration ? Que peut-on prouver ?
L’ambition de ce document est plutˆot de se focaliser sur l’informatique. Nous
estimerons que ce document aura atteint son but si `a sa lecture notre lecteur
change au final la r´eponse qu’il aurait pu faire `a priori sur des questions aussi
simples que celle-ci :
– qu’est-ce qu’un ordinateur ?
– qu’est-ce qu’une preuve ?
– qu’est-ce qu’un algorithme ?
– qu’est-ce qu’un bon algorithme ?
Si tel est le cas, sa fa¸con de programmer, ou d’appr´ehender un probl`eme
informatique ne devrait plus ˆetre la mˆeme.
Remerciements L’auteur de ce document souhaite remercier vivement Johanne
Cohen, Bruno Salvy et David Monniaux pour leurs retours sur des versions
pr´eliminaires de ce document.
Tous les commentaires (mˆemes typographiques, orthographiques, etc.) sur
ce document sont les bienvenus et `a adresser `a bournez@lix.polytechnique.fr.
1.1 Concepts math´ematiques
1.1.1 Ensembles, Fonctions
Soit E un ensemble, et e un ´el´ement. On note e ∈ E pour signifier que e est
un ´el´ement de l’ensemble E. Si A et B sont deux ensembles, on note A ⊂ B
pour signifier que tout ´el´ement de A est un ´el´ement de B. On dit dans ce cas que
A est une partie de B. Lorsque E est un ensemble, les parties de E constituent
un ensemble que l’on note P(E). On notera A ∪ B, A ∩ B pour respectivement
l’union et l’intersection des ensembles A et B. Lorsque A est une partie de E,
on notera Ac pour le compl´ementaire de A dans E.
On appelle produit cart´esien de deux ensembles E et F l’ensemble des couples
form´es d’un ´el´ement de E et d’un ´el´ement de F :
E × F = {(x,y)|x ∈ E et y ∈ F}.12 CHAPITRE 1. INTRODUCTION
Pour n ≥ 1 un entier, on note En = E × · · · × E le produit cart´esien de E
par lui mˆeme n fois. En peut aussi se d´efinir1
r´ecursivement par E1 = E, et
En+1 = E × En.
Intuitivement, une application f d’un ensemble E vers un ensemble F est un
objet qui associe `a chaque ´el´ement e d’un ensemble E un unique ´el´ement f(e)
de F. Formellement, une fonction f d’un ensemble E vers un ensemble F est
une partie Γ de E × F. Son domaine est l’ensemble des x ∈ E tel que (x,y) ∈ Γ
pour un certain y ∈ E. Son image est l’ensemble des y ∈ F tel que (x,y) ∈ Γ
pour un certain x ∈ E. Une application f d’un ensemble E vers un ensemble F
est une fonction dont le domaine est E.
Une famille (xi)i∈I d’´el´ements d’un ensemble X est une application d’un
ensemble I dans X. I est appel´e l’ensemble des indices, et l’image par cette
application de l’´el´ement i ∈ I est not´ee xi
.
Le produit cart´esien se g´en´eralise `a une famille d’ensembles :
E1 × · · · × En = {(x1,. .. ,xn)|x1 ∈ E1, · · · ,xn ∈ En}.
L’union et l’intersection se g´en´eralisent `a une famille quelconque de parties
d’un ensemble E. Soit (Ai)i∈I une famille de parties de E.
[
i∈I
Ai = {e ∈ E|∃i ∈ I e ∈ Ai};
\
i∈I
Ai = {e ∈ E|∀i ∈ I e ∈ Ai}.
On notera N l’ensemble des entiers naturels, R l’ensemble des r´eels, et C
l’ensemble des complexes. Z est un anneau. R et C sont des corps. On notera
R
≥0
l’ensemble des r´eels positifs ou nuls.
1.1.2 Alphabets, Mots, Langages
Nous rappelons maintenant quelques d´efinitions ´el´ementaires sur les mots
et les langages. La terminologie, emprunt´ee `a la linguistique, rappelle que les
premiers travaux sont issus de la mod´elisation de la langue naturelle.
On fixe un ensemble Σ que l’on appelle alphabet. Les ´el´ements de Σ sont
appel´es des lettres ou des symboles. Un mot w sur l’alphabet Σ est une suite
finie w1w2 · · · wn de lettres de Σ. L’entier n est appel´e la longueur du mot w. Il
est not´e |w|.
Le mot vide ǫ est le seul mot de longueur 0. Un langage sur Σ est un ensemble
de mots sur Σ. L’ensemble de tous les mots sur l’alphabet Σ est not´e Σ∗
.
Exemple 1.1 {0, 1}
∗ d´esigne l’ensemble des mots sur l’alphabet Σ = {0, 1}.
Par exemple, 00001101 ∈ {0, 1}
∗
.
1
Il y a une bijection entre les objets d´efinis par les deux d´efinitions.1.1. CONCEPTS MATHEMATIQUES ´ 13
On d´efinit une op´eration de concat´enation sur les mots : la concat´enation
du mot u = u1u2 · · · un et du mot v = v1v2 · · · vm est le mot not´e u.v d´efini
par u1u2 · · · unv1v2 · · · vm, c’est-`a-dire le mot dont les lettres sont obtenues en
juxtaposant les lettres de v `a la fin de celles de u. L’op´eration de concat´enation
not´ee . est associative, mais non-commutative. Le mot vide est un ´el´ement neutre
`a droite et `a gauche de cette op´eration. On appelle aussi Σ∗
le mono¨ıde (libre)
sur l’alphabet Σ (car l’op´eration de concat´enation lui donne une structure de
mono¨ıde).
On note aussi uv pour la concat´enation u.v. En fait, tout mot w1w2 · · · wn
peut se voir comme w1.w2 · · · .wn, o`u wi repr´esente le mot de longueur 1 r´eduit
`a la lettre wi
. Cette confusion entre les lettres et les mots de longueur 1 est
souvent tr`es pratique.
Exemple 1.2 Par exemple, si Σ est l’ensemble Σ = {a,b}, aaab est le mot de
longueur 4 dont les trois premi`eres lettres sont a, et la derni`ere est b.
Lorsque i est un entier, on ´ecrit w
i pour le mot obtenu en concat´enant i fois
le mot w : w
0
est le mot vide ǫ, w
1
est le mot w, et w
i+1 est w.w. · · · ,w o`u il y
a i fois le mot w. Autrement dit, w
i+1 = w
iw = wwi pour tout entier i.
Exemple 1.3 En utilisant la confusion pr´ec´edente entre lettres et mots de longueur
1, aaabbc peut aussi s’´ecrire a
3
b
2
c.
Un mot u est un pr´efixe d’un mot w, s’il existe un mot z tel que w = u.z.
C’est un pr´efixe propre si u 6= w. Un mot u est un suffixe d’un mot w s’il existe
un mot z tel que w = z.u.
1.1.3 Changement d’alphabet
Il est souvent utile de pouvoir r´e´ecrire un mot sur un alphabet en un mot sur
un autre alphabet. Par exemple, on a souvent besoin en informatique de coder
en binaire, c’est-`a-dire avec l’alphabet Σ = {0, 1}.
Une fa¸con de faire pour changer d’alphabet est de proc`eder par r´e´ecriture
lettre par lettre.
Exemple 1.4 Par exemple, si Σ est l’alphabet Σ = {a,b, c}, et Γ = {0, 1}, on
peut coder les mots de Σ
∗
sur Γ
∗ par la fonction h telle que h(a) = 01, h(b) = 10,
h(c) = 11. Le mot abab se code alors par h(abab) = 01100110, c’est-`a-dire par
le mot obtenu en codant lettre par lettre.
Tr`es formellement, ´etant donn´es deux alphabets Σ et Γ, un homomorphisme
est une application de Σ∗ dans Γ∗
telle que
– h(ǫ) = ǫ
– h(u.v) = h(u).h(v) pour tous mots u et v.
En fait, tout homomorphisme est parfaitement d´etermin´e par son image sur
les lettres de Σ. Il s’´etend alors aux mots de Σ∗ par
h(w1w2 · · · wn) = h(w1).h(w2).. .. .h(wn)14 CHAPITRE 1. INTRODUCTION
pour tout mot w = w1w2 · · · wn : c’est en fait une cons´equence du th´eor`eme 2.5
du chapitre 2.
1.1.4 Graphes
Un graphe G = (V,E) est donn´e par un ensemble V , dont les ´el´ements sont
appel´es sommets, ou nœuds, et d’une partie de E ⊂ V × V , dont les ´el´ements
sont appel´es des arcs. Un chemin de s `a t est une suite (s = s0,. .. ,sn = t) de
nœuds tels que, pour 1 ≤ i ≤ n, (si−1,si) soit un arc. Un chemin simple est
un chemin qui ne passe pas deux fois par le mˆeme sommet. Un circuit est un
chemin de longueur non nulle dont l’origine co¨ıncide avec l’extr´emit´e.
Si les arcs ne sont pas orient´es, c’est-`a-dire, si l’on consid`ere qu’`a chaque fois
qu’il y a l’arc (u, v) il y a aussi l’arc (v,u) (et r´eciproquement), on dit que le
graphe G est non orient´e, et les ´el´ements de E sont appel´es des arˆetes. Lorsqu’il
y a une arˆete entre u et v, c’est-`a-dire lorsque (u, v) ∈ E, on dit que u et v sont
voisins. Le degr´e d’un sommet u est le nombre de ses voisins.
Exemple 1.5 Le graphe (non-orient´e) G = (V,E) avec
– V = {0, 1,. .. , 6}
– E = {(0, 1),(3, 4),(5, 1),(6, 3),(6, 4)}.
est repr´esent´e ci-dessous.
0
1
2
3
4
5
6
Un graphe est dit connexe si deux quelconques de ses nœuds sont reli´es par
un chemin.
Exemple 1.6 Le graphe de l’exemple 1.5 n’est pas connexe.
1.1.5 Arbres
Les arbres sont omnipr´esents en informatique. En fait, plusieurs notions distinctes
se cachent sous cette terminologie : arbres libres, arbres enracin´es, arbres
ordonn´es, etc.
Il y a par ailleurs plusieurs fa¸cons de pr´esenter les arbres, et ces diff´erentes
notions. Essentiellement, on peut le faire en partant de la th´eorie des graphes,
c’est-`a-dire de la notion de graphe, ou alors en partant de d´efinitions inductives
(r´ecursives).
Puisque nous reviendrons sur les d´efinitions inductives de plusieurs de ces
classes d’arbres dans le chapitre 2, pr´esentons ici les arbres en partant de la
notion de graphe.1.1. CONCEPTS MATHEMATIQUES ´ 15
On va pr´esenter dans ce qui suit des familles d’arbres de plus en plus contraints :
dans l’ordre, on va pr´esenter les arbres libres, puis les arbres enracin´es, les arbres
ordonn´es.
Arbres libres
Un arbre libre est un graphe non-orient´e connexe et sans circuit. On appelle
feuille un nœud de l’arbre qui ne poss`ede qu’un seul voisin. Un sommet qui n’est
pas une feuille est appel´e un sommet interne.
Exemple 1.7 (Un arbre libre) Repr´esentation graphique d’un arbre libre, dont
les feuilles sont les nœuds 5, 0 et 6.
0
1
2
3
4
5
6
Presque tous nos arbres seront ´etiquet´es : soit A un ensemble dont les ´el´ements
sont appel´es des ´etiquettes. Un arbre ´etiquet´e par A est la donn´ee d’un
arbre G = (V,E) et d’une application qui associe `a chaque sommet de V un
´el´ement de A.
Arbre enracin´e
Un arbre enracin´e ou arbre est un arbre libre muni d’un sommet distingu´e,
appel´e sa racine. Soit T un arbre de racine r.
Exemple 1.8 (Un arbre) Repr´esentation graphique d’un arbre, dont les feuilles
sont les nœuds 5, 0, 4 et 2. On repr´esente la racine 3 en haut.
3
1
5 0
4 6
2
Pour tout sommet x, il existe un chemin simple unique de r `a x. Tout sommet
y sur ce chemin est un ancˆetre de x, et x est un descendant de y. Le sous-arbre de
racine x est l’arbre contenant tous les descendants de x. L’avant-dernier sommet
y sur l’unique chemin reliant r `a x est le parent (ou le p`ere ou la m`ere) de x, et
x est un enfant (ou un fils ou une fille) de y.16 CHAPITRE 1. INTRODUCTION
L’arit´e d’un sommet est le nombre de ses enfants. Un sommet sans enfant est
une feuille, un sommet d’arit´e strictement positive est appel´e sommet interne.
La hauteur d’un arbre T est la longueur maximale d’un chemin reliant sa racine
`a une feuille. Un arbre r´eduit `a un seul nœud est de hauteur 0.
Arbres ordonn´es
Un arbre ordonn´e (on dit aussi arbre plan) est un arbre dans lequel l’ensemble
des enfants de chaque nœud est totalement ordonn´e. Autrement dit, pour chaque
sommet interne d’arit´e k, on la notion de 1ier fils, 2i`eme fils, . . ., k`eme fils.
Par exemple, un livre structur´e en chapitres, sections, etc se pr´esente comme
un arbre ordonn´e.
Exemple 1.9 (Arbre ordonn´e de la table des mati`eres d’un livre)
1
1.1 1.2
2 3
3.1
3.1.1 3.1.2
3.2
Autres notions d’arbre
Le concept d’arbre binaire est assez diff´erent des d´efinitions d’arbre libre,
arbre enracin´e et arbre ordonn´e. Il est pr´esent´e dans la section 2.4.2 du chapitre
2.
Les termes sont des arbres ordonn´es ´etiquet´es particuliers. Ils sont pr´esent´es
dans la section 2.4.3 du chapitre 2.
1.2 La m´ethode de diagonalisation
Rappelons que N
2 = N × N est d´enombrable : il est possible de mettre en
correspondance N avec N
2
. Nous allons illustrer graphiquement une fa¸con de
parcourir les couples d’entiers.1.2. LA METHODE DE DIAGONALISATION ´ 17
(0, 0)
(0, 1)
(0, 2)
(0, 3)
(1, 0)
(1, 1)
(1, 2)
(1, 3)
(2, 0)
(2, 1)
(2, 2)
(2, 3)
(3, 0)
(3, 1)
(3, 2)
(3, 3)
(4, 0) (5, 0)
(0, 4)
(0, 5)
(1, 4)
(4, 1)
. . .
. . .
. . .
. . .
. . .
. . .
Par contre, les parties de N ne sont pas d´enombrables : cela peut se voir par
la m´ethode de diagonalisation dˆue `a Cantor.
Illustrons-le graphiquement. Supposons que l’on puisse ´enum´erer les parties
de N, et notons les T1, T2, . . .Tn . . .Chaque partie Ti de N peut se voir comme
la ligne i du tableau M = (Mi,j )i,j `a entr´ees dans {0, 1} dont l’´el´ement Mi,j est
1 si et seulement si l’´el´ement j est dans la i`eme partie de N.
0 1 . . . . . . j . . .
T0
T1
.
.
.
Ti
.
.
.
Mi,j
On consid`ere alors la partie T
∗ obtenue en “inversant la diagonale de M” :
formellement, on consid`ere T
∗ = {j|Mj,j = 0}. Cette partie de N n’est pas dans
l’´enum´eration, car sinon elle devrait avoir un num´ero j0 : si j0 ∈ T
∗
, alors on
devrait avoir Mj0,j0 = 1 par d´efinition de M, et Mj0,j0 = 0 par d´efinition de
T
∗
: impossible. Si j0 6∈ T
∗
, alors on devrait avoir Mj0,j0 = 0 par d´efinition de
M, et Mj0,j0 = 1 par d´efinition de T
∗
: impossible.18 CHAPITRE 1. INTRODUCTION
Cet argument est `a la base de certains raisonnements en calculabilit´e, comme
nous le verrons.
1.3 Notes bibliographiques
Lectures conseill´ees Pour aller plus loin sur les notions ´evoqu´ees dans ce
chapitre, nous sugg´erons la lecture de [Arnold and Guessarian, 2005] ou du polycopi´e
du cours INF421, ou des polycopi´es des cours de l’´ecole polytechnique
de premi`ere ann´ee et des cours de classes pr´eparatoires.
Bibliographie La partie sur les arbres est essentiellement reprise du polycopi´e
de INF421. Le reste du chapitre est inspir´e de diff´erentes sources dont le
polycopi´e de INF561, [Hopcroft et al., 2001] et [Arnold and Guessarian, 2005].
L’introduction est essentiellement reprise de [Sipser, 1997].Chapitre 2
R´ecursivit´e et induction
2.1 Motivation
Les d´efinitions r´ecursives sont omnipr´esentes en informatique. Elles sont pr´esentes
`a la fois dans les langages de programmation, mais aussi pr´esentes dans
de nombreux concepts que l’on manipule.
Exemple 2.1 (Listes en JAVA) Par exemple, en JAVA, lorsqu’on d´efinit
class L i s t e {
in t c on ten u ;
L i s t e s u i v a n t ;
}}
L i s t e l s t ;
on d´efinit la classe Liste de fa¸con r´ecursive (inductive) : en utilisant dans la
d´efinition de la classe, le champ “suivant” du type de la classe Liste elle mˆeme.
Exemple 2.2 (Arbres ordonn´es) Nous avons d´efini les arbres ordonn´es dans
le chapitre pr´ec´edent en passant par la notion de graphe. Une alternative naturelle
serait de pr´esenter les arbres ordonn´es par une d´efinition r´ecursive : un
arbre ordonn´e est soit vide, soit r´eduit `a un sommet (une racine), soit constitu´e
d’un sommet (une racine) et une liste (ordonn´ee) d’arbres ordonn´es (ses fils).
Dans ce chapitre, nous nous attardons sur les d´efinitions inductives d’ensembles
et de fonctions, qui permettent de donner un sens `a des d´efinitions
r´ecursives.
Nous discutons, par ailleurs comment il est possible de faire des preuves sur
des structures d´efinies inductivement, en introduisant les preuves par induction
structurelle.
1920 CHAPITRE 2. RECURSIVIT ´ E ET INDUCTION ´
2.2 Raisonnement par r´ecurrence sur l’ensemble
N
L’induction structurelle est une g´en´eralisation de la preuve par r´ecurrence :
revenons sur cette derni`ere pour avoir les id´ees au clair.
Lorsque l’on raisonne sur les entiers, le premier principe d’induction aussi
appel´e principe de r´ecurrence math´ematique est un mode de raisonnement particuli`erement
utile.
Th´eor`eme 2.1 Soit P(n) un pr´edicat (une propri´et´e) d´ependant de l’entier n.
Si les deux conditions suivantes sont v´erifi´ees :
(B) P(0) est vrai ;
(I) P(n) implique P(n + 1) pour tout n ;
alors pour tout entier n, P(n) est vrai.
D´emonstration: Le raisonnement se fait par l’absurde. Consid´erons X =
{k ∈ N|P(k) est faux}. Si X est non vide, il admet un plus petit ´el´ement n.
D’apr`es la condition (B), n 6= 0, et donc n−1 est un entier, et P(n−1) est vrai
par d´efinition de X. On obtient une contradiction avec la propri´et´e (I) appliqu´ee
pour l’entier n − 1.
Pour faire une preuve par r´ecurrence, on ´etablit donc une propri´et´e en 0
(cas de base), et on ´etablit que la propri´et´e est h´er´editaire, ou inductive : P(n)
implique P(n + 1) pour tout n.
Le concept de preuve inductive g´en´eralise cette id´ee `a d’autres ensembles
que les entiers, `a savoir aux ensembles qui se d´efinissent inductivement.
2.3 D´efinitions inductives
Les d´efinitions inductives visent `a d´efinir des parties d’un ensemble E.
Remarque 2.1 Cette remarque, pour les puristes, peut ˆetre ´evit´ee dans une
premi`ere lecture.
Nous nous restreignons dans ce document au cadre o`u l’on souhaite d´efinir
par induction des objets qui correspondent `a des parties d’un ensemble d´ej`a
connu E. Nous faisons cela pour ´eviter les subtilit´es et paradoxes de la th´eorie
des ensembles.
Le lecteur tr`es attentif pourra observer que l’on consid´erera dans la suite
tr`es souvent l’´ecriture syntaxique des objets plutˆot que les objets eux-mˆemes.
En effet, en faisant ainsi, on garantit que l’on se place sur l’ensemble E = Σ∗
pour un certain alphabet Σ, et on ´evite de se poser la question de l’existence de
l’ensemble E sous-jacent dans les raisonnements qui suivent.
Par exemple, pour formaliser compl`etement l’exemple 2.1 plus haut, on chercherait
plutˆot `a d´efinir une repr´esentation syntaxique des listes plutˆot que les
listes.
@Ξ
Département Informatique de l’IUT de l’Université Bordeaux 1
Cours d’Analyse et Conception des Systèmes d’Information
(d’Outils et Modèles pour le Génie Logiciel)
7 novembre 2007 Olivier GuibertAlgorithmique Programmation
Architecture Systèmes Réseaux
ACSI Bases de Données
Mathématiques
Économie et Gestion des Organisations
Langues (Anglais) Expression-Communication
… et Projet Personnel et Professionnel, Projets Tutorés, Stage
Programme Pédagogique National
OMGLPlan
• Bibliographie
• Définitions
• Intervenants
• Cycles de vie du logiciel
• Taxinomie des méthodes d’informatisation
• Démarche
• Modèles
• Méthodes et langages de modélisation
+ Gestion de Projet, Qualité, Interface HommeMachine,
etc.BibliographieBibliographie : génie logiciel
• ACSIOME, Modélisation dans la conception des systèmes
d'information, Masson, 1989
• GALACSI, Les systèmes d'information : analyse et conception,
Dunod, 1984
• GALACSI, Comprendre les systèmes d'information : exercices
corrigés d'analyse et de conception, Dunod, 1985
• I. SOMMERVILLE, Le génie logiciel et ses applications, InterÉditions, 1985
• C. TESSIER, La pratique des méthodes en informatique de gestion,
Les Editions d'Organisation, 1995
• P. ANDRÉ et A. VAILLY, Conception des systèmes d’information –
Panorama des méthodes et des techniques, Ellipses, collection
TECHNOSUP / Génie Logiciel, 2001
• P. ANDRÉ et A. VAILLY, Spécification des logiciels – Deux
exemples de pratiques récentes : Z et UML, Ellipses, collection
TECHNOSUP / Génie Logiciel, 2001
ACSIOME = Analyse et Conception des Systèmes d’Information : Outils, Modèles, Études
= M.C. HEYDEMANN, V. PRINCE, C. REYNAUD, F. SCHLIENGER et D. SCHLIENGER
GALACSI = Groupe d’Animation et de Liaison pour l’Analyse et Conception des Systèmes d’Information
= H. BRIAND, J.-B. CRAMPES, C. DUCATEAU, Y. HEBRAIL, D. HERIN-AIME, J. KOULOUMDJIAN
et R. SABATIERBibliographie : systémique
• J-L. LE MOIGNE, Les systèmes d'information dans les
organisations, Presses Universitaires de France, 1973
• J-L. LE MOIGNE, Les systèmes de décision dans les organisations,
Presses Universitaires de France, 1974
• J-L. LE MOIGNE, La théorie du système général - Théorie de la
modélisation, Presses Universitaires de France, 1977
• J. MÉLÈSE, Analyse modulaire des systèmes, Éditions Hommes et
Techniques, 1977
• J. MÉLÈSE, Approche systémique des organisations, Éditions
Hommes et Techniques, 1979Bibliographie : bases de données
• M. ADIBA et C. DELOBEL, Bases de données et systèmes
relationnels, Dunod, 1983
• G. GARDARIN, Bases de données : les systèmes et leurs langages,
Eyrolles, 1983Bibliographie : MERISE
• CGI (Compagnie Générale d'Informatique), MERISE ou
l'informatique avec méthode, Nathan, 1986
• H. TARDIEU, A. ROCHFELD et R. COLLETTI, La méthode
MERISE, tome 1 : principes et outils, Les Éditions d'Organisation,
1983
• H. TARDIEU, A. ROCHFELD, R. COLLETTI, G. PANET et G.
VAHEE, La méthode MERISE, tome 2 : démarches et pratiques, Les Éditions d'Organisation, 1985
• A. ROCHFELD et J. MOREJON, La méthode MERISE, tome 3 :
gamme opératoire, Les Éditions d'Organisation, 1989
• G. PANET et R. LETOUCHE, MERISE/2, modèles et techniques
MERISE avancés, Les Éditions d'Organisation, 1994
• D. NANCI et B. ESPINASSE, Ingénierie des Systèmes
d’Informations : MERISE Deuxième génération, Vuibert, 2001Bibliographie : SADT
• D. T. ROSS, Structured Analysis : A language for Communicating
Ideas, IEEE Transactions, Software engineering, vol. SE-3, n°1
• D. T. ROSS et K. E. SCHOMAN, Structured Analysis for
Requirements Definition, IEEE Transactions, Software engineering ,
vol. SE-3, n°1
• IGL Technology, SADT, un langage pour communiquer, Eyrolles,
1989, 1993 (3ème édition)
• M. LISSANDRE, Maîtriser SADT, Colin, 1990
• P. JAULENT, Génie logiciel : les méthodes, Armand Colin, 1990Bibliographie : méthodes objet
• S. SHLAER et S.J. MELLOR, Object-Oriented Systems Analysis:
Modeling the World in Data, Englewood Cliffs, New Jersey: Yourdon
Press, 1988
• S. BAILIN, Remarks on Object-Oriented Requirements Specification,
Laurel, MD: Computer Technology Associates, 1988
• M. BOUZEGHOUB, G. GARDARIN et P. VALDURIEZ, Les Objets :
concepts, langages, bases de données, méthodes, interfaces,
Eyrolles, 1997
• J.-L. CAVARERO et R. LECAT, La conception orientée objet,
évidence ou fatalité, Ellipses, collection TECHNOSUP / Génie
Logiciel, 2000Bibliographie : méthodes objet
(« de MERISE à l’objet »)
• A. ROCHFELD et M. BOUZEGHOUB, From Merise to OOM, Revue
Ingénierie des Systèmes d’Information, vol. 1, n°2, 1993
• J. MOREJON, Merise : vers une modélisation objet, Les Éditions
d'Organisation, 1994
• M. BOUZEGHOUB, G. GARDARIN et P. VALDURIEZ, Du C++ à
Merise objet : Objets, Eyrolles, 1994
• B. ESPINASSE, M. LAI et D. NANCI, Merise+ : Une extension de la
méthode Merise à l’approche objet par un apport de la méthode
HOOD, Revue Ingénierie des Systèmes d’Information, Hermès Éditeur, vol. 3, n°2-3, 1995
• B. ESPINASSE et D. NANCI, Merise et l’approche orientée objet : du
couplage avec OMT à une troisième génération, Revue Ingénierie des Systèmes d’Information, Hermès Éditeur, vol. 5, n°4, 1997
• N. KETTANI, D. MIGNET, P. PARÉ et C. ROSENTHAL-SABROUX,
De Merise à UML, Eyrolles, 1998
• J. GABAY, Merise. Vers OMT et UML, InterÉditions, 1998Bibliographie : méthodes objet
(OOA, Fusion, MCO, MACAO)
• P. COAD et E. YOURDON, Object-oriented analysis, Prentice Hall, 1990
• D. COLEMAN, P. ARNOLD, S. BODOFF, C. DOLLIN, H. GILCHRIST, J.
HAYES et P. JEREMAES, Fusion : la méthode orientée objet de 2ème
génération, Masson, 1992
• X. CASTELLANI, MCO : Méthodologie d’analyse et de conception des
systèmes à objets, Masson, 1993
• J.-B. CRAMPES, Méthode orientée-objet intégrale MACAO - Démarche
participative pour l’analyse, la conception et la réalisation de logiciels,
Ellipses, collection TECHNOSUP / Génie Logiciel, 2003Bibliographie : méthodes objet
(HOOD, OMT, OOSE)
• G. BOOCH, Object Oriented Design with Application, The
Benjamin/Cummings Publishing Company Inc., 1991
• G. BOOCH, Analyse et Conception orientées objets, Addison
Wesley, 1994
• M. LAI, Conception orientée objet, pratique de la méthode HOOD,
Dunod, 1991
• J. RUMBAUGH, M. BLAHA, W. PREMERLANI, F. EDDY et W.
LORENSEN, Object oriented modeling and design, Prentice Hall,
1991
• I. JACOBSON, M. CHRISTERSON, P. JONSON et G. ÖVERGAARD, Object-Oriented Software Engineering: A Use Case
Driven Approach, Addison Wesley, 1992
• I. JACOBSON, Le génie logiciel orienté objet, Addison WesleyBibliographie : UML
• P.-A. MULLER, Modélisation objet avec UML, Eyrolles, 1998
• C. MORLEY, B. LEBLANC et J. HUGUES, UML pour l'analyse d'un
système d'information – Le cahier des charges du maître d'ouvrage,
Dunod, 2000
• C. SOUTOU, Objet-Relationnel sous Oracle8, Modélisation avec
UML, Eyrolles, 1999
• P. ROQUES et F. VALLÉE, UML en action – De l’analyse des
besoins à la conception en Java, Eyrolles, 2000
• M. LAI, Penser objet avec UML et Java, InterÉditions, 1998
• M. LAI, UML : La notation unifiée de modélisation objet – De Java
aux EJB, Dunod, 2000
• G. BOOCH, J. RUMBAUGH et I. JACOBSON, The Unified Modeling
Language User Guide, Addison-Wesley, 1999
• I. JACOBSON, G. BOOCH et J. RUMBAUGH, The Unified Software
Development Process, Addison-Wesley, 1999
• J. RUMBAUGH, I. JACOBSON et G. BOOCH, The Unified Modeling
Language Reference Manual, Addison-Wesley, 1999Bibliographie : B
• M. SPIVEY, La notation Z, Masson - Prentice Hall, 1992
• D. LIGHTFOOT, Spécification formelle avec Z, TEKNEA, 1994
• J.-R. ABRIAL, The B-book: Assigning Programs to Meanings,
Cambridge University Press, 1996
• J.-R. ABRIAL, Introduction à la méthode B, 6 vidéo-cassettes, IUT
de Nantes
• J.-R. ABRIAL, La méthode B - études de cas, 6 vidéo-cassettes, IUT
de Nantes
• H. HABRIAS, Introduction à la spécification, Masson, 1993
• H. HABRIAS, Spécification formelle avec B, Éditions Hermès –
Lavoisier, 2001Bibliographie : interface hommemachine
• J.-B. CRAMPES, Interfaces graphiques ergonomiques - Conception
et Modélisation, Ellipses, collection TECHNOSUP / Génie Logiciel,
1997DéfinitionsDéfinitions : OMGL
• OMGL = Outils et Modèles pour le Génie Logiciel
• Outil : logiciel supportant une méthode
• Modèle : représentation schématique de la réalité
• Logiciel selon l'arrêté du 22 décembre 1981 : ensemble
des programmes, procédés et règles, et éventuellement
de la documentation, relatifs au fonctionnement d'un
ensemble de traitements de l'information
• Génie Logiciel (ou l'ingénierie des systèmes
d'information) selon l'arrêté du 30 décembre 1983 :
ensemble des activités de conception et de mise en
œuvre des produits et des procédures tendant à
rationaliser la production du logiciel et de son suiviDéfinitions : ACSI
• ACSI = Analyse et Conception des Systèmes
d'Information
• Analyse : processus d'examen de l'existant
• Conception : processus de définition de la
future application informatique
• Systèmes d'Information : ensemble des
moyens (humains et matériels) et des méthodes
se rapportant au traitement de l'information
d'une organisationDéfinitions : BD
• BD = Bases de Données
• Bases de Données [définition des
informaticiens] : ensemble des données (de
l'organisation) structurées et liées entre elles :
– stocké sur support à accès direct (disque
magnétique)
– géré par un SGBD (Système de Gestion de Bases de
Données)
– accessible par un ensemble d'applicationsDéfinitions (compléments)
• Informatique : science du traitement
automatique et rationnel de l'information
[académie française, 1966]
• Informatique de Gestion : informatisation des
systèmes d'information
• AGL = Atelier de Génie Logiciel (CASE =
Computer Aided Software Engineering) :
ingénierie du logiciel assisté par ordinateurL’information, indispensable dans
le processus de décision d'une
organisation
• Diminution de l'incertitude
• Liberté de choix
• Cohésion de l'organisation
• Évolutivité par rapport à l'environnementQualités requises pour une
information
• Pertinence (mesure la qualité d’une information) :
relation directe entre l’action à accomplir ou la décision à
prendre
– précision : ni trop importante, ni trop faible
– sécurité (pour reconstituer l’information en cas d’accident)
– intégrité (contraintes statiques ou dynamiques
)
– confidentialité (protection contre tentatives d’accès)
– non redondance (un seul exemplaire de chaque information)
– Convivialité (qualité de représentation sur support externe et
facilité d’accès par les utilisateurs)
– âge (temps entre enregistrement et sortie des résultats
)
– fréquence (nombre de transmissions par unité de temps)
• Cohérence (d’unité, de temps, etc.)
• Rentabilité : coût d’obtention
≤ gain, meilleur serviceTypes d'information
• Niveau d'agrégation
– brutes
– élaborées
• Flux
– logistique
– monétaire
– de personnel
– de l'actif
• Utilisation
– planification stratégique
– gestion administrative
– régulation opérationnelle
• Nature du support
– oral
– documentaire
– informatiqueDéfinitions : systémique
• Analyse systémique : analyse qui envisage les éléments
d'une conformation complexe, les faits (notamment les
faits économiques), non pas isolément mais
globalement, en tant que parties intégrante d'un
ensemble dont les différents composants sont dans une
relation de dépendance réciproque [P.L.I. 2003]
• Neuf niveaux imbriqués de complexité selon cette
théorie : l'objet passif, l'objet actif, l'objet actif régulé,
l'objet s'informe, l'objet décide son activité, l'objet actif a
une mémoire, l'objet actif se coordonne, l'objet actif
imagine (et donc s'auto-organise), l'objet actif
s'auto-finalise
L'organisation correspond au dernier niveauDéfinitions : système
• Système : ensemble d'éléments en interaction
dynamique, dont les éléments sont organisés et
coordonnés en vue d'atteindre un objectif, qui évolue
dans un environnementUn système vu comme une « boîte
noire »Système : de la « boîte noire » à la
« boîte blanche »
Le système se décompose en sous-systèmes dont on
définit les entrées (issues de l'extérieur ou sorties
d'autres sous-systèmes) et les sorties (à destination de
l'extérieur ou devenant les entrées d'autres
sous-systèmes) Système : de la « boîte noire » à la
« boîte blanche »Système : de la « boîte noire » à la
« boîte blanche »
Chaque sous-système est lui-même un système :
affinages successifs jusqu'à l'obtention d'une « boîte
blanche »Principales difficultés de l’approche
d’un système par décomposition
récursive
• identification du système
• identification des limites du système
• identification des sous-systèmes
• risque de perte engendrée par la
décomposition
• etc.Définitions : système organisationnelDéfinitions : système organisationnel
• Système de Décision (ou pilotage, management, etc.)
– Guide l'organisation vers ses objectifs (activités de planification
et de contrôle) : coordonne, imagine, finalise, élabore objectifs
– Gérer
• Système d'Information
– Intermédiaire entre les systèmes de décision et opérationnel, par
qui transite toute information :
• mémorise l’information (conservation de l'information pour des
besoins ultérieurs),
• traite l’information (rapprochements, calculs, comparaisons),
• fait circuler l’information (accès à la mémoire, échange entre
acteurs)
• Système Opérant (ou logistique, technologique,
physique, de production, etc.)
– Effectue la transformation : reçoit, traite, envoi
e
– Acheter ; Produire ; Stocker ; Vendre
Remarque : un même employé peut être un acteur de
chacun des trois sous-systèmesRôles du système d’information
• Produire les informations légales réclamées par
l'environnement
• Déclencher les décisions programmées
• Fournir des informations aux décideurs pour aider à la
prise de décisions non programmées
• Coordonner les tâches en assurant les communications
au sein du système organisationnel Connaissances nécessaires en
Informatique de Gestion
• Science de gestion : mise en place du réseau
d'information et de communication (conception du
système d'information)
• Technique informatique : conception et réalisation du
système informatique pour gérer le système
d'information (conception du logiciel) Définitions : système d’information
vs système informatique
• Le système informatique est la partie informatisée du
système d’information automatisable
système informatique
système d’information automatisable
système d’informationDéfinitions : système informatique
• Communication
– Système informatique communique directement avec
son environnement (utilisateurs, fichiers d’autres
systèmes via un réseau ou non, etc.)
– Communication entre composants d’une application
(ex. : fichier de mouvement)
• Traitement
– Demandes de traitements issues de l’échange entre
le système informatique et son environnement
– Pilotage des traitements proposés par le système
informatique en gérant les appels aux processus
permettant de les réaliser
• Mémorisation
– Gestion des données par différents modes d’accès
(et stockage aux niveaux logique et physique)Enjeux de l’informatisation pour
l'organisation
• Augmenter la productivité en améliorant l’efficacité des
utilisateurs
• Améliorer les conditions de travail : enrichissement des
tâches
• Rendre un meilleur service (de qualité, rapide, etc.) aux
partenaires de l'organisation Facteurs de la complexité de
l'informatisation
• Difficultés techniques de l'informatique : complexité de la
mise en œuvre des matériels, complexité de la
construction logicielle, réflexion abstraite, contraintes
techniques
• Constantes novations (matérielle et logicielle)
• Symbiose requise entre l'application informatique et
toute l'organisation (et ses partenaires)
• Multiplicité des décisions et nombreux domaines
(humain, financier, technique, etc.) de l'organisation
concernésCritères d'un bon système
informatique
• Productivité (en rationalisant le processus
d'informatisation)
– Établissement d'une ligne directrice des informatisations
– Planification et suivi des performances
– Efficacité des études informatiques
– Utilisation judicieuse des technologies
• Qualité
– Conformité de la réalisation par rapport aux besoins
– Documentation correcte
– Adaptabilité
– Fiabilité
– Facilité d'utilisation
• Rentabilité (i.e. gain pour l'organisation relativement au
coût de l'informatisation)L'informatique remplit maintenant
un rôle stratégique dans
l'organisation
On est passé de l’automatisation des tâches
administratives aux systèmes d'information d'aide à
la décision (SIAD)
• Système opérant
• Début années 1960
• Faible complexité des
traitements
• Mise à jour transactionnelles,
chaînes séquentielles
• Information précise
• L3G
• Système décisionnel
• Plus récent
• Forte complexité des
traitements
• Consultation en temps partagé
• Information significative,
rapidement disponible
• SQL
Informatique de production
Informatique de managementIntervenantsIntervenants : les départements du service
informatique (01 Informatique 27/10/1995)
• Direction informatique
Responsable du service informatique ; Chef d’un département
du service informatique
• Expertise
Administrateur ou expert en système (d’exploitation), réseau,
base de données, méthodes, qualité, sécurité, technologies
diverses
• Études - Développement
Chef de projet ; Analyste ; Concepteur ; Développeur (ou
programmeur)
• Production - Exploitation
Opérateur - Pupitreur ; Analyste d’exploitation ; Contrôleur
réseau ; Technicien (micro-informatique, réseau, messagerie,
téléphonie)
• Support et assistance
Assistant technique clientèle
Autre métier : Consultant en systèmes d'informationIntervenants : anciens diplômés du
département informatique de l’IUT
de l’université Bordeaux 1
(statistiques élaborées à partir des 530 réponses
reçues sur 2156 diplômés au 18/12/1996)
• Direction informatique ………………………………. • Expertise ………………………………………………
• Études – Développement ……………………………
• Production - Exploitation ; Support et assistance ...
• Non informaticien ………………………………….....
16 %
10 %
54 %
12 %
8 %Intervenants : MOA vs MOE
• La maîtrise d'ouvrage (MOA) : les utilisateurs
– Direction générale
– Responsable du service des utilisateurs
– Personnel
– Autres services
– Clients
• La maîtrise d'œuvre (MOE) : les informaticiens,
prestataires de services
– Responsable du service informatique
– Chef de projet
– Analyste
– Développeur
– Personnel de l’exploitation
– Sous-traitants de l'applicationNomenclature 2005 des
emplois-métiers
Les emplois-métiers du système d’information
dans les grandes entreprises
CIGREF (club informatique des grandes
entreprises françaises)
février 2005
http://www.cigref.fr/cigref/livelink
.exe/Nomenclature_RH_2005.pdfNomenclature 2005 : 6 familles
• Conseil en système d'information et maîtrise
d'ouvrage (6 métiers)
• Support et assistance aux utilisateurs (3 métiers)
• Production et exploitation (7 métiers)
• Études, développement et intégration (4
métiers)
• Support et assistance technique interne (6
métiers)
• Administration et gestion de la direction du
système d'information (5 métiers)Nomenclature 2005 : 31 métiers
• Conseil en système d'information et maîtrise
d'ouvrage
– Consultant en systèmes d’information
– Urbaniste des systèmes d’information
– Chef de projet maîtrise d’ouvrage
– Responsable du système d’information « métier »
– Gestionnaire d’applications
– Responsable de projet « métier »
• Support et assistance aux utilisateurs
– Assistant fonctionnel
– Technicien support SVP
– Chargé d’affaires internesNomenclature 2005 : 31 métiers
• Production et exploitation
– Technicien d’exploitation
– Technicien poste de travail
– Technicien réseaux ou télécoms
– Administrateur d’outils / systèmes / réseaux et
télécoms
– Administrateur de bases de données
– Intégrateur d’exploitation
– Pilote d’exploitation
• Études, développement et intégration
– Chef de projet maîtrise d’œuvre
– Développeur
– Intégrateur d’applications
– Paramétreur de progiciels de gestion intégré (PGI i.e.
ERP, enterprise resource planning
)Nomenclature 2005 : 31 métiers
• Support et assistance technique interne
– Expert système d’exploitation
– Expert réseaux / télécoms
– Expert méthode et outils / qualité / sécurité
– Expert en technologie internet / intranet et multimédia
– Responsable sécurité des systèmes d’information
– Architecte technique
• Administration et gestion de la DSI
– Responsable du management de la DSI
– Responsable d’exploitation informatique
– Responsable d’une entité informatique
– Responsable de(s) service(s) administratif(s) et
financier(s) de la DSI
– Responsable TélécomsNomenclature 2005 : développeur
• Synonymes
– Analyste-programmeur
– Réalisateur en informatique
– Analyste fonctionnel
– Analyste réalisateurNomenclature 2005 : développeur
• Mission
À la demande de la maîtrise d’œuvre, et sur la base
des spécifications fonctionnelles émises par celle-ci,
le développeur analyse, paramètre et code les
composants logiciels applicatifs dans le respect des
normes et procédures, ainsi que les évolutions
souhaitéesNomenclature 2005 : développeur
• Activités et tâches
– Analyse
Définition de spécifications ; Analyse organique ; Adaptation
et paramétrage de progiciels applicatifs ; Prototypage
– Développement
Réalisation de modules (objets et composants logiciels) ;
Assemblage de ces éléments ; Rédaction de documentations
; Industrialisation de composants et d’applications
– Qualification
Élaboration de jeux d’essais (tests unitaires d’intégration) ;
Tests ; Identification et traitement des dysfonctionnements
– Maintenance
Maintenance corrective ; Maintenance évolutive ;
Administration des composants logiciels réutilisables et
gestion de la nomenclature de ces composantsNomenclature 2005 : développeur
• Parcours professionnel
– Profil : Bac + 2 ou 3
– Expérience : DébutantNomenclature 2005 : développeur
• Tendances et facteurs d’évolution
– Usage croissant des progiciels, d’où importance
croissante du paramétrage, de l’objet, du fonctionnel
aux dépens du développement spécifique, de
l’algorithmique
– Renouvellement rapide des langages : java, langages
objet…
– Importance croissante de l’ergonomie
– Durée de vie des applications raccourcie
– Souci de réutilisation des développementsNomenclature 2005 : développeur
• Savoir-faire système d’information
– Expertise
• Langages de programmation [Développement]
• Méthodes, normes et outils de développement
[Développement]
– Maîtrise
• Conception, modélisation et architecture d’applications
[Conception]
• Algorithmique [Développement]
• Techniques de développement (maquettage et prototypage,
client-serveur, objet, RAD) [Développement]
• Charte d’utilisation et de sécurité des SI [Sécurité
informatique]
– …/…Nomenclature 2005 : développeur
– Application
• Parc applicatif et de services [Architecture applicative /
fonctionnelle]
• Paramétrage d’applications [Développement]
• Intégration de logiciels [Intégration]
• Intégration de matériels [Intégration]
• Gestion de production [Production - Exploitation]
• Normes et procédures de sécurité I&T (Informatique et
Télécoms) [Sécurité informatique]
– Notions
• Architecture de systèmes d’exploitation [Architecture
technique]
• Administration de bases de données [Gestion de données -
Bases de données]
• Intégration de systèmes d’exploitation [Intégration]
• Environnements d’exploitation [Production - Exploitation]
• Logiciels et matériels réseaux [Télécom - Réseaux]Nomenclature 2005 : développeur
• Savoir-faire généraux
– Expertise
– Maîtrise
• Ergonomie et interfaces homme-machine [Savoirs de base]
– Application
• Compréhension des clients de la DSI (utilisateurs
fonctionnels) et de leurs besoins [Connaissances des métiers
de l’entreprise]
• Techniques de l’assurance qualité [Qualité]
• Capacité rédactionnelle [Savoirs de base]
– Notions
• Culture générale I&T [Connaissances des métiers de
l’entreprise]
• Pratique de l’anglais technique lu, écrit et parlé [Langue]Nomenclature 2005 : développeur
• Aptitudes comportementales
– Essentiel
• Méthode [Compétences de résolution de problèmes]
• Analyse [Compétences de résolution de problèmes]
• Rigueur [Compétences d’efficacité personnelle]
– Utile
• Logique [Compétences de résolution de problèmes]
• Adaptabilité [Compétences d’efficacité personnelle]
• Gestion de situation [Compétences d’efficacité personnelle]
• Pragmatisme [Compétences d’efficacité personnelle]
• Écoute et communication [Compétences relationnelles]
• Travail en équipe [Compétences relationnelles]Cycles de vie du logicielCycle de développement et cycle
de vie du logiciel : les phases
• Analyse
• Conception
• Réalisation
• Tests
• Exploitation
• Maintenance
Cycle
de
vie
Cycle
de
développementCycles de vie du logiciel
• Analyse de l'existant et définition des
besoins, du système d'information et du
logiciel
• Conception du système d'information et du
logiciel
• Réalisation (ou codage, programmation) :
traduction des algorithmes dans un
langage compréhensible par un ordinateurCycles de vie du logiciel
• Tests :
– vérification du logiciel (i.e. système
informatique)
– validation du logiciel
– vérification du système d'information
– validation du système d'information
Vérification : le produit en cours d’élaboration répond-il à la
définition des besoins ? (est-ce bien le produit ?)
Validation : le produit en cours d’élaboration remplit-il les
fonctionnalités désirées par l'utilisateur ? (est-ce le bon
produit ?)Cycles de vie du logiciel
• Exploitation : utilisation du logiciel une fois
installé (et dont on fait la recette)
• Maintenance
– Correction des erreurs
– Amélioration des fonctions existantes
– Ajout de nouvelles fonctionnalitésCycles de vie en cascade (ou en
chute d’eau)
Critiques :
– Recouvrement de phases
– Avancées et retours d’une seule phase du cycle de
développement à la fois
– Impact de la maintenance sur toutes les phases du
développement
– Contacts avec l’utilisateur restreints à la phase
d’analyseCycles de développement en V
• Système signifie ici système d'information (manuel et informatisé)
• Modèle de l'AFCIQ (Association Française pour le Contrôle Industriel de
Qualité) avec le vocabulaire suivant : Spécification fonctionnelle \
Conception préliminaire \ Conception détaillée \ Codage / Tests unitaires /
Tests d'intégration / RecetteCycles de développement en M
3 activités interviennent durant toute la durée du développement en V
– Gestion de projet : pilotage du projet
– Gestion des configurations : gestion des différentes versions du produit
– Assurance qualité : contrôle systématiquement que le produit en cours est
cohérent et complet, en le confrontant à des normes préétablies si elles
existentCycles de développement en W
• Maquette : défilement d'écrans donnant une idée de ce que sera la
future application (sans accès aux données)
• Les maquettes sont élaborées par les informaticiens et validées par
les utilisateurs
• Avantages du maquettage
– Gain de temps sur les phases en aval (2nd V)
– Limitation des erreurs lors de la recetteCycles de développement en
spirale
• Prototype : application en
réduction (avec accès aux
données)
• Expérimentation : tests de
la part des utilisateurs du
produit dans sa version
actuelle (éventuellement
définitive)
• Bilan : critique de
l’expérimentation
• Généralisation de
l’approche par itération
• Ex. : conception d’outils de
pilotage (car une forte
réactivité aux besoins non
stables des utilisateurs est
nécessaire)Cycles de développement
composite : un exemple
Démonstration : présentation du produit aux utilisateursCycles de vie de l’ISOCycles de vie d’EuroMethodeChiffres : coût moyen relatif de
chaque phase (du cycle de
développement du logiciel) pour
une application de gestion
• Analyse et Conception : 44 %
• Réalisation : 28 %
• Tests : 28 % Chiffres : coût relatif de correction
d'une erreur selon la phase (du
cycle de vie du logiciel) au cours de
laquelle elle a été détectée
Analyse : 1
Conception : 2
Réalisation : 5
Tests : 10
Exploitation et Maintenance : plus de 100
• Remarque : plus de 80 % des erreurs sont introduites durant les
phases d'analyse et de conception
• Les coûts de la maintenance corrective (ni adaptative, ni évolutive)
peuvent aller jusqu'à deux fois ceux du développement
Exemple pathologique (système avionique) : coût de développement de 30$ par instruction mais coût de maintenance de 4000$ par instructionChiffres divers
• Productivité moyenne d'un programmeur d'une
application de gestion simple : moins de 600 lignes de
code par mois
• Application moyenne (en 1985) : 100 000 lignes de code
pour 600 000 €
Ex. : suivi de production pour 3000 personnes, entreprise
commerciale de 2 milliards de chiffre d'affaires
• Taille d’un projet
– Entre 100 et quelques milliers de jours
– Jusqu’à 50 personnesTaxinomie des méthodes
d’informatisationMéthode d'informatisation :
définition
Une méthode d'informatisation en
informatique de gestion
– définit un processus d'informatisation du
système d'information (totalement ou
partiellement i.e. pour tout ou partie du cycle
de vie du logiciel
)
– possède une portée (champ d'étude i.e.
domaine étudié
)
– décrit une démarche i.e. un ensemble de
travaux en les ordonnant (succession
d’étapes)Méthode d'informatisation : règles
• S'appuyer sur des concepts théoriques :
définition des concepts
• Proposer une démarche : cadre général pour
définir le travail à accomplir par les intervenants
• Permettre sa mise en œuvre par des outils :
pour faciliter la manipulation des concepts
• Atteindre un but : l’informatisation éventuelle (
⇒
argumentation et faisabilité)
N. B. : une méthode ne remplace ni l’expérience,
ni la connaissance, ni le talentMéthode d'informatisation :
composants
• Modèles : ensemble de concepts et de règles
destiné à expliquer et construire la
représentation de phénomènes organisationnels
• Langages : destinés à l’élaboration des
spécifications, à faciliter la communication
• Démarche
• Outils et techniques : aides à la mise en œuvre
des modèles, langages, démarche Méthode d'informatisation :
objectifs
• Réduire la complexité des informatisations (ex. : en
identifiant et donc en maîtrisant les facteurs de cette complexité)
• Rendre cohérents tous les projets (ex. : même approche,
même « style » des dossiers, meilleure intégration entre projets)
• Capitaliser les expériences (ex. : réutilisation des solutions
ayant résolu les mêmes problèmes, acquisition de savoir-faire)
• Augmenter la qualité des travaux d'informatisation (ex. :
mêmes standards)
• Augmenter la productivité des travaux d'informatisation
(ex. : standardisation augmente l’efficacité)
• Améliorer les communications entre intervenants
(utilisateurs et informaticiens)Méthode d'informatisation
N. B. : les SSII ont été les premières à créer des
méthodes
Les solutions empiriques
– Avantage : répondent à l'urgence
– Inconvénient : génèrent des applications provisoires
(car complexes, non fiables, coûteuses, etc.) Taxinomie des méthodes :
fondements théoriques
• Cartésienne (démarche dite analytique ; résolution des
problèmes un à un)
– Approche fonctionnelle (analyse et conception des systèmes
d'information par rapport à la définition des besoins) et
descendante (du général au particulier)
– Ex. : SADT, CORIG
• Systémique (démarche dite globalisante ; résolution
globale des problèmes)
– Approche conceptuelle (processus de modélisation par niveaux
d'abstraction successifs)
– Repose sur l'identification de projets qui structurent
l'organisation (sans qu'il y ait obligatoirement un besoin)
– Ex. : MERISE, AXIAL, IA-NIAMTaxinomie des méthodes :
fondements théoriques
• À objet (application du paradigme objet à tout le
processus)
– Les objets (de l'application, de services distribués) et les
utilitaires communs échangent des informations (demandes et
réponses de services) à l'aide de messages
– Ex. : OOA, OMT, MCO, HOOD, OOSE, MERISE Objet
• Formelle (utilisation des mathématiques)
– Spécification et conception formelles exprimées à l’aide du
langage mathématique qu’il faut ensuite prouver
– Ex. : BTaxinomie des méthodes :
générations
• Première génération
– Des années 60 au début des années 70
– Automatisation des procédures administratives
– Problèmes de programmation (ex. : WARNIER, JACKSON,
etc. sur l’art de bien écrire du code i.e. programmation
structurée)
– Approche analytique (par les données) ou synthétique (par les
fonctions)
– Ex. : MINOS (analytique), CORIG (synthétique)Taxinomie des méthodes :
générations
• Deuxième génération
– Années 70
– Généralisation des champs d'étude au système d'information et
à l'organisation en entier
– Préconisations (en analyse, conception, programmation) et
démarche d'informatisation (schéma directeur, plan
d'informatisation, conduite de projet)
– Prise en compte de nouvelles techniques (temps réel, bases de
données, ergonomie), nouvelles formalisations
(entités-associations), évolution des sciences de gestion
– Ex. : IA-NIAM, SADTTaxinomie des méthodes :
générations
• Troisième génération
– Depuis la fin des années 70 (dont les méthodes à objets des
années 80)
– Informatisation globale (cohérence, complétude)
– Innovations technologiques (matérielles et logicielles)
– Démarche de synthèse, davantage de modélisation, introduction
d'outils logiciels associés
– Ex. : MERISE, AXIAL, SSADM, OOA, OMT, OOSE, HOOD, B
• Quatrième génération ?
– Intégration des technologies orientées objets, client/serveurTaxinomie des méthodes :
domaines d'application
• Particulier
– Application à un travail précis et indépendant de toute démarche
– Ex. : RACINES pour l'élaboration d'un schéma directeur
• Partiel
– Description et ordonnancement de travaux relativement à une
démarche d'informatisation partielle
– Ex. : CORIG pour la conception et la réalisation du système
informatique, SADT et IA-NIAM pour la conception du système
d'information et du système informatique
• Global
– Processus d'informatisation complet (de l'introduction de
l'informatique dans une organisation à la maintenance des
applications) : description et ordonnancement de tous les
travaux
– Ex. : MERISE, AXIAL, SSADM, OOA, HOOD, OMT, OOSE, BTaxinomie des méthodes :
démarche
• Linéaire
– Succession linéaire des travaux (démarche découpée en étapes
découpées en phases découpées en tâches découpées en
opérations)
– Analyse descendante (des problèmes généraux aux problèmes
particuliers) par décomposition hiérarchique des travaux
– Itération et condition possibles
– Ex. : MERISE, AXIAL, etc.
• Non linéaire
– Analyse ascendante par intégration progressive des résultats Taxinomie des méthodes :
approche
• Ascendante
– Recensement et analyse des sorties (papier ou écran) puis
établissement des entrées nécessaires et suffisantes
– La liste des informations obtenue est ainsi l'ensemble minimal
nécessaire pour obtenir les résultats, ce qui permet difficilement
de prendre en compte l'évolution des besoins de l'organisation
– Ex. : MINOS
• Descendante
– Recensement des informations du système d'information
existant (sans oubli ni répétition) et des nouvelles fonctionnalités
des utilisateurs
– Ex. : CORIG, MERISE, etc. (la plupart des méthodes actuelles)Quelques méthodes :
≤1982
• CORIG
– Compagnie Générale d'Informatique, France, 1966
– Conception et réalisation du système informatique
• SADT (Structured Analysis and Design Techniques)
– D.T. ROSS pour SofTech, USA, 1976 (et IGL Technology, France,
1977)
– Conception du système d'information et du système informatique
• MCP (Méthode de Conduite de Projets informatiques)
– RATP et AFCET, France, 1978
– Conduite de projets
• [H]OOD ([Hierarchical] Object Oriented Design)
– R. ABBOTT en 1980, G. BOOCH en 1983 (CISI & MATRA & CRI pour
l'Agence Spatiale Européenne en 1987)
– Conception et réalisation du système informatique
• IA-NIAM (Nijssen's Information Analysis Method)
– M. NIJSSEN pour Control Data, Belgique, 1982
– Conception du système d'information et du système informatique Quelques méthodes : 1983..1986
• MCX et MCO (Méthode générale d'analyse des applications
informatiques)
– X. CASTELLANI, France, 1983
– Informatisation complète
• MERISE et MERISE/2 (Méthode d'étude et de réalisation
informatique pour les systèmes d’entreprise)
– H. TARDIEU pour Séma-Matra et Gamma International, France, 1983
– Informatisation complète
• JSD (Jackson System Development)
– M. JACKSON, Systems Ltd, Royaume-Uni, 1983
– Conception du système d'information et du système informatique
• SSADM (Structured Systems Analysis and Design Method)
– LBMS pour CCTA, Grande-Bretagne, 1986
– Informatisation complète
• AXIAL (Analyse et Conception de Systèmes d’Information Assistés
par Logiciels)
– IBM, France, 1986
– Informatisation complète Quelques méthodes :
≥1988
• REMORA
– C. ROLLAND de l'Université Paris 1 (Sorbonne), France, 1988
– Conception du système d'information et du système informatique
• OOA (Object-Oriented Analysis)
– P. COAD et E. YOURDON, 1991
• OMT (Object Modeling Technique)
– J. RUMBAUGH, 1991
– Conception du système d'information et du système informatique
• OOSE (Object-Oriented Software Engineering)
– I. JACOBSON, 1992
• Z
– D. LIGHTFOOT, 1992
– Conception du système d'information et du système informatique
– N. B. : c’est un langage de notation et non pas une méthode
• B
– H. HABRIAS, 1993
• UML (Unified Modeling Language)
– G. BOOCH, I. JACOBSON et J. RUMBAUGH, 1999
– N. B. : c’est un langage de modélisation et non pas une méthodeDémarcheDémarche d’une méthode
d'informatisation traditionnelle
• Étude préalable
• Analyse fonctionnelle
• Analyse organique
• Programmation
• Mise en serviceDémarche : 3 premières étapes
• Étude préalable
– Étude de l’existant
→ dossier de l’existant validé
– Étude d'opportunité
→ rapport d'opportunité
→ cahier des charges (et plan directeur de réalisation
)
• Analyse fonctionnelle
– Conception (modèles de communication, des
traitements et des données)
– Validation
→ schéma conceptuel
• Analyse organique
– Progiciel ou Développement spécifique
→ solution informatiqueDémarche : étude préalable
(objectif)
• Analyse du fonctionnement de l'organisation et
diagnostic général de l’existant
• Recensement des critiques (positives ou
négatives, d’organisation et informatiques) et
des besoins des utilisateurs
• Opportunité (financement, moyens humains,
etc.) et faisabilité (technique) des
automatisations
• Rédaction d'un cahier des chargesDémarche : étude de l’existant
(importance)
Toute l'application en dépend
⇒
– exhaustivité
– exactitude
Gravité croissante d'une étude préalable
se révélant incomplète ou inexacte lors
de l'analyse fonctionnelle et/ou
organique (peu grave), de la
programmation (dommage), de
l’exploitation (catastrophique)Démarche : étude de l’existant
(objectif)
Description de l'existant (par différentes
représentations littéraires/schématiques et
modèles de
communication/traitement/données) en
collectant toutes les informations
(informatisées ou non) utiles et
nécessaires Démarche : étude de l’existant
(phases)
• Collecte
– Aller sur le terrain
– Observer
– Questionner
– Prendre des notes
– etc.
• Représentation
– Rédiger
– Formaliser les renseignements collectés
– Modéliser
– etc.
• Validation Démarche : collecte
• Objectif : recueillir et sélectionner les
informations intéressantes (i.e.
pertinentes) parmi toutes les informations
vues (i.e. observées) ou entendues (via
entretiens)
• Informations à recueillir
– Nature, volume, fréquence, précision
observée ou requise, durée de vie,
ancienneté, etc.
– Exemplaires vierges et renseignés Démarche : collecte (critères
)
• Informations sur le système actuel et futur
• Informations sur le système ou du système
– Ne recueillir que les informations directement utiles liées à l'étude
• Informations de type
– Dynamique : circulation des documents dans l’espace (ex. : diagramme
de circulation des documents ou de l’information, diagramme de flots de
données) et dans le temps (calendrier, temps des traitements, délai de
circulation, etc.)
– De transformation : procédure de traitement, règle de gestion,
enchaînement des tâches, formule de calcul, condition de
déclenchement des traitements
– Statique : données élémentaires (ex. : dictionnaire des données) et
documents (fiches de rubriques/fichiers/documents), services et postes
de travail (ex. : organigramme, fiche de fonction)
• Degré de conscience ou d’expression de l'information
– Collecter les informations exprimées (par écrit ou oralement)
– Détecter les informations conscientes non exprimées
– Deviner les informations inconscientes
– N. B. : selon le cas, faire exprimer/reconnaître les informations non
exprimées ou les laisser dans l'ombreDémarche : collecte (moyens)
• À partir de documents (écrits et collectés)
– Documents existants : d’exécution (ex. : facture, bulletin de paye,
bordeaux, fichiers produits, etc.), de gestion (ex. : organigrammes,
statistiques, etc.) ou à établir entièrement
– Documents à compléter (questionnaire)
• Entretien (ou enquête orale)
– Accompagnant des documents écrits (pour les
expliquer/compléter/contrôler/mettre à jour) ou sans document écrit
préalable (avec ou sans la participation de l’interlocuteur)
– Contraignant ou peu directif (selon expérience/aisance de l’analyste)
– Quelques conseils : fixer un rendez-vous, préparer l’entretien, être
ponctuel, préciser l'objectif, questionner, écouter, noter, demander tous
les documents nécessaires, conclure, faire un compte-rendu
• Observation (ou enquête visuelle)
– Après un entretien par exemple
– Qualitative (sur le déroulement d’une procédure d’un poste de travail,
sur la circulation empruntée par un document marqué, etc.) ou
quantitative (ex. : mesurer le nombre de tâches pour une période
donnée, la durée d’exécution d’un travail, etc.)Démarche : collecte
(ordonnancement des tâches)
Tâches d'introduction (définition de l’étude)
Tâches d'analyse du présent (recueil de l’existant)
Tâches montrant les contraintes et désirs de l'organisation future (critique)
Tâches de conclusion
1 2 3
4
5 6
7
8
9
10
● 11 12 14 13
Remarques
– Il existe des tâches séparées dont la collecte est commune, et
inversement une tâche peut nécessiter des collectes séparées
– Avancées ou retour en arrière possibles
– Il ne s'agit que d'un ordonnancement possibleDémarche : collecte
(ordonnancement des tâches
d'introduction)
1. Prise de connaissance du contexte i.e. de la structure
hiérarchique de l'organisation et de son environnement
social, technique et économique
2. Reformulation des limites de l'étude et du découpage
en projets à partir de ce qui a été décrit ou demandéDémarche : collecte
(ordonnancement des tâches
d'analyse du présent)
3. Au niveau du projet retenu, étude de la structure
hiérarchique et liste des postes de travail et des centres
de décision
4. Étude détaillée des postes de travail
5. Établissement d'une liste des fichiers et des documents
6. Représentation de la circulation des documents
mentionnant les traitements
7. Recensement et description des règles de gestion (:=
condition facultative, affectation et règle de calcul), i.e.
les procédures et règles de traitement
8. Confection d'un dictionnaire des rubriquesDémarche : collecte
(ordonnancement des tâches
montrant les contraintes et
désirs de l'organisation future)
9. Récapitulation des moyens et ressources utilisés et
des contraintes (durée, délai, fréquence, volume, coût,
réglementation, ergonomie)
10. Récapitulation des demandes d'information et des
critiques formulées par le personnel consulté
11. Contrôle du travail effectué i.e. des éléments du
système d'information existant répertoriés au cours de
l'analyse Démarche : collecte
(ordonnancement des tâches de
conclusion)
12. Constitution du dossier de l’existant i.e. première
version du cahier des charges détaillé
13. Validation de l'étude auprès des personnes
compétentes et concernées par l'étude
14. Premier examen critique des personnes ayant réalisé
cette analyse mentionnant leurs avis sur l’existantDémarche : étude d’opportunité
(objectif)
Faciliter la prise de décision par la
direction générale en commission
informatique sur la suite à donner à l'étude
(par un rapport synthétique présentant les
principales critiques formulées et les
diverses solutions envisageables) i.e. la
mise en œuvre d'un certain nombre de
projets d'automatisation parmi ceux
proposés Démarche : étude d’opportunité
(critique du système d'information
existant)
• Niveaux : général, des domaines d'étude, des services
et postes de travail
• Causes possibles de dysfonctionnement
– Insuffisance des moyens de traitement de l'information (ex. : en
personnel, matériel, locaux)
– Mauvaise organisation (ex. : centralisation excessive ou
insuffisante, personnel inadapté ou incompétent, mauvaise
structure hiérarchique)
– Circuits informationnels mal étudiés (ex. : trop longs, non
compris)
– Méthodes de traitements mal formalisées ou archaïques (ex. :
inexistence d’algorithme)
– Documents inexistants ou inutiles ou incomplets
– Fichiers inexistants, mal structurés, incomplets, redondants, etc.
• Exposé des besoins nouveaux exprimés par les
utilisateurs Démarche : étude d’opportunité
(propositions de solutions)
• Pallier les dysfonctionnements et améliorer le
système
– Solutions non informatisées
• Personnel (ex. : embauche, promotion, déplacement,
formation)
• Matériels (ex. : achat, remplacement, entretien,
déplacement)
• Documents (ex. : création, modification, suppression,
amélioration du circuit)
• Méthodes (ex. : réorganisation des tâches, définition des
algorithmes)
• Fichiers (ex. : création, restructuration)
– Solutions informatisées
• Définition des tâches devant être automatisées
• Découpage en projets d'automatisation homogènes et
relativement indépendants, en faisant apparaître les priorités
de réalisationDémarche : étude d’opportunité
(synthèse des propositions de
solutions)
• Évaluation financière (coût estimé et gain
escompté) de chaque proposition
• Présentation de l'ordre des priorités entre les
différentes solutions
• Mesure de la faisabilité et établissement de la
mise en œuvre (en prenant en compte des
mesures d’accompagnement : personnel,
matériel, logiciel, etc.) de chaque propositionPlan directeur de réalisation
Présentation de toutes les modalités de
réalisation (des programmes d'application
spécifiques) :
– responsabilités
– personnel d’exécution
– calendrier de réalisation de chaque projet
– liaisons entre les différents projets (ou
logiciels acquis)
– interventions éventuelles d'informaticiens
extérieurs à l'organisationCahier des charges
• Destinataires
Service informatique, constructeur ou société
de services en informatique
• Objectif
Définir les besoins en matériel et en logiciel
du futur système informatique (pour permettre
de choisir l'une des solutions) afin d'établir un
contrat entre utilisateurs et informaticiensCahier des charges
(renseignements informatiques)
• Description détaillée des fonctionnalités
attendues
• Évaluation chiffrée des volumes à mettre en
œuvre
– Données à stocker, sauvegarder, saisir, imprimer
– Modes de travaux envisagés : immédiat ou en temps
différé, unitaire ou par lot
Ex. : saisie d’un questionnaire, édition des
commandes du jour, sauvegarde incrémentale,
édition préprogrammée des bulletins de paye
– Nombre maximum d'utilisateurs connectés
simultanémentCahier des charges
(renseignements informatiques)
• Définition des besoins en matériel
– Types de postes de travail (bureau, ordinateur, taille
écran, type d’imprimante, etc.)
– Réseau de communication utilisé (privé ou public, en
étoile ou en bus ou en anneau ou …, local ou global,
etc.)
– Périphériques particuliers (ex. : lecteur de code à
barres)
• Définition des besoins en logiciel
– Progiciels systèmes (système d’exploitation,
compilateurs et interpréteurs des langages de
programmation, utilitaires, gestionnaire des données,
gestionnaire réseau, etc.)
– Progiciels d'application Cahier des charges (renseignements
technico-commerciaux, avant la livraison)
• Conditions financières des matériels et logiciels : achat,
location, maintenance, etc.
• Conditions d’extension de la configuration matérielle
(mémoire principale, mémoire auxiliaire, périphériques,
etc.) et des logiciels (amélioration des performances,
volumes de données, nouvelles fonctionnalités, etc.
), en
assurant portabilité et compatibilité
• Conditions d'implantation des matériels (plan, onduleur,
climatisation, puissance électrique, etc.) et logiciels (ex. :
système d’exploitation, mémoire minimale, etc.)
• Conditions d’essais (des performances, sur du matériel
équivalent, etc.)
• Conditions de livraison (délai, pénalités de retard,
responsable du transport du matériel, installation et
adaptation, support logiciel, livraison partielle, etc.)Cahier des charges (renseignements
technico-commerciaux, après la livraison)
• Conditions de maintenance (durée, jour et délai
d’intervention, coût des nouvelles versions, etc.)
• Durée d'utilisation en cas de location
• Formation du personnel (nature, durée, date, coût, lieu,
etc. des stages et cours)
• Aide à la mise en œuvre (durée et périodicité, nombre
de techniciens à disposition, etc.)
• Documentation (nature, coût, nombre d’exemplaires,
nouvelles versions, etc.)
• Conditions de reconversion des applications existantesDémarche : analyse fonctionnelle
• Objectif
Obtenir un schéma général de structuration des traitements et
des données, à un niveau conceptuel (c'est-à-dire indépendant
de tout matériel ou logiciel de base)
Quoi faire ?
• Critères d'un schéma conceptuel
– Communicable (avec utilisateurs et autres informaticiens)
– Conforme
– Valide : complet et cohérent
– Réalisable (automatisable en partie)
• Principe d'indépendance des traitements et des données
Pour cela, un logiciel (le SGBD) doit être capable, au moment de
l’exécution des programmes, de retrouver les données
nécessaires aux traitements à effectuer
Indépendance logique (respectivement physique) lorsque le
schéma conceptuel (respectivement logique) des données peut être
modifié sans changer les programmes Démarche : conception
• Représentation de la communication au sein de
l'organisation
• Représentation de l'ensemble des traitements
– Modélisation des traitements avec leurs conditions d'activation,
leurs règles d'utilisation et de transformation, leur enchaînement,
etc.
• Statique : description d'un traitement
• Dynamique : spécification des conditions d’exécution (événement
déclencheur) et d’enchaînement (en séquence, en parallèle,
convergent, etc.) de traitements pour caractériser le comportement
du système
• Représentation de l’ensemble des données
– Modélisation de toutes les informations (et de leurs structures)
devant être manipulées (et donc stockées)
– Contraintes d'intégrité : conditions à satisfaire pour les données
mémorisées par le système d'information
• Statique : vérifiées à tout moment
• Dynamique : caractérise la validité des changements d'états du
système d'information
Remarque : certaines contraintes sont déjà inclues dans les modèlesDémarche : validation
• Validation formelle des traitements et des
données
– Complétude des traitements
• L’ensemble des traitements décrits correspondent à la
définition
– Cohérence des traitements
• Statique : pas de contradiction
• Dynamique : pas d'inter-blocage, terminaison
– Complétude des données
• Pas d'oubli (respect de la norme décrivant le modèle)
– Cohérence des données
• Conformité à la norme : pas d'ambiguïté, pas de
contradiction, pas de redondance,
désagrégation/décomposition Démarche : validation
• Synthèse des différents schémas
(de communication, des
traitements, des données)
garantissant la cohérence du
schéma conceptuel
1. Toute communication s'appuie (si
besoin) sur un traitement
2. Tous les traitements assurent les
communications de l'organisation
avec son environnement et en son
sein
3. Aucun traitement ne fait référence à
une donnée n’existant pas
4. Toutes les données sont manipulées
par au moins un traitement
Communication
1
2
Traitements
3
4
DonnéesDémarche : validation
• Confrontation avec les utilisateursDémarche : analyse organique
(objectif)
Adapter la solution fonctionnelle à un choix
technique particulier
– Définition des structures de données et de leur
enregistrement
– Détermination des unités de traitement
– Choix des matériels
– Établissement du calendrier et des budgets de
réalisation Démarche : progiciel vs
développement spécifique
• Achat d'un progiciel standard (i.e. un PGI)
– Plus économique (à long terme)
– Présent sur de nombreux segments de marché
– Produit déjà testé
– S'assurer de la réelle adaptation aux besoins
– Complexité du paramétrage
– Peut nécessiter de recourir à un spécialiste
– Existe-t-il un service après-vente, de plus viable à long terme ?
• Développement spécifique
– Solution parfaitement adaptée aux besoins
– Deux approches : traditionnelle ou génie logiciel
– Deux étapes
• Étape logique : choix d'organisation (Qui fera quoi ? Où ? Quand ?)
• Étape physique : choix techniques (Comment : avec quels moyens
matériels et logiciels ?)Démarche : approche traditionnelle
• Représentation des traitements
– Étape logique : prise en compte des contraintes des
utilisateurs faisant intervenir le temps (date de début
au plus tôt, date de fin au plus tard, durée, date de
début effective, etc.) et le lieu (communication entre
les acteurs, poste de travail effectuant le traitement,
traitement manuel ou interactif ou différé) des
traitements
Cas particulier : procédures de fonctionnement en
mode dégradé (données détruites, lieu ou ressource
indisponible)
– Étape physique : fait intervenir les contraintes de
ressources nécessaires et utilisées (regroupement de
traitements successifs, éclatement d'un traitement) et
affecter les responsabilités des traitements Démarche : approche traditionnelle
• Représentation des données
– Étape logique : prise en compte des besoins
d'utilisation des informations (ex. : définition des
modes d'accès aux données)
– Étape physique : prise en compte des contraintes
physiques liées en particulier aux matériels et
logiciels utilisés (ex. : description des données par
rapport à leur implantation, calculs d'activité afin de
déterminer les
schémas/vues/index/clusters/redondances/etc. les
plus efficaces, etc.) Démarche : approche traditionnelle
• Structure d'accueil : mémoire, processeur,
réseau, langage, progiciel, etc.
• Interface homme-machine : ergonomie, langage
de communication
• Méthode de conception : analyse descendante
• Programmation : programmation objet
(encapsulation, héritage, polymorphisme, etc.)
• Calendrier
• Budget de programmationDémarche : approche génie logiciel
(objectif)
Passer à l'ère industrielle de la production
du logiciel, en développant des méthodes
et des techniques permettant de réaliser à
moindre coût des logiciels performants et
fiables Démarche : approche génie logiciel
• Concevoir (le produit)
– Résultat d'une analyse ou d'une étude de marché
– Fournir un ensemble de spécifications détaillées
– Choisir une interface utilisateur : graphique (on
évitera dorénavant une interface en mode texte)Démarche : approche génie logiciel
• Fabriquer
– Principe : décomposer en composants plus simples,
et mettre au point un processus d'assemblage
– Pour chaque composant identifié, trois choix
possibles :
• Utiliser un composant standard : SGF ou SGBD, bibliothèque
mathématique, bibliothèque de classes, applets JAVA,
contrôles VBX ou ActiveX, etc.
• Le fabriquer soi-même
• En sous-traiter la fabrication, lorsque les coûts sont trop
importants, par une entreprise spécialisée
– Implémenter les traitements : décomposition
modulaire
– Implémenter les données : données transitoires et
permanentes
– Méthode : programmation descendante, objet Démarche : approche génie logiciel
– Langage de programmation
• Choix d'un paradigme (ex. : procédural, déclaratif,
fonctionnel, L4G, objet, etc.)
• Identification des besoins : objets, systèmes répartis, bases
de données, systèmes concurrents, etc.
• Identification des moyens : disponibilité du produit sur les
plateformes cibles, personnel formé
– Choix des outils
• Outils de développement rapide : pour du prototypage car les
performances sont souvent insuffisantes
• Générateurs de code : description de haut niveau des
traitements à réaliser, code généré en L3G
• Outils spécialisés : SGBD, gestionnaire réseau, architecture
client/serveur, etc.Démarche : approche génie logiciel
• Tester
– Jeux d'essais : jeux de données couvrant tous les cas
possibles, générateurs de tests
– Simulation du fonctionnement : injection de données,
brenchmark de systèmes
– Tests en grandeur nature (par les utilisateurs finals)Démarche : approche génie logiciel
• Prouver/Valider
– Méthodes mathématiques de preuve de programmes
(cf. FLOYD, HOARE, etc.)
– Preuve des spécifications formelles du logiciel
– Utilisation d'outils de validation
– Vérifier l'adéquation aux besoins Démarche : approche génie logiciel
• Évaluer les performances
– Calculs des complexités a priori (et s'assurer que les
charges des machines suffiront)
– Tests en grandeur nature (dans l’environnement final,
dans les conditions réelles d’exploitation) Démarche : approche génie logiciel
• Assurer la fiabilité
– Plus aucune erreur majeure
– Risque d’erreurs (mineures) résiduelles (ex. :
conditions limites non testées)
– Révisions successives du logiciel (versions alpha,
béta, release, mises à jour mineures et majeures) Démarche : approche génie logiciel
• Fournir une documentation
– Technique
• Durant tout le développement (dossier de programmation) :
communication entre sous-équipes, rédigé quotidiennement
par les développeurs
• Pour la maintenance (guide de maintenance) : recherche
ultérieure des causes d’erreurs
• Pour l’installation (guide d’installation
)
– Utilisateur
• Mode d’emploi pour un produit sur mesure (manuel
utilisateur) : précis, technique, sans fioritures
• Communication pour un produit grand public : rédigé par des
professionnels
N. B. : précise, claire, fiable, à jour, etc.Démarche : approche génie logiciel
• Proposer un service après-vente
– Maintenance sur site, ligne directe, service payant
– FormationModèlesModèles : modélisation
• Problème de la réalité : flou, difficile à appréhender, etc.
• Deux types d’erreurs : réalité omise et schéma prenant
en compte davantage que la réalité
• Rarement un seul modèle (union de modèles)Modèles : objectifs de la
modélisation
• Rendre compte de la réalité
– Conforme
– Complet
– Réalisable
– Plausible
• Simplifier la réalité
• Ne présenter qu’un aspect du problème
• Permettre de mieux comprendre un problème
complexe
• Permettre de communiquer les connaissances
– Standard
– Précis
– Simple
– CohérentModèles : outils et types
• Outils
– Langage naturel
– Représentation graphique
– Mathématiques
• Types de modèles
– De communication, des traitements ou de
données
– Statique ou dynamiqueModèles : l’exemple « jouet »
• Les traitements
– Le jour de la rentrée, le secrétariat de
l’établissement avise les étudiants qu'ils ont
jusqu’à la fin de la semaine pour amener les
originaux des diplômes qu'ils ont obtenus,
ceci permettant de compléter les fiches des
étudiants
– Un mois après la rentrée, le secrétariat
transmet une photocopie des fiches au
directeur de l’établissement
• Un fichier (… de cinq étudiants)Modèles : l’exemple « jouet »Modèles : l’exemple « jouet »Modèles : l’exemple « jouet »
• Problème des zones variables (zéro, une ou
plusieurs valeurs) engendrant des difficultés de
stockage efficace
– Ex. : les voitures des étudiants
• Problème de redondance
– Ex. : intitulé complet des diplômesQuelques modèles
• Actigramme
• Algèbre relationnelle
• Arbre de décomposition fonctionnel
• Calcul relationnel
• Cycle de vie d'un objet
• Datagramme
• Diagramme d’activités
• Diagramme d’états-transitions
• Diagramme d’objets
• Diagramme de cas d’utilisation
• Diagramme de circulation de l'information
• Diagramme de circulation des documents
• Diagramme de classes
• Diagramme de collaboration
• Diagramme de communication
• Diagramme de composants
• Diagramme de déploiement
• Diagramme de flots de donnéesQuelques modèles
• Diagramme de flots d'événements entre classes
• Diagramme de flots d'événements entre objets
• Diagramme de séquence
• Diagramme de structure
• Diagramme de structures composites
• Diagramme de suivi d'événements
• Diagramme de temps
• Diagramme des paquetages
• Diagramme d'états (structuré)
• Diagramme global d'interaction
• Fiche de description de fonction
• Fiches de description de document
• Fiches de description de fichier
• Fiches de description de rubrique
• Graphe acteurs-flux
• Grille d'analyse des rubriques
• Logique des propositions et des prédicats
• Machine abstraiteQuelques modèles
• Modèle conceptuel des traitements
• Modèle conceptuel des traitements analytique
• Modèle de flux (modèle de contexte, modèle de flux conceptuel,
modèle de flux organisationnel)
• Modèle dynamique
• Modèle entités-associations (ou modèle conceptuel des données)
• Modèle fonctionnel
• Modèle logique des données
• Modèle logique des données réparties
• Modèle logique des traitements (guidage fonctionnel, interface
utilisateur (présentation, dialogue), noyau applicatif non interactif)
• Modèle logique des traitements répartis
• Modèle navigationnel
• Modèle objet
• Modèle organisationnel des données
• Modèle organisationnel des traitements
• Modèle organisationnel des traitements analytique
• Modèle relationnelQuelques modèles
• Organigramme
• Réseaux de Pétri
• Schéma d'architecture logique des moyens informatiques
• SQL
• Substitution généralisée
• Table de décision
• Théorie des ensembles et relationsMéthodes et langages de
modélisation
MERISE/2
SADT
OMT
UML
B
http://sites.univ-provence.fr/veronis/cours/INFZ18/veronis-INFZ18.pdf
Introduction `a l’information quantique
Bellac Le
To cite this version:
Bellac Le. Introduction `a l’information quantique. 2006.
HAL Id: cel-00092955
https://cel.archives-ouvertes.fr/cel-00092955
Submitted on 12 Sep 2006
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.1
Pr´etirage INLN 2003/08
INTRODUCTION A L’INFORMATION QUANTIQUE
Michel Le Bellac
Cours donn´e a` l’Ecole Sup´erieure de Sciences Informatiques (ESSI)
Octobre 2003
R´esum´e. Ce cours a pour objectif d’exposer a` un public de non physiciens les notions de physique quantique
n´ecessaires pour comprendre l’information quantique et d’illustrer le calcul quantique en prenant
comme exemple de l’algorithme de factorisation de Shor.
INSTITUT NON LINEAIRE DE NICE UMR 6638
1361 routes des Lucioles 06560 Valbonne
e-mail : michel.le−bellac@inln.cnrs.fr2Table des mati`
eres
1 Qu’est-ce qu’un qu-bit ? 5
1.1 Polarisation de la lumi`ere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 Polarisation d’un photon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3 Formulation math´ematique : le qu-bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4 Principes de la m´ecanique quantique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.5 G´en´erateur quantique de nombres al´eatoires . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.6 Cryptographie quantique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2 Manipulations d’un qu-bit 19
2.1 Sph`ere de Bloch, spin 1/2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2 Ev´ olution dynamique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3 Manipulations de qu-bits : oscillations de Rabi . . . . . . . . . . . . . . . . . . . . . . . . 23
3 Corr´elations quantiques 27
3.1 Etats ´ a` deux qu-bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.2 Op´erateur densit´e et entropies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.3 Th´eor`eme de non clonage quantique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.4 In´egalit´es de Bell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.5 T´el´eportation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4 Introduction au calcul quantique 39
4.1 Calcul r´eversible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2 Portes logiques quantiques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.3 Transformation de Fourier quantique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.4 P´eriode d’une fonction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.5 R´ealisations physiques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Contents
34 TABLE DES MATIERES `Chapitre 1
Qu’est-ce qu’un qu-bit ?
L’information quantique est la th´eorie de l’utilisation des sp´ecificit´es de la physique quantique pour
le traitement et la transmission de l’information. Toutefois il convient de bien s’entendre sur cet ´enonc´e,
car tout objet physique, si on l’analyse suffisamment en d´etail, est un objet quantique, ce que Rolf
Landauer a exprim´e dans une formule provocatrice : “Un tournevis est un objet quantique”. De fait, les
propri´et´es conductrices de la lame m´etallique du tournevis font fondamentalement appel aux propri´et´es
quantiques de la propagation des ´electrons dans un milieu cristallin, tandis que le manche est un isolant
´electrique car les ´electrons sont pi´eg´es dans un milieu d´esordonn´e. C’est encore la m´ecanique quantique
qui permet d’expliquer que la lame, conducteur ´electrique, est aussi un conducteur thermique, tandis que
le manche, isolant ´electrique, est aussi un isolant thermique. Pour prendre un exemple plus directement
li´e a` l’informatique, le comportement des transistors qui sont grav´es sur la puce de votre PC n’a pu
ˆetre imagin´e en 1947 par Bardeen, Brattain et Shockley qu’`a partir de leurs connaissances en physique
quantique. Bien qu’il ne soit pas un ordinateur quantique, votre PC fonctionne suivant les principes de
la m´ecanique quantique !
Cela dit, ce comportement quantique est aussi un comportement collectif. En effet si la valeur 0 d’un bit
est repr´esent´ee physiquement dans un ordinateur par un condensateur non charg´e tandis que la valeur 1
est repr´esent´ee par le mˆeme condensateur charg´e, la diff´erence entre ´etats charg´e et non charg´e se traduit
par le d´eplacement de plusieurs millions d’´electrons. Un autre exemple pour illustrer cette notion : dans
une exp´erience de TP classique, on excite de la vapeur de sodium par un arc ´electrique, et on observe une
lumi`ere jaune, la fameuse “raie jaune du sodium”. Mais on n’observe pas le comportement d’un atome
individuel, la cellule contient typiquement 1020 atomes.
La grande nouveaut´e, depuis le d´ebut des ann´ee 1980, est la possibilit´e pour les physiciens de manipuler
et d’observer des objets quantiques ´el´ementaires individuels : photons, atomes, ions etc., et pas seulement
d’agir sur le comportement quantique collectif d’un grand nombre de tels objets. C’est cette possibilit´e
de manipuler et d’observer des objets quantiques ´el´ementaires qui est a` l’origine de l’information quantique,
ou` ces objets quantiques ´el´ementaires permettront de construire physiquement les qu-bits. Cela
dit, aucun concept fondamentalement nouveau n’a ´et´e introduit depuis les ann´ees 1930, et les p`eres fondateurs
de la m´ecanique quantique (Heisenberg, Schr¨odinger, Dirac . . .), s’ils ressuscitaient aujourd’hui,
ne seraient pas surpris par l’informatique quantique, mˆeme s’ils seraient suremen ˆ t ´eblouis les prouesses
des exp´erimentateurs, qui r´ealisent aujourd’hui des exp´eriences qualifi´ees a` l’´epoque de “gedanken experiment”.
Il vaut aussi la peine de signaler que la miniaturisation croissante de l’´electronique va trouver ses limites
en raison des effets quantiques, qui vont devenir incontournables en dessous du nanom`etre. Ainsi on
estime que le loi de Moore pourrait ne plus ˆetre valable d’ici dix a` quinze ans.
Quelques r´ef´erences
• Le livre de base est celui de Michael Nielsen et Isaac Chuang Quantum Computation and Quantum
Information, Cambridge University Press, Cambridge (2000).
• Egalemen ´ t int´eressant est le cours de John Preskill que l’on trouve (avec des exercices) sur le site
http ://www.theory.caltech.edu/˜ preskill/
56 CHAPITRE 1. QU’EST-CE QU’UN QU-BIT ?
Ce cours se place a` un niveau plus avanc´e que celui de Nielsen et Chuang.
• Voir aussi le cours de David Mermin
http ://www.ccmr.cornell.edu/˜ mermin/qccomp/CS483.html
• Comme introduction sans ´equations a` la physique quantique, je recommande le livre de Valerio
Scarani, Introduction a` la physique quantique, Vuibert (2003).
• Pour un texte plus complet, voir par exemple mon livre Physique quantique, EDPSciences/Editions ´
du CNRS, (2003).
1.1 Polarisation de la lumi`ere
Notre premier exemple de qu-bit sera fourni par la polarisation d’un photon, mais il faut d’abord
rappeler bri`evement ce qu’est la polarisation de la lumi`ere. La polarisation de la lumi`ere a ´et´e mise en
´evidence pour la premi`ere fois par le chevalier Malus en 1809. Malus observait la lumi`ere du soleil couchant
r´efl´echie par la vitre d’une fenˆetre du Palais du Luxembourg a` travers un cristal de spath d’Islande. En
faisant tourner ledit cristal, il constata que l’une des deux images du soleil disparaissait. Comme nous
le verrons ci-dessous, le spath d’Islande est un cristal bir´efringent, qui d´ecompose un rayon lumineux en
deux rayons polaris´es perpendiculairement, tandis que le rayon r´efl´echi par la vitre est (partiellement)
polaris´e. Pour une orientation convenable du cristal, on observera donc une extinction (ou une forte
att´enuation) d’un des deux rayons. Le ph´enom`ene de polarisation met en ´evidence le caract`ere vectoriel
des vibrations lumineuses, propri´et´e ´egalement partag´ee par les vibrations sonores de cisaillement : dans
un cristal isotrope, une vibration sonore peut correspondre, soit a` une vibration transverse a` la direction
de propagation, ou onde de cisaillement, soit a` une vibration longitudinale, ou onde de compression. Dans
le cas de la lumi`ere, la vibration est uniquement transverse : le champ ´electrique de l’onde lumineuse est
orthogonal a` la direction de propagation.
Rappelons la description math´ematique d’une onde scalaire progressive se propageant suivant l’axe Oz :
l’amplitude de vibration u(z,t) est de la forme
u(z,t) = u0 cos(ωt − kz)
ou` ω est la fr´equence de la vibration, ω = ck, c ´etant la vitesse de propagation. Dans le plan z = 0
u(z = 0,t) = u(t) = u0 cos ωt
Dans le cas d’une onde ´electromagn´etique filtr´ee par un polaro¨ıd, la vibration est un vecteur du plan
xOy, transverse a` la direction de propagation
Ex = E0 cos θ cos ωt
Ey = E0 sin θ cos ωt
(1.1)
ou` θ d´epend de l’orientation du polaro¨ıd. L’intensit´e (ou l’´energie) lumineuse, mesur´ee par exemple a`
l’aide d’une cellule photo´electrique, est proportionnelle au carr´e du champ ´electrique, I ∝ E2
0
(en g´en´eral
l’´energie d’une vibration est proportionnelle au carr´e de l’amplitude de vibration). Le vecteur unitaire pˆ
du plan xOy
pˆ = (cos θ,sin θ) E~ = E0pˆ cos ωt (1.2)
caract´erise la polarisation (lin´eaire) de l’onde ´electromagn´etique. Si θ = 0 la lumi`ere est polaris´ee suivant
Ox, si θ = π/2, elle est polaris´ee suivant Oy. La lumi`ere naturelle est non polaris´ee, elle se compose
d’une superposition incoh´erente (ce terme important sera d´efini ult´erieurement de fa¸con pr´ecise) de 50%
de lumi`ere polaris´ee suivant Ox et de 50% de lumi`ere polaris´ee suivant Oy.
Pour ´etudier de fa¸con quantitative la polarisation, nous allons nous servir d’un ensemble polariseur/
analyseur. Nous faisons d’abord passer la lumi`ere dans un polariseur dont l’axe fait un angle θ avec l’axe
Ox, puis dans un second polariseur, appel´e analyseur, dont l’axe fait un angle α avec l’axe Ox (figure 1.1),
avec
nˆ = (cos α,sin α) (1.3)1.1. POLARISATION DE LA LUMIERE ` 7
z
x
Ex
θ
Ey
y
polariseur
analyseur
x
α
y
Fig. 1.1 – Ensemble polariseur-analyseur.
A` la sortie de l’analyseur, le champ ´electrique E~ 0
s’obtient en projetant le champ (1.1) sur nˆ
E~ 0 = (E~ · nˆ)nˆ = E0 cos ωt(pˆ · nˆ)nˆ
= E0 cos ωt(cos θ cosα + sin θ sinα) nˆ
= E0 cos ωt cos(θ − α)nˆ (1.4)
On en d´eduit la loi de Malus pour l’intensit´e
I
0 = I cos2
(θ − α) (1.5)
La polarisation lin´eaire n’est pas la plus g´en´erale possible. Une polarisation circulaire s’obtient en choisissant
θ = π/4 et en d´ephasant la composante Oy de ±π/2, par exemple
Ex =
E0
√
2
cos ωt
Ey =
E0
√
2
cos
ωt −
π
2
=
E0
√
2
sin ωt
(1.6)
Le vecteur champ ´electrique d´ecrit un cercle de rayon |E0| dans le plan xOy. Le cas le plus g´en´eral est
celui de la polarisation elliptique, ou` l’extr´emit´e du champ ´electrique d´ecrit une ellipse
Ex = E0 cos θ cos(ωt − δx) = E0 Re h
cos θ e
−i(ωt−δx)
i
Ex = E0 sin θ cos(ωt − δx) = E0 Re h
sin θ e
−i(ωt−δy )
i (1.7)
Il sera important de remarquer pour la suite que seule la diff´erence δ = (δy − δx) est physiquement
pertinente. En effet, un simple changement de l’origine des temps permet de choisir par exemple δx = 0.
En r´esum´e, la polarisation la plus g´en´erale est d´ecrite par un vecteur complexe normalis´e a` l’unit´e (ou
vecteur unitaire) dans un espace a` deux dimensions, de composantes
λ = cos θ e
iδx µ = sin θ e
iδy
avec |λ|
2 + |µ|
2 = 1. En fait, en raison de l’arbitraire de phase, le vecteur de composantes (λ
0
, µ
0
)
λ
0 = λ e
iϕ µ
0 = µ e
iϕ
repr´esente la mˆeme polarisation que (λ, µ). Il est plus correct de dire que la polarisation est repr´esent´ee
math´ematiquement par un rayon, c’est-`a-dire un vecteur a` une phase pr`es.
Remarques8 CHAPITRE 1. QU’EST-CE QU’UN QU-BIT ?
• Une lame bir´efringente (figure 1.2) permet de s´eparer deux ´etats de polarisation orthogonaux, tandis
qu’un polaro¨ıd absorbe une des deux polarisations en laissant passer la polarisation orthogonale.
• Consid´erons un ensemble analyseur/polariseur crois´es, par exemple le polariseur suivant Ox et l’analyseur
suivant Oy. Aucune lumi`ere n’est transmise. Mais si on introduit un polariseur interm´ediaire
dont l’axe fait un angle θ avec Ox, alors une partie de la lumi`ere est r´etablie : une premi`ere projection
donne un facteur cos θ et une seconde un facteur sin θ, d’ou` l’intensit´e a` la sortie de l’analyseur
I
0 = I cos2
θ sin2
θ
qui s’annule uniquement pour θ = 0 ou θ = π/2
axe optique
lame
bir´efringente
Dx
Dy
z
x
θ
y
E
O
O
Fig. 1.2 – D´ecomposition de la polarisation par une lame bir´efringente. Le rayon ordinaire O est polaris´e
horizontalement, le rayon extraordinaire E est polaris´e verticalement.
1.2 Polarisation d’un photon
Depuis Einstein (1905), on sait que la lumi`ere est compos´ee de photons, ou particules de lumi`ere. Si
l’on r´eduit suffisamment l’intensit´e lumineuse, on devrait pouvoir ´etudier la polarisation des photons individuels,
que l’on sait parfaitement d´etecter a` l’aide de photomultiplicateurs. Supposons que l’exp´erience
d´etecte N photons. Lorsque N → ∞, on doit retrouver les r´esultats de l’optique ondulatoire que nous
venons d’´enoncer. Effectuons par exemple l’exp´erience suivante (figure 1.2) : une lame bir´efringente s´epare
un faisceau lumineux dont la polarisation fait un angle θ avec Ox en un faisceau polaris´e suivant Ox et un
faisceau polaris´e suivant Oy, les intensit´es ´etant respectivement I cos2
θ et I sin2
θ. R´eduisons l’intensit´e
de telle sorte que les photons arrivent un a` un, et pla¸cons deux photod´etecteurs Dx et Dy derri`ere la
lame. L’exp´erience montre Dx et Dy ne cliquent jamais simultan´ement
1
: un photon arrive entier soit sur
Dx, soit sur Dy, un photon ne se divise pas. D’autre part l’exp´erience montre que la probabilit´e px
(py
)
de d´etection d’un photon par Dx (Dy) est de cos2
θ (sin2
θ). Si l’exp´erience d´etecte N photons, on aura
donc Nx (Ny) photons d´etect´es par Dx (Dy)
Nx ' N cos2
θ Ny ' N sin2
θ
ou` le ' tient compte des fluctuations statistiques de l’ordre de √
N. Comme l’intensit´e lumineuse est
proportionnelle au nombre de photons, on retrouve la loi de Malus a` la limite N → ∞. Cependant on
note deux probl`emes.
• Premier probl`eme. Peut-on pr´evoir, pour un photon donn´e, s’il va d´eclencher Dx ou Dy ? La
r´eponse de la th´eorie quantique est NON, ´enonc´e qui a profond´ement choqu´e Einstein (Dieu ne
1Sauf cas de “dark count”, ou` un compteur se d´eclenche spontan´ement.1.2. POLARISATION D’UN PHOTON 9
joue pas aux d´es!). Certains physiciens (dont Einstein) ont ´et´e tent´es de supposer que la th´eorie
quantique ´etait incompl`ete, et qu’il y avait des “variables cach´ees” dont la connaissance permettrait
de pr´evoir le sort individuel de chaque photon. Moyennant des hypoth`eses tr`es raisonnables sur
lesquelles je reviendrai au chapitre 3, on sait aujourd’hui que de telles variables cach´ees sont exclues.
Les probabilit´es de la th´eorie quantique sont intrins`eques, elles ne sont pas li´ees a` une connaissance
imparfaite de la situation physique, comme c’est le cas par exemple dans le jeu de pile ou face.
• Deuxi`eme probl`eme. Recombinons2
les deux faisceaux de la premi`ere lame bir´efringente, en
utilisant une seconde lame sym´etrique de la premi`ere (figure 1.3). Cherchons la probabilit´e qu’un
photon traverse l’analyseur. Un photon peut choisir le trajet x avec une probabilit´e cos2
θ ; il a
ensuite une probabilit´e cos2 α de traverser l’analyseur, soit une probabilit´e totale cos2
θ cos2 α. S’il
choisit le trajet y, il aura une probabilit´e sin2
θ sin2 α de traverser l’analyseur. La probabilit´e totale
s’obtient en additionnant les probabilit´es des deux trajets possibles
p
0
tot = cos2
θ cos2 α + sin2
θ sin2 α (1.8)
Ce r´esultat est FAUX ! En effet l’optique classique nous apprend que l’intensit´e est I cos2
(θ − α),
et le r´esultat correct, confirm´e par l’exp´erience, est
ptot = cos2
(θ − α) (1.9)
ce qui n’est pas du tout la mˆeme chose !
θ
x
y
axes
optiques
polariseur analyseur
x
y
α
E
O
z
Fig. 1.3 – D´ecomposition et recombinaison de polarisations a` l’aide de lames bir´efringentes.
En fait, pour retrouver les r´esultats de l’optique ondulatoire, il faut introduire en physique quantique la
notion fondamentale d’amplitude de probabilit´e, dont le module carr´e donne la probabilit´e
a(θ → x) = cos θ a(x → α) = cosα
a(θ → y) = sin θ a(y → α) = sin α
et on doit additionner les amplitudes pour des trajets indiscernables
atot = cos θ cosα + sin θ sin α = cos(θ − α)
ce qui redonne bien (1.9)
ptot = |atot|
2 = cos2
(θ − α)
Supposons que l’on ait un moyen de savoir si le photon emprunte le trajet x ou le trajet y (impossible
dans notre cas, mais des exp´eriences analogues r´epondant a` la question “Quel trajet ?” ont ´et´e r´ealis´ees
avec des atomes). On pourrait alors diviser les photons en deux classes, ceux qui ont choisi le trajet x et
ceux qui ont choisi le trajet y. Pour les photons ayant choisi le trajet x, on pourrait bloquer le trajet y
par un cache sans rien changer, et inversement pour les photons ayant choisi le trajet y on pourrait
bloquer le trajet x. Bien ´evidemment, le r´esultat ne peut ˆetre alors que (1.8). Si on arrive a` discriminer
entre les trajets, le r´esultat n’est plus le mˆeme, les trajets ne sont plus indiscernables. Dans les conditions
exp´erimentales ou` il est impossible en principe de distinguer entre les trajets, on peut dire, au choix :
2Toutefois il faut prendre quelques pr´ecautions : voir Physique quantique, exercice 3.1.10 CHAPITRE 1. QU’EST-CE QU’UN QU-BIT ?
• soit que le photon emprunte les deux trajets a` la fois;
• soit (ce qui a ma pr´ef´erence) que cela n’a pas de sens de poser la question “Quel trajet ?”, puisque les
conditions exp´erimentales ne permettent pas d’y r´epondre, et, suivant Asher Peres “Unperformed
experiments have no results!”.
Il faut noter que si l’exp´erience permet de d´ecider entre les deux trajets, le r´esultat est (1.8), mˆeme si
l’on d´ecide de ne pas les observer. Il suffit que les conditions exp´erimentales permettent, en principe, de
distinguer entre les deux trajets.
Nous avons examin´e un cas particulier de ph´enom`ene quantique, la polarisation d’un photon, mais les
r´esultats que nous venons de d´ecrire nous ont conduits au coeur de la physique quantique.
1.3 Formulation math´ematique : le qu-bit
On peut utiliser la polarisation des photons pour transmettre de l’information, par exemple par une
fibre optique. On d´ecide, tout a` fait arbitrairement, d’attribuer la valeur un du bit a` un photon polaris´e
suivant Ox et la valeur z´ero a` un photon polaris´e suivant Oy. En information quantique, les personnes
qui ´echangent de l’information sont appel´ees conventionnellement Alice (A) et Bob (B). Alice envoie par
exemple a` Bob une suite de photons polaris´es suivant
yyxyxyyyx · · ·
Bob analyse la polarisation de ces photons a` l’aide d’une lame bir´efringente comme dans la figure 1.2 et
en d´eduit le message d’Alice
001010001 · · ·
Ce n’est ´evidemment pas une fa¸con tr`es efficace d’´echanger des messages, mais c’est a` la base de la
cryptographie quantique. Cependant la question int´eressante est maintenant : quelle est la valeur du
bit que l’on peut attribuer par exemple a` un photon polaris´e a` 45o
? Suivant les r´esultats de la section
pr´ec´edente, un photon polaris´e a` 45o
est une superposition lin´eaire d’un photon polaris´e suivant Ox et
d’un photon polaris´e suivant Oy. Un qu-bit est donc une entit´e beaucoup plus riche qu’un bit ordinaire,
qui ne peut prendre que les valeurs 0 et 1. En un certain sens, un qu-bit peut prendre toutes les valeurs
interm´ediaires entre 0 et 1 et contiendrait donc une quantit´e infinie d’information ! Cependant cet ´enonc´e
optimiste est imm´ediatement d´ementi lorsque l’on se rend compte que la mesure du qu-bit ne peut donner
que le r´esultat 0 ou 1, quelle que soit la base choisie. Malgr´e tout on peut se poser la question de cette
“information cach´ee” dans la superposition lin´eaire, et nous verrons au chapitre 4 qu’on peut l’exploiter
sous certaines conditions.
Afin de rendre compte de la possibilit´e des superpositions lin´eaires, il est naturel d’introduire pour la
description math´ematique de la polarisation un espace vectoriel a` deux dimensions H. A` tout ´etat de
polarisation on va faire correspondre un vecteur de cet espace vectoriel. On peut par exemple choisir pour
vecteurs de base de H les vecteurs |xi et |yi correspondant aux polarisations lin´eaires suivant Ox et Oy.
Tout ´etat de polarisation pourra se d´ecomposer suivant cette base3
|Φi = λ|xi + µ|yi (1.10)
Une polarisation lin´eaire sera d´ecrite par des coefficients λ et µ r´eels, mais la description d’une polarisation
circulaire (1.6) ou elliptique (1.7) exige de faire appel a` des coefficients λ et µ complexes : l’espace H est
donc un espace vectoriel complexe.
Les amplitudes de probabilit´e vont correspondre a` un produit scalaire sur cet espace. Soit deux vecteurs
|Φi (1.10) et |Ψi
|Ψi = ν|xi + σ|yi
Le produit scalaire de deux vecteurs sera not´e hΨ|Φi et par d´efinition
hΨ|Φi = ν
∗λ + σ
∗µ = hΦ|Ψi
∗
(1.11)
3J’utilise des lettres grecques majuscules pour les vecteurs g´en´eriques de H afin d’´eviter toute confusion avec des vecteurs
repr´esentant des polarisations lin´eaires comme |θi, |αi etc.1.3. FORMULATION MATHEMA ´ TIQUE : LE QU-BIT 11
ou` c
∗
est le complexe conjugu´e de c. Ce produit scalaire est donc lin´eaire par rapport a` |Φi et antilin´eaire
par rapport a` |Ψi. Il d´efinit une norme ||Φ|| du vecteur |Φi
||Φ||2 = hΦ|Φi = |λ|
2 + |µ|
2
(1.12)
Notez que les vecteurs |xi et |yi sont orthogonaux par rapport au produit scalaire (1.11) et qu’ils sont de
norme unit´e
hx|xi = hy|yi = 1 hx|yi = 0
La base {|xi, |yi} est donc une base orthonorm´ee de H. Nous allons ajouter a` la d´efinition d’un ´etat
physique la condition (commode, mais non essentielle) de normalisation
||Φ||2 = |λ|
2 + |µ|
2 = 1 (1.13)
Les ´etats de polarisation seront donc repr´esent´es math´ematiquement par des vecteurs unitaires (de norme
unit´e) de l’espace H. Un espace vectoriel muni d’un produit scalaire d´efini positif est appel´e un espace
de Hilbert, et H est l’espace de Hilbert des ´etats de polarisation.
Revenons maintenant aux amplitudes de probabilit´e. Un ´etat de polarisation lin´eaire suivant θ sera not´e
|θi et
|θi = cos θ |xi + sin θ |yi (1.14)
L’amplitude de probabilit´e pour qu’un photon polaris´e suivant θ traverse un analyseur orient´e suivant α
est, comme nous l’avons vu,
a(θ → α) = cos(θ − α) = hα|θi (1.15)
Elle est donc donn´ee par le produit scalaire des vecteurs |αi et |θi, et la probabilit´e de traverser l’analyseur
est donn´ee par le module carr´e de cette amplitude (voir (1.9))
p(θ → α) = cos2
(θ − α) = |hα|θi|2
(1.16)
De fa¸con g´en´erale on d´efinira des amplitudes de probabilit´e (“l’amplitude de probabilit´e de trouver |Φi
dans |Ψi”), ou` |Φi et |Ψi repr´esentent des ´etats de polarisation g´en´eraux, par
a(Φ → Ψ) = hΨ|Φi (1.17)
et la probabilit´e correspondante sera
p(Φ → Ψ) = |a(Φ → Ψ)|
2 = |hΨ|Φi|2
(1.18)
N.B. En fait un vecteur d’´etat n’est d´efini qu’`a une phase multiplicative pr`es
(λ, µ) ≡ e
iδ
(λ, µ)
car remplacer |Φi par
|Φ
0
i = e
iδ
|Φi
ne change pas les probabilit´es |hΨ|Φi|2
, qui sont les seules quantit´es mesurables. Une phase multiplicative
globale n’est donc pas physiquement pertinente : la correspondance n’est pas entre ´etat physique et
vecteur, mais plutˆot entre ´etat physique et rayon, c’est-`a dire un vecteur a` une phase pr`es.
Nous sommes maintenant prˆets a` aborder la question cruciale de la mesure en physique quantique.
La notion de mesure repose sur celle de pr´eparation d’un ´etat quantique et celle de test. Reprenons
l’ensemble polariseur/analyseur, en supposant que l’analyseur est orient´e suivant Ox. Si le polariseur est
aussi orient´e suivant Ox, un photon sortant du polariseur traverse l’analyseur avec une probabilit´e de
100% ; si le polariseur est orient´e suivant Oy, la probabilit´e est nulle. L’analyseur effectue un test (de la
polarisation), et le r´esultat du test est 1 ou 0. Le test permet donc de connaˆıtre l’´etat de polarisation du
photon. Mais ceci n’est pas le cas g´en´eral. Supposons que le polariseur soit orient´e suivant la direction θ
ou la direction orthogonale θ⊥
|θi = cos θ |xi + sin θ |yi
|θ⊥i = − sin θ |xi + cos θ |yi
(1.19)
Si le polariseur pr´epare par exemple le photon dans l’´etat |θi et que l’analyseur est orient´e suivant Ox,
la probabilit´e de r´eussite du test est cos2
θ. Deux remarques sont essentielles12 CHAPITRE 1. QU’EST-CE QU’UN QU-BIT ?
• Apr`es le passage dans l’analyseur, l’´etat de polarisation du photon n’est plus |θi, mais |xi. La
mesure modifie l’´etat de polarisation.
• Si le photon est polaris´e elliptiquement, et non lin´eairement
λ = cos θ µ = sin θ e
iδ
δ 6= 0
la probabilit´e de r´eussite du test est encore cos2
θ : le test ne permet pas de d´eterminer la polarisation
de fa¸con non ambigu¨e. C’est seulement si la probabilit´e de r´eussite du test est 0 ou 1 que la mesure
permet de d´eterminer l’´etat de polarisation initial. Il n’existe donc pas de test permettant de
d´eterminer a` coup sur ˆ l’´etat de polarisation (inconnu) d’un photon.
On constate donc une diff´erence de principe entre la mesure en physique classique et la mesure en
physique quantique. En physique classique, la quantit´e physique a` mesurer pr´eexiste a` la mesure : si
un radar mesure la vitesse de votre voiture a` 180 km/h sur l’autoroute, cette vitesse pr´eexistait a` sa
mesure par le gendarme (ce qui lui donne la l´egitimit´e pour verbaliser). Au contraire, dans la mesure
de la polarisation d’un photon |θi par un analyseur orient´e suivant Ox, le fait que le test donne une
polarisation suivant Ox ne permet pas de conclure que le photon test´e avait au pr´ealable sa polarisation
suivant Ox. Si l’on reprend l’analogie de la voiture, on pourrait imaginer que comme dans (1.19) la voiture
soit dans un ´etat de superposition lin´eaire de deux vitesses4
, par exemple
|vi =
r
1
3
|120km/hi +
r
2
3
|180 km/hi
Le gendarme mesurera une vitesse de 120 km/h avec une probabilit´e de 1/3 et une vitesse de 180 km/h
avec une probabilit´e de 2/3, mais il serait erron´e de penser que l’un des deux r´esultats existait avant la
mesure.
1.4 Principes de la m´ecanique quantique
Les principes de la m´ecanique quantique g´en´eralisent ce que nous avons vu dans le cas de la polarisation
d’un photon.
• Principe 1. L’´etat physique d’un syst`eme quantique est repr´esent´e par un vecteur |Φi appartenant
a` un espace de Hilbert (en g´en´eral de dimension infinie) H. Sauf mention explicite du contraire, |Φi
sera choisi unitaire : ||Φ||2 = 1.
• Principe 2. Si |Φi et |Ψi sont deux ´etats physiques, l’amplitude de probabilit´e a(Φ → Ψ) de
trouver Φ dans Ψ est donn´ee par le produit scalaire hΨ|Φi
a(Φ → Ψ) = hΨ|Φi
et la probabilit´e pour Φ de r´eussir le test Ψ est
p(Φ → Ψ) = |a(Φ → Ψ)|
2 = |hΨ|Φi|2
Pour r´ealiser le test, on doit disposer d’un premier dispositif pr´eparant le syst`eme quantique dans
l’´etat |Φi (polariseur) et d’un second dispositif capable de le pr´eparer dans l’´etat |Ψi, que l’on
utilisera comme analyseur.
Apr`es le test, le syst`eme quantique est dans l’´etat |Ψi, ce qui veut dire du point de vue math´ematique
que l’on r´ealise une projection orthogonale sur |Ψi. Soit PΨ ce projecteur. Comme5
|PΨΦi ≡ PΨ|Φi = |ΨihΨ|Φi = (|ΨihΨ|)|Φi
on peut ´ecrire ce projecteur sous la forme tr`es commode
PΨ = |ΨihΨ| (1.20)
4Bien sur ˆ on ne sait pas r´ealiser un tel ´etat avec une voiture, mais on sait tr`es bien fabriquer une particule ´el´ementaire
ou un atome dans un ´etat de superposition lin´eaire de deux vitesses.
5L’action d’un op´erateur M sur un vecteur |Φi sera ´ecrite indiff´eremment M|Φi ou |MΦi.1.4. PRINCIPES DE LA MECANIQUE ´ QUANTIQUE 13
La projection du vecteur d’´etat est appel´ee dans l’interpr´etation de Copenhague de la m´ecanique quantique
“r´eduction du vecteur d’´etat”, ou, pour des raisons historiques, “r´eduction du paquet d’ondes”.
Cette r´eduction du vecteur d’´etat est une fiction commode de l’interpr´etation de Copenhague, qui ´evite
d’avoir a` se poser des questions sur le processus de mesure, et elle est souvent ajout´ee comme principe
de base suppl´ementaire. Cependant on peut parfaitement se passer de ce principe si on prend en compte
le processus de mesure. Un exemple en sera donn´e dans la section 4.4.
Illustrons ces notions en revenant a` la polarisation. Dans la base {|xi, |yi}, les projecteurs Px et Py sur
ces ´etats de base sont
Px = |xihx| =
1 0
0 0
Py = |yihy| =
0 0
0 1
On remarque que l’op´erateur identit´e peut ˆetre ´ecrit comme la somme des deux projecteurs Px et Py
Px + Py = |xihx| + |yihy| = I
relation dite relation de fermeture, qui se g´en´eralise a` une base orthonorm´ee d’un espace de Hilbert H de
dimension N
X
N
i=1
|iihi| = I hi|ji = δij
Les projecteurs Px et Py commutent
[Px,Py] ≡ PxPy − PyPx = 0
Les tests |xi et |yi sont dits compatibles. En revanche les projecteurs sur |θi et |θ⊥i
Pθ = |θihθ| =
cos2
θ sin θ cos θ
sin θ cos θ sin2
θ
Pθ⊥ = |θ⊥ihθ⊥| =
sin2
θ − sin θ cos θ
− sin θ cos θ cos2
θ
ne commutent pas avec Px et Py, comme on le v´erifie imm´ediatement par un calcul explicite
[Px,Pθ] =
0 sin θ cos θ
− sin θ cos θ 0
Les tests |xi et |θi sont dits incompatibles.
Pour des d´eveloppements ult´erieurs, il sera utile de remarquer que la connaissance des probabilit´es de
r´eussite d’un test T permet de d´efinir une valeur moyenne hT i
hT i = 1 × p(T = 1) + 0 × p(T = 0) (= p(T = 1))
Par exemple si le test est T est repr´esent´e par la proc´edure |Ψi et qu’on l’applique a` un ´etat |Φi
p(Ψ) = |hΨ|Φi|2 = hΦ|ΨihΨ|Φi = hΦ(|ΨihΨ|Φi) = hΦ|PΨΦi (1.21)
Il est d’usage en physique quantique d’appeler valeur moyenne d’un op´erateur M dans l’´etat |Φi la
quantit´e
hΦ|MΦi ≡ hMiΦ
Au test T = |Ψi on peut donc associer le projecteur PΨ dont la valeur moyenne dans l’´etat |Φi donne
suivant (1.21) la probabilit´e de r´eussite du test.
La g´en´eralisation de cette observation permet de construire des propri´et´es physiques d’un syst`eme quantique.
Donnons un exemple en revenant au cas de la polarisation. Supposons que nous construisions (de
fa¸con tout a` fait arbitraire) une propri´et´e M d’un photon de la fa¸con suivante : M vaut +1 si le photon
est polaris´e suivant Ox et M vaut −1 si le photon est polaris´e suivant Oy. On peut associer a` la propri´et´e
physique M l’op´erateur hermitique M
M = Px − Py14 CHAPITRE 1. QU’EST-CE QU’UN QU-BIT ?
qui v´erifie bien
M|xi = +|xi M|yi = −|yi
La valeur moyenne de M est par d´efinition
hMi = 1 × p(M = 1) + (−1) × p(M = −1)
Supposons le photon dans l’´etat θ, alors la valeur moyenne hMiθ dans l’´etat |θi est
hMiθ = hθ|Pxθi − hθ|Pyθi = cos2
θ − sin2
θ = cos(2θ)
L’op´erateur M construit ci-dessus est un op´erateur hermitique (M = M†
, ou Mij = M∗
ji
), et de fa¸con
g´en´erale, les propri´et´es physiques en m´ecanique quantique sont repr´esent´ees math´ematiquement par des
op´erateurs hermitiques, souvent appel´es observables. Nous avons construit M a` partir de projecteurs,
mais r´eciproquement on peut construire les projecteurs a` partir d’un op´erateur hermitique M grˆace au
th´eor`eme de d´ecomposition spectrale.
Th´eor`eme. Soit M un op´erateur hermitique. Alors on peut ´ecrire M en fonction d’un ensemble de
projecteurs Pn qui v´erifient
M =
X
n
anPn (1.22)
PnPm = Pnδmn X
n
Pn = I (1.23)
ou` les coefficients r´eels an sont les valeurs propres de M. Les projecteurs Pn sont orthogonaux entre eux
(mais en g´en´eral ils projettent sur un sous-espace de H et non sur un seul vecteur de H) et leur somme
est l’op´erateur identit´e.
1.5 G´en´erateur quantique de nombres al´eatoires
L’utilisation des propri´et´es quantiques permet de r´ealiser exp´erimentalement des g´en´erateurs de
nombres al´eatoires, et non pseudo-al´eatoires, ce qui est essentiel pour la cryptographie quantique, comme
on le verra dans la section suivante. Un des dispositifs les plus simples utilise une lame semi-transparente,
ou s´eparateur de faisceau. Si un rayon lumineux tombe sur une lame semi-transparente, une partie de la
lumi`ere est transmise et une partie est r´efl´echie. On peut s’arranger que ceci se fasse dans des proportions
de 50%/50%. Si maintenant on diminue l’intensit´e de sorte que les photons arrivent un a` un sur la lame,
on constate que ces photons peuvent ˆetre, soit r´efl´echis et d´etect´es par D1, soit transmis et d´etect´es par
D2 (figure 1.4). Il n’y a aucune corrr´elation entre les d´etections, et on a un v´eritable jeu de pile ou face
non biais´e.
D2
D1
Fig. 1.4 – Lame semi-transparente et d´etection de photons.1.6. CRYPTOGRAPHIE QUANTIQUE 15
Un prototype a ´et´e r´ealis´e suivant ce principe par le groupe d’optique quantique de Gen`eve. Il fournit
des nombres al´eatoires au taux de 105 nombres par seconde et l’absence de biais (ou de corr´elations entre
nombres suppos´es al´eatoires) a ´et´e test´ee par des programmes standard.
1.6 Cryptographie quantique
La cryptographie quantique est une invention r´ecente fond´ee sur l’incompatibilit´e de deux bases
diff´erentes d’´etats de polarisation lin´eaire. La cryptographie usuelle repose sur une cl´e de chiffrage connue
seulement de l’exp´editeur et du destinataire. Ce syst`eme est appel´e a` cl´e secr`ete. Il est en principe tr`es
sur ˆ
6
, mais il faut que l’exp´editeur et le destinataire aient le moyen de se transmettre la cl´e sans que
celle-ci soit intercept´ee par un espion. Or la cl´e doit ˆetre chang´ee fr´equemment, car une suite de messages
cod´es avec la mˆeme cl´e est susceptible de r´ev´eler des r´egularit´es permettant le d´echiffrage du message
par une tierce personne. Le processus de transmission d’une cl´e secr`ete est un processus a` risque, et c’est
pour cette raison que l’on pr´ef`ere maintenant les syst`emes fond´es sur un principe diff´erent, dits syst`emes
a` cl´e publique, ou` la cl´e est diffus´ee publiquement, par exemple sur Internet. Un syst`eme a` cl´e publique
courant
7
est fond´e sur la difficult´e de d´ecomposer un nombre tr`es grand N en facteurs premiers, alors que
l’op´eration inverse est imm´ediate : sans calculette on obtiendra en quelques secondes 137 × 53 = 7261,
mais ´etant donn´e 7261, cela prendra un certain temps a` le d´ecomposer en facteurs premiers. Avec les
meilleurs algorithmes actuels, le temps de calcul sur ordinateur n´ecessaire pour d´ecomposer un nombre N
en facteurs premiers croˆıt avec N comme exp[(ln N)
1/3
(ln ln N)
2/3
]. Il faut aujourd’hui quelques mois a`
une grappe de PC pour factoriser un nombre de 150 chiffres. Dans le syst`eme de chiffrage a` cl´e publique,
le destinataire, appel´e conventionnellement Bob, diffuse publiquement a` l’exp´editeur, appel´e conventionnellement
Alice, un nombre tr`es grand N = pq produit de deux nombres premiers p et q, ainsi qu’un
autre nombre c (voir l’annexe 1.6.1). Ces deux nombres N et c suffisent a` Alice pour chiffrer le message,
mais il faut disposer des nombres p et q pour le d´echiffrer. Bien sur ˆ un espion (appel´e par convention
Ev` e) disposant d’un ordinateur suffisamment puissant finira par casser le code, mais on peut en g´en´eral se
contenter de conserver secret le contenu du message pendant un temps limit´e. Cependant, on ne peut pas
exclure que l’on dispose un jour d’algorithmes tr`es performants pour d´ecomposer un nombre en facteurs
premiers, et de plus, si des ordinateurs quantiques voient le jour, aucun nombre ne pourra leur r´esister.
Heureusement la m´ecanique quantique vient a` point nomm´e pour contrecarrer les efforts des espions!
“Cryptographie quantique” est une expression m´ediatique, mais quelque peu trompeuse : en effet, il ne
s’agit pas de chiffrer un message a` l’aide de la physique quantique, mais d’utiliser celle-ci pour s’assurer
que la transmission de la cl´e n’a pas ´et´e espionn´ee. Comme nous l’avons d´ej`a expliqu´e, la transmission d’un
message, chiffr´e ou non, peut se faire en utilisant les deux ´etats de polarisation lin´eaire orthogonaux d’un
photon, par exemple |xi et |yi. On peut d´ecider d’attribuer par convention la valeur 1 a` la polarisation |xi
et la valeur 0 a` la polarisation |yi : chaque photon transporte donc un bit d’information. Tout message,
chiffr´e ou non, peut ˆetre ´ecrit en langage binaire, comme une suite de 0 et de 1, et le message 1001110
sera cod´e par Alice grˆace a` la s´equence de photons xyyxxxy, qu’elle exp´ediera a` Bob par exemple par
une fibre optique. A` l’aide d’une lame bir´efringente, Bob s´epare les photons de polarisation verticale et
horizontale comme dans la figure 1.2, et deux d´etecteurs plac´es derri`ere la lame lui permettent de d´ecider
si le photon ´etait polaris´e horizontalement ou verticalement : il peut donc reconstituer le message. S’il
s’agissait d’un message ordinaire, il y aurait bien sur ˆ des fa¸cons bien plus simples et efficaces de le
transmettre ! Remarquons simplement que si Ev` e s’installe sur la fibre, d´etecte les photons et renvoie a`
Bob des photons de polarisation identique a` ceux exp´edi´es par Alice, Bob ne peut pas savoir que la ligne a
´et´e espionn´ee. Il en serait de mˆeme pour tout dispositif fonctionnant de fa¸con classique (c’est-`a-dire sans
utiliser le principe de superposition) : si l’espion prend suffisamment de pr´ecautions, il est ind´etectable.
C’est ici que la m´ecanique quantique et le principe de superposition viennent au secours d’Alice et
de Bob, en leur permettant de s’assurer que leur message n’a pas ´et´e intercept´e. Ce message n’a pas
besoin d’ˆetre long (le syst`eme de transmission par la polarisation est tr`es peu performant). Il s’agira en
g´en´eral de transmettre une cl´e permettant de chiffrer un message ult´erieur, cl´e qui pourra ˆetre remplac´ee
6Un chiffrage absolument sur ˆ a ´et´e d´ecouvert par Vernam en 1935. Cependant la s´ecurit´e absolue suppose que la cl´e soit
aussi longue que le message et ne soit utilis´ee qu’une seule fois !
7Appel´e chiffrage RSA, d´ecouvert par Rivest, Shamir et Adleman en 1977.16 CHAPITRE 1. QU’EST-CE QU’UN QU-BIT ?
a` la demande. Alice envoie vers Bob quatre types de photons : polaris´es suivant Ox : ↑ et Oy : →
comme pr´ec´edemment, et polaris´es suivant des axes inclin´es a` ±45o Ox
0
: - et Oy
0
: %, correspondant
respectivement aux valeurs 1 et 0 des bits. De mˆeme Bob analyse les photons envoy´es par Alice a` l’aide
d’analyseurs pouvant prendre quatre directions, verticale/horizontale, et ±45o
. Une possibilit´e serait
d’utiliser un cristal bir´efringent orient´e al´eatoirement soit verticalement, soit a` 45o de la verticale et
de d´etecter les photons sortant de ce cristal comme dans la figure 1.3. Cependant, au lieu de faire
tourner l’ensemble cristal+d´etecteurs, on utilise plutˆot une cellule de Pockels, qui permet de transformer
une polarisation donn´ee en une polarisation orient´ee de fa¸con arbitraire et de maintenir fixe l’ensemble
cristal+d´etecteur. La figure 1.5 donne un exemple : Bob enregistre 1 si le photon est polaris´e ↑ ou -, 0 s’il
est polaris´e → ou %. Apr`es enregistrement d’un nombre suffisant de photons, Bob annonce publiquement
la suite des analyseurs qu’il a utilis´es, mais non ses r´esultats. Alice compare sa s´equence de polariseurs a`
celle de Bob et lui donne toujours publiquement la liste des polariseurs compatibles avec ses analyseurs.
Les bits qui correspondent a` des analyseurs et des polariseurs incompatibles sont rejet´es (−), et, pour les
bits restants, Alice et Bob sont certains que leurs valeurs sont les mˆemes : ce sont les bits qui serviront
a` composer la cl´e, et ils sont connus seulement de Bob et Alice, car l’ext´erieur ne connaˆıt que la liste des
orientations, pas les r´esultats! Le protocole d´ecrit ci-dessus est appel´e BB84, du nom de ses inventeurs
Bennett et Brassard.
1
polariseurs d’Alice
analyseurs de Bob
mesures de Bob
bits retenus
1 1 0 1 0 0 1 1 1
s´equences de bits 1 0 0 1 0 0 1 1 1
1 − − 1 0 0 − 1
Fig. 1.5 – Cryptographie quantique : transmission de photons polaris´es entre Bob et Alice.
Il reste a` s’assurer que le message n’a pas ´et´e intercept´e et que la cl´e qu’il contenait peut ˆetre utilis´ee sans
risque. Alice et Bob choisissent au hasard un sous-ensemble de leur cl´e et le comparent publiquement. La
cons´equence de l’interception de photons par Ev` e serait une r´eduction de la corr´elation entre les valeurs
de leurs bits : supposons par exemple qu’Alice envoie un photon polaris´e suivant Ox. Si Ev` e l’intercepte
avec un polariseur orient´e suivant Ox
0
, et que le photon est transmis par son analyseur, elle ne sait pas
que ce photon ´etait initialement polaris´e suivant Ox ; elle renvoie donc a` Bob un photon polaris´e dans la
direction Ox
0
, et dans 50% des cas Bob ne va pas trouver le bon r´esultat. Comme Ev` e a une chance sur
deux d’orienter son analyseur dans la bonne direction, Alice et Bob vont enregistrer une diff´erence dans
25% des cas et en conclure que le message a ´et´e intercept´e. Cette discussion est bien sur ˆ simplifi´ee : elle ne
tient pas compte des possibilit´es d’erreurs qu’il faut corriger, et d’autre part il faut r´ealiser des impulsions
a` un seul photon et non des paquets d’´etats coh´erents qui ne seraient pas inviolables.8
. N´eanmoins la
m´ethode est correcte dans son principe et un prototype a ´et´e r´ealis´e r´ecemment pour des transmissions
dans l’air sur plusieurs kilom`etres. Il est difficile avec une fibre optique de contrˆoler la direction de la
polarisation sur de longues distances, et c’est pourqui on utilise un support physique diff´erent pour mettre
en oeuvre le protocole BB84 avec des fibres. Dans ces conditions la transmission a pu ˆetre effectu´ee sur
une centaine de kilom`etres.
Annexe 1.6.1 : le codage RSA. Bob choisit deux nombres premiers p et q, N = pq, et un nombre c
n’ayant pas de diviseur commun avec le produit (p − 1)(q − 1). Il calcule d qui est l’inverse de c pour la
8Dans le cas de transmission de photons isol´es, le th´eor`eme de non clonage quantique (§ 6.3.2) garantit qu’il est impossible
a` Ev` e de tromper Bob, mˆeme s’il lui est possible de faire moins de 50% d’erreurs en utilisant une technique d’interception
plus sophistiqu´ee.1.6. CRYPTOGRAPHIE QUANTIQUE 17
multiplication modulo (p − 1)(q − 1)
cd ≡ 1 mod (p − 1)(q − 1)
Il envoie a` Alice par une voie non s´ecuris´ee les nombres N et c (mais pas p et q s´epar´ement!). Alice veut
envoyer a` Bob un message cod´e, qui doit ˆetre repr´esent´e par un nombre a < N (si le message est trop
long, Alice le segmente en plusieurs sous messages). Elle calcule ensuite
b ≡ a
c mod N
et envoie b a` Bob. Quand Bob re¸coit le message il calcule
b
d mod N = a (!)
Le fait que le r´esultat soit pr´ecis´ement a, c’est-`a dire le message original d’Alice, est un r´esultat de th´eorie
des nombres. En r´esum´e, sont envoy´es sur voie publique, non s´ecuris´ee, les nombres N, c et b.
Exemple.
p = 3 q = 7 N = 21 (p − 1)(q − 1) = 12
c = 5 n’a aucun facteur commun avec 12, et son inverse par rapport a` la multiplication modulo 12 est
d = 5 car 5 × 5 = 24 + 1. Alice choisit pour message a = 4. Elle calcule
4
5 = 1024 = 21 × 48 + 16 4
5 = 16 mod 21
Alice envoie donc a` Bob le message 16. Bob calcule
b
5 = 165 = 49.932 × 21 + 4 165 = 4 mod 21
et Bob r´ecup`ere donc le message original a = 4.18 CHAPITRE 1. QU’EST-CE QU’UN QU-BIT ?Chapitre 2
Manipulations d’un qu-bit
Dans le chapitre pr´ec´edent, j’ai examin´e un qu-bit a` un instant d´etermin´e. Dans un espace de Hilbert
H, ce qu-bit est d´ecrit par un vecteur unitaire |ϕi
|ϕi = λ|0i + µ|1i |λ|
2 + |µ|
2 = 1 (2.1)
J’ai choisi une base orthonorm´ee {|0i, |1i} de H et d´ecompos´e le vecteur |ϕi suivant cette base. Je me
propose maintenant d’examiner l’´evolution temporelle de ce qu-bit, ce qui expliquera comment nous
pourrons le manipuler.
2.1 Sph`ere de Bloch, spin 1/2
Avant de passer a` cette ´evolution temporelle, je voudrais donner une description un peu plus g´en´erale
du qu-bit et de ses r´ealisations physiques. J’ai choisi en ´ecrivant (2.1) une base orthonorm´ee {|0i, |1i} de
H, et les coefficients λ et µ peuvent ˆetre param´etr´es, compte tenu de l’arbitraire de phase, par
λ = e
−iφ/2
cos
θ
2
µ = e
iφ/2
sin
θ
2
(2.2)
Les deux angles θ et φ peuvent ˆetre consid´er´es comme des angles polaires et azimutal, et (θ, φ) param`etrent
la position d’un point sur la surface d’une sph`ere de rayon unit´e, appel´ee sph`ere de Bloch (ou sph`ere de
Poincar´e pour le photon) (figure 2.1).
Si l’on revient a` la polarisation d’un photon en identifiant |0i → |xi et |1i → |yi, les ´etats |xi et |yi
correspondent aux pˆoles nord et sud de la sph`ere
|xi : θ = 0, φ ind´etermin´e |yi : θ = π, φ ind´etermin´e
tandis que les polarisations circulaires correspondent a` des points sur l’´equateur
|Di : θ =
π
2
, φ =
π
2
|Gi : θ =
π
2
, φ = −
π
2
Une autre r´ealisation physique importante du qu-bit est le spin 1/2. La RMN (R´esonance Magn´etique
Nucl´eaire) et l’IRM (Imagerie par R´esonance Magn´etique...nucl´eaire1
) reposent sur le fait que le proton
poss`ede un spin 1/2, ce que l’on met en ´evidence de la fa¸con suivante : on fait passer un faisceau de
particules2 de spin 1/2 dans un champ magn´etique orient´e suivant une direction nˆ perpendiculaire a` la
direction du faisceau. On constate que le faisceau se scinde en deux sous-faisceaux, l’un est d´evi´e dans
la direction nˆ, l’autre dans la direction oppos´ee −nˆ. C’est l’exp´erience de Stern-Gerlach (figure 2.2, avec
nˆ k Oz), qui est tr`es analogue dans son principe a` la s´eparation d’un rayon de lumi`ere naturelle en deux
1L’adjectif “nucl´eaire”, politiquement incorrect, a ´et´e supprim´e pour ne pas effrayer le grand public...
2Toutefois on doit utiliser des atomes neutres et non des protons, sinon les effets seraient masqu´es par des forces dues
aux charges, et de plus le magn´etisme nucl´eaire est trop faible pour ˆetre mis en ´evidence dans une telle exp´erience.
1920 CHAPITRE 2. MANIPULATIONS D’UN QU-BIT
|π/4i
x
y
O
θ
φ
z |xi
|Di
|Gi
|yi
| − π/4i
P
Fig. 2.1 – Sph`ere de Bloch.
rayons par un cristal bir´efringent. On peut imaginer l’analogue d’une exp´erience analyseur/polariseur avec
un spin 1/2 (figure 2.3). Toutefois on remarque que la situation polariseur/analyseur crois´es correspond
a` θ = π et non a` θ = π/2 comme dans le cas des photons3
. On construit une base de H en prenant pour
vecteur de base les vecteurs |+i et |−i, qui correspondent aux ´etats pr´epar´es par un champ magn´etique
parall`ele a` Oz. Suivant (2.1) et (2.2), l’´etat de spin 1/2 le plus g´en´eral est
|ϕi = e
−iφ/2
cos
θ
2
|+i + e
iφ/2
sin
θ
2
|−i (2.3)
et on montre4 que cet ´etat est celui s´electionn´e par un champ mag´etique parall`ele a` nˆ, avec
nˆ = (sin θ cos φ,sin θ sin φ, cos θ) (2.4)
La sph`ere de Bloch poss`ede dans ce cas une interpr´etation g´eom´etrique ´evidente : le spin 1/2 d´ecrit par
le vecteur (2.3) est orient´e suivant la direction nˆ.
Nous avons vu que les propri´et´es physiques des qu-bits ´etaient repr´esent´es par des op´erateurs hermitiques.
Une base commode pour ces op´erateurs est celle des matrices de Pauli
σ1 (ou σx) =
0 1
1 0
σ2 (ou σy) =
0 −i
i 0
σ3 (ou σz) =
1 0
0 −1
(2.5)
Ces matrices sont hermitiques (et aussi unitaires) et toute matrice 2 × 2 hermitique M peut s’´ecrire
comme
M = λ0I +
X
3
i=1
λiσi (2.6)
avec des coefficients r´eels. Les matrices de Pauli v´erifient les importantes propri´et´es suivantes
σ
2
i = I σ1σ2 = iσ3 + perm. circ. (2.7)
3Le photon a un spin 1, et non 1/2 !
4Ceci est une cons´equence de l’invariance par rotation : voir Physique quantique, chapitre 3.2.2. EV´ OLUTION DYNAMIQUE 21
aimant
four
fentes collimatrices
N
S ∇~ Bz
z
y x
Fig. 2.2 – Exp´erience de Stern-Gerlach.
(a)
(b)
E
E
|+i
|+i
|+i
Fig. 2.3 – Polariseurs crois´es pour le spin 1/2.
Les ´etats |+i et |−i sont vecteurs propres de σz avec les valeurs propres ±1
|+i =
1
0
|−i =
0
1
σz|±i = ±|±i (2.8)
et on v´erifie imm´ediatement que le vecteur |ϕi (2.3) est vecteur propre de
~σ · nˆ = σxnx + σyny + σznz
avec la valeur propre +1
~σ · nˆ =
cos θ e
−iφ
sin θ
e
iφ
sin θ − cos θ
(2.9)
Nous venons de voir la r´ealisation physique d’un qu-bit par un spin 1/2, mais il en existe bien d’autres,
comme par exemple un atome a` deux niveaux. Dans tous les cas on aura un espace de Hilbert de
dimension 2, et l’´etat d’un qu-bit pourra toujours ˆetre repr´esent´e par un point sur la sph`ere de Bloch.
Revenant a` la notation {|0i, |1i}, on pourra (par exemple) faire l’identification |+i → |0i et |−i → |1i.
2.2 Ev´ olution dynamique
Nous introduisons explicitement le temps, en supposant que (2.1) est valable a` t = 0
|ϕ(t = 0)i = λ(t = 0)|0i + µ(t = 0)|1i (2.10)
Nous allons supposer (Principe n
o 3) que la transformation
|ϕ(0)i → |ϕ(t)i22 CHAPITRE 2. MANIPULATIONS D’UN QU-BIT
est lin´eaire et que la norme de |ϕi reste ´egale a` l’unit´e
5
|ϕ(t)i = λ(t)|0i + µ(t)|1i (2.11)
|λ(t)|
2 + |µ(t)|
2 = 1 (2.12)
La transformation |ϕ(0)i → |ϕ(t)i est donc une transformation unitaire U(t, 0)
|ϕ(t)i = U(t, 0)|ϕ(t = 0)i
En g´en´eral
|ϕ(t2)i = U(t2,t1)|ϕ(t1)i U
†
(t2,t1) = U
−1
(t2,t1) (2.13)
De plus U doit ob´eir a` la propri´et´e de groupe
U(t2,t1) = U(t2,t
0
)U(t
0
,t1) (2.14)
et enfin U(t,t) = I. Utilisons la propri´et´e de groupe et un d´eveloppement de Taylor avec dt infinit´esimal
pour ´ecrire
U(t + dt,t0) = U(t + dt,t)U(t,t0)
U(t + dt,t0) ' U(t,t0) + dt
d
dt
U(t,t0)
U(t + dt,t)U(t,t0) '
I − i dtHˆ (t)
U(t,t0)
ou` nous avons d´efini l’op´erateur Hˆ (t), le hamiltonien, par
Hˆ (t) = i
dU(t
0
,t)
dt
0
t
0=t
(2.15)
La pr´esence du facteur i assure que Hˆ (t) est un op´erateur hermitique. En effet
I = U
†
(t + dt,t)U(t + dt,t) ' [I + i dtHˆ †
(t)][I − i dtHˆ (t)] ' I + i dt(Hˆ † − Hˆ )
ce qui implique Hˆ = Hˆ †
. On d´eduit de ce qui pr´ec`ede l’´equation d’´evolution (aussi appel´ee ´equation de
Schr¨odinger)
i
dU(t,t0)
dt
= Hˆ (t)U(t,t0) (2.16)
Comme Hˆ est un op´erateur hermitique, c’est une propri´et´e physique, et de fait Hˆ n’est autre que
l’op´erateur ´energie du syt`eme. Dans le cas fr´equent ou` la physique est invariante par translation de
temps, l’op´erateur U(t2,t1) ne d´epend que de la diff´erence (t2 − t1) et H est ind´ependant du temps.
Illustrons ceci par la RMN (ou l’IRM). Dans une premi`ere ´etape les spins 1/2 sont plong´es dans un champ
magn´etique intense (∼ 1 Tesla, 1 Tesla= 104 gauss, environ 104
fois le champ magn´etique terrestre, c’est
pourquoi il vaut mieux ne pas garder sa montre pour passer une IRM !) ind´ependant du temps. Le
hamiltonien est alors ind´ependant du temps, et comme il est hermitique, il est diagonalisable dans une
certaine base
Hˆ =
ωA 0
0 ωB
(2.17)
ωA et ωB sont les niveaux d’´energie du spin 1/2. Si le champ magn´etique est parall`ele a` Oz, les vecteurs
propres de Hˆ ne sont autres que les vecteurs de base |+i ≡ |0i et |−i ≡ |1i. Comme Hˆ est ind´ependant
du temps, l’´equation d’´evolution (2.16)
i
dU
dt
= HˆU
5Cette seconde condition semble aller de soi, mais elle suppose en fait que tous les degr´es de libert´e quantiques soient
pris en compte dans H : l’´evolution n’est pas en g´en´eral unitaire lorsque le qu-bit est seulement une partie d’un syst`eme
quantique plus vaste et que l’espace de Hilbert des ´etats est plus grand que H. Le fait que la transformation soit lin´eaire
peut ˆetre d´eduit d’un duˆ a` th´eor`eme de Wigner : voir Physique quantique, chapitre 8.
Cours ”la Culture informatique”. Composant r´egional
de l’enseignement scolaire en Russie
Efim Kogan, Yuri Pervin
To cite this version:
Efim Kogan, Yuri Pervin. Cours ”la Culture informatique”. Composant r´egional de
l’enseignement scolaire en Russie. Revue de l’EPI (Enseignement Public et Informatique), 1996,
pp.161-176. .
HAL Id: edutice-00001152
https://edutice.archives-ouvertes.fr/edutice-00001152
Submitted on 15 Nov 2005
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.161
LA REVUE DE L'EPI N° 83 LA CULTURE INFORMATIQUE
COURS “LA CULTURE INFORMATIQUE”-
composant régional de l’enseignement scolaire
en Russie
E. KOGAN, Y. PERVINE
Résumé et commentaire destinés au lecteur français
Malgré l’apparition d’un nombre important d’écoles secondaires y
compris d’écoles privées de formes diverses, dans le l’enseignement public
de la Russie, les écoles d’état ont conservé leur rôle dominant. Après la
destruction de l’Union Soviétique et l’affaiblissement du rôle de Ministère
de l’Education en Russie, c’est aux régions que revient le rôle de résolution
des problèmes globaux. Les professeurs E. Kogan, chef du département
d’enseignement dans la région de Samara et Y. Pervine, coordinateur du
projet “la Culture informatique” proposent leur méthode d’approche
d’informatisation de l’enseignement public à Samara, une des régions les
plus développées de la Russie. Suite au congrès consacré à
l’informatisation de l’enseignement dans les écoles qui a eu lieu à Samara
en Octobre 1994, il s’est avéré que bon nombre d’autres régions de la Russie
soient intéressées à ce projet. Le texte présenté ici a été préparé pour ce
Congrès.
Dans toutes les écoles de la Russie, une heure par semaine peut être
consacrée à discuter avec les écoliers des problèmes les plus actuels dans
leur ville, dans leur région. L’utilisation de cette heure peut être variée.
Par exemple, à Samara cette heure est consacrée à la préparation d’une
nouvelle génération informatisée.
Depuis 1985, un nouveau cours d’informatique a été créé dans toutes
les écoles de l’Union Soviétique. Dans la lignée des études, ce cours
avait lieu pendant les deux dernières années d'études. Cependant l'enseignement
de l’informatique de la première à la onzième classe comme cela
se passe à Samara est une première.
La formation des enseignants s’effectue dans les instituts de perfectionnement
des professeurs qui existent dans chaque ville régionale.162
E. KOGAN, Y. PERVINE LA REVUE DE L'EPI
Parmi la grande variété d’ordinateurs que possèdent les écoles en
Russie, ce sont les IBM PC qui sont surtout utilisés, bien qu’ils ne soient
pas toujours bien configurés.
Le système de numérotation des classes en Russie diffère du système
français : les enfants commencent leur vie scolaire en première classe (7
ans) jusqu’à la 11ème qui est l’année de promotion. Il existe deux variantes
de l’enseignement élémentaire : trois années pour les élèves forts et
quatre années pour les enfants de niveau moyen.
1. REMARQUES PRÉLIMINAIRES
Aujourd’hui on voit nettement se détacher une nouvelle société
informatisée. Dans les conditions actuelles les exigences requises auprès
de la nouvelle génération par rapport à celles présentées il y a un quart
de siècle de cela ont changé. Aujourd’hui un jeune homme doit posséder
des connaissances des nouvelles technologies. Il doit pouvoir maîtriser
des problèmes tels que :
- planification de son activité,
- recherche d’une information nécessaire pour la résolution d’un
problème donné,
- projet et construction des modèles informatiques,
- discipline de communication et structure des messages,
- instrumentation de tous les aspects de l’activité humaine, mise en
pratique des moyens techniques modernes dans la vie quotidienne,
industrielle, artistique.
L’ensemble de toutes ces connaissances, capacités et pratiques
nouvelles composent un nouveau style de pensée opérationnel. L’école
actuelle est équipée d’un fond informatique et de techniques de calcul
modernes qui ont pour but de transmettre un nouveau style de pensée à
l’étudiant.
Un homme capable de travailler sur un système informatique, avec
des bases de données et des tableurs électroniques, sur des réseaux
d’information locaux et globaux, acquiert non seulement une maîtrise des
nouvelles technologies, mais surtout une nouvelle vision du monde. Le
niveau culturel de ce jeune homme caractérise la notion de culture
informatique qui doit commencer à être enseignée dès les premières
leçons. 163
LA REVUE DE L'EPI LA CULTURE INFORMATIQUE
Le problème qui se pose pour la formation de la Culture
informatique est qu’elle repose sur une commande sociale de la société
informatisée moderne. Aujourd’hui on pose des conditions bien définies
pour la résolution de ces problèmes :
- L’ordinateur personnel cesse d’être un objet exotique à l’école mais
devient un instrument de travail quotidien dans l’activité scolaire.
- Il y a eu accumulation d’expérience dans l’enseignement des bases de
l’informatique et de l’utilisation des ordinateurs à des enfants d’âges
différents.
- Le système de formation a reçu une grande liberté dans l’élaboration
des programmes et des plans d’étude.
- L’heure régionale permet d’orienter le processus d’enseignement vers
les problèmes les plus actuels pour la région.
On a pour la suite une description du développement de ce cours qui a
déjà été largement implanté dans les écoles de la région de Samara dès
l’année scolaire 1994-1995.
2. QU’EST-CE QUE LE COURS “LA CULTURE INFORMATIQUE”
?
En projetant le cours “la Culture informatique”, il faut tenir
compte des conditions réelles qu’il impliquera quand il s’introduira à
l’école. On a déjà dégagé précédemment certaines exigences de ce cours.
Bien que la plupart de ces exigences soient d’ordre conjoncturel, il est
impossible de les nier. Les exigences sont regroupées en plusieurs
groupes. La classification de ces exigences est assez conventionnelle.
2.1. Les exigences méthodologiques
1) Il s’agit d’un cours qui serait obligatoire dans les écoles
d’enseignement général. Il élimine a priori l’orientation professionnelle
en faveur d’une orientation philosophique. A partir de là le but du cours
serait de fournir un mode de pensée, qui irait de pair avec la société
informatisée moderne.
2) Dans les discussions sur l’approche procédurale et fonctionnelle
pour l’enseignement de l’informatique (la discipline principale du cours)
“la Culture informatique” doit s’en tenir à son juste milieu : l’initiation
aux paquets de programmes appliqués (éditeurs, bases de données,164
E. KOGAN, Y. PERVINE LA REVUE DE L'EPI
tableurs) tient une grande place dans l'enseignement, mais ne doit pas
abaisser le niveau d’apprentissage des connaissances fondamentales
d’informatique et des structures de gestion et de données.
3) Les connaissances et les savoirs reçus dans ce cours formeront
l'arsenal de l’art de planification au sens large du terme (qui ne se limite
pas aux capacités techniques de la programmation). Les techniques de
planification (et surtout la procédure décroissante de construction) sont
les bases de nombreux thèmes du cours “la Culture informatique” qui se
développeront tout au long des années d’étude.
4) Le cours “la Culture informatique” est une discipline obligatoire
dans les écoles d'enseignement général. Aucune restriction élitiste n’est
admise lors de l'introduction de ce cours à l’école. Il doit être accessible à
tout écolier de niveau moyen.
La recherche d’élèves talentueux se fera au niveau des relations
individuelles entre le professeur et l’élève.
5) Les formes collectives d’enseignement sont réalisées de façons
maximale dans ce cours. Un des buts du cours : enseigner à l’écolier à se
sentir responsable de la décision à prendre devant le groupe. D’autre
part, l’organisation de l’enseignement et plus particulièrement les projets
et exercices informatiques démontrent à l’étudiant la possibilité de puiser
dans les solutions du groupe.
6) L’ordinateur se présente devant les enfants comme une machine
d’information universelle et non pas comme une calculatrice. Le cours a
pour but de démontrer qu’un ordinateur est un instrument qui facilite,
améliore et organise la communication entre les hommes.
7) Le cours doit contribuer à l’humanisation de l’enseignement de
façon directe ou indirecte. En examinant les différents procédés informatiques,
le cours “la Culture informatique” enseigne les structures des oeuvres
littéraires et musicales et il montre les détails et techniques graphiques
mais permet également de développer le côté émotionnel de l’enfant
sans oublier le contenu sémantique.
8) Les outils informatiques du cours ainsi que de nombreux procé-
dés d’enseignement ont pour but d’assurer la recherche scientifique et
artistique. Les enfants apprennent la pratique de construction, de mise
en forme et de soutenance de la recherche scientifique. Les élèves organisent
des concerts, impriment des journaux muraux, éditent des recueils165
LA REVUE DE L'EPI LA CULTURE INFORMATIQUE
de leurs oeuvres, préparent leurs expositions de dessins au moyen de
rédacteurs informatiques, de bases de données, de systèmes d’édition.
9) Le principe de spirale didactique est un des facteurs de la
structuration en méthodologie de la plupart des disciplines scolaires :
d’abord on apprend des notions fondamentales à l’étape de l’éducation
primaire, puis on les développe dans les classes centrales de l’école secondaire,
enfin on passe à la généralisation scientifique pour les classes de
promotion. On peut observer la même spirale dans le cours "la Culture
informatique" : d’abord les exécuteurs les plus simples à gestion directe,
puis l’ordinateur qui joue le rôle d’un dispositif gérant des exécuteurs,
enfin les moyens informatiques (la programmation) de la gestion.
2.2. Les exigences pédagogiques
10) On pourrait discuter d’un idéal de l’enseignement primaire
informatisé après une radicale restructuration du contenu de
l’enseignement et des méthodes. Une telle approche exigerait aujourd’hui
beaucoup de temps et d'énormes ressources.
Afin de faciliter la construction du cours, les auteurs du cours ont
reçu une autorisation qui leur permettrait de ne pas respecter de façon
stricte les exigences interdisciplinaires. Cependant les auteurs n'ont pas
profité de cette possibilité pour des raisons :
premièrement à cause du stéréotype pédagogique de pensée des
constructeurs du logiciel ;
deuxièmement parce que les liaisons interdisciplinaires sont si
organiques que le refus de les représenter compliquerait
l’élaboration du cours au lieu de la simplifier.
11) Parmi les disciplines scolaires qui sont comprises dans le cours
“la Culture informatique”, il faut absolument parler de l’informatique.
C’est pourquoi une des plus importantes questions sur la mise en
place du cours “la Culture informatique” est sa corrélation avec le cours
d’informatique standard. Dans les deux à quatre prochaines années (la
période de transition) ces deux cours coexisteront.
Une fois que la mise en place du cours “la Culture informatique”
sera faite dans toutes les classes jusqu’à la onzième, le cours d'informatique
standard pourra alors être éliminé. Les craintes que l’on serait susceptible
d’avoir face à l’introduction récente d’examens en informatique à
l'entrée de plusieurs universités et écoles supérieures n’ont pas lieu166
E. KOGAN, Y. PERVINE LA REVUE DE L'EPI
d’être. En effet le bagage des connaissances que reçoivent les enfants
pendant le cours “la Culture informatique’ dépasse les exigences requises
pour cet examen.
12) En tenant compte de la valeur propre du cours “la Culture
informatique”, de son contenu original, de sa structure non conventionnelle,
il est indispensable de concevoir un support au cours par des
manuels et matériaux didactiques ; en effet les manuels et systèmes
didactiques existants ne peuvent être utilisés, même comme solution
palliative.
13) Le facteur le plus important du cours est le contingent des professeurs
qui introduiront ce cours à l’école.
Les étapes de l’éducation primaire (classes de 1ère à 3ème ou 1ère
à 4ème) devront être dirigées par le même instituteur, qui enseignera les
disciplines de base.
Ainsi les matériels didactiques orientés vers l’instituteur devront
respecter le niveau spécifique d’un instituteur de l’école primaire. Ce
niveau ne prend pas en compte la connaissance de la programmation, des
systèmes d’exploitation et des programmes professionnels appliqués. Le
matériel didactique doit être détaillé et accessible à l'instituteur.
14) Le professeur d’informatique est chargé du cours "la Culture
informatique". D’une part, cela assure le niveau indispensable de qualification.
D’autre part, la participation du professeur d’informatique à ce
cours renforcera le prestige de sa discipline. Enfin, cette augmentation de
sa charge de travail par une discipline qui lui donne toutes les possibilités
de manifester son individualité créative servira au professeur de stimulant
moral et matériel.
15) Tous les composants du cours “la Culture informatique” sont
orientés vers le système traditionnel. Etant donné que les classes sont
généralement équipées de 10 à 15 ordinateurs personnels il faudra absolument
utiliser la documentation administrative qui permettra de diviser
les groupes en deux sous-groupes pour les leçons d’informatique.
2.3. Exigences de l’ordre de l’organisation
16) Le cours se compose de 11 modules, chacun correspondant à
une année scolaire. Afin d’obtenir un effet le plus rapidement possible, on
prévoit dans le cours quelques “points d’entrées” - des modules (années167
LA REVUE DE L'EPI LA CULTURE INFORMATIQUE
d’étude) avec lesquels on pourrait entamer le cours “la Culture
informatique”.
Il est évident que si le point d’entrée (voir 2.1.4 "Structure d'implantation
du cours") est éloigné de la 1ère classe, l’enseignant qui
abordera le cours devra être vigilant et compléter les lacunes éventuelles.
Les manuels et les matériels didactiques pour les classes des points
d’entrées prévoient différentes variantes d’introduction du cours aux
enfants. On peut trouver inutile d’écrire deux ou trois assortiments des
matériaux didactiques pour chaque point d’entrée. Chaque manuel doit
contenir différentes variantes des premiers paragraphes dans lesquels on
expose les résumés des modules précédents, qui seront adaptés à chaque
point d’entrée.
17) Le volume de chaque module est déterminé par la notion de
l’heure régionale. Il compte 32 heures pour une année scolaire. Ainsi le
volume général du cours “la Culture informatique” de la 1ère à la
dernière classe s’évalue à 320 (ou 352) heures.
18) La remise à niveau des instituteurs qui ne se pratiquait pas
auparavant est une étape complexe qui exige un travail énorme. Les professeurs
qui seront les pionniers dans l’enseignement du cours “la
Culture informatique” ne possèdent bien souvent pas suffisamment de
manuels et de matériels didactiques pendant ces cours de formation. Ils
n’ont accès qu’à des fichiers textes ou à des maquettes de documentation
technique. C’est pour cette raison que l’un des premiers documents
administratifs préparé pour le projet “la Culture informatique” a été le
plan méthodologique détaillé des études pour les séminaires de formation
des enseignants. Le plan de séminaire est prévu pour les instituts
régionaux de perfectionnement des enseignants. Il a été élaboré avec la
participation des auteurs des systèmes méthodologiques et du logiciel.
19) La salle prévue pour le cours est la classe d’informatique.
L’utilisation de cette salle pour les cours d’informatique standard (deux
dernières années scolaires) et pour certaines leçons informatisées des différentes
disciplines rend l’horaire de cette classe extrêmement chargé. Le
choix de cette classe pour le cours de la Culture informatique ne fait
qu’augmenter les problèmes.
La création d’une classe spécifique au cours “la Culture
informatique” serait la solution la plus rationnelle. Un autre problème
d’ordre ergonomique s’ajoute. En effet les jeunes enfants ne peuvent pas
travailler aux tables destinées aux adultes. Le cours “la Culture168
E. KOGAN, Y. PERVINE LA REVUE DE L'EPI
informatique” souhaité dans les classes primaires ne fait qu’aggraver les
problèmes de la classe d’informatique.
20) Il est nécessaire de prévoir pour les enfants qui suivent le cours
une participation aux camps d’été, où ils trouveront simultanément du
repos et une rencontre avec des ordinateurs et systèmes informatiques,
dans des conditions nouvelles et plus confortables.
Il est utile de prévoir de tels camps d’été équipés d'ordinateurs
surtout pour la période d’implantation du cours "la Culture
informatique".
Le programme de travail extra scolaire avec des enfants dans le
domaine de l’informatique doit être élaboré en association avec le contenu
du cours “la Culture informatique”.
2.4. Exigences techniques
21) Des programmes professionnels et éducatifs adaptés, sont en
proportion équivalente dans le cours. Il est évident que les programmes
originaux prédominent à l’école primaire, tandis que l’enseignement des
élèves de promotion inclut la connaissance de certains systèmes informatiques
professionnels.
D’ailleurs l’utilisation des moyens professionnels de programmation
par les écoliers n’implique pas leur orientation vers l’étude de la
documentation des programmes. Dans ce cas aussi on prépare les maté-
riels didactiques spécialement pour les élèves de l’école publique classique.
22) Le type d’ordinateurs recommandés pour le cours “la Culture
informatique” était à priori déterminé. Il s’agit d’ordinateurs PC et de
machines compatibles. La configuration minimum comporte une mémoire
centrale de 640 Ko et des moniteurs avec des adapteurs EGA ou supé-
rieurs (pour plusieurs types d’ordinateurs russes et en particulier pour
des ordinateurs avec les moniteurs CGA cette condition est trop restrictive).
23) Le rôle des ordinateurs dans l’organisation des fonctions communicatives
en société informatisée est fondamental, et les problèmes de
communication avec l’aide d'ordinateurs doivent être abordés dans le
cours.
Le réseau local est bien souhaitable en classe. En plus, simultané-
ment à la solution des questions administratives et techniques de169
LA REVUE DE L'EPI LA CULTURE INFORMATIQUE
l’introduction du cours "la Culture informatique", il est important
d’établir les modems dans toutes les écoles de la région pour assurer des
communications à travers les réseaux globaux (ou, au moins, à travers le
réseau régional du système d’éducation nationale).
En même temps il est clair que l’introduction des réseaux dans
toutes les écoles sans exception (même dans les régions développées) est
une perspective à long terme. C’est pourquoi pendant les études des problèmes
de communication on utilise les moyens de simulation des
réseaux locaux.
24) Le principe de simulation des situations réelles se réalise parfois
dans les classes supérieures : en admettant l’absence de modems
dans les écoles et l'impossibilité d'accéder aux réseaux globaux
d’information, le cours doit néanmoins argumenter l’actualité des communications
informatiques et former des acquis de base des communications
intermachines. Les conditions techniques (minimum) citées ci-dessus
sont considérablement restrictives pour les communications réelles.
Dans toutes les situations identiques la simulation comme principe
méthodologique devient l’unique possibilité.
3. STRUCTURE GÉNÉRALE DU COURS “LA CULTURE INFORMATIQUE”
DANS LE CADRE DE L’HEURE RÉGIONALE (1-11)
1ère classe
Ton ami l’ordinateur
Introduction élémentaire à la pratique du dialogue avec
l’ordinateur. L’ordinateur aux leçons de mathématiques et de langue
maternelle.
Les programmes de l'entraînement les plus simples de l’interface
clavier et souris. Les exercices de calculs directs et inverses, la composition
du nombre et l’arithmétique la plus simple. Les exercices avec les
programmes des systèmes "Le Petit", "Le voyage au Pays d’Abécédaire",
"Robotland+".
Pour le module de la première classe on prévoit un livret illustré.
“Ton ami l’ordinateur” destiné aux enfants, le matériel didactique pour
l’instituteur et des instructions pour les utilisateurs des programmes.170
E. KOGAN, Y. PERVINE LA REVUE DE L'EPI
2ème classe
Ensembles, éléments et indices.
Les premières notions sur ensemble, sous-ensemble et leurs élé-
ments. La régularité et l’ordre. La classification et la construction.
L’ordinateur aux leçons de mathématiques et de langue maternelle.
Les jeux et les exercices sur la classification, l'entraînement de la
mémoire et la construction, basés sur les programmes des paquets "Les
Classificateurs" et "Le Petit".
Il y a un recueil illustré de problèmes pour les enfants avec des
exercices de classification, d’analyse des indices caractéristiques de
l’ensemble, de construction et d'entraînement de la mémoire. Le matériel
didactique pour l’instituteur est construit avec les commentaires méthodologiques
pour chaque leçon.
3ème classe
Algorithmes
Les algorithmes autour de nous. Les modèles informatiques.
Les notions de commande et d’algorithme sont considérées et discutées
en détail. Les exercices avec des programmes de la section “Les
études algorithmiques” du système Robotland+, des paquets "Le Petit" et
"L'Arithmétique". Les instruments informatiques des leçons de mathé-
matiques.
Le livre pour les enfants et le matériel didactique pour l’instituteur
basés sur le système Robotland+ est en préparation.
4ème classe
L’ordinateur aide à réfléchir
La notion de l'exécuteur et des moyens de gestion. Reconnaissances
des régularités et recherche des algorithmes ; la méthode de la boite
noire.
Le schéma général d’étude des exécuteurs. Enseignement préparatoire
des structures de gestion. Solution des problèmes combinatoires et
construction des exécuteurs. Les exercices avec des programmes de la
section “Les Exécuteurs” du système Robotland+ et du paquet "Les Images
gaies".171
LA REVUE DE L'EPI LA CULTURE INFORMATIQUE
Les livres du module pour les enfants et pour l’instituteur sont en
préparation.
5ème classe
L’ordinateur et le mot
Editeur de texte : dictées, compositions, journaux muraux et livres.
On considère les mécanismes du traitement de l'information textuelle
et les applications scolaires éventuelles d’éditeur adapté au texte
dans le cadre du cours "la Culture informatique" ainsi que dans d'autres
disciplines.
Le livre de lecture pour les enfants “Ordinateur et mot” est déjà
édité à la base du paquet "Tort" (le paquet des programmes appliqués
destiné à enseigner le traitement de texte aux enfants), avec un livre
pour le professeur et un recueil d'instructions pour l’utilisateur.
6ème classe
L'ordinateur - un instrument de l’art
Les éditeurs graphiques, exposition de dessins faits à l’aide de
l’ordinateur. Rédaction de l’information musicale.
On étudie le paquet d’éditeurs adaptés graphiques pendant les
leçons et hors cours. Application graphique aux systèmes intégrés (la
construction de contes).
On introduit les premières bases de la musique et de la rédaction
de l’information musicale. Les expositions, les tournois, les concerts dans
la classe d’informatique.
On a fait éditer un livre pour les écoliers (en deux parties : la graphique
et la musique) et le matériel didactique pour le professeur.
7ème classe
Coucaratcha et Tortille font des études avec l’ordinateur
Procédures, paramètres, récursions
L'exécuteur Coucaratcha. La gestion directe et programmée. Procédures.
Rédaction des procédures. Les structures de gestion du langage
de Coucaratcha.172
E. KOGAN, Y. PERVINE LA REVUE DE L'EPI
Logo est le langage des enfants et des ordinateurs. Introduction
graphique pour les débutants au langage de programmation Logo. Les
premières notions de la technologie des projets. Les structures de données,
les récursions, les dessins animés.
Le manuel pour les écoliers est en publication. Il contient des élé-
ments de gestion des exécuteurs Coucaratcha et Tortille de Logo, les
premières leçons de programmation. On édite aussi un livre pour le professeur.
Le logiciel de ce module est l'exécuteur programmé Coucaratcha de
Robotland+ et la version du système Logowriter avec le lexique russe.
8ème classe
Dépôts d’information
Bases de données et tableurs électroniques.
On discute les structures des processus de mémorisation et de
recherche de l’information. Les applications des bases de données pendant
les leçons et hors cours.
Qu’est-ce que la banque et l’argent de clearing ? Que faut il avoir
dans la base de données sur la bibliothèque scolaire (ou à domicile).
Les pratiques de manipulation avec les tableurs électroniques.
On prépare le livre de lecture pour les enfants au sujet des bases
de données et des tableurs ainsi qu’un livre pour le professeur. On utilisera
le logiciel original adapté.
9ème classe
Codage de l’information
Formes différentes de présentation de l’information et de son traitement.
Les transformations de l’information définissent des sujets de
module. L’ordinateur comme machine universelle de transformation de
l’information. Une grande série de travaux de laboratoire accompagne le
cours.
Le module s’accompagne d’un manuel et d’un livre pour enseignant,
qui ont été spécialement conçus pour le cours "la Culture
informatique".173
LA REVUE DE L'EPI LA CULTURE INFORMATIQUE
10ème classe
Modèles informatiques
Programmes et projets.
Principes de programmation structurée. Logiciel des disciplines
scolaires hors de l’informatique.
Simulation des objets et des processus réels par les moyens informatiques.
Les notions fondamentales de l’informatique comme généralisation
des exécuteurs et des robots. Les caractéristiques de l’interface.
Le logiciel du module se présente sous forme de programmes du
système Koumir-93 et d'une série d'exécuteurs d'hypertextes.
11ème classe
Nouvelles technologies informatiques
L’ordinateur - l’outil de la société informatisée. Logiciel, matériel,
informaticiel.
On donne une notion des systèmes complexes intégrés et de leur
utilisation dans les processus de transformation de l’information et dans
les systèmes appliqués.
Les systèmes d’édition. Les processus et les systèmes parallèles.
Multimédia.
On montre les principes et on donne des exemples de construction
d'encyclopédies hypertextes ainsi que de leur manipulation. Exercices de
préparation de matériaux publiés avec l’aide de systèmes d'édition sur
table. Notion de communication dans les réseaux locaux et globaux
d’information. Traitement de vidéo- et audio-information par les moyens
multimédia.
4. STRUCTURE D’IMPLANTATION DU COURS
Le cours “La Culture informatique” se présente comme un système
de modules, chacun correspondant à une année scolaire. Du point de vue
du contenu d’enseignement, la spirale didactique est bien rendu par les
séquences de modules. Une telle spirale caractérise les autres cycles
scientifiques dans le système de l’éducation scolaire : les notions fondamentales
en interprétation élémentaire au début de l’école, le retour au
niveau méthodologique plus haut dans les classes supérieures. Les modules
sont ainsi préparés avec une certaine autonomie.174
E. KOGAN, Y. PERVINE LA REVUE DE L'EPI
Premièrement, les élèves qui quittent l’école générale sans terminer
leur enseignement secondaire, reçoivent néanmoins les notions de
base de la Culture informatique, qui leur permettront de s’orienter dans
la société informatisée.
Deuxièmement, la structure modulaire du cours permet d’organiser
le processus scolaire au cours “la Culture informatique” pas obligatoirement
en séquence stricte qui commencerait en première classe et se terminerait
en onzième, mais de prévoir quelques points éventuels de
départ pour commencer le cours à tout moment “les points d’entrée”.
Troisièmement, la structure modulaire du cours rend réelle,
l’élaboration du projet qui se fera par étapes avec un partage strict des
fonctions entre des équipes autonomes d’auteurs.
Dans la section 3 “Structure générale du cours” on considèrait le
plan d’étude de base qui prévoit la séquence dite naturelle d'apprentissage
du contenu.
On y marque des points d’entrée éventuels et on discute les modifications
correspondantes du plan d’étude.
Entrée de base. Premier point d’entrée 1ère classe
Point d’entrée temporaire 2ème classe
3ème classe
4ème classe
Deuxième point d’entrée 5ème classe
6ème classe
7ème classe
8ème classe
Troisième point d’entrée 9ème classe
10ème classe
11ème classe175
LA REVUE DE L'EPI LA CULTURE INFORMATIQUE
Entrée de base. Premier point d’entrée
Dans l’enseignement scolaire d’aujourd’hui il y a deux modifications
du plan d’étude pour l’école primaire : 1-3 et 1-4.
On édite des manuels pour les modules de troisième-quatrième
classes sous une seule couverture. Le maître de classe reçoit la recommandation
d’utiliser entièrement le plan ou de le raccourcir selon le
schéma d’enseignement accepté par son école. Ces deux plans d’étude
pour les troisième-quatrième classes sont placés en appendice du livre du
maître pour l'aider à s’adapter au schéma donné.
La structure modulaire du cours permet de ne pas corriger tout le
contenu suivant du plan de base.
Le point d’entrée temporaire (auxiliaire) de la seconde classe est
destiné à simplifier les problèmes plutôt administratifs liés d’un côté à la
large implantation du cours dans les écoles d’une grande région, et d'un
autre côté au décalage entre le début de l’enseignement dans la première
classe et le passage à l’école secondaire (la 5ème classe). Les élèves de la
seconde classe qui commencent le cours, doivent récupérer les connaissances
et pratiques qu’ils n’ont pas encore eu. Le problème s’est surtout
simplifié parce que le travail d’alphabétisation guidé pour des écoliers de
première classe à l’aide d’ordinateurs n’est plus indispensable : le contingent
de la seconde classe se compose d’élèves qui savent lire. Plusieurs
programmes exigeant la compréhension de textes peuvent bien fonctionner
en module de la seconde année sans adaptation supplémentaire.
Deuxième point d’entrée
Les écoliers commencent à faire connaissance avec la Culture
informatique directement par le traitement de texte qui présente le type
le plus important des processus informatiques modernes sur ordinateur.
Les notions indispensables de l’algorithme, de l'exécuteur, du système de
commandes peuvent être complétés un peu plus tard (9ème-10ème), au
nouveau cycle de la spirale didactique.
Du point de vue administratif la cinquième classe est un point
d’entrée très commode. Le passage à l’école secondaire avec son enseignement
multidisciplinaire permet de confier l'introduction du cours à
des professeurs ayant une meilleure formation, spécialisés en informatique.176
E. KOGAN, Y. PERVINE LA REVUE DE L'EPI
Troisième point d’entrée
Les exigences préalables qui sont posées devant les écoliers de
neuvième classe du point de vue de leur préparation à la perception du
cours “la Culture informatique” sont les suivantes :
- expérience minimale du travail sur ordinateur, pratiques de manipulation
avec le clavier,
- expérience d’écriture de programmes de 10-20 lignes dans
n’importe quel langage de programmation.
On peut se débarrasser des ces exigences après huit leçons supplémentaires
et diminuer le volume du module 9 de huit heures.
Parmi les participants à l’élaboration du logiciel et du didacticiel
du cours, on peut citer les institutions compétentes du pays : société
“Robotland”, l’Association “Ordinateur et enfance”, Institut des problèmes
d’informatique de l’Académie des Sciences de la Russie, Institut des
Nouvelles Technologies en Education, société “Infomir” (Université de
Moscou) et d'autres équipes scientifiques et les spécialistes à Moscou,
Samara et Pereslavl-Zalessky.
E. KOGAN, Y. PERVINE
Vers une signalisation universelle
Badr Benmammar
To cite this version:
Badr Benmammar. Vers une signalisation universelle. 3`eme cycle. 2006.
HAL Id: cel-00718228
https://cel.archives-ouvertes.fr/cel-00718228v3
Submitted on 6 Aug 2012
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Vers une signalisation universelle
Badr BENMAMMAR
Université Bordeaux 1
1Plan
• Introduction
Contexte
Objectif
Approches retenues
• Approche basée sur le profil
Profil de mobilité de l’utilisateur
La spécification de la mobilité (MSpec)
1
• Signalisation générique: MQoS NSLP
Réservation de ressources à l’avance
Gestion dynamique de ressources
• Validation
Scénario fixe-mobile
• Conclusion
Contributions
Perspectives
2Introduction
Problématique:
Emergence de nouvelles applications très exigeantes en terme de qualité de
service (applications multimédias).
Emergence de nouveaux réseaux sans fil.
2
Garantir la qualité de service dans un environnement IP mobile, une tâche très
difficile.
• Objectif:
Proposer des solutions capables d’améliorer la qualité de service dans un
environnement IP mobile.
3
Introduction `a la gestion m´emoire
Olivier Zendra
To cite this version:
Olivier Zendra. Introduction `a la gestion m´emoire. Universit´e Henri Poincar´e, Nancy 1.
UFR STMIA. Master Ing´enierie Syst`eme, sp´ecialit´e Electronique Embarqu´ee et Instrumentale.
Nancy, France, 2005.
HAL Id: inria-00001232
https://cel.archives-ouvertes.fr/inria-00001232
Submitted on 11 Apr 2006
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Introduction à la gestion mémoire
olivier.zendra@loria.fr
http://www.loria.fr/~zendra
Olivier Zendra
Chargé de Recherche
INRIA-Lorraine / LORIAOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Plan du cours
• 1- Gestion mémoire: les bases
• 2- Gestion mémoire et temps réel:
éléments
• 3- Gestion mémoire et systèmes
embarqués: éléments
– Basse consommationOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
1- Bases de la gestion mémoire
• Concepts de base: tas, pile
• Gestion manuelle / automatique
• Algorithmes classiques:
– comptage de références
– marquage-balayage
– copie / compactageOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Concepts de base en gestion
mémoire
• Mémoire: des puces (matériel)
• Vue par le système (OS/application) via
des adresses (logiciel)
0 4 8 12
MMUOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Concepts de base en gestion
mémoire
• Manipulation des adresses à la main
(ASM):
MOV 47,#0xFBBFC
MOV 74,#0xFBFBC
ADD 3,#0xFBFBC
INC #0xFBBFC
SUB #0XFBBFC,#0xFBFBC
– Peu clair...Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Concepts de base en gestion
mémoire
• Manipulation des adresses à la main
(ASM)
– Permet de mettre des données en un lieu
précis de la mémoire
– Compliqué si on veut faire cohabiter plusieurs
applications
– Lisibilité et maintenabilité pitoyablesOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Concepts de base en gestion
mémoire
• Manipulation symbolique explicite des
adresses: variables et pointeurs
int *a = 0xFBBFC
int *b = 0xFBFBC
*a = 47
*b = 74
*b = *b+3
*a = *a+1
*b = *b-*a
– C'est mieux: plus haut niveau, plus clairOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Concepts de base en gestion
mémoire
• Manipulation symbolique implicite des
adresses: variables et références
int a = 47
int b = 74
b += 3
a++
b -= aOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Concepts de base en gestion
mémoire
• Manipulation symbolique implicite des
adresses: variables et références
– Encore plus haut niveau, plus clair
– Localisation (adresse) masquée (par le
système qui gère la mémoire)
• Facile d'avoir plusieurs programmes (« multi-tâche »)Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Concepts de base en gestion
mémoire
• Le contrôleur mémoire (MMU) montre à
l'OS une mémoire matérielle continue
alors que puces discontinues
• Le système (d'exploitation) montre au
programme une mémoire virtuelle
– La pagination est masquée
– Chaque programme se croit seul (simplifié)Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Mémoire virtuelle
• Mise en correspondance mémoire
virtuelle / mémoire réelle
– traduction d'adresses
– mémoire virtuelle >> mémoire réelle
– mémoire virtuelle vue comme une seule zone
(continue) alors que mémoire réelle discontinue
(en pages)Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Mémoire virtuelle
n° page décalage
@ physique
complète
Programme
CPU
table des pages
(1 par processus)
@ physique page
@ physique page décalage
@ logique
RAM
0xF047006A
0xF047
0x006A
0x0B50
0x0B50006AOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Structuration mémoire
• Mémoire d'un programme découpée en
plusieurs zones:
– zone(s) statique(s) (RAM, voire ROM)
– zone(s) de code (lecture seule)
– zone(s) de données (lecture-écriture)
• pile
• tasOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Structuration mémoire: exemple
Pile Tas Zone
statique Zone de code
0x0000
0x0FFF
0xA000
0xCFFF
0xD000
0xD2FF
0xD300
0xF5FFOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
La pile
• Zone « dans laquelle s'exécute le
programme »
– paramètres, variables locale, adresse et valeur
de retour de fonction / routine / méthode
– croît à chaque appel, décroît à chaque retour
• Automatique: géré par l'environnement
d'exécution (runtime)
• +/- invisible du programme(ur)Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
La pile
0xCC12
123
-4
'm'
0xFFB4
67
0x0000
MAX
...
...
@ de retour
paramètre 1
paramètre 2
paramètre 3
variable locale 1
variable locale 2
@ de retour
variable locale 1
variable locale 2
...
...
SP
APPEL n+1
APPEL n
NB: Ici, pile croissante avec adresses croissantes.
En pratique, la pile croît souvent vers 0x0000.Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Le tas
• Zone où le programme(ur) alloue toutes ses
données qui ne sont pas en pile
• Allocation explicite: malloc C
MonObjet*mon_objet=(MonObjet*)malloc(sizeof(MonObjet));
• Allocation « implicite »: new en Java, C++...
MonObjet mon_objet = new MonObjet();Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Le tas
Pile
mon_objet 0xFFB4
...
...
...
...
0xFFB4
Mon_Objet
Tas
47
0x22B474
0x22B512
0Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Le tas
• Zone « désordonnée », contrairement à
la pile (d'où les noms...)
• La gestion mémoire concerne
principalement le tasOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Le tas
0xD28B
0xD2AF
0xD2FF
0xD32B
S o p h i e
26
6
172
Personne 0xD2FF
6 D u p o n t 0xD2D7
0xD2D7
8 4 1 3 3 1 2 4 2
Entier[8] Chaîne Chaîne
PileOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire manuelle
• Allocations et désallocations (libérations)
explicites (malloc/free):
void les_20_premiers_premiers(){
int premiers[]=malloc(20*sizeof(int));
// variable premiers en pile, zone en tas
for (int i=0;i<20;i++)
premiers[i]=calculer_premier(i);
afficher_tableau_entiers(20,premiers);
free(premiers); // si pas là, fuite dans tas
}Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire manuelle
• Problème: risques d'oublis
– mémoire non libérée (gaspillage)
– utilisation d'une donnée déjà libérée (erreur !)
– extrêmement difficiles à détecter et corrigerOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire automatique
• Un système remplace le développeur en
allouant et surtout désallouant
automatiquement
– impossible d'oublier de désallouer (mais
possible de continuer de référencer à tort)
– plus difficile (si pointeurs) voire impossible (si
références) d'utiliser une donnée déjà libéréeOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire automatique
• Exemple:
void les_20_premiers_premiers(){
int premiers[] = new int[20];
// variable premiers en pile, zone en tas
for (int i=0;i<20;i++)
premiers[i]=calculer_premier(i);
afficher_tableau_entiers(20,premiers);
} // ici, premiers est dépilé, donc la zone
// en tas n'est plus référencée, elle peut
// être automatiquement recyclée/libéréeOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire automatique
• Système automatique de gestion
mémoire = ramasse-miettes
• Doit pouvoir garder (ou retrouver) les
données/objets encore actifs, et du coup
être capable de libérer les autres
• Connaît les zones mémoire libres
(allouables) et celles qui sont occupées Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire automatique
• Maintient une liste des zones libres:
Tas Tas
zones_libres null
taille
suivant
taille
suivant
taille
suivant
réf. 0 réf. 1 réf. 2 réf. 3 réf. 4 réf. 5Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithmes classiques
de gestion mémoire automatique
• Comptage de références
• Marquage-balayage
• Copie-compactageOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence
• A chaque objet (ou donnée, structure,
zone mémoire) alloué est associé un
compteur entier indiquant le nombre de
références sur cet objetOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence
S o p h i e
26
6
172
Personne 0xD2FF
6 D u p o n t
0xD2D7
8 4 1 3 3 1 2 4 2
Entier[8] Chaîne Chaîne
Pile
Compteurs de références
1 2 1 1Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence
• A chaque affectation, on met à jour les
compteurs concernés:
a = new X(); // nb_réf(X1)=1
b = a; // nb_réf(X1)=2
a = new X(); // nb_réf(X1)=1; nb_réf(X2)=1
b = null; // nb_réf(X1)=0: X1 libérable
• Libération peut être immédiate (+
simple) ou différéeOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence
• Libérer un objet X1:
– récupérer la mémoire de X1 (remise en liste
libre)
– diminuer les compteurs de références des
objets pointés par X1
• libérations en cascade possibles (peut prendre du temps)Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence
• Le problème des cycles
Objet A
Objet C Objet B
2
1 1
Pile...Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence
• Le problème des cycles
Objet A
Objet C Objet B
2
1 1
Pile... 1Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence
• Cycles non détectés
– Besoin en plus d'un système de détection de
cycles
Objet A
Objet C Objet B
1
1 1
Le cycle A/B/C n'est plus référencé,
mais ses compteurs sont >0, donc
les objets ne sont pas collectés...Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence
• Problème de la fragmentation
Tas Tas
A l'instant T1:
A l'instant T2 > T1:
Tas Tas
zones_libres null
Le programme s'exécute,
des objets sont libérésOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence
• Fragmentation possible
Tas Tas
zones_libres null
A l'instant T2, on veut allouer 5:
Mais pas de zone mémoire assez grande disponible:
Pourtant il y a de la mémoire libre (14 en tout): c'est la fragmentation.Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Comptage de référence: bilan
• Simple
• Exécution répartie le long de celle du prog.
• Coûteux au total: MAJ de compteur(s) à
chaque affectation
• Pas de gros délai si objets libérés un par un.
Délais si cascades...
• Problème des cycles
• Fragmentation possibleOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Marquage-balayage
• Le ramasse-miettes se déclenche par
intermittence
– Exécution du ramasse-miettes arrête le
programme temporairement
• Lorsque ramasse-miettes se déclenche:
– phase de marquage: trouver les vivants
– phase de balayage: recycler les mortsOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Marquage-balayage
• A chaque objet alloué est associé un
marqueur (ou drapeau, ou mark flag)
S o p h i e
26
6
172
Personne 0xD2FF
6 D u p o n t
0xD2D7
8 4 1 3 3 1 2 4 2
Entier[8] Chaîne Chaîne
MarqueurOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de marquage
• Partir des racines (piles, zone statique)
du graphes d'objets
• Pour chaque objet rencontré
– s'il est déjà marqué, rien à faire
– sinon le marquer et propager l'algorithme sur
tous les objets qu'il référence
• Quand le marquage se termine, on a
tous les actifs. Les autres sont morts.Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de marquage
0xCC12
-4
'm'
0xFFB4
67
...
...
@ de retour
param. 1
param. 2
param. 3
var. loc. 1
var. loc. 2
@ de retour
param. 1
var. loc. 1
...
...
APPEL n-1 APPEL n
0xFFB4
4567
0xDC28
0xF028
Pile (racines)
Objet C
Objet A Objet B
Objet D
Objet EOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de marquage
0xCC12
-4
'm'
0xFFB4
67
...
...
@ de retour
param. 1
param. 2
param. 3
var. loc. 1
var. loc. 2
@ de retour
param. 1
var. loc. 1
...
...
APPEL n-1 APPEL n
0xFFB4
4567
0xDC28
0xF028
Pile (racines)
Objet C
Objet A Objet B
Objet D
Objet E
VOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de marquage
0xCC12
-4
'm'
0xFFB4
67
...
...
@ de retour
param. 1
param. 2
param. 3
var. loc. 1
var. loc. 2
@ de retour
param. 1
var. loc. 1
...
...
APPEL n-1 APPEL n
0xFFB4
4567
0xDC28
0xF028
Pile (racines)
Objet C
Objet A Objet B
Objet D
Objet E
V VOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de marquage
0xCC12
-4
'm'
0xFFB4
67
...
...
@ de retour
param. 1
param. 2
param. 3
var. loc. 1
var. loc. 2
@ de retour
param. 1
var. loc. 1
...
...
APPEL n-1 APPEL n
0xFFB4
4567
0xDC28
0xF028
Pile (racines)
Objet C
Objet A Objet B
Objet D
Objet E
V V
VOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de marquage
0xCC12
-4
'm'
0xFFB4
67
...
...
@ de retour
param. 1
param. 2
param. 3
var. loc. 1
var. loc. 2
@ de retour
param. 1
var. loc. 1
...
...
APPEL n-1 APPEL n
0xFFB4
4567
0xDC28
0xF028
Pile (racines)
Objet C
Objet A Objet B
Objet D
Objet E
V V
VOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de marquage
0xCC12
-4
'm'
0xFFB4
67
...
...
@ de retour
param. 1
param. 2
param. 3
var. loc. 1
var. loc. 2
@ de retour
param. 1
var. loc. 1
...
...
APPEL n-1 APPEL n
0xFFB4
4567
0xDC28
0xF028
Pile (racines)
Objet C
Objet A Objet B
Objet D
Objet E
V V
VOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de marquage
0xCC12
-4
'm'
0xFFB4
67
...
...
@ de retour
param. 1
param. 2
param. 3
var. loc. 1
var. loc. 2
@ de retour
param. 1
var. loc. 1
...
...
APPEL n-1 APPEL n
0xFFB4
4567
0xDC28
0xF028
Pile (racines)
Objet C
Objet A Objet B
Objet D
Objet E
V V
VOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de balayage
• On parcourt la liste de toutes les zones
mémoires.
• Si marqué, on conserve (on démarque
pour le coup suivant),
• Si pas marqué, on intègre la zone dans
la liste libre.Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Algorithme de balayage
V Objet A Objet E V Objet C Objet D V Objet B Zone des objets
de taille 56 du tas
zones_libres
Après marquage, avant balayage:
null
Balayage: drapeaux vidés,
zones libres en liste
Objet A zone libre Objet C Objet B Zone des objets
de taille 56 du tas
zones_libres
Après balayage:
null
zone libreOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Marquage-balayage: bilan
• Pauses longues: marquage + balayage
– durée du marquage dépend de la taille du
graphe d'objets (surtout les vivants)
• Amélioration: incrémental (pauses
fractionnées)
• Les cycles ne sont pas un problème
• Fragmentation possibleOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Copie-compactage
• Principe: parcours du graphe d'objets
(comme marquage-balayage) et recopie
des vivants dans nouvel espace
mémoire (de façon contiguë).
• (cf. page 8 de [JLAP2004] sur ma page
web publications)Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Copie-compactage: bilan
• Parcours comme marquage
• Recopie coûteuse
• Gestion de « forwarding pointers »
• Double espace mémoire
• Pas de fragmentationOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
2- Gestion mémoire et temps réel
• TR: +/- rapide, mais prévisible
• Souvent, gestion à la main, bas niveau,
placement fixe des structures dans des
emplacements fixes
– flexibilité minimale
– réutilisabilité très faible
– prédictibilité totale (capitale en TR dur)Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
2- Gestion mémoire et temps réel
• Problèmes si utilisation d'algorithmes
plus génériques (vus précédemment)
– Hiérarchie mémoire plus souple amène défauts
de page
• Délai
• Peu prévisibles
– Pauses que le GC impose au mutateur
• Délai
• ImprévisibleOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Ramasse-miettes temps réel
• Algorithmes incrémentaux ne suffisent
pas en TR
• Développement d'algorithmes TR
spécifiques
– Idée: considérer le GC comme une tâche
« comme les autres »
• Ordonnancé parmi les autres tâches
• Problème: le faire au bon momentOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
3- Gestion mémoire
et systèmes embarqués
• Systèmes embarqués: omniprésents
• Types de contraintes:
– Faible taille (code, données, RAM, ROM)
– Faible puissance de calcul
– Systèmes embarqués autonomes (tél. PDA,
APN...)
• Faible puissance électrique max (instantanée)
• Faible autonomie en énergie (cumulée)Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire basse énergie
• Impact de la mémoire sur l'énergie
consommée
– Coût statique (leakage): majeure partie
– Coût dynamique (accès): plus modeste
– Taille de la mémoire active
– Type de la mémoire active: RAM, SRAM, etc.
• Plus est rapide, plus consomme E (sauf disque)Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire basse énergie
• Impact de la mémoire sur l'énergie
consommée
– « éloignement » de la mémoire
• accès bus très coûteux
– Gros caches == perfs++ == leakage++
== fréquence-- == perfs--
– Placement et F d'accès des données
importantsOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire basse énergie:
solutions
• Technologies matérielles (pour mémoire)
– Conception des cellules SRAM (+ de place, -
de fuites): 6 transistors SRAM
– Partitionnement des bancs mémoire (seul le
bloc accédé est activé)
– Cache decay: lignes de cache « mortes »
mises en mode basse énergie (Vdd gating)
– Nombreuses autres ! Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire basse énergie:
solutions
• Idée 1: éteindre ce qui ne sert pas
– Mémoire en bancs
– Énergie: grouper (Vitesse: entrelacer)
• Grouper à l'allocation / selon durée de vie
• Statiquement ou dynamiquement (ordo. ou GC)
• Regrouper lors du GC: libérer bancs complets pour les
éteindreOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire basse énergie:
solutions
• Idée 1: éteindre ce qui ne sert pas
– Beaucoup de compromis
• GC quand nouveau banc va être allumé ? Compromis
gain/coût...
• Compression de données ? Compromis gain/coût...
• Attention au coût (E et T) d'éteindre/rallumerOlivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire basse énergie:
solutions
• Idée 2: limiter le coût E des transferts de
données
– Données très utilisées dans mémoire où accès
dynamique peu cher
– Données peu utilisées dans mémoire où perte
statique faible (même si accès cher)
– Minimiser les transferts (Data Transfert and
Storage Exploration): copies des données ?Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire basse énergie:
solutions
• Idée 3: diminuer le coût du GC
– Optimisations en faveur énergie, pas vitesse
• Marqueurs groupés, pas dans objets
– Éviter les recopies d'objets
– ...Olivier ZENDRA Master Ingénierie Système / Électronique Embarquée et Instrumentale / Gestion mémoire Nov. 2005
Gestion mémoire basse énergie:
bilan
• « energy-aware GC »
• Collaboration nécessaire avec le reste
du système
– ordonnancement
– matériel (API requise)
– ...
• Pas trivial.
Approches (m,k)-firm pour la gestion de la qualit´e de
service temps r´eel
Ye-Qiong Song
To cite this version:
Ye-Qiong Song. Approches (m,k)-firm pour la gestion de la qualit´e de service temps r´eel.
INPL-ENSEM, LORIA Nancy, 2005.
HAL Id: inria-00000790
https://cel.archives-ouvertes.fr/inria-00000790
Submitted on 19 Nov 2005
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Approches (m,k)-firm pour la gestion de la qualité de service temps réel
YeQiong SONG
LORIA - INPL
Campus Scientifique, B.P. 239
54506 Vandoeuvre-Lès-Nancy, France
song@loria.fr
Résumé
Cet article présente d’abord un état de l’art sur les
principaux algorithmes d’ordonnancement développés
pour la garantie temps réel (m,k)-firm, puis explique
comment les approches (m,k)-firm peuvent être utiles
pour une meilleure gestion de la qualité de service avec
dégradation contrôlée (graceful degradation) dans les
réseaux et systèmes temps réel. Un algorithme appelé
(m,k)-WFQ est détaillé pour illustrer l’intérêt de
l’approche (m,k)-firm dans l’ordonnancement des
paquets de flux MPEG dans des réseaux. Le problème
fondamental de la garantie déterministe de (m,k)-firm est
également approfondi à travers l’élaboration de la
condition suffisante d’ordonnançabilité de l’algorithme
DBP.
1. Introduction
Aujourd’hui, de plus en plus d’applications temps réel
sont déployées au-dessus de réseaux comme l’Internet.
Ceci signifie que ces réseaux doivent fournir des
garanties en termes de respect de contraintes temporelles
sur les communications. L’augmentation constante de
débit des réseaux qui composent l’Internet (Ethernet,
réseaux mobiles sans fil, réseaux courants porteurs par
exemple) n’apporte une solution que temporaire. En
effet, le surplus de bande passante apportée par toute
augmentation de débit est pratiquement immédiatement
comblée par de nouvelles applications multimédias. La
technique de réservation qui consiste à sur-dimensionner
les ressources (over-provisioning) n’est, donc, pas une
solution viable à l’avenir. Ce constat oblige donc à
spécifier des techniques et méthodes pour garantir une
Qualité de Service (QdS) temporelle sous des contraintes
de ressources limitées. De plus, la gestion de la QdS
temporelle dans l’Internet soulève un problème de
passage à l’échelle. Pour y faire face, l’IETF
recommande d’appliquer l’architecture « Diffserv »
plutôt que « Intserv ». Mais le problème de « Diffserv »
est que la garantie est vis à vis de classes de trafics et
non pour une application. Une exigence de garantie
déterministe de QdS pour une application dans une
classe d’applications oblige à un dimensionnement selon
la contrainte la plus stricte imposée aux applications
considérées, conduisant de nouveau à un
surdimensionnement de ressources. Notons que des
solutions pour supporter des applications sous
contraintes temps réel souples sur l’Internet ont été
proposées [El-Gendy03]. Mais ces solutions n’apportent
qu’une garantie temps réel probabiliste. Ceci peut ne pas
convenir à certains types d’applications, notamment dans
le cas du contrôle-commande ou du multimédia. En
effet, ces applications peuvent tolérer des pertes de
paquets (ou des paquets écartés à cause du retard
dépassant l’échéance requise) en transmission sur les
réseaux mais à condition que ces pertes soient
distribuées selon un modèle spécifié de manière
déterministe et non en observant une propriété sur la
moyenne de leurs occurrences (par exemple,
transmission de paquet de MPEG, de voix sur IP, …).
Un problème typique est comment éviter trop de pertes
consécutives des paquets en cas de congestion des
réseaux. Il est clair que les politiques classiques de
gestion de buffers telles que TD (Tail-Drop) conduit
inévitablement à des pertes consécutives tandis que RED
(Random Early Detection), en écartant aléatoirement des
paquets dans une région de taille de file d’attente, essaie
de résoudre ce problème mais sans donner aucune
garantie.
Si l’on s’attache aux systèmes temps réel distribués,
on est confronté au même problème de
surdimensionnement. Classiquement, chercher la
garantie absolue de QdS pour des applications sous
contraintes temps réel dures revient à prendre en compte
du pire cas ; or le système fonctionne en temps normal
avec un cas moyen très éloigné du pire cas. Ce
phénomène est encore plus accentué avec le déploiement
de la méthode d’ordonnancement holistique comme
démontré dans [Martin04]. Contrairement à des
mécanismes de QdS dans l’Internet qui s’auto-adaptent à
l’état du système grâce au mécanisme de contrôle
d’admission et des mesures de QdS en-ligne (une sorte
de « feedback »), un système temps réel classique conçu
selon l’approche temps réel dur souffre de rigidité à
cause des hypothèses strictes sur le modèle de
tâches/messages. Ce qui peut rendre une solution ordonnançable vulnérable face aux aléas (de charges, de
ressources, de perturbations de l’environnement) Aussi,
dans le domaine du contrôle-commande, il apparaît
intéressant de s’orienter vers la notion de système
adaptatif afin de supporter non seulement la variation de
performances du support informatique (tolérance aux
fautes), mais aussi l’évolution de l’application qui induit
une variation de charges par rapport aux hypothèses du
départ sur le modèle d’activation de tâches. En plus,
l’utilisation des composants standards, comme par
exemple un réseau Ethernet partagé avec d’autres
applications à la place d’un bus de terrain, exige aussi
l’implémentation des mécanismes de contrôle
d’admission et d’ordonnancement de trafics en fonction
de la mesure en-ligne de la QdS, c’est à dire avec
« feedback ». Fournir des mécanismes de gestion de la
QdS appropriés dans un système temps réel adaptatif
(incertitude de charges et de ressources) reste encore un
problème ouvert [ARTIST03].
Par ailleurs, que ce soit en QdS dans les réseaux ou en
ordonnancement dans les systèmes temps réel, les
travaux antérieurs négligent le fait que la plupart des
applications soient capables, dans une limite à identifier,
de tolérer et/ou s’adapter à la variation de performances
du système. Des exemples typiques sont la transmission
de vidéo et voix qui tolère la perte occasionnelle des
paquets, des systèmes de contrôle-commande sur-
échantillonnés qui peuvent non seulement tolérer des
pertes des échantillons, mais en plus la loi de commande
peut aussi compenser des pertes et retards grâce à
l’emploi de boucles de contrôle fermées ayant comme
entrée supplémentaire la QdS instantanée du système
support. Par exemple, des travaux regroupés sous le nom
de NCS « Networked Control Systems » visent à étudier
la robustesse des lois de commande en fonction de
variation de performance de l’architecture informatique
support (calculateurs et réseaux) ou à concevoir des lois
de commande robuste en prenant en compte la variation
de la QdS du système support (en particulier le réseau)
[Nilsson98], [Chow01], [Jumel03]. Il est donc plus
optimal de concevoir des applications temps réel en
prenant compte cette capacité « naturelle » de tolérance
du non-respect des échéances. Dans ce cas, le modèle
(m,k)-firm [Hamdaoui95] paraît convenable pour
spécifier plus précisément les contraintes temps réel.
Une contrainte (m,k)-firm est définie sur une tâche
récurrente. Elle exige qu’au moins m parmi k invocations
consécutives de la tâche doivent être exécutées par le
système en respectant leur échéance, avec m ≤ k (le cas
où m = k est équivalent du cas de temps réel dur, que
nous notons aussi par (k,k)-firm). Si l’on considère
qu’une application peut accepter une dégradation de
service jusqu’à m exécutions avant l’échéance parmi k
demandes d’exécutions consécutives quelconques, un
système peut alors conçu selon l’approche (m,k)-firm
pour offrir des niveaux de QdS variés entre (k,k)-firm
(cas normal) et (m,k)-firm (pire cas) avec autant de
niveaux intermédiaires correspondant aux différentes
valeurs possibles entre k et m. Ce qui résulte en un
système avec la dégradation de la QdS contrôlée
(Graceful degradation).
La garantie du respect des contraintes temps réel
selon le modèle (m,k)-firm dans un système temps réel
dynamique et dans un réseau à QdS nécessite des efforts
de recherche dans deux directions : 1) pour la prise en
compte explicite de cette nouvelle contrainte (m,k)-firm,
des algorithmes d’ordonnancement classiques tels que
EDF (Earliest Deadline First), FP (Fixed Priority), WFQ
(Weighted Fair Queueing) doivent être étendus et des
algorithmes nouveaux restent à développer ; 2) bien
qu’en moyenne (m,k)-firm permette de diminuer le
besoin de ressources par rapport au temps réel dur qui est
équivalent à (k,k)-firm, il n’est pas toujours possible de
réaliser ce gain lors que l’ordonnancement est non
préemptif et une garantie déterministe de (m,k)-firm
(appelé aussi par certains chercheurs (m,k)-hard) est
exigée. Ceci à cause de la NP-complétude du problème.
Deux pistes sont possibles : soit le développement de
l’analyse d’ordonnançabilité vis à vis de l’algorithme
d’ordonnancement proposé dans des cas particuliers
mais représentent un intérêt pratique, soit étendre le
modèle (m,k)-firm initial afin de permettre de réaliser ce
gain.
L’objectif de ce papier est de donner un aperçu des
algorithmes d’ordonnancement pour la garantie
déterministe temps réel (m,k)-firm et les appliquer à la
gestion de la QdS.
La gestion de la QdS est assurée par trois
fonctions fondamentales: ordonnancement, gestion de
files d’attente en cas de saturation et la régulation de
trafic. Dans ce papier, nous nous intéressons
principalement à l’application du modèle (m,k)-firm
dans la fonction de l’ordonnancement.
Le reste de ce papier est organisé comme ce qui suit.
La section 2 présente un état de l’art sur les travaux
autour de (m,k)-firm. La section 3 décrit (m,k)-WFQ qui
permet à un serveur WFQ (Weighted Fair Queueing) de
prendre en compte plus efficacement des contraintes
temporelles des flux multimédias temps réel. La section
4 présente une analyse d’ordonnançabilité de
l’algorithme DBP (Distance Based Priority) non
préemptif. Enfin, la section 5 conclut le papier et indique
les perspectives.
2. Etat de l’art sur (m,k)-firm
2.1. Modèle général: MIQSS
Considérons un modèle d’accès multiple à une
ressource partagée que nous allons appeler MIQSS
(Multiple Input Queues Single Server) dans la suite de ce
document. Nous cherchons à ordonnancer des demandes
d’accès au serveur commun, tout en satisfaisant leurs contraintes temporelles et en optimisant le taux
d’utilisation du serveur. Dans notre contexte de systèmes
distribués temps réel, ce serveur peut modéliser un
processeur pour les demandes d’exécution des
invocations de tâches ou un médium de transmission
(bande passante) de paquets.
Afin que nos résultats puissent aussi être
applicables à la transmission de paquets, seul le cas
non-préemptif nous intéresse. Notons que ce cas est en
général plus difficile à analyser que le cas préemptif.
Serveur
de capacité
c
τ1
τ2
τN
.
.
.
politique
d’ordonnancement
des clients en tête
des queues
sources interarrivée
clients
Figure 1. Modèle MIQSS
Une source τi est caractérisée par sa fonction de
flux d’arrivée Fi. Dans cette étude, cette fonction peut
être :
• Périodique ou sporadique: décrit par (Ci, Ti) dans
le cas d’une date initiale quelconque d’arrivée du
premier client et (ri, Ci, Ti) dans le cas d’une date
initiale fixe ri, où Ci est le temps d’exécution d’un
client et Ti la période d’inter-arrivée (ou d’interarrivée
minimale dans le cas sporadique).
• Périodique avec gigues : (Ci, Ti, Ji) ou (ri, Ci, Ti, Ji).
Où Ji représente le déphasage maximum de l’instant
d’une arrivée de client par rapport à la période.
• (σi, ρi)-borné : une courbe linéaire caractérisée par
une taille de rafale σi et un débit moyen ρi qui
majore la vraie fonction cumulative d’arrivée du
travail [LeBoudec02], [Chang00]. La quantité du
travail apportée par un client est définie par Wi avec
notamment où c représente le débit du
serveur.
/ C W i i = c
Dans la suite, les contraintes temps réel sont
toujours données par (Di, mi, ki) où Di est l’échéance
relative à l’instant d’arrivée d’un client et (mi, ki) sont
les deux paramètres de la contrainte (mi, ki)-firm.
2.2. Expression de contraintes (m,k)-firm et WHRT
Une source sous contrainte temps réel (m, k)-firm
peut se trouver dans l’un des deux états : normal et
échec transitoire (dynamic failure) [Hamdaoui95]. La
connaissance de son état à l’instant t dépend de
l’historique du traitement des k derniers clients
générés par la source. Si l’on associe ‘1’ à un client
respectant son échéance et ‘0’ à un client ratant son
échéance, cet historique est alors entièrement décrit
par une suite de k bits appelée une k-séquence. La
Figure 2 donne un exemple de (2,3)-firm avec par
convention le déplacement vers la gauche des bits.
111
101
011
010
001
100
110
000
0
1
0
1
0
0
1
1
0
1
0
1
1
0
1
0 1: échance respectée 0: échance non respectée
Etat normal
Etat d’échec transitoire
Figure 2. Diagramme d’état-transition d’une source
avec (2,3)-firm
Dans un système qui peut être modélisé par MIQSS,
on peut définir l’état du système à un instant t à partir
des états des sources du même instant. Un système est
dit en état d’échec transitoire si au moins une de ses
sources est en échec transitoire (une sorte de ET logique
entre les états de l’ensemble de sources).
Une source peut exprimer sa contrainte (m,k)-firm
en spécifiant simplement la valeur des deux
paramètres : m et k.
Afin de faciliter l’expression des contraintes du
type (m,k)-firm mais avec plus de précision sur la
répartition des m parmi les k clients consécutifs,
[Bernat97] et [Bernat01] ont enrichi ce modèle (m,k)-
firm en proposant trois autres formes qui
correspondent à la complémentarité et la
consécutivité:
• (m , k )-firm : au plus m clients avec échéance non
respectée dans une fenêtre quelconque de k arrivées
consécutives
• m, k -firm : au moins m clients consécutifs avec
échéance respectée dans une fenêtre quelconque de
k arrivées consécutives
• m , k -firm: au plus m clients consécutifs avec
échéance non respectée dans une fenêtre quelconque
de k arrivées consécutives
La notion de (m,k)-firm est alors généralisée et
une source sous ces formes de contraintes est dite sous
contrainte WHRT (Weakly-Hard Real-Time)
[Bernat01]. Néanmoins il convient de remarquer que
certaines de ces formes peuvent toujours être
exprimées sous forme de (m,k)-firm :
• (m , k )-firm : équivalente à (k-m,k)-firm• m, k -firm : pas d’équivalence dans (m,k)-firm
• m k, = m : en fait il est facile de constater
qu’avec m k, , on ne peut jamais avoir plus de m
clients consécutifs avec échéance non respectée
quelque soit la taille de k pourvu que m < k. De plus
une source respectant (m,k)-firm inclut le cas
particulier de k − m .
Notons que la k-séquence réalisée par un
algorithme d’ordonnancement n’est pas
nécessairement répétitive. On parle alors de kséquence
dynamique.
Un cas particulier d’expression de contrainte
(m,k)-firm est la spécification d’une k-séquence fixe
appelée un κ-pattern (ou (m,k)-pattern [Quan00]).
Cette technique s’inspire du modèle de calcul
imprécis [Chung90] où une tâche est composée d’une
partie critique (mandatory) et d’une partie optionnelle.
Le κ-pattern d’une source ayant une contrainte
temporelle (m,k)-firm est défini par la succession de k
éléments de l’alphabet {0, 1} où ‘0’ indique une
demande de traitement optionnelle et ‘1’ une demande
critique avec où πi est le i
ème élément du
κ-pattern pour 1 .
1
k
i i
π m = ∑ =
≤ ≤i k
En répétant continuellement le κ-pattern, on classe
les demandes de traitement des clients d’un flux (ou
une source) en deux catégories : optionnelle et
critique. Il est facile de prouver qu’il suffit de traiter
avec succès toutes les demandes critiques (les m
« 1 ») pour satisfaire la contrainte (m,k)-firm (voir
[Ramanathan99], Théorème 1). Notons que la
réciproque n’est pas vraie car une garantie (m,k)-firm
n’a pas objectif de produire une k-séquence fixe. Les
demandes optionnelles peuvent être traitées quand le
serveur n’est pas occupé ou rejetées si leur échéances
ne peuvent pas être respectées par le serveur.
De ce fait, le nième client (ou demande de
traitement) d’un flux ayant la contrainte temporelle
(m,k)-firm est considéré comme étant un client
critique si et seulement s’il satisfait la relation
suivante :
π(n%k) = 1 (1)
avec n%k le reste de la division de n modulo k.
L’utilisation d’un κ-pattern fixe a l’avantage de
ramener le problème de l’analyse d’ordonnançabilité
du système (m,k)-firm à celui de l’analyse
d’ordonnançabilité classique. Par exemple quand tous
les clients critiques sont ordonnancés sous la politique
FP (fiexed priority) et les clients optionnels ont la
priorité la moins élevée, l’analyse d’ordonnançabilité
est donnée dans [Ramanathan99]. L’application de
cette classification peut être utile dans le domaine du
multimédia. En effet, ce concept peut être appliqué à
un flux de paquets vidéos pour sélectionner les
paquets critiques dans un GOP (Group of Pictures) en
utilisant le standard de compression MPEG [Furht99].
Par exemple, un flux compressé utilisant la structure
du GOP suivante [IBBPBBPBB], où les paquets I
(Intra images) et P (Predicted images) sont plus
importants que les paquets B (Bi-directional
predicted/interpolated images), peut être considéré
comme étant un flux ayant des contraintes temporelles
de type (6,9)-firm et spécifié par le κ-pattern suivant
{πi(1≤i≤k)} = {110110110}. Ce κ-pattern signifie
qu’une partie des paquets de type B est déclarée
comme optionnelle par la source de ce flux. Par
exemple, le 226ème
paquet est considéré comme étant
critique car π(226%9) = π1 = 1 et le 228ème
paquet est
considéré comme étant optionnel car π(228%9) = π3 = 0.
Une fois la contrainte WHRT spécifiée, on peut
alors passer à l’étape de recherche d’algorithmes
d’ordonnancement pour que la contrainte soit
respectée (de façon déterministe ou probabiliste).
2.3. Algorithmes d’ordonnancement pour (m,k)-firm
Il existe aujourd’hui principalement deux familles
d’algorithmes qui prennent en compte (m,k)-firm:
dynamique (par exemple DBP : Distance Based
Priority) et statique (par exemple EFP : Enhanced
Fixed Priority). Par algorithme dynamique nous
voulons dire que la priorité affectée à chaque client
est ajustée automatiquement en fonction de l’état du
système (en particulier de la k-séquence des sources) à
l’instant t. Tandis qu’une affectation statique de
priorité est basée sur un paramètre fixe (taux m/k par
exemple).
Un algorithme dynamique a l’avantage de permettre
au système de s’adapter aux changements de situation
(variation de flux, de capacité du serveur, …). Il
convient à la gestion en-ligne de la QdS. Le problème est
qu’il ne donne souvent qu’une garantie statistique (besteffort)
de m sur k. C’est le cas de DBP et de la première
version de DWCS (Dynamic Window Constrained
Scheduling) [West99]. Une version améliorée de DWCS
[West04] permet de donner une garantie déterministe de
m sur k sous des conditions particulières (même Ci pour
toutes les sources). A contrario, un algorithme statique
permet une vérification hors-ligne du système et garantit
de façon déterministe le respect de m sur k échéances
dans le cas où le système ne violerait pas les hypothèses
du pire cas.
Dans ce qui suit nous expliquons le principe de DBP,
DWCS et EFP. 2.3.1. DBP (Distance Based Priority) Le serveur choisit les clients présents en tête des
queues selon leur priorité. Dans le cas d’égalité de
priorité parmi les clients à choisir, EDF (Earliest
Deadline First) est utilisée par défaut. Nous notons
par DBP-EDF ce système.
DBP [Hamdoui95] est la façon la plus directe pour
la prise en compte de la contrainte (m,k)-firm. Pour
une k-séquence donnée, DBP définit à chaque début
du service d’un client la distance d’aller à un état
d’échec transitoire comme le nombre consécutif de
bits 0 à ajouter pour atteindre cet état. La priorité que
DBP donne au client en tête de la queue
correspondante à la k-séquence est égale à cette
distance. Si la source se trouve déjà en état d’échec
transitoire (i.e., moins de m 1 dans la k-séquence), la
plus haute priorité 0 est affectée. Par exemple, pour
une source sous contrainte (3,5)-firm, le client en tête
de la queue est de priorité 2 si les 5 clients précédents
forment une k-séquence (11011), il est de priorité 3 si
les 5 clients précédents forment une k-séquence
(10111).
2.3.2. DWCS (Dynamic Window Constrained
Scheduling)
L’algorithme DWCS a été conçu dans [West99] pour
maximiser l’utilisation de la bande passante du réseau en
cas de surcharge pour des flux temps-réel tolérant aux
pertes. Il se charge de garantir la contrainte de type
(2x x, + − y) firm , c'est-à-dire, pas plus que 2x
dépassements d’échéances dans n’importe quelle fenêtre
de x+y paquets consécutifs tout en ayant la capacité de
partager la bande passante entre les paquets des flux en
compétition en proportion de leurs échéances et
tolérances aux pertes, avec x représente le nombre de
paquets qui pourraient être perdus ou transmis en retard
pour chaque fenêtre fixe de taille y paquets consécutifs.
DWCS est développé pour être employé comme une
alternative à EDF dans des conditions de surcharge, étant
donné que les performances de EDF se dégradent
sérieusement pour une charge supérieure à un.
Formellement, selon [Hamdaoui95] la priorité est
évaluée comme suit. Nous notons par
( 1 1 , , , j ) j j j
j i k i i s = δ − + " δ δ − la k-séquence de la source τj,
par lj(n,s) la position (en comptant à partir de droite)
de la nième
échéance respectée (ou 1) dans sj, la priorité
du (i+1)ème
client de τj est donnée par : Cet algorithme nécessite deux attribues par flux pour
assurer l’ordonnancement des paquets :
• L’échéance : elle est définie comme étant le
temps maximum entre le service de deux paquets
consécutifs au sein d’un même flux. Dans le cas
d’un flux périodique, l’échéance d’un flux
Di
Di τ i
est égale à sa période T . i
_ 1 ( , ) j P DBPi j j j j k l m s + = − +1 (2)
Notons que lorsqu’il y a moins de n 1 dans s, alors
lj(n,s) = kj + 1, afin que la plus haute priorité (= 0)
soit affectée. • La contrainte de fenêtre fixe: elle est aussi appelée
facteur de tolérance aux pertes. Elle est spécifiée
par la valeur i i = y W x i où représente le
nombre maximum de paquets perdus (ou transmis
en retard) pour chaque fenêtre fixe de taille
paquets consécutifs.
xi
i y
La Figure 3 schématise comment DBP est utilisé
pour l’affectation de priorité. Cette politique
d’affectation dynamique de priorité peut être
facilement et efficacement implémentée en matériel
car l’historique de chaque source peut être stocké dans
un registre de kj bits. Bien que DWCS s’intéresse à une fenêtre fixe, cette
contrainte peut inclure le cas de fenêtre glissante du
modèle (m,k)-firm. Dans [West04], il a été montré que
cette contrainte (x,y) permet, au pire (quand les x paquets
perdus se trouvent à la fin d’une fenêtre de taille y et les
x autres paquets se perdent au début de la fenêtre
suivante), de garantir le respect de (2x x, + − y) firm .
Comme DBP, DWCS maintient l’information d’état par
flux mais l’utilisation de cette information diffère
significativement de DBP. En effet, DBP affecte la
priorité relative à un flux en se basant sur l’historique
des k derniers clients, alors que DWCS utilise la notion
de la fenêtre fixe dans laquelle x et y changent de valeurs
au cours du temps selon un algorithme que nous
expliquons par la suite.
( , , , ) 1 1 1 1 δ i − k 1 + 1 " δ i − δ i
( , , , ) 2 2 1 2 k 2 1 i i δ i − + " δ − δ
2 1 2 2 2 3 , , , i + i + i + " j j j
( , , , ) 1 1 N
i N
i N δ i − k N + " δ − δ
N
i N
i N
i j j j 3 2 1 , , , " + + +
1 1 1 1, i+ pi+ 1 j 1 1 2 1 3 , , , i + i + i + " j j j
2 1 2
1, i+ pi+ j
N
i Nji 1 p 1 , + +
DBP
DBP
DBP
Serveur
...
...
τ 1
τ N
τ 2
x ji : ième travail de source x x pi : priorité du ième travail de source x
Figure 3. DBP pour l’affectation de priorité des
clients en tête des queues DWCS choisit les paquets à servir en fonction de
leurs échéances ainsi que leurs facteurs de tolérance aux
pertes. Dans [West99], l’affectation de priorité selon lapremière version de DWCS (DWCS1
) se résume en six
règles et est présentée dans le tableau suivant.
1 Choisir le paquet avec la plus petite contrainte de
fenêtre (plus petit facteur de tolérance aux
pertes) ( ) =
= = 1..
min i i i i N
W x y avec ≠ 0 i y
2 S’il existe 1 , , alors servir
avec EDF
≤ ≤ i j N /W W i = j ≠
( ) =
= 1..
min n n N
D
0
3 S’il existe 1 , et
, alors servir le paquet ayant le plus
petit numérateur de la contrainte de fenêtre
≤ ≤ i j N
=
= 1..
min i N
x
/ 0 W W i = j ≠
( )i
Di = D j
4 Si W W= = 0 et i j = = 0 i j y y
=
= 1..
min n n N
D
, alors servir avec
EDF ( )
5 Si W , alors servir le paquet ayant le plus
grand dénominateur de la contrainte de fenêtre
= 0 i
( ) =
= 1..
max n n N
y
6 Tous les autres cas sont traités par FIFO
Nous observons que si deux paquets ont les mêmes
valeurs de facteurs de tolérance aux pertes et les mêmes
valeurs d’échéances, alors les paquets sont servis selon
l’ordre croissant des où i x i x yi représente la valeur
courante du facteur de tolérance aux pertes pour tous les
paquets du ième flux. Ainsi, la priorité est affectée au
paquet du flux ayant la contrainte de perte la plus étroite,
afin d’éviter des pertes consécutives de paquets. Si les
facteurs de tolérance ainsi que les dénominateurs i y des
deux paquets sont nuls, alors les paquets sont servis dans
l’ordre croissant de leurs échéances ; Sinon, si les
dénominateurs i y sont non nuls, alors le paquet ayant la
plus grande valeur du dénominateur de la contrainte de
fenêtre sera affecté la plus haute priorité.
Chaque fois qu’un paquet du flux i est transmis, la
contrainte de fenêtre du i
ème
flux est ajustée. De même,
les contraintes de fenêtre des autres flux sont ajustées
dans le cas où il existe des paquets de ces flux qui ont
dépassé leurs échéances.
Pour les flux tolérant les pertes de paquets, les
paquets ayant raté leurs échéances sont tout simplement
rejetés. Pour les flux ne tolérant pas de pertes de paquets,
les échéances servent à réduire le délai d’attente dans les
files avant leur transmission. La valeur du facteur de
tolérance sert dans ce cas à éviter un retard excessif des
paquets de tel flux.
Les contraintes x et y sont ajustées au cours du
temps en fonction des échéances si elles sont ratées ou
non. Considérons un flux i ayant la contrainte de fenêtre
originale W x i i = yi à l’instant initial. Notons par
′ = ′ ′ W x i i yi la contrainte de fenêtre courante. Si le
paquet du flux i est transmis avant le dépassement de son
échéance, les contraintes x et sont ajustées de la
façon suivante :
′
i ′
i y
si (
si
or
al
s
s
i
′
j
(
( )
′
s
ors
lors
j ′ −
′ ′
= = ′ ′
ors
j y
x y
y
)
( )
al 1
0 or ;
i i i
i i i i i i
y x y y
x y x x y y
′ ′ > = ′ −
′ ′ = = =′ ′ =
Cependant, pour tous les paquets des autres flux en
attente, si un paquet du flux / j ≠ i rate son
échéance, alors les contraintes sont ajustées selon la
règle suivante:
)
( )
( )
( )
′ >
′ ′ = − =
′ ′ = = ′ = ′ =
′ =
+ > =
Si 0 Alors
1; 1;
Si 0 Al ;
Sinon Si 0 Alor
Si 0 Al +
Si 0 A +
j
j j
j j j j j
j
j j
j j j
j
j j j j
x
x x
x y x x y y
x
y x
y x
x y y y
j
Donc à chaque fois qu’une échéance du flux j est
ratée, le facteur de tolérance aux pertes de ce flux est
ajusté de façon à lui donner plus d’importance dans le
prochain tour de sélection de paquet. Cette approche
évite le problème de famine en affectant des priorités
plus élevées aux flux qui sont susceptibles de violer leurs
contraintes de fenêtre initiales. Inversement, un paquet
du flux i est servi avec respect de son échéance, conduit
à la diminution du facteur de tolérance des autres flux
réduisant ainsi sa priorité aux prochains tours.
Récemment, West et al. proposent dans [West04] la
deuxième version de DWCS (DWCS2
). La différence
principale avec la première version est que les deux
premières lignes du tableau sont inversées. Dans la
deuxième version de DWCS, la première règle
d’affectation de priorité est identique à EDF, i.e. le
paquet ayant la plus petite échéance est le plus
prioritaire. La deuxième règle dans DWCS2
fait recours à
une comparaison des contraintes de fenêtre lorsque les
échéances sont égales. West et al. expliquent que le
changement de l’ordre des règles est dû à l’optimalité de
EDF dans des conditions de charge normale pour
respecter les échéances et par conséquent les contraintes
de fenêtre. Cependant, l’algorithme DWCS1
reste
toujours plus performant que EDF dans des conditions
de surcharge où il est impossible de respecter toutes les
échéances.
Dans [West04], les auteurs étudient les
caractéristiques temporelles de DWCS2
et montre
analytiquement que, dans le cas où il existe un
ordonnancement faisable pour un ensemble de flux
périodiques, les délais des flux en service sont toujours bornés même en situation de surcharge. En effet, il a été
montré que le délai garanti à chaque flux est indépendant
des autres flux en service même en situation de
surcharge. De plus, les résultats de simulation montrent
que DWCS et DBP on des performances similaires en
termes de nombre d’échéances ratées et de violation de
la contrainte de fenêtre. Enfin, une implémentation sur
Linux de DWCS est téléchargeable à partir du site de
l’auteur.
2.3.3. EFP (Enhanced Fixed Priority)
EFP est proposé dans [Hamdaoui97],
[Ramanathan99]. Pour prendre en compte la
contrainte (m,k)-firm, il suffit que chaque source
définisse un κ-pattern et marque parmi ses k clients
consécutifs m clients critiques et k-m clients
optionnels. En faisant ainsi le serveur pourra rejeter
un client optionnel en cas de surcharge (c’est à dire au
cas où son échéance ne peut plus être respectée par le
serveur). Tous les clients critiques peuvent être
ordonnancés par un algorithme à priorité fixe tel que
RM (Rate Monotonic). Les clients optionnels sont
servis avec la priorité la plus basse selon la politique
FIFO. Le problème revient donc à définir un κ-
pattern. Pour commencer le marquage, le premier
client de chaque source est marqué critique par défaut.
Pour une source τi, le marquage des clients critiques et
optionnels selon sa contrainte (mi,ki)-firm est alors
entièrement donné par l’équation suivante.
Le nième
client (n = 0, 1, …) est marqué critique si
n vérifie : n m k
n
k m
× = ×
Ce qui donne comme κ-pattern suivant (pour i=1, 2,
…, k) :
1 si
0 sinon
i
i m k i
π k m
× = × =
(3)
Le marquage ne dépend que du rapport mi/ki. Une
condition suffisante est donnée dans [Ramanathan99]
pour la garantie déterministe de contrainte (mi,ki)-
firm.
Cet algorithme souffre néanmoins trois problèmes:
• Le premier client de chaque source est marqué
critique par défaut. Ce qui force artificiellement le
système de se retrouver dans un « pire cas ».
• L’équation 3 distribue régulièrement les m clients
critiques parmi les k arrivées consécutives. Ce qui
peut ne pas être optimal dans certaines situations.
• La technique de marquage ne dépend que du rapport
mi/ki, mais pas de Ci et Ti. Deux sources ayant des Ci
et Ti très différents mais avec la même contrainte
(m,k)-firm relèveront du même κ-pattern et donc se
verront leur clients critiques distribués de la même
façon. Le fait de ne pouvoir les distinguer peut
conduire à une situation non optimale.
Partant de l’idée qu’une partition judicieuse et
globale des clients critiques de toutes les sources
devrait donner une meilleure ordonnançabilité,
[Quan00] a amélioré l’algorithme présenté dans
[Hamdaoui97, Ramanathan99]. Il a d’abord prouvé
que trouver une partition optimale est NP-difficile.
Puis, il donne une heuristique pour optimiser la
répartition de mi clients critiques parmi ki clients
consécutifs en prenant en compte les relations entre
les sources.
3. (m,k)-WFQ pour une meilleure gestion de
la QdS temps réel
L’ordonnanceur WFQ (Weighted Fair Queueing)
[Parekh93] est déployé dans les commutateurs et
routeurs du réseau Internet pour fournir de la QdS
grâce à ses propriétés de garantie de bande passante et
de délai borné pour des flux (σ,ρ)-bornés.
L’algorithme (m,k)-WFQ consiste à intégrer les
contraintes temporelles (m,k)-firm au processus
d’ordonnancement de WFQ. Nous faisons d’abord un
rappel du principe de WFQ afin d’expliquer ensuite
l’apport de (m,k)-WFQ.
WFQ garantit à chaque flux servi la proportion de
la bande passante réservée selon son coefficient de
partage Φi. Chaque paquet de messages est estampillé
par un tag appelé temps virtuel de départ. Le serveur
sélectionne toujours le paquet dont le temps virtuel de
départ est le premier à partir de l’instant de sélection.
Dans WFQ le temps virtuel de départ est défini par :
{ } 1 max , ( )
k
k k i
i i
i
L F F V t − = Φ
+ (4)
avec
• : temps virtuel de départ du k
ième paquet du i
ème
flux,
k Fi
• V(t) : le temps virtuel quand le k
ième paquet arrive,
• Φi : le coefficient de partage du i
ème flux,
k • Li : la taille du k
ième paquet du i
ème flux,
• ma { } 1 x , ( ) k F V i t − : le temps virtuel du début de
service du k
ième paquet.
Avec WFQ, il est montré dans [LeBoudec02] que
pour un flux τi de type (σi,ρi)-borné et ayant un débit
moyen réservé gi ≥ ρi, le délai garanti par WFQ à ce
flux est borné par :
max ,max i
i
i
L D
g c
σ
= + (5) où Lmax est la taille maximale du paquet parmi tous les
paquets dans tous les flux et c la capacité de
traitement du serveur.
Nous rappelons qu’un flux est dit (σ,ρ)-borné si sa
fonction cumulative d’arrivée R(t) vérifie la relation
∀ ≤ 0 , s ≤ t R (t) − R(s) ≤ σ ρ + (t − s) avec σ la taille
maximale de rafale et ρ le débit moyen à long terme.
La borne fournie par WFQ sur le temps de réponse
d’une source de flux est étroitement liée au coefficient
de partage de la bande passante ρi et à la taille de la
rafale σi. Pour avoir un délai d’attente court, un flux
doit réserver une large bande passante. Pour un flux
de faible débit moyen et ayant une grande rafale ceci
peut conduire à une mauvaise utilisation de la bande
passante. Ce problème peut être résolu avec la
politique WFQ priorisé proposé dans [Wang02] mais
la notion de (m,k)-firm n’est pas prise en compte.
Nous avons proposé dans [Koubâa04a],
[Koubâa04b] une approche appelée (m,k)-WFQ. Pour
que l’ordonnanceur WFQ puisse prendre en compte
les contraintes temporelle (m,k)-firm, nous exprimons
la contrainte par un κ-pattern, donc la source marque
m paquets critiques parmi tous les k paquets
consécutifs et les autres étant optionnels.
L’ordonnanceur (m,k)-WFQ estampille ensuite le
paquet par son temps virtuel de départ décrit par
l’équation 4. L’algorithme est décrit dans la Figure 4.
Le processus de service est activé quand au moins un
paquet existe dans la file d’attente du système. Le
serveur sélectionne le paquet ayant le plus petit temps
virtuel de départ parmi tous les paquets critiques
présents en tête de files. Si aucun paquet critique
existe, le choix sera fait parmi les paquets optionnels.
Puis, si le paquet sélectionné est critique, il est
exécuté (ou transmis) directement par le serveur,
tandis que si le paquet est optionnel, l’ordonnanceur
vérifie avant son exécution si ce paquet pouvait
éventuellement satisfaire son échéance. Si l’échéance
souhaitée ne peut être garantie après l’exécution, le
serveur rejette le paquet et refait une nouvelle
sélection, sinon, il l’envoie.
L’avantage de l’algorithme proposé est qu’il
permet de garantir une bande passante à un flux tout
en intégrant les propriétés temporelles dans le
processus d’ordonnancement ce qui revient à gérer les
flux plus efficacement. En effet, le rejet des paquets
optionnels qui ne satisfont pas leurs échéances permet
au serveur de donner la main plus rapidement aux
paquets critiques en attente. Cette perte ne dégrade
pas les performances des flux servis tant que leurs
contraintes (mi,ki)-firm sont satisfaites. Ainsi, (m,k)-
WFQ diminue forcément les bornes sur les temps de
réponse des flux temps réel par rapport à WFQ
standard. Dans ce qui suit nous montrons
quantitativement cette amélioration par simulation
d’un exemple.
Entrées
Flux τi = {(Période ou Débit), Echéance
Désirée, (mi,ki), (Gigue ou Rafale),
Taille de Paquet)
Affectation de priorité
A l’arrivée du aième du flux [i] {
si ( ( % )i π a k = 1 ) alors {
Marquer le paquet comme critique;
}
sinon {
Marquer le paquet comme optionnel;
}
Calculer le temps virtuel de départ k Fi ;
Estampiller le paquet avec k Fi ;
}
Mettre le paquet dans sa file d’attent;
Discipline de Service
Serveur
Tant que (la file est non vide) {
= libre;
si (serveur!= occupé) {
Choisir le paquet dont k Fi plus petit
si (paquet est critique) {
Envoyer le paquet;
Serveur = occupé;
sinon { //Paquet Optionnel
}
si (l’échéance serait ratée){
Rejet du paquet;
Serveur = libre;
sinon {
}
Envoyer le paquet;
Serveur = occupé;
}
}
}
si (serveur== occupé) {
attendre jusqu’à tx totale du paquet;
Serveur= libre;
}
Figure 4. Algorithme (m,k)-WFQ
Considérons un réseau constitué de trois sources
de trafic. Ces trois sources partagent un lien de 10
Mbit/s selon leurs coefficients de réservation. Dans
cette simulation, on considère une taille fixe à tous les
paquets des trois flux de 8 Kbits. Le Tableau 1
récapitule les paramètres de simulation pour chacun
des flux.
Le marquage de paquets en critiques et optionnels
est spécifié par un κ-pattern fixe pour chaque source. La première source génère un flux de voix selon le
modèle de trafic ON/OFF. Les périodes d’activité ON
et de silence OFF sont exponentiellement distribuées
avec les moyennes 1/ et avec
une période de génération de paquets dans la période
d’activité de 50 ms. Donc, le débit moyen du flux est
de 64 Kb/s. Les contraintes temporelles sont de type
(4,5) et l’échéance souhaitée d’un paquet est fixée à
10 ms. Le κ-pattern fixe le profil de la séquence
comme : 11011 11011 11011 …
500 µ ON = ms 1/ 755ms OFF µ =
(m,k) Débit Trafic κ-pattern Echéance
Voix (4,5) 64 kb/s ON/OFF (500/755/50)ms 11011 10 ms
Vidéo (3,5) 2Mb/s Périodique avec gigue ~2Mb/s 10110 4 ms
FTP (0,1) 7,936 Mb/s Périodique avec gigue ~7.936 Mb/s 0 Infinie
Tableau 1. Configuration simulée
La deuxième source est une source CBR (Constant
Bit Rate ) périodique avec gigue (95% de Ti-Ci) qui
génère un flux vidéo de 2 Mbit/s. L’échéance des
paquets est fixée à 4 ms avec une garantie de type
(3,5). Le κ-pattern fixe le profil de la séquence
comme : 10110 10110 10110 …
La troisième source est un agrégat de flux FTP,
que nous supposons périodique avec gigue (95% de
Ti-Ci) et qui consomme le reste de la bande passante
ayant donc un débit de 7,936 Mb/s. Un flux FTP est
vulnérable à la perte de paquets et ce trafic fonctionne
en mode Best-Effort. Donc, il ne possède pas de
propriétés temporelles strictes comme dans le cas des
deux sources temps-réel : Voix et Vidéo. Par
conséquent, nous fixons une garantie de type (0,1)
pour le flux FTP et une échéance infinie afin d’éviter
tout rejet de paquets FTP optionnels.
Le tableau 2 montre les bornes mesurées sur le temps de
réponse des paquets pour chacun des flux et ce pour le
serveur (m,k)-WFQ, le serveur WFQ, le serveur (m,k)-
FIFO et le serveur FIFO.
(m,k)-WFQ WFQ (m,k)-FIFO FIFO
Voix 9,769 (taux de rejet = 6,8%) 2428,031 20,529 48,031
Vidéo 3,999 (taux de rejet = 5,5%) 55,391 21,086 49,031
FTP 9,696 36,562 21,442 49,083
Tableau 2. Bornes sur les temps de réponse (ms)
Les cas du serveur FIFO et (m,k)-FIFO sont
simulés pour que l’on puisse les comparer avec le cas
du serveur (m,k)-WFQ. Un serveur (m,k)-FIFO est
simplement un serveur FIFO avec le rejet des paquets
optionnels ayant leur échéances ratées.
Comme prévu, (m,k)-WFQ fournit une garantie
plus étroite sur le délai pour les flux temps-réel. Dans
ce scénario, on peut remarquer que le délai maximal
garanti par WFQ au trafic de la voix est assez grand.
Ce résultat découle de deux facteurs majeurs (cf.
équation 5) : le faible taux de bande passante réservée
(64 Kbit/s) et la taille importante de la rafale.
L’algorithme (m,k)-WFQ permet de réduire
considérablement les bornes sur les temps de réponse
en sacrifiant quelques paquets optionnels selon les
contraintes temporelles (m,k)-firm de chaque flux. Le
rejet des paquets optionnels ne satisfaisant pas leurs
échéances améliore nettement le délai des paquets
critiques. En comparant (m,k)-WFQ avec la politique
(m,k)-FIFO, on peut aussi constater que (m,k)-WFQ
conserve la bonne propriété de WFQ en terme de
distinction des flux (garantie par flux).
Pour fournir la garantie déterministe de (m,k)-firm
dans (m,k)-WFQ, nous donnons la borne sur le temps
de réponse de (m,k)-WFQ. L’évaluation de cette
borne n’est pas triviale essentiellement à cause de la
difficulté de déterminer la part de paquets optionnels
que le serveur a effectivement servi. La Figure 5
montre le modèle en « network calculus » qui a
permis le calcul de cette borne.
Le calcul de la borne sur le temps de réponse
utilise le formalisme du Network Calculus
[LeBoudec02]. Dans [Koubâa04a] nous avons intégré
les contraintes (m,k)-firm dans le formalisme du
Network Calculus en introduisant la notion du (m,k)-filtre qui permet de filtrer tous les paquets optionnels
et fournir en sortie seulement les paquets critiques. La
Figure 5 montre la technique pour modéliser le flux
effectif qui devra être servi par un serveur,
garantissant un débit fixé tel que celui de WFQ. Le
flux effectif contient tous les paquets critiques et le
nombre maximum de paquets optionnels qui pourront
être servis par l’ordonnanceur. Les paquets optionnels
servis sont ceux qui ne ratent pas leurs échéances. Ce
flux effectif est utilisé pour le calcul de la borne sur le
délai garanti par (m,k)-WFQ.
R*2(t)
R*3(t)
(m,k)
Filter
(k-m,k)
Filter
R*1(t)
R(t) R*(t)
Mux
( , σ ρ) k m−
k
Shaper
Figure 5. Modèle de Network calculus
Le délai maximal garanti pour une source (σ,ρ)-
borné respectant une contrainte temporelle (m,k)-firm
avec un taux de partage de bande passante g ≥ ρ et
servi par un ordonnanceur (m,k)-WFQ est :
* max max m k, k m,k
e L D
g g c
σ = ⋅ λ λ + − ⋅ + (6)
Avec e ≤ σ la taille maximale de rafale des paquets
optionnels qui pourraient être transmis par
l’ordonnanceur. λm k, désigne le taux de bits critiques
du flux et λk m− ,k le taux de bits optionnels du flux.
Dans le cas où la taille du paquet est constante
m k,
m
k
λ = . Si aucun paquet optionnel n’est servi,
* x Dmin
Lma m k, g c +
σ = ⋅ λ est la plus petite borne sur le
délai. Pour garantir un délai entre Dmin* et Dmax*, on
peut ajuster l’échéance maximale Dop qui détermine e
= gDop.
L’algorithme (m,k)-WFQ peut être étendu et intégré
dans Intserv et le réseau ATM. L’idée de base est que
chaque source voulant profiter d’une garantie avec
dégradation adaptée doit marquer ses paquets en tant que
optionnel ou critique selon sa contrainte (m,k)-firm et
son κ-pattern associé. L’ordonnanceur WFQ qui garantit
le débit dans le cadre du service garanti, doit tenir
compte de cette classification. Les paquets optionnels
dont l’échéance ne peut être respectée sont rejetés.
(m,k)-WFQ permet alors de garantir des bornes sur le
délai plus précises et d’une manière plus flexible. Pour
une source ayant un trafic défini par le TSPEC (M,p,b,r)
de Intserv et d’ATM avec M la taille maximale d’un
paquet, p le débit crête, b la taille maximale de la rafale
autorisée et r le débit moyen à long terme associé à la
contrainte (m,k)-firm et autorisant un délai maximal pour
les paquets optionnels égal à , le délai maximal Dmax
a été obtenu dans [Koubâa04b] de façon similaire à
l’obtention de l’équation 6.
Dop
4. Garantie déterministe et condition
suffisante de DBP
On vient de voir que beaucoup d’algorithmes
d’ordonnancement ont été proposés pour fournir une
garantie en moyenne (best-effort) et déterministe du
temps réel (m,k)-firm. S’il est vrai que par rapport à la
garantie déterministe du temps réel dur, le fait de ne
plus viser que garantir en moyenne m échéances parmi
les k instances consécutives d’une tâche résulte en
moins de demande de ressources en moyenne, il n’est
pas évident que cet avantage est toujours conservé
lorsqu’on cherche une garantie déterministe de (m,k)-
firm. Cette question est fondamentale pour savoir si
un algorithme d’ordonnancement pour (m,k)-firm peut
apporter des avantages par rapport à un algorithme
connu (EDF, FP, …) pour le temps réel dur avec
garantie déterministe. Le point clé pour répondre à
cette question est la recherche de conditions
suffisantes d’ordonnançabilité. Un ensemble de
sources τ = (τ1, τ2, …, τN) (dans le modèle MIQSS)
ordonnançable respecte alors la contrainte (m,k)-firm
de façon déterministe car l’analyse d’ordonnançabilité
est réalisée dans le pire cas.
Le cas de (m,k)-WFQ donne relativement
simplement cette garantie déterministe grâce à WFQ
qui transforme en fait un serveur partagé en N
serveurs dédiés à N sources, avec comme facteur
d’interférence la longueur maximale d’un paquet Lmax.
L’obtention d’une condition suffisante dans un
modèle MIQSS avec non préemption est en général un
problème difficile.
Dans ce paragraphe, nous donnons d’abord un état de
l’art sur ce problème de recherche de conditions
suffisantes pour l’ordonnancement non préemptif, puis
une condition suffisante pour la garantie déterministe du
temps réel (m,k)-firm avec l’ordonnancement NP-DBPEDF
(Non Preemptive - Distance Based Priority -
Earliest Deadline First) [Li03], [Li04].
4.1. Etat de l’art sur les conditions suffisantes
Nous commençons par nous intéresser à la
condition suffisante pour la garantie déterministe
(k,k)-firm (i.e. temps réel dur). Pour un ensemble de
sources périodiques ou sporadiques τ = (τ1, τ2, …, τN)avec τi = {Ti, Ci, Di} et des dates initiales
quelconques, [Jeffay91] a donné un ensemble de
conditions suffisantes et nécessaires
d’ordonnançabilité sous EDF non préemptif (noté par
NP-EDF : Non-Preemptive EDF). Dans la suite de ce
paragraphe nous supposons que le temps est discrétisé
et indexé par les entiers. Nous supposons également
que l’échéance est égale à la période (ou à l’intervalle
d’interarrivée minimal s’il s’agit du cas sporadique).
Théorème de [Jeffay91] :
Considérons un ensemble de N sources
périodiques ou sporadiques τ = (τ1, τ2, …, τN)
avec τi = {Ti, Ci, Di} classées dans l’ordre nondécroissant
des périodes (i.e. pour deux sources
τi, τj, si i < j, alors Ti ≤ Tj) et Di = Ti. Si τ est
ordonnançable, on a :
C1:
1
1
N
i
i i
C
= T ∑ ≤
C2: ∀i, 1< i N; ∀L, T1 < L < Ti ≤ :
1
1
1 i
i j
j j
L C C
T
−
=
− ≥ + ∑ L
Si τ satisfait les conditions C1 et C2 cidessus,
alors NP-EDF peut ordonnancer
n’importe quel ensemble concret généré à partir
de τ. C’est à dire τi avec une date initiale ri.
Le sens de C1 est clair. C’est la charge globale
normalisée qui ne doit jamais dépasser 1. Une autre
interprétation de C1 peut être que pour un intervalle
de temps quelconque, la demande de traitement est
toujours inférieure à la longueur de l’intervalle. C2
décrit une répartition extrême des flux d’arrivée : le
client Ci occupe le serveur et tous les autres arrivent
juste après une unité de temps (temps discret). Le
serveur doit alors être capable de terminer le
traitement de Ci, ainsi que le traitement des autres
arrivées (représentées par le deuxième terme dans C2)
sans dépasser une échéance.
Pour un ensemble τ dans le modèle MIQSS on
peut utiliser ce théorème pour dimensionner la
capacité de traitement du serveur c (Ci = Wi/c). Dans
[Li03] un algorithme est développé pour trouver le c
minimal.
En ce qui concerne la garantie déterministe (m,k)-
firm dans le modèle MIQSS, si l’on considère (m,k)-
WFQ comme un cas particulier de MIQSS et DWCS
[West04] comme étant trop restreint, un seul autre
résultat proposé par [Ramanathan99] existe pour le
cas de κ-pattern fixe selon l’équation 3 que nous
instancions ici dans le modèle MIQSS pour prendre en
compte les sources multiples.
Pour une source τi = {Ti, Ci, Di, mi, ki} le κ-pattern
correspondant est une suite binaire de ki bits
∏ = i i {π 1 2 , π π i ... ik i }
1
ki
m ij i j
∑ π =
=
, qui satisfait : (1) le nème client est
critique si πι(n%ki) = 1 et optionnel si πι(n%ki) = 0 ;
(2) .
Le κ-pattern proposé dans [Ramanathan99] est
donné par :
1 Si
0 S 1,2, inon
i i
ij i i
i
j m k j k m
j k
π
× = × = = "
(7)
Les demandes de traitement critiques sont
ordonnancées selon RM (Rate Monotonic). La
condition suffisante est donnée par le théorème
suivant.
Théorème de [Ramanathan99] :
Considérons un ensemble de N sources
périodiques ou sporadiques τ = (τ1, τ2, …, τN)
avec τi = {Ti, Ci, Di, mi, ki} classées dans
l’ordre non-décroissant des périodes (i.e. pour
deux sources τi, τj, si i < j, alors Ti ≤ Tj) et Di =
Ti. Définissons les termes ci-dessous :
: , i i
ij j j i
i i
k k R l T l T T l Z m m +
= ⋅ ⋅ < ∈
1
1
i
i i
j
R R
−
=
=∪ j
( ) j
j
j j
m t
n t
k T
=
1
1
( ) ( )
i
i i j
j
W t C n t C
−
=
= + ⋅ ∑ j
Si i t R i n W (t) t 1 mi ∈ ≤ pour tout 1 i ≤ ≤ N ,
alors la politique RM respecte de façon
déterministe toutes les contraintes (mi,ki)-firm.
Dans la pratique pour un ensemble de source τ =
(τ1, τ2, …, τN) avec dates initiales quelconques,
trouver la capacité du serveur c minimale requise pour
la garantie déterministe selon ce théorème est NPdifficile
[Quan00]. Dans [Quan00] des algorithmes heuristiques sont
proposés. Afin de minimiser la charge instantanée
dans le pire cas (qui permet de diminuer la demande
en c), [Quan00] propose de répartir plus
uniformément les mi parmi les ki en faisant la rotation
des mi selon l’équation suivante.
(( 1) ) 1 si 1
0 s 1,2, inon
i i i
i
ij i i
i
j s m k j s k m
j k
π
− − × − = × + = = "
(8)
où si est le nombre de périodes obtenues par le
décalage circulaire vers la droite.
Un algorithme heuristique choisit une valeur de si
provoquant ainsi moins d’interférence de demandes
d’exécution par rapport à l’algorithme de
[Ramanathan99]. Ce principe de rotation ne change
pas de κ-pattern vis à vis d’une source mais change
simplement la répartition dans l’axe du temps des
demandes d’exécution critiques de N sources. En
réalité, cette rotation veut introduire une sorte de κ-
pattern dynamique. De ce point de vue DBP le fait
plus facilement par l’affectation de priorité en-ligne.
4.2. Condition suffisante pour NP-DBP-EDF
Par rapport à NP-EDF dans [Jeffay91], NP-DBPEDF
introduit une variable supplémentaire qui est la
valeur de DBP à l’instant t. Pour un client de la source
τi sa priorité DBP est calculée selon l’équation 2 et on
la note par DBPj(t). A un instant t, l’ensemble des
clients peut être classé en trois classes suivantes :
1) Le client en cours de service dans le serveur
2) Les clients en attente avec DBPj(t) = 1, i.e., ces
clients doivent être exécutés par le serveur et
terminer leur service avant leurs échéances
respectives, sinon la garantie (m,k)-firm sera
violée
2+i) Les clients en attente avec DBPj(t) = i (i>1), i.e.,
un tel client sera exécuté si le serveur est
disponible et si l’exécution peut terminer avant
son échéance, sinon il sera écarté par le serveur
et le prochain client de la source aura sa priorité
augmentée : DBPj(t+Tj) = DBPj(t)-1
Nous rappelons qu’en cas d’égalité de priorité
DBP, EDF est utilisé.
La condition suffisante est donnée par le théorème
suivant (cf. [Li03] pour la preuve).
Théorème de [Li03] :
Considérons un ensemble de N sources périodiques ou sporadiques τ = (τ1, τ2, …, τN) avec τi = {Ti, Ci, Di, mi,
ki} classées dans l’ordre non-décroissant des périodes (i.e. pour deux sources τi, τj, si i < j, alors Ti ≤ Tj) et Di = Ti.
Si τ satisfait les conditions C1 et C2 suivantes durant un intervalle de temps L quelconque, NP-DBP-EDF peut
alors ordonnancer n’importe quel ensemble concret τ’ généré par τ. C’est à dire qu’il n’y aura aucune violation de
contrainte (mi,ki)-firm pour i = 1, 2, …, N.
C1: ,
i i
i i
i i
i U i i i
L L k T
L k T
m M in m C ∈ k T T
− + +
∑ i
( ) 1 ( ( ) 2) 1 ( ( ) 2) 1 ( ( ) 2) ,
j j
j j j j
j j j j
j j j
j U j j j
L DBP t T
L DBP t T k T
L DBP t T k T
m Min m C L ∈ −τ k T T
− − − − − − − − − − + ≤
∑
C2: , , m in ( i ∀ ∀i L L > T )
1 1
i
i i i
i i i
i i
i i i
L C
L C k T
L C k T
m Min m C
k T T
+
− − − − + + − − +
, 1 i( ) 1 ( ( ) 2) 1 ( ( ) 2) 1 ( ( ) 2) ,
i
j j
j j j j
j j j j
j j j
j j j j
L DBP t T
L DBP t T k T
L DBP t T k T
m Min m C ∈ −τ τ k T T
− − − − − − − − − − + ≤
∑ L
Où U est l’ensemble de clients de DBP = 1 qui peuvent arriver au même instant t et τ - U l’ensemble des autres
clients. Dans le pire cas cet ensemble U peut inclure un client de chaque source et τ - U = ∅ (ensemble vide).
Dans la pratique pour un ensemble concret τ’, ce pire cas peut ne jamais être atteint.
En fait, cette expression de condition suffisante est
celle de NP-EDF avec une variable qui est DBPj(t).
Nous avons démontré [Li03] par ailleurs que pour un
système avec des valeurs de mi et ki quelconques (avec
mi < ki, pour i = 1, 2, … N qui représente le numéro de
source), cette condition suffisante peut être équivalente à
la condition définie dans le cas du temps réel dur : (k,k)-
firm.
Pour un ensemble concret de sources, un
programme développé dans [Li03] peut être utilisé
pour évaluer la différence en terme de demande de
capacité de traitement du serveur entre (m,k)-firm et
(k,k)-firm.
Figure 6 et Figure 7 montrent ce qu’on peut
obtenir par ce programme pour le cas concret du
Tableau 3. L’abscisse représente un intervalle de
temps L et l’ordonnée la demande de serveur devant
être exécutée avant la fin de l’intervalle de temps L
(i.e. arrivée cumulative du travail). Dans chaque
figure la courbe supérieure correspond à la demande
de (k,k)-firm et celle inférieure correspond à la
demande de (m,k)-firm. On a supposé que toutes les
DBPi(t) = 1 (le pire cas) pour (m,k)-firm.
contrainte (m,k) Ci Ti
= Di
Source 1 (2,5) 8 12
Source 2 (4,5) 10 20
Source 3 (3,6) 2 5
Source 4 (1,5) 4 6
Tableau 3. Un cas concret du MIQSS
On peut constater que la demande de serveur de
(m,k)-firm ne dépasse jamais celle de (k,k)-firm mais
les deux courbes se superposent pour des petites
valeurs de L.
Comment éviter cette situation indésirable constitue
alors un objectif de nos travaux futurs car le
dimensionnement du serveur du modèle MIQSS en
dépend directement. Dans [Li03] une analyse des causes
de la superposition est développée et nous concluons que
la meilleure approche d’ordonnancement et les meilleurs
κ-patterns doivent être donnés par le serveur
(ordonnanceur). Ce qui peut être réalisé par
l’établissement d’un protocole de négociation de la QdS
entre les sources et l’ordonnanceur.
t(ms)
workload
10 20 30 40 50 60
Figure 6. Différence en demande de serveur
entre conditions 1 de [Li03] et de [Jeffay91]
t(ms) t(ms)
workload
10 20 30 40 50 60 t(ms)
Figure 7. Différence en demande de serveur
entre conditions 2 de [Li03] et de [Jeffay91]5. Conclusion et perspectives
Offrir la QdS temps réel avec dégradation
contrôlée selon le modèle (m,k)-firm consiste en une
piste intéressante pour la conception des systèmes
temps réel adaptatifs. En effet par rapport à la
conception des lois de commande adaptatives en
fonction de la variation de la QdS dans un système de
contrôle-commande distribué, qui est basée sur une
métrologie explicite en temps réel de la QdS du réseau
[Michaut03], une approche utilisant par exemple DBP
a l’avantage d’être simple car la « métrologie » de la
QdS du système (certes se réduit au seul paramètre
qui est équivalent à la charge) est réalisée
implicitement par la k-séquence qui peut être
considérée comme un historique de la QdS du réseau.
Parmi les algorithmes d’ordonnancement sous
contrainte (m,k)-firm, nous préférons les algorithmes
dynamiques tels que DBP et DWCS aux algorithmes
utilisant un κ-pattern fixe. Ceci pour essentiellement
deux raisons : la capacité d’adaptation en-ligne à la
variation d’état du système (variation en flux d’entrée,
en capacité de traitement du serveur, …) et le
potentiel de mieux utiliser le serveur dans le modèle
MIQSS. Cette dernière est simple à comprendre.
Considérons une source ayant déjà les m premiers
clients servis. Le serveur, en cas de surcharge, peut ne
pas servir les k-m clients suivants tout en satisfaisant
la contrainte de (m,k)-firm. Tandis qu’avec un κ-
pattern fixe, le serveur ayant déjà servi les m premiers
clients (critiques et optionnels) risque de continuer à
servir encore des clients s’il y des clients critiques
dans les k-m clients suivants selon le κ-pattern.
Nos travaux futurs visent principalement deux
directions : 1) Implémentation de la gestion dynamique
de QdS selon le modèle (m,k)-firm dans les réseaux; 2)
Recherche de conditions suffisantes d’ordonnançabilité
avec d’autres algorithmes d’ordonnancement pour la
garantie déterministe de (m,k)-firm ainsi que leur
exploitation pour le dimensionnement du serveur dans le
modèle MIQSS.
References
[ARTIST03] Project IST-2002-34820, Roadmap, “Adaptive
Real-Time Systems for Quality of Service Management”,
http://www.systemes-critiques.org/ARTIST/Roadmaps/ ,
May 6th 2003.
[Bernat01] Bernat, G., A. Burns and A. Llamosi, “Weakly-hard
real-time systems”, IEEE Transactions on Computers,
50(4), pp.308-321, April 2001.
[Bernat97] Bernat G. and A. Burns, “Combining (n, m)-hard
deadlines and dual priority scheduling”, Proceedings of
Real-Time Systems Symposium, pages 46–57, Dec 1997.
[Chang00] Chang, C. S., Performance Guarantees in
Communication Networks. New York: Springer-Verlag,
2000.
[Chow01] Chow, M.Y., Y. Tipsuwan, “Network-based control
adaptation for network QoS variation”, IEEE Military
Communications Conference (MILCOM2001), Vol. 1,
pp257 -261, 2001.
[Chung90] Chung, J.Y., Liu, J.W. and Lin, K.J., “Scheduling
periodic jobs that allows imprecise results”, IEEE Trans.
on Computers, 39(9):1156-1175, sep. 1990.
[El-Gendy03] El-Gendy, M.A., A. Bose, K.G. Shin, “Evolution
of the Internet QoS and support for soft real-time
applications”, proceedings of the IEEE, Vol.91, No.7,
pp1086-1104, July 2003.
[Furht99] Furht, B. (Editor), Handbook of multimedia
computing, CRC Press LLC, 1999.
[Hamdaoui95] Hamdaoui M. and P. Ramanathan, “A dynamic
priority assignment technique for streams with (m, k)-
firm deadlines”, IEEE Transactions on Computers,
44(4), 1443–1451, Dec.1995.
[Hamdaoui97] Hamdaoui M. and P. Ramanathan, “Evaluating
Dynamic Failure Probability for Streams with (m, k)-
firm Deadline”, IEEE Transactions on Computers,
46(12), pp.1325–1337, Dec.1997.
[Jeffay91] Jeffay, K., Stanat, D.F. and Martel, C.U., “On Non
Pre-emptive Scheduling of Periodic and Sporadic Task”,
IEEE real-time systems symposium, pp129-139, San
Antonio (USA), Dec. 4-6, 1991.
[Jumel03] Jumel, F., N. Navet, F. Simonot-Lion, « Influence
des performances d'une architecture informatique sur la
fiabilité des systèmes échantillonnés ». Edition Teknéa
RTS'2003. (Paris). 2003.
[Koubâa04a] Koubâa, A., Song, Y.Q., “Loss-Tolerant QoS
using Firm Constraints in Guaranteed Rate Networks”,
10th IEEE Real-Time and Embedded Technology and
Applications (RTAS'2004), Toronto (Canada) 25-28 May
2004.
[Koubâa04b] Koubâa, A., Gestion de la qualité de service
temporelle selon la contrainte (m,k)-firm dans les
réseaux à commutation de paquets, Thèse de l’INPL,
Nancy, 27 octobre 2004.
[LeBoudec02] Le Boudec, J.Y. and P. Thiran, Network
Calculus: A Theory of Deterministic Queueing Systems
For The Internet, Online Version of the Book of Springer
Verlag – LNCS 2050, July 2002.
[Li03] Li, J., « Sufficient condition for guaranteeing (m,k)-firm
real-time requirement under NP-DBP-EDF scheduling »,
Rapport de DEA d’informatique de Lorraine, LORIA,
Juin 2003.
[Li04] Li, J., Y.Q. Song, F. Simonot-Lion, « Schedulability
analysis for systems under (m,k)-firm constraints »,
WFCS2004, Vienna (Austria), Sept. 22-24, 2004.
[Martin04] Martin S., « Maîtrise de la dimension temporelle de
la Qualité de Service dans les réseaux », Thèse
Université Paris 12 (projet Hipercom INRIA), 6 Juillet
2004. [Michaut03] Michaut F., « Adaptation des applications
distribuées à la Qualité de Service fournie par le réseau
de communication », Thèse UHP Nancy 1, 26 Nov.
2003.
[Nilsson98] Nilsson, J., et al, “Stochastic analysis and control
of real-time systems with random time delays”,
Automatica, vol.34, pp.57-64, 1998.
[Parekh93] Parekh, A.K., R.G. Gallager, “A generalized
processor sharing approach to flow control in integrated
services networks: the single-node case”, IEEE/ACM
Transactions on Networking, Volume 1, Issue 3, pp344-
357, June 1993.
[Quan00] Quan G. and X. Hu, “Enhanced Fixed-priority
Scheduling with (m, k)-firm Guarantee”, Proc. Of 21st
IEEE Real-Time Systems Symposium, pp.79-88, Orlando,
Florida, (USA), November 27-30, 2000.
[Ramanathan99] Ramanathan P., “Overload management in
Real-Time control applications using (m, k)-firm
guarantee”. IEEE Transactions on Parallel and
Distributed Systems, 10(6):549–559, June 1999.
[Wang02] Wang, S., Y. Wang, K. Lin, “Integrating Priority
with Share in the Priority-Based Weighted Fair Queueing
Scheduler for Real-Time Networks” Journal of RTS,
p119-149, 2002.
[West04] West, R., Y. Zhang, K. Schwan and C. Poellabauer,
"Dynamic Window-Constrained Scheduling of RealTime
Streams in Media Servers", IEEE Transactions on
Computers, Volume 53, Number 6, pp. 744-759, June
2004.
[West99] West, R. and K. Schawn, “Dynamic windowconstrained
scheduling for multimedia applications”, 6th
International Conf. On Multimedia Computing and
Systems, ICMCS’99, IEEE, June 2000.
Introduction `a l’analyse syntaxique et `a la compilation
Roberto M. Amadio
To cite this version:
Roberto M. Amadio. Introduction `a l’analyse syntaxique et `a la compilation. Ecole d’ing´enieur. ´
Paris Diderot (Paris 7), 2009, pp.68.
HAL Id: cel-00373150
https://cel.archives-ouvertes.fr/cel-00373150v2
Submitted on 25 Jun 2009
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Introduction `a l’analyse syntaxique et `a la compilation
(notes de cours) ∗
Roberto M. Amadio
Universit´e Paris Diderot (Paris 7)
25 juin 2009
R´esum´e
Ces notes de cours sont une introduction aux diff´erentes phases de la compilation des
langages de programmation. Apr`es un survol de ces phases bas´e sur un petit langage
d’expressions arithm´etiques, on pr´esente la th´eorie des grammaires alg´ebriques LL et LR.
On s’int´eresse ensuite `a l’´evaluation et au typage en s’appuyant sur les techniques de la
s´emantique op´erationnelle. On d´ecline ces techniques dans le cadre de simples langages qui
refl`etent les styles de programmation imp´eratif, `a objets et fonctionnel. Enfin, on aborde
les questions de la conception d’une machine virtuelle, de la gestion de la m´emoire et de
la traduction du langage source dans le langage d’une machine virtuelle.
∗Envoyez vos corrections `a amadio@pps.jussieu.fr
1Table des mati`eres
1 Pr´eliminaires 4
1.1 Objectifs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Programme du cours et des travaux pratiques . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Pr´e-requis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Bibliographie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Introduction 6
2.1 Le langage source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 L’analyse lexicale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 L’analyse syntaxique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 La syntaxe abstraite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 L’´evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.6 Le typage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.7 Une machine virtuelle et son langage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.8 La compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3 Grammaires Alg´ebriques (rappel) 14
3.1 Grammaires . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 D´erivations et ambigu¨ıt´e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3 Simplification de grammaires non-contextuelles . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.4 Automates `a pile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.5 Automates `a pile d´eterministes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4 Grammaires LL 18
4.1 Fonctions First et Follow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.2 Grammaires LL(1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5 Grammaires LR 22
5.1 Probl`emes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2 Pragmatique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.3 Survol des r´esultats les plus importants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.4 Grammaires LR(0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.5 Grammaires LR(1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6 Evaluation et typage d’un langage imp´eratif 31 ´
6.1 Syntaxe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.2 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 ´
6.3 Extension avec proc´edures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.4 Mise-en-oeuvre . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.5 Liaison et ´evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.6 Typage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7 Evaluation et typage d’un langage `a objets 42 ´
7.1 Syntaxe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7.2 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 ´
7.3 Typage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8 Evaluation et typage d’un langage fonctionnel 48 ´
8.1 Substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.2 Appel par nom et appel par valeur . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.3 Typage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.4 Un ´evaluateur pour le langage fonctionnel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
8.5 Vers une mise en oeuvre . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
8.6 Mise en oeuvre de l’´evaluateur . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
29 Machine virtuelle et compilation 55
9.1 Instructions du code octet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.2 Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
9.3 Erreurs et typage du code octet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10 Gestion de la m´emoire 62
10.1 Marquage et balayage (mark and sweep) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
10.2 Comptage des r´ef´erences (reference counting) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
10.3 R´ecup´eration par copie (copying collection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
10.4 Inversion de pointeurs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
31 Pr´eliminaires
1.1 Objectifs
A l’issu de ce cours, l’´etudiant doit ˆetre capable :
– de d´ecrire la syntaxe abstraite d’un langage de programmation et de construire un
analyseur syntaxique pour ce langage `a l’aide d’outils standards.
– de comprendre la description formalis´ee de la s´emantique op´erationnelle et de la s´emantique
statique d’un langage (principalement le typage).
– de programmer un ´evaluateur et un v´erificateur de correction statique.
– d’´ecrire un compilateur vers une simple machine virtuelle et de mettre en oeuvre la
machine virtuelle (notamment la gestion de la m´emoire).
1.2 Programme du cours et des travaux pratiques
– Syntaxe des langages de programmation.
– Principes de l’analyse syntaxique descendante (LL) et montante (LR).
– Pr´esentation des outils Lex et Yacc sous OCAML.
– R´ealisation d’un analyseur syntaxique complet.
– Evaluation et typage d’un langage imp´eratif, d’un langage `a objets et d’un langage ´
fonctionnel.
– R´ealisation d’un ´evaluateur et d’un v´erificateur de type pour un langage `a objets.
– Machine virtuelle et fonction de compilation pour le langage imp´eratif.
– Principes de gestion de la m´emoire.
1.3 Pr´e-requis
Notions d’algorithmique et de logique. Notions de programmation imp´erative, `a objets et
fonctionnelle. Notions de langages formels : langages rationnels et alg´ebriques.
1.4 Bibliographie
Ces notes ne sont qu’une trace synth´etique de ce qui est discut´e dans le cours. On pourra
se r´ef´erer aux textes suivants pour une pr´esentation plus approfondie.
– A. Appel. Modern compiler implementation in ML, Cambridge University Press (en
anglais seulement).
– A. Aho, R. Sethi et J. Ullman. Compilateurs : principes, techniques et outils. Dunod
(disponible aussi en anglais). Un classique, notamment pour la partie sur l’analyse
syntaxique.
– R. Wilhelm, D. Maurer. Les compilateurs— th´eorie, construction, g´en´eration, Masson
(disponible aussi en anglais). Les quatre premiers chapitres de ce texte contiennent
des descriptions assez compl`etes de machines virtuelles pour des langages imp´eratifs,
fonctionnels, `a objets et logiques.
Ces notes de cours consid`erent uniquement des langages de programmation s´equentiels
de type imp´eratif, `a objets et fonctionnel. On fait l’impasse sur les questions de compilation
li´ees aux langages parall`eles et/ou avec des contraintes de temps r´eel. Par ailleurs, on ignore
les probl`emes d’optimisation et de g´en´eration de code qui sont associ´es `a la compilation vers
4les langages assembleurs. Ces questions comprennent, par exemple, l’optimisation de boucles,
l’analyse de vivacit´e et l’allocation de registres.
52 Introduction
Que fait un ordinateur ? Il ex´ecute des commandes. Que fait un compilateur ? Il traduit
des commandes formul´ees dans un certain langage L (dit langage source) dans les commandes
d’un langage L
0
(dit langage objet) compr´ehensible par l’ordinateur. Avant de traduire, il faut
s’assurer que la ‘phrase’ `a traduire soit bien une phrase du langage source. C’est le but de
l’analyse syntaxique.
Dans ce cours un langage est toujours un langage de programmation et dans ce contexte on
parle de compilation plutˆot que de traduction. Notre premier objectif est d’introduire un petit
langage de programmation et de s’en servir pour illustrer de fa¸con informelle les diff´erentes
phases de l’analyse syntaxique et de la compilation.
2.1 Le langage source
Le langage source consid´er´e est un langage d’expressions. Il comprend :
– Des constantes qui d´enotent des nombres naturels : 0, 12, 345, . . .
– Des constantes qui d´enotent des valeurs bool´eennes : true, false.
– Des op´erateurs : +, ∗, and, or , . . .
– Des variables (ou identificateurs) : x, a45, zzz, . . .
Il est aussi possible de d´eclarer des identificateurs `a l’aide d’une instruction let in et de
composer les expressions `a l’aide d’une instruction if then else.
2.2 L’analyse lexicale
La premi`ere tˆache consiste `a identifier les unit´es lexicales de notre langage. Dans notre
cas, il s’agira de :
– Mots clefs (let, if,. . .)
– Symboles (+, ∗,(,), . . .)
– Identificateurs (toute suite de lettres et de chiffres qui commence par une lettre).
– Nombres (toute suite de chiffres).
Il faut aussi d´ecider quels sont les symboles qui permettent de s´eparer les unit´es lexicales.
Typiquement on choisit : le symbole blanc, le retour chariot et la tabulation. Enfin, on utilise
souvent un symbole sp´ecial eof pour marquer la fin du fichier.
Exemple 2.1 Dans
let x7= 3
in
(x7+4 )
eof
On devrait identifier les unit´es lexicales suivantes (qu’on s´epare avec un espace) :
let x7 = 3 in ( x7 + 4 ) eof
La sp´ecification des unit´es lexicales est effectu´ee `a l’aide d’expressions r´eguli`eres (on dit
aussi rationnelles). Cette approche est particuli`erement utile pour les unit´es lexicales comme
6les identificateurs qui comportent une infinit´e d’´el´ements. Par exemple, un identificateur est
sp´ecifi´e par les expressions r´eguli`eres :
chiffre = 0 + · · · + 9
lettre = a + · · · + z + A + · · · + Z
ident = lettre · (chiffre + lettre)
∗
A partir d’une expression r´eguli`ere, des algorithmes standards permettent de construire un
automate fini qui reconnaˆıt exactement les unit´es lexicales sp´ecifi´ees. L’outil Lex permet
d’automatiser compl`etement ce travail. L’utilisateur d´ecrit les unit´es lexicales et l’outil g´en`ere
une fonction qui permet de lire la prochaine unit´e lexicale disponible en entr´ee ou d’afficher
un signal d’erreur si aucune unit´e lexicale est reconnue.
2.3 L’analyse syntaxique
Grˆace `a l’analyse lexicale, nous pouvons voir le langage source comme un mot dont les
caract`eres sont les unit´es lexicales. Ainsi, dans le cas de l’exemple 2.1, on pourrait obtenir un
mot de la forme :
let id(x7 ) eq cnst(3 ) in lpar id(x7 ) plus cnst(4 ) rpar eof
Certains caract`eres du mot en question comme id et cnst ont un param`etre. Ce param`etre est
une valeur qui est associ´ee `a l’unit´e lexicale. La prochaine tˆache consiste `a d´ecrire la structure
des phrases du langage en s’appuyant sur la th´eorie des grammaires non-contextuelles (ou
alg´ebriques). Par exemple, voici une grammaire qui d´ecrit notre langage :
op → plus | prod | and | · · ·
e → id | cnst | e op e | lpar e rpar
b → e | if e then b else b | let id eq e in b | lpar b rpar
S → b eof
Et voici une d´erivation gauche :
S ⇒ b eof
⇒ let id eq e in b eof
⇒ let id eq cnst in b eof
⇒ let id eq cnst in e eof
⇒ let id eq cnst in lpar e rpar eof
⇒ let id eq cnst in lpar e plus e rpar eof
⇒ let id eq cnst in lpar id plus e rpar eof
⇒ let id eq cnst in lpar id plus cnst rpar eof
On remarquera que les unit´es lexicales sont les symboles terminaux de la grammaire.
Un premier probl`eme est de d´eterminer si une certaine suite d’unit´es lexicales appartient au
langage g´en´er´e par la grammaire. Il y a des algorithmes g´en´eraux qui permettent de r´epondre
`a cette question mais ces algorithmes ne sont pas tr`es efficaces. Par ailleurs, une grammaire
peut ˆetre ambigu¨e et cette ambigu¨ıt´e est nuisible au processus de compilation. Dans les ann´ees
70 on a donc d´efini un certain nombre de sous-classes des langages alg´ebriques. Les contraintes
principales qu’on souhaite satisfaire sont les suivantes :
1. On s’int´eresse `a des grammaires alg´ebriques non-ambigu¨es.
72. Le langage g´en´er´e doit ˆetre reconnaissable par un automate `a pile d´eterministe (APD).
3. La construction de l’APD `a partir de la grammaire doit ˆetre suffisamment efficace.
4. La classe de grammaires consid´er´ee doit ˆetre suffisamment expressive pour traiter les
constructions principales des langages de programmation.
L’analyse syntaxique ne se limite pas `a d´eterminer si un mot peut ˆetre g´en´er´e par une
grammaire. Deux autres objectifs aussi importants sont :
– Si le mot n’est pas dans le langage g´en´er´e, il faut produire un message d’erreur informatif
qui facilite la correction du programme. Par exemple : Missing ) at line 342.
– Si le mot peut ˆetre g´en´er´e, alors on veut construire une repr´esentation interne du programme
qui permettra d’effectuer d’autres v´erifications (analyse statique) et ´eventuellement
de proc´eder `a une compilation. On appelle aussi syntaxe abstraite cette repr´esentation
interne.
2.4 La syntaxe abstraite
La ‘syntaxe abstraite’ d’un programme est essentiellement un arbre ´etiquet´e. Le fait de
passer d’une repr´esentation lin´eaire (un mot) `a une repr´esentation `a arbre permet d’´eliminer
certaines informations syntaxiques comme les parenth`eses. Dans des langages `a la ML, la
repr´esentation d’un arbre ´etiquet´e est directe `a l’aide de d´eclarations de type et de constructeurs.
Par exemple, dans notre cas on pourrait avoir :
op = Plus | And | ...
exp = Id of string | Cnst of int | Op of op * exp * exp
body = Exp of exp | Ite of exp * body * body | Let of string * exp * body
Ainsi la syntaxe abstraite associ´ee `a notre programme serait :
Let("x7", Exp(Cnst(3)), Exp(Op(Plus, Id("x7"), Cnst(4))))
Dans d’autres langages comme C ou Java, la repr´esentation d’un arbre ´etiquet´e demande
un certain travail de codage (enregistrements, pointeurs,. . .)
La construction de l’arbre s’effectue en associant des ‘actions s´emantiques’ aux r`egles de
la grammaire. Par exemple, l’action qu’on associe `a la r`egle b → let id eq e in b pourrait
ˆetre celle de construire un arbre dont la racine est ´etiquet´ee par Let et qui a trois fils qui
correspondent aux arbres associ´es `a id, e et b, respectivement.
2.5 L’´evaluation
Toute traduction (ou compilation) suppose une pr´eservation de la signification (ou s´emantique)
de la phrase traduite. Comment faire pour d´ecrire la s´emantique d’un langage de programmation
? Une id´ee g´en´erale qui s’applique aussi bien aux automates qu’aux langages de
programmation est de d´ecrire formellement le calcul et de retenir le ‘r´esultat’ du calcul. Cette
id´ee est ad´equate au moins pour les langages s´equentiels et d´eterministes que nous traitons
dans ce cours.
Dans notre ´etude de cas, nous pouvons ´etablir que le r´esultat du calcul d’une expression
est une valeur v, `a savoir ou bien un bool´een ou bien un nombre naturel. Pour d´ecrire le
calcul on utilise une relation ⇓. Cette relation est d´efinie sur la syntaxe abstraite mais pour
8des raisons de lisibilit´e on l’´ecrit toujours en utilisant la syntaxe concr`ete. La relation est
d´efinie par les r`egles suivantes.
v ⇓ v
ei ⇓ ni ∈ N i = 1, 2
e1 + e2 ⇓ n1 + n2
e ⇓ true b1 ⇓ v
if e then b1 else b2 ⇓ v
e ⇓ false b2 ⇓ v
if e then b1 else b2 ⇓ v
e
0 ⇓ v
0
[v
0/x]b ⇓ v
let x = e
0
in b ⇓ v
Ici on se limite au cas o`u op est l’addition sur les nombres naturels.
On d´enote par [v/x]b la substitution de v pour x dans b qui est d´efinie par r´ecurrence sur
la structure de b :
[v/x]v
0 = v
0
[v/x]y =
(
v si x = y
y sinon
[v/x](e1 + e2) = [v/x]e1 + [v/x]e2
[v/x](if e then b1 else b2) = if [v/x]e then [v/x]b1 else [v/x]b2
[v/x](let y = e in b) = (
let y = [v/x]e in b si x = y
let y = [v/x]e in [v/x]b sinon
On remarquera que dans [v/x](let x = e in b) l’op´eration de substitution n’affecte pas b car
la variable x est li´ee `a l’expression e dans b.
Voici un exemple d’application des r`egles :
3 ⇓ 3 4 ⇓ 4
3 ⇓ 3 [3/x](x + 4) ⇓ 7
let x = 3 in (x + 4) ⇓ 7
On ne peut pas ´evaluer une expression qui contient une variable non d´eclar´ee. Par exemple, on
ne peut pas ´evaluer let x = 3 in y. Par ailleurs, le branchement if e then b1 else b2 ⇓ v est d´efini
seulement si le test e s’´evalue en une valeur bool´eenne. Il est toujours possible de compl´eter
la d´efinition de la s´emantique de fa¸con `a prendre en compte ces situations anormales. A cette
fin, on introduit la possibilit´e qu’une expression s’´evalue en une nouvelle valeur err . On peut
9alors reformuler et compl´eter les r`egles comme suit :
v ⇓ v
ei ⇓ ni ∈ N i = 1, 2
e1 + e2 ⇓ n1 + n2
ei ⇓ vi i = 1, 2 {v1, v2} 6⊂ N
e1 + e2 ⇓ err
e ⇓ true b1 ⇓ v
if e then b1 else b2 ⇓ v
e ⇓ false b2 ⇓ v
if e then b1 else b2 ⇓ v
e ⇓ v v /∈ {true, false}
if e then b1 else b2 ⇓ err
e
0 ⇓ v
0 v
0 6= err [v
0/x]b ⇓ v
let x = e
0
in b ⇓ v
e
0 ⇓ err
let x = e
0
in b ⇓ err
x ⇓ err
2.6 Le typage
Certaines erreurs peuvent ˆetre ´evit´ees si le programme satisfait des contraintes additionnelles
de bonne formation. Une m´ethode standard pour formuler ces contraintes est de donner
des r`egles de typage. Un type est une abstraction d’un ensemble de valeurs. Dans notre cas,
nous consid´erons un type bool pour l’ensemble des valeurs bool´eennes {true, false} et un type
nat pour l’ensemble des nombres naturels.
Les jugements utilis´es dans les r`egles de typage ont la forme E ` b : τ o`u :
– τ ∈ {bool, nat} est un type.
– E est un environnement de type, c’est-`a-dire une fonction partielle `a domaine fini des
identificateurs aux types.
Il convient d’introduire un minimum de notations :
– On repr´esente par x1 : τ1, . . . , xn : τn o`u xi 6= xj si i 6= j l’environnement de type E tel
que E(xi) = τi pour i = 1, . . . , n et qui n’est pas d´efini autrement.
– Si f : D * D0
est une fonction partielle, d ∈ D et d
0 ∈ D0 alors
f[d
0
/d](x) = (
d
0
si x = d
f(x) autrement
Par exemple, E[τ /x] est l’environnement de type qui se comporte comme E sauf sur x
o`u il rend le type τ .
– On d´enote par ∅ l’environnement de type `a domaine vide et on abr`ege le jugement
∅ ` b : τ avec ` b : τ .
Les r`egles de typage sont les suivantes :
n ∈ N
E ` n : nat
v ∈ {true, false}
E ` v : bool
E(x) = τ
E ` x : τ
E ` ei
: nat i = 1, 2
E ` e1 + e2 : nat
E ` e : bool E ` bi
: τ i = 1, 2
E ` if e then b1 else b2 : τ
E ` e : τ
0 E[τ
0/x] ` b : τ
E ` let x = e in b : τ
10Voici un exemple de preuve de typage.
x : nat ` x : nat x : nat ` 4 : nat
` 3 : nat x : nat ` (x + 4) : nat
` let x = 3 in x + 4 : nat
On remarquera que la valeur err n’est pas typable. Notre objectif est de montrer qu’une
expression typable ne peut pas s’´evaluer `a err . Comme la valeur err n’est pas typable, il suffit
de montrer que la relation d’´evaluation pr´eserve la typabilit´e.
Proposition 2.2 Si x1 : τ1, . . . , xn : τn ` b : τ , ` vi
: τi pour i = 1, . . . , n et [v1/x1, . . . , vn/xn]b ⇓
v alors ` v : τ .
Idee de la preuve ´ . Par r´ecurrence sur le typage de b. On se limite `a traiter le cas le plus
int´eressant o`u le programme a la forme let x = e in b. On suppose x 6= xi pour i = 1, . . . , n.
Le cas o`u x = xi est similaire. Soient E = x1 : τ1, . . . , xn : τn et S = [v1/x1, . . . , vn/xn]. On
sait que la preuve de typage termine par :
E ` e : τ
0 E[τ
0/x] ` b : τ
E ` let x = e in b : τ
Par ailleurs, on sait que :
S(let x = e in b) = (let x = Se in Sb) ⇓ v
Par d´efinition de l’´evaluation, on doit avoir Se ⇓ v
0
. Par hypoth`ese de r´ecurrence sur E ` e : τ
0
,
il suit que ` v
0
: τ
0
. Donc v
0 6= err . Mais alors on doit avoir : S[v
0/x]b ⇓ v. Par hypoth`ese de
r´ecurrence sur E[τ
0/x] ` b : τ , il suit que ` v : τ . •
Exercice 2.3 Montrez qu’il y a des expressions qui ne s’´evaluent pas en erreur et qui ne sont
pas typables.
Exercice 2.4 D´emontrez une version plus forte de la proposition 2.2, `a savoir si x1 : τ1, . . . , xn :
τn ` b : τ et ` vi
: τi pour i = 1, . . . , n alors [v1/x1, . . . , vn/xn]b ⇓ v et ` v : τ . Cette version
‘forte’ ne se g´en´eralise pas `a des langages plus compliqu´es car souvent le typage ne suffit pas
`a assurer la terminaison du programme ´evalu´e.
2.7 Une machine virtuelle et son langage
Une machine virtuelle est un ensemble de structures de donn´ees et d’algorithmes qui
permettent d’ex´ecuter (efficacement) un certain ensemble d’instructions. En d’autres termes,
une machine virtuelle peut ˆetre vue comme un type de donn´ee.
On consid`ere une machine virtuelle dont la m´emoire est divis´ee en deux parties :
– Une zone statique qui contient un compteur ordinal pc, un pointeur `a la pile sp et les
instructions du programme `a ex´ecuter.
– Une pile de valeurs dont le sommet est point´e par sp.
11On voit la m´emoire comme un tableau M et on d´enote, par exemple, par M[sp] la cellule du
tableau d’adresse sp. La machine peut ex´ecuter un certain nombre d’instructions dont nous
d´ecrivons l’effet sur les structures de la machine virtuelle :
build v sp := sp + 1; M[sp] := v; pc := pc + 1
branch j (si M[sp] = true alors pc := pc + 1 sinon pc := j); sp := sp − 1
load i sp := sp + 1; M[sp] := M[i]; pc := pc + 1
add sp := sp − 1; M[sp] := M[sp] + M[sp + 1]; pc := pc + 1
return pc := 0; M[0] := M[sp]; sp := 0
Le cycle de chargement ex´ecution (fetch and execute) est :
pc := 1; sp := 0;
while pc 6= 0 do
execute(pc)
Donc le calcul termine quand pc = 0 et dans ce cas le r´esultat est `a l’adresse 0 de la pile.
On remarquera que la machine virtuelle ne v´erifie pas les types des donn´ees. Ainsi il est
possible d’ex´ecuter une instruction branch lorsque M[sp] ne contient pas une valeur bool´eenne
ou d’ex´ecuter une instruction add lorsque le sommet de la pile ne contient pas deux nombres
naturels. On pourrait ajouter des actions qui v´erifient les types au moment de l’ex´ecution.
Alternativement, on pourrait s’assurer statiquement que le code compil´e ne produit jamais
des erreurs de type.
2.8 La compilation
On souhaite compiler un programme b dans une liste d’instructions de la machine virtuelle.
On d´efinit une fonction de compilation C qui prend en param`etre une expression et une liste
de variables w et produit une liste d’instructions de la machine virtuelle. La liste w garde une
trace des d´eclarations let x = . . . et naturellement au d´ebut de la compilation on suppose que
la liste est vide. Nous utilisons la notation i(x, w) pour indiquer la position la plus `a droite
de l’occurrence de x dans w. Par exemple i(x, y · x · z · x · y) = 4.
C(x, w) = (load i(x, w)) · (return)
C(v, w) = (build v) · (return)
C(e1 + e2, w) = C
0
(e1, w) · C0
(e2, w) · (add) · (return)
C
0
(x, w) = load i(x, w)
C
0
(v, w) = build v
C
0
(e1 + e2, w) = C
0
(e1, w) · C0
(e2, w) · (add)
C(let x = e in b, w) = C
0
(e, w) · C(b, w · x)
C(if e then b1 else b2, w) = C
0
(e, w) · (branch κ) · C(b1, w) · κ : C(b2, w)
On introduit une fonction auxiliaire C
0 qui ne retourne pas le r´esultat `a la fin du calcul. Dans
la derni`ere ´equation, nous utilisons la notation κ : C(. . .) pour indiquer que l’adresse de la
premi`ere instruction de C(. . .) est κ.
Exemple 2.5 La compilation de l’expression
let x = 3 in
let y = x + x in
let x = true in
if x then y else x
12est la suivante o`u dans la troisi`eme colonne on pr´esente le contenu de la pile au moment de
l’ex´ecution :
1 : build 3
2 : load 1 3
3 : load 1 3 3
4 : add 3 3 3
5 : build true 3 6
6 : load 3 3 6 true
7 : branch 10 3 6 true true
8 : load 2 3 6 true
9 : return 3 6 true 6
10 : load 3 (code mort)
11 : return (code mort)
On remarquera que certaines instructions sont redondantes ou inaccessibles (code mort).
Exercice 2.6 Consid´erez :
b = let x = 3 in
let x = x + x in
let y = true in
if y then x + x else x
Calculez les unit´es lexicales, l’arbre de d´erivation et la syntaxe abstraite de b. Evaluez et typez ´
b. Compilez b et ex´ecutez le code compil´e.
Un point important que nous omettons de traiter ici est celui de la correction de la
fonction de compilation. Un premier pas pourrait consister `a montrer que la compilation d’un
programme bien typ´e ne produit pas d’erreurs au moment de l’ex´ecution. Ensuite, on pourrait
chercher `a montrer que si un programme bien typ´e s’´evalue dans une valeur v alors l’ex´ecution
du code compil´e produira comme r´esultat la valeur v.
133 Grammaires Alg´ebriques (rappel)
3.1 Grammaires
D´efinition 3.1 Une grammaire G est un vecteur (V, Σ, S, R) o`u V est un ensemble fini de
symboles terminaux et non-terminaux, Σ ⊆ V est l’ensemble des symboles terminaux, S ∈
V \Σ est le symbole initial (et un non-terminal), et R ⊆fin V
+ × V
∗
est l’ensemble des r`egles
(ou productions).
Par convention, on utilise a, b, . . . pour les symboles terminaux, u, v, . . . pour les mots sur
Σ, A, B, . . . , S pour les symboles non-terminaux, X, Y, . . . pour les symboles terminaux et
non-terminaux et α, β, γ, . . . pour les mots sur V . On ´ecrit (α, β) ∈ R comme α → β. La
notation α → β1 | · · · | βn est une abr´eviation pour α → β1, . . . , α → βn.
Une configuration est simplement un mot sur V . Si α, β ∈ V
∗
sont des configurations alors
α ⇒ β (α se r´e-´ecrit dans β dans une ´etape) si
α = γ1γγ2, γ → γ
0
et β = γ1γ
0γ2 .
On d´enote par ⇒∗
la clˆoture r´eflexive et transitive de ⇒. Le langage L(G) g´en´er´e par une
grammaire G est d´efini par
L(G) = {w ∈ Σ
∗
| S ⇒∗ w} .
Dans les ann´ees 60, Noam Chomsky a propos´e une classification des grammaires selon le
type des r`egles utilis´ees. En particulier :
Lin´eaires droites Les r`egles ont la forme A → w ou A → wB avec A, B ∈ V \Σ et w ∈ Σ
∗
.
Ces grammaires g´en`erent exactement les langages r´eguliers (ou rationnels).
Non contextuelles Les r`egles ont la forme A → α avec A ∈ V \Σ et α ∈ V
∗
. Ces grammaires
g´en`erent exactement les langages non-contextuels (on dit aussi alg´ebriques).
Exemple 3.2 La grammaire suivante d´ecrit les mots sur l’alphabet {a, b} qui peuvent ˆetre
lus indiff´eremment de gauche `a droite et de droite `a gauche.
S → | a | b | aSa | bSb .
La grammaire est non-contextuelle mais elle n’est pas lin´eaire droite.
3.2 D´erivations et ambigu¨ıt´e
Soit G = (V, Σ, S, R) une grammaire non-contextuelle. Une d´erivation est une s´equence
de pas de r´e´ecriture qui m`ene du symbole S `a un mot w ∈ Σ
∗
. Une d´erivation gauche (droite)
est une d´erivation o`u dans tous les pas de r´e´ecriture on d´eveloppe le symbole non-terminal le
plus `a gauche (droite).
Une d´erivation peut ˆetre repr´esent´ee par un arbre de d´erivation dont les noeuds sont
´etiquet´es par les symboles dans V . La racine de l’arbre est ´etiquet´ee avec le symbole initial
S. Quand une r`egle A → X1 · · · Xn avec Xi ∈ V est appliqu´ee, on ajoute n fils au noeud qui
correspond `a A et on les ´etiquette avec X1, . . . , Xn. On remarque qu’il peut y avoir plusieurs
d´erivations qui produisent le mˆeme arbre mais que les d´erivations gauches (droites) sont en
correspondance bijective avec les arbres de d´erivation.
14D´efinition 3.3 (ambigu¨ıt´e) Une grammaire est ambigu¨e s’il y a un mot w ∈ L(G) qui
admet deux arbres de d´erivation diff´erents. Un langage non-contextuel est ambigu si toutes
les grammaires non-contextuelles qui le g´en`erent sont ambigu¨es.
Exemple 3.4 Il est facile de v´erifier que la grammaire E → i | E + E | E ∗ E est ambigu¨e.
Il est beaucoup plus difficile de montrer que le langage {a
n
b
n
c
md
m | n, m ≥ 1} ∪ {a
n
b
mc
md
n
|
n, m ≥ 1} est ambigu.
Exercice 3.5 Soit G = (V, T, S, R) une grammaire non-contextuelle o`u V = {S, A, B, a, b},
T = {a, b} et
R = {S → | aB | bA, A → aS | bAA | a, B → bS | aBB | b}.
1. Donnez un arbre de d´erivation, ainsi que les d´erivations gauches et droites de la chaˆıne
aaabbabbba.
2. G est-elle ambigu¨e ?
3.3 Simplification de grammaires non-contextuelles
D´efinition 3.6 Soit G = (V, Σ, S, R) une grammaire non-contextuelle. Un symbole X ∈ V
est utile si ∃ w ∈ Σ
∗ S ⇒∗ αXβ ⇒∗ w.
Proposition 3.7 Soit G = (V, Σ, S, R) une grammaire non-contextuelle telle que L(G) 6= ∅.
Alors on peut construire une grammaire non-contextuelle ´equivalente G0
telle que tous les
symboles sont utiles.
Idee de la preuve ´ . On proc`ede en trois ´etapes.
(1) D’abord on montre qu’on peut ´eliminer tous les symboles non-terminaux qui ne peuvent
pas produire un mot de symboles terminaux. A cette fin, on calcule it´erativement le plus
petit ensemble U tel que : (i) si A → w alors A ∈ U et (ii) si A → X1 . . . Xn et Xi ∈ Σ ∪ U
pour tout i = 1, . . . , n alors A ∈ U. Ensuite, on ´elimine toutes les r`egles qui contiennent des
symboles non-terminaux qui ne sont pas dans U.
(2) On calcule it´erativement l’ensemble des symboles non-terminaux qui sont accessible `a
partir du symbole initial. Soit U le plus petit ensemble tel que (i) S ∈ U, et (ii) si A → α
et A ∈ U alors les non-terminaux dans α sont dans U. On ´elimine toutes les r`egles qui
contiennent des symboles non-terminaux qui ne sont pas dans U.
(3) En supposant (1) et (2), on peut aussi d´eterminer les symboles terminaux utiles. Ces sont
les symboles qui paraissent `a droite d’une des r`egles restantes. •
Exemple 3.8 On consid`ere la grammaire :
S → AB | a A → a
En appliquant la m´ethode pr´ec´edente on arrive `a la grammaire S → a. Remarquez que le
r´esultat n’est pas celui souhait´e si on applique la simplification (2) avant la simplification (1).
D´efinition 3.9 Une -r`egle est une r`egle de la forme A → .
15Proposition 3.10 Soit G = (V, Σ, S, R) une grammaire non-contextuelle. Alors :
(1) On peut d´eterminer si ∈ L(G).
(2) Si /∈ L(G) alors on peut construire une grammaire non-contextuelle ´equivalente sans
-r`egles.
(3) Si ∈ L(G) alors on peut construire une grammaire non-contextuelle ´equivalente qui
contient exactement une -r`egle de la forme S → o`u S est le symbole initial et tel que le
symbole initial S ne paraˆıt pas `a droite d’une r`egle.
Idee de la preuve ´ . (1) On calcule it´erativement les symboles non-terminaux qui peuvent
se r´eduire au mot .
(2) Pour chaque r`egle A → X1 · · · Xn on g´en`ere les sous-r`egles A → Xi1
· · · Xik
o`u 1 ≤ i1 <
· · · < ik ≤ n, k ≥ 1 et les ´el´ements effac´es Xj se r´e-´ecrivent en .
(3) Si ∈ L(G) alors la m´ethode d´ecrite dans (2) produit une grammaire G = (V, Σ, S, R)
qui g´en`ere le langage L(G)\{}. Ensuite on ajoute un nouveau symbole initial S
0
et les r`egles
S
0 → | S. •
Exemple 3.11 Consid´erons la grammaire S → aS0
b, S
0 → | aS0
b. L’´elimination de la
-r`egle m`ene `a la grammaire : S → ab | aS0
b, S
0 → ab | aS0
b.
Exercice 3.12 Soit G une grammaire non-contextuelle sans -r`egles. Montrez qu’on peut
´eliminer les r`egles de la forme A → B o`u A, B sont des symboles non-terminaux.
3.4 Automates `a pile
Un automate `a pile (AP) est un automate fini qui dispose en plus d’une pile. Les automates
`a pile reconnaissent exactement les langages non-contextuels.
D´efinition 3.13 Un automate `a pile M est un vecteur (Σ, Q, qo, F, Γ, Zo, δ) o`u Σ est l’alphabet
d’entr´ee, Q est un ensemble fini d’´etats, qo ∈ Q est l’´etat initial, F ⊆ Q est l’ensemble
des ´etats finaux, Γ est l’alphabet de la pile, Zo ∈ Γ est le symbole initialement pr´esent sur la
pile et enfin
δ : (Σ ∪ {}) × Q × Γ → 2
(Q×Γ
∗)
est la fonction de transition.
Une configuration est un triplet (w, q, γ) ∈ Σ
∗×Q×Γ
∗
. La relation de r´eduction est d´efinie
par
(aw, q, Zγ) `M (w, q0
, γ0γ) si (q
0
, γ0
) ∈ δ(a, q, Z)
(w, q, Zγ) `M (w, q0
, γ0γ) si (q
0
, γ0
) ∈ δ(, q, Z)
Donc M plac´e dans l’´etat q et avec le symbole Z au sommet de la pile peut se d´eplacer dans
l’´etat q
0
en rempla¸cant Z par γ
0 au sommet de la pile et en lisant (ou sans lire) un symbole
de l’entr´ee. On remarque qu’`a chaque pas un AP doit lire un symbole de la pile et que donc
le calcul s’arrˆete si la pile est vide.
Le langage reconnu par un AP M est d´efini par
L(M) = {w ∈ Σ
∗
| ∃ γ ∈ Γ
∗
, q ∈ F (w, qo, Zo) `
∗
M (, q, γ)} .
16Dans ce cas on dit que l’AP accepte sur ´etat final. Une d´efinition alternative consiste `a accepter
sur pile vide. Formellement
L(M) = {w ∈ Σ
∗
| ∃ q ∈ Q (w, qo, Zo) `
∗
M (, q, )} .
Si on prend la deuxi`eme d´efinition, il est inutile de sp´ecifier l’ensemble F d’´etats finaux dans
la d´efinition d’AP. Il n’est pas trop difficile de montrer qu’un langage est accept´e par un AP
sur ´etat final si et seulement si il est accept´e par un AP (pas forc´ement le mˆeme) sur pile
vide.
Un AP peut aussi ˆetre repr´esent´e comme un graphe dirig´e : une arˆete de l’´etat q `a l’´etat
q
0
est ´etiquet´ee par le triplet (a, X)/γ ssi (q
0
, γ) ∈ δ(a, q, X), o`u a ∈ Σ ∪ {}.
Proposition 3.14 Les langages reconnus par les AP sont exactement ceux g´en´er´es par les
grammaires non-contextuelles.
3.5 Automates `a pile d´eterministes
D´efinition 3.15 (APD) Un AP d´eterministe (APD) est un AP tel que chaque configuration
accessible a au plus un successeur imm´ediat.
Proposition 3.16 Les conditions suivantes assurent qu’un AP M = (Σ, Q, qo, F, Γ, Zo, δ)
est d´eterministe :
(1) ]δ(a, q, X) ≤ 1 pour a ∈ Σ ∪ {}.
(2) Si δ(, q, X) 6= ∅ alors ∀ a ∈ Σ δ(a, q, X) = ∅.
Les langages reconnus par les APD forment une classe interm´ediaire entre les langages
r´eguliers et les langages non-contextuels. En particulier, il n’est pas possible de d´eterminiser
les AP. Les langages reconnus par les APD sont stables par compl´ementaire mais pas par
union (ou intersection).
Exemple 3.17 Il n’y a pas d’APD qui puisse reconnaˆıtre le langage {a
i
b
j
c
k
| i = j ou j = k}.
Exercice 3.18 On consid`ere la grammaire G
S → aSbS | bSaS | .
Soit L le langage g´en´er´e par G et L
0 = L\{}. Montrez que :
1. La grammaire G est ambigu¨e.
2. Il y a une grammaire sans -r`egles qui g´en`ere le langage L
0
.
Exercice 3.19 Construisez un AP d´eterministe qui reconnaˆıt le langage g´en´er´e par la grammaire
:
S
0 → S$
S → if E then S else S L → end
S → begin S L L →; SL
S → print E E → num = num
174 Grammaires LL
On consid`ere une premi`ere classe de langages non-contextuels, dits langages LL (pour
left-to-right parse, leftmost derivation), qui sont reconnus par un APD. L’APD cherche `a
construire une d´erivation gauche en gardant sur la pile les symboles qui doivent encore ˆetre
r´e-´ecrits. Au d´ebut du calcul le symbole initial S est plac´e sur la pile. A chaque pas, l’automate
d´ecide (de fa¸con d´eterministe) quelle r`egle appliquer simplement en regardant les k premiers
symboles en entr´ee et le symbole au sommet de la pile. Nous consid´erons ici le cas k = 1.
4.1 Fonctions First et Follow
D´efinition 4.1 Soit G = (V, Σ, S, R) une grammaire non-contextuelle, A ∈ V \Σ et γ ∈ V
∗
.
On d´efinit :
(1) null(A) si A ⇒∗
.
(2) First(γ) = {a ∈ Σ | ∃ α γ ⇒∗ aα}.
(3) Follow(A) = {a ∈ Σ | S ⇒∗ αAaβ}.
Donc si a ∈ First(γ) alors on peut r´ecrire γ dans un mot dont le premier symbole est a.
D’autre part si a ∈ Follow(A) alors on peut trouver une d´erivation o`u a suit imm´ediatement
A.
On suppose que tous les symboles sont utiles (cf. section 3). Nous avons d´ej`a consid´er´e le
calcul du pr´edicat null (cf. section 3). Clairement First() = ∅ et si a ∈ Σ alors First(a) = {a}.
De plus,
First(X1 . . . Xn) = [
i=1,...,n
{First(Xi) | null(X1), . . . , null(Xi−1)} .
Il est donc suffisant de d´eterminer First sur les symboles non-terminaux. La fonction First
est la plus petite fonction (au sens de l’inclusion ensembliste) telle que pour toutes les r`egles
A → Y1 . . . YnXα, n ≥ 0, X ∈ V , on a
null(Yi), 1 ≤ i ≤ n ⇒ First(A) ⊇ First(X) .
La fonction Follow est la plus petite fonction telle que si A → αBY1 . . . YnXβ, n ≥ 0, X ∈ V
alors
null(Yi), 1 ≤ i ≤ n ⇒ Follow(B) ⊇ First(X)
et si A → αBY1 . . . Yn, n ≥ 0 alors
null(Yi), 1 ≤ i ≤ n ⇒ Follow(B) ⊇ Follow(A) .
4.2 Grammaires LL(1)
D´efinition 4.2 Une grammaire non-contextuelle G = (V, Σ, S, R) est LL(1) si pour tous
les symboles non-terminaux A avec r`egles A → α1 | · · · | αn les conditions suivantes sont
satisfaites :
(1) First(αi) ∩ First(αj ) = ∅ si i 6= j.
(2) Si null(A) alors First(αi) ∩ Follow(A) = ∅ pour i = 1, . . . , n.
18Exemple 4.3 Consid´erez la grammaire
S → d | ABS A → B | a B → | c
Alors
null First Follow
S non {a, c, d} ∅
A oui {a, c} {a, c, d}
B oui {c} {a, c, d}
La grammaire n’est pas LL(1) car par exemple null(A), A → a et a ∈ Follow(A) ∩ First(a).
Sans perte de g´en´eralit´e, on peut supposer que si null(A) alors A → est une r`egle de
la grammaire. Si la grammaire est LL(1) alors on associe au couple (a, A) ∈ Σ × (V \Σ) une
r`egle comme suit :
– Si a ∈ First(αi) alors on applique la r`egle A → αi
.
– Si null(A) et a ∈ Follow(A) alors on choisit la r`egle A → .
Ensuite on peut construire un APD M = (Σ, {qo} ∪ {qa | a ∈ Σ}, qo, V, S, δ) dont la
fonction de transition δ est d´efinie par :
δ(a, qo, a) = {(qo, )} si a ∈ Σ
δ(a, qo, A) = {(qa, α)} si a ∈ Σ, A → α, a ∈ First(α)
δ(a, qo, A) = {(qa, )} si a ∈ Σ, null(A), a ∈ Follow(A)
δ(, qa, a) = {(qo, )} si a ∈ Σ
δ(, qa, A) = {(qa, α)} si a ∈ Σ, A → α, a ∈ First(α)
δ(, qa, A) = {(qa, )} si a ∈ Σ, null(A), a ∈ Follow(A)
Exemple 4.4 Consid´erez la grammaire
S → iEtSeS | c E → b
On d´erive
null First Follow
S non {i, c} {e}
E non {b} {t}
Donc la grammaire est LL(1) et on peut construire un APD qui reconnaˆıt le langage g´en´er´e.
L’APD a comme alphabet d’entr´ee Σ = {i, t, e, c, b} et les transitions suivantes :
(qo, x, x) 7→ (qo, ) x ∈ Σ (qo, c, S) 7→ (qc, c)
(qo, i, S) 7→ (qi
, iEtSeS) (qo, b, E) 7→ (qb, b)
(qc, , c) 7→ (qo, ) (qc, , S) 7→ (qc, c)
(qi
, , i) 7→ (qo, ) (qi
, , S) 7→ (qi
, iEtSeS)
(qb, , E) 7→ (qb, b) (qb, , b) 7→ (qo, )
Voici le calcul par lequel l’APD reconnaˆıt l’entr´ee ibtcec avec pile vide :
(qo, ibtcec, S) ` (qi
, btcec, iEtSeS) ` (qo, btcec, EtSeS) ` (qb, tcec, btSeS)
` (qo, tcec, tSeS) ` (qo, cec, SeS) ` (qc, ec, ceS) ` (qo, ec, eS)
` (qo, c, S) ` (qc, , c) ` (qo, , )
19Exemple 4.5 Consid´erez la grammaire
S → S
0$ S
0 → A | B | A → aAb | B → bBa |
On d´erive :
null First Follow
S non {$, a, b} ∅
S
0 oui {a, b} {$}
A oui {a} {b, $}
B oui {b} {a, $}
Donc la grammaire est LL(1) et on peut construire un APD qui reconnaˆıt le langage g´en´er´e.
Exercice 4.6 Expliquez pourquoi la grammaire suivante n’est pas LL(1) :
S → iEtSS0
| a S0 → eS | E → b
La grammaire est-elle ambigu¨e ?
Exercice 4.7 On consid`ere la grammaire suivante avec symbole initial S :
S → G$ G → P
G → P G P → id : R
R → R → idR
1. Calculez les fonctions null , First et Follow sur les symboles non-terminaux de la grammaire.
2. La grammaire est-elle LL(1) ? Motivez votre r´eponse.
Exercice 4.8 On consid`ere la grammaire.
S → A | B A → aAb | 0 B → aBbb | 1
Calculer le First de S, A et B. La grammaire est-elle LL(1) ? Pouvez vous construire un
automate `a pile d´eterministe qui reconnaˆıt le langage g´en´er´e par la grammaire ?
Exercice 4.9 On consid`ere la grammaire :
S → E$ E → T E0
E0 → +T E0
| T → F T0
T
0 → ∗F T0
| F → (E) | id
1. Calculez First des symboles non terminaux.
2. Calculez Follow des symboles non terminaux.
3. La grammaire est-elle LL(1) ? Expliquez.
4. Calculez une grammaire ´equivalente sans -r`egles.
20Exercice 4.10 Le but de cet exercice est de montrer que l’on peut toujours ´eliminer une production
de la forme A → Aα (production qu’on appelle r´ecursive gauche). Cette ´elimination
peut aider `a construire une grammaire LL ´equivalente. Dans la suite on appelle A-production
une production de la forme A → β . Soit G une grammaire,
A → Aα1 | . . . | Aαn
l’ensemble des A-productions ayant A comme symbole le plus `a gauche et
A → β1 | . . . | βm
les autres A-productions. Consid´erez la grammaire G0 obtenue en ajoutant un symbole B et
en rempla¸cant les A-productions par :
A → β1 | . . . | βm | β1B | . . . | βmB
et
B → α1 | . . . | αn | α1B | . . . | αnB
Montrez que G0
est ´equivalente `a G.
Exercice 4.11 On consid`ere la grammaire suivante :
S → E$ E → E + T | E − T | T
T → T ∗ F | T /F | F F → id | num | (E)
Eliminez les productions r´ecursives gauches. ´
215 Grammaires LR
Dans les APD associ´es aux grammaires LL on cherche `a construire une d´erivation gauche `a
partir du symbole initial. On proc`ede de la racine vers les feuilles et on effectue des expansions
de symboles non-terminaux, c’est-`a-dire on remplace la partie gauche d’une r`egle (un nonterminal)
par sa partie droite.
Dans les APD associ´es aux grammaires LR (pour left-to-right parse, rightmost derivation)
on cherche `a construire une d´erivation droite `a partir des feuilles. On proc`ede des feuilles vers
la racine et on effectue des r´eductions, c’est-`a-dire on remplace la partie droite d’une r`egle
par sa partie gauche (un non-terminal). Plus pr´ecis´ement, l’APD peut effectuer deux types
d’actions :
shift On d´eplace un symbole de l’entr´ee vers la pile.
reduce On remplace un mot α au sommet de la pile par un non-terminal X, `a condition que
X → α soit une r`egle de la grammaire.
L’APD peut lire k symboles de l’entr´ee avant de d´ecider quelle action ex´ecuter.
Exemple 5.1 On consid`ere la grammaire :
S
0 → S$ S → S; S | id := E | print(L)
E → id | num | E + E | (S, E) L → E | L, E
Il se trouve que cette grammaire est LR. Dans la table 1, nous d´ecrivons l’ex´ecution de l’APD
o`u on omet le symbole initial de la pile.
Pile Entr´ee Action
id := num; print(num)$ shift
id := . . . shift
id := num . . . shift
id := num ; . . . reduce E → num
id := E ; . . . reduce S → id := E
S ; . . . shift
S; print . . . shift
S; print (. . . shift
S; print( num . . . shift
S; print(num ). . . reduce E → num
S; print(E ). . . reduce L → E
S; print(L ). . . shift
S; print(L) $ reduce S → print(L)
S; S $ reduce S → S; S
S $ shift
S$ reduce S
0 → S$
S
0
accept
Tab. 1 – Exemple d’analyse LR
5.1 Probl`emes
Un certain nombre de questions doivent ˆetre clarifi´ees :
22– La taille de la pile de l’APD peut ´evoluer suite `a des op´erations de shift et de reduce.
On a besoin d’exprimer de fa¸con synth´etique ce qui se trouve sur la pile.
– Un membre droit d’une r`egle peut ˆetre facteur droit d’une autre r`egle comme dans :
A → α1α2 B → α2
Si α1α2 sont sur la pile, il faut d´ecider quelle r´eduction appliquer. On appelle cette
situation un conflit reduce/reduce.
– Si une partie droite d’une r`egle est sur la pile, faut-il ex´ecuter un reduce ou un shift ?
Une possibilit´e serait de privil´egier toujours un reduce, mais dans certaines situations il
peut ˆetre pr´ef´erable d’ex´ecuter un shift comme dans la deuxi`eme ligne de la table 1.
5.2 Pragmatique
Le processus de d´eveloppement d’un APD est automatis´e grˆace `a des outils comme Yacc.
– On commence par ´ecrire une grammaire, le plus souvent en imitant une autre grammaire
qui marche.
– Yacc met en ´evidence un certain nombre de conflits shift/reduce ou reduce/reduce.
– On cherche `a r´egler les conflits. Yacc offre la possibilit´e de sp´ecifier simplement la fa¸con
d’associer un op´erateur et les priorit´es entre op´erateurs.
5.3 Survol des r´esultats les plus importants
– Un langage L a la propri´et´e du pr´efixe si
w ∈ L, w = w1w2, w2 6= ⇒ w1 ∈/ L
c’est-`a-dire si un mot w appartient `a L alors aucun pr´efixe propre de w est dans L.
– On peut toujours modifier un langage L pour qu’il ait la propri´et´e du pr´efixe. On
introduit un nouveau symbole terminal $ et on consid`ere L
0 = {w$ | w ∈ L}. Il est ais´e
de v´erifier que L
0 a la propri´et´e du pr´efixe. De plus, les mots dans L
0
sont simplement
les mots de L avec un marqueur au fond.
– On associe `a une grammaire LR(k) un APD dont les d´ecisions peuvent d´ependre des k
symboles en entr´ee.
– Les grammaires LR(0) g´en`erent exactement les langages qui ont la propri´et´e du pr´efixe
et qui sont accept´es par un APD.
– Si un langage est accept´e par un APD alors on peut construire une grammaire LR(1)
qui le g´en`ere.
– Le processus de g´en´eration d’un APD `a partir d’une grammaire LR(1) peut ˆetre inefficace.
Pour cette raison, on s’int´eresse aussi `a des classes de grammaires SLR(1) et
LALR(1) qui sont un compromis entre l’efficacit´e des grammaires LR(0) et la g´en´eralit´e
des grammaires LR(1).
5.4 Grammaires LR(0)
Soit G = (V, Σ, S, R) une grammaire non-contextuelle. On ´ecrit α ⇒D β pour signifier
que la r´e´ecriture concerne le symbole non-terminal de α le plus `a droite.
23D´efinition 5.2 Soit · un symbole tel que · ∈/ V . On d´efinit l’ensemble des items :
Item = {A → α · β | A → αβ}
D´efinition 5.3 Un mot γ ∈ V
∗
est un pr´efixe admissible s’il existe une d´erivation droite :
S ⇒∗
D δAw ⇒D δαβw
o`u w ∈ Σ
∗
, δα = γ et A → αβ est une r`egle. Dans ce cas, on dit aussi que l’item A → α · β
est valide pour γ.
Exemple 5.4 On consid`ere la grammaire
S
0 → Sc S → SA | A A → aSb | ab
avec S
0
symbole initial. L’ensemble Item est compos´e par
{S
0 → ·Sc, S0 → S · c, S0 → Sc·, S → ·SA, . . .}
On prend comme d´erivation droite :
S
0 ⇒D Sc ⇒D SAc ⇒D SaSbc
Pour d´eterminer les pr´efixes admissibles par rapport `a SaSbc on cherche d’abord un sous-mot
qui correspond `a une partie droite d’une r`egle. Dans notre cas la seule possibilit´e est aSb. Par
ailleurs, S
0 ⇒D Sc ⇒D SAc ⇒D SaSbc. Donc on peut prendre w = c et on obtient comme
pr´efixes admissibles : S, Sa, SaS et SaSb.
Construction de l’AFD Comment savoir si un pr´efixe est admissible ? Un r´esultat remarquable
est qu’on peut construire un AFD qui accepte exactement les pr´efixes admissibles et
qui au passage, nous donne aussi l’ensemble des items valides pour le pr´efixe.
On commence par construire un AFN (automate fini non-d´eterministe) M et on obtient
l’AFD par une proc´edure standard de d´eterminisation.
– L’alphabet d’entr´ee de l’AFN est l’ensemble V de symboles terminaux et non terminaux
de la grammaire.
– L’ensemble des ´etats est donn´e par Q = {q0} ∪ Item. On a donc l’ensemble des items
et un ´etat q0 qu’on prend comme ´etat initial.
– Tous les ´etats sauf q0 sont des ´etats finaux.
– La fonction de transition δ a le type :
δ : Q × (V ∪ {}) → 2
Q
et elle est d´efinie par les conditions suivantes :
1. δ(q0, ) = {S → ·α | S → α ∈ R}.
2. δ(A → α · Bβ, ) = {B → ·γ | B → γ ∈ R}.
3. δ(A → α · Xβ, X) = {A → αX · β} o`u X ∈ V .
24Exemple 5.5 On construit l’AFN associ´e `a la grammaire dans l’exemple 5.4. Soient :
0 = q0 1 = S
0 → ·Sc 2 = S
0 → S · c 3 = S
0 → Sc· 4 = S → ·SA 5 = S → ·A
6 = S → A· 7 = S → S · A 8 = A → ·aSb 9 = A → ·ab 10 = S → SA· 11 = A → a · Sb
12 = A → a · b 13 = A → aS · b 14 = A → ab· 15 = A → aSb·
Les transitions sont d´efinies par le tableau suivant :1
→ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0
1 S
2 c
3
4 S
5 A
6
7 A
8 a
9 a
10
11 S
12 b
13 b
14
15
Une configuration de l’AFN est un couple (q, w) o`u q est un ´etat et w est un mot. On
´ecrit (q, w) ` (q
0
, w0
) ((q, w) `
∗
(q
0
, w0
)) si l’AFN peut aller de la premi`ere `a la deuxi`eme
configuration avec un pas de calcul (un nombre fini, ´eventuellement 0, de pas de calcul).
Th´eor`eme 5.6 (q0, γ) `
∗
(A → α·β, ) ssi γ est un pr´efixe admissible et A → α·β est valide
pour γ.
Idee de la preuve ´ . (⇒) On proc`ede par r´ecurrence sur la longueur du chemin le plus court
´etiquet´e avec γ qui va de l’´etat initial q0 `a un item (´etat) A → α · β.
– Si le chemin a longueur 1 alors γ = , l’item a la forme S → ·β, est un pr´efixe
admissible pour la d´erivation droite S ⇒D β et S → ·β est valide pour .
– Si la derni`ere arˆete est ´etiquet´ee par X ∈ V alors l’arˆete va d’un item A → α
0
· Xβ `a
un item A → α
0X · β avec α = α
0X. Par hypoth`ese de r´ecurrence,
S ⇒∗
D δAw ⇒D δα0Xβw
γ
0 = δα0
et A → α
0
· Xβ est valide pour γ
0
. Mais alors la mˆeme r´eduction montre que
γ = γ
0X est admissible et que A → α
0X · β est valide pour γ.
– Si la derni`ere arˆete est ´etiquet´ee par alors l’arˆete va d’un item B → α1 ·Aβ1 `a un item
A → ·β. Par hypoth`ese de r´ecurrence, B → α1 · Aβ1 est valide pour γ. Donc
S ⇒∗
D δBw ⇒D δα1Aβ1w
et γ = δα1. Si tous les symboles de la grammaire sont utiles, on peut supposer que
β1 ⇒∗
D w1. Donc
S ⇒∗
D δBw ⇒D δα1Aβ1w ⇒∗
D δα1Aw1w
avec γ = δα1 admissible et A → ·β valide pour γ.
1
Il faut lire le tableau de la fa¸con suivante : si le symbole X a ordonn´ee q et abscisse q
0
alors l’automate
peut faire une transition X de q `a q
0
.
25(⇐) On suppose
S ⇒∗
D γ1Aw ⇒D γ1αβw
o`u A → αβ est un r`egle et γ = γ1α. On montre par r´ecurrence sur la longueur de la d´erivation
droite que
(q0, γ1) `
∗
(A → ·αβ, )
Il suit, par construction de l’automate, que (A → ·αβ, α) `
∗
(A → α · β, ) et donc que
(q0, γ) `
∗
(A → α · β, ).
– Le cas de base est imm´ediat : si S ⇒D β alors (q0, ) ` (S → ·β, ).
– Pour le pas inductif, supposons que
S ⇒∗
D γ2Bw1 ⇒D γ2γ3Aγ4w1 ⇒∗
D γ2γ3Aw2w1
o`u γ1 = γ2γ3 et w = w2w1. Par hypoth`ese de r´ecurrence : (q0, γ2) `
∗
(B → ·γ3Aγ4, ).
On d´erive : (B → ·γ3Aγ4, γ3) `
∗
(B → γ3 · Aγ4, ) ` (A → .αβ, ). Donc : (q0, γ1) `
∗
(A → ·αβ, ). •
A partir de l’AFN on d´erive par d´eterminisation un AFD dont les ´etats sont des ensembles
d’items.
D´efinition 5.7 Un item est complet s’il a la forme A → α·, c’est-`a-dire le symbole sp´ecial ·
est le symbole le plus `a droite.
D´efinition 5.8 La grammaire G est LR(0) si
1. Le symbole initial ne paraˆıt pas `a droite d’une r`egle (une condition technique qui n’est
pas restrictive en pratique).
2. Si un ´etat de l’AFD associ´e contient un item complet alors il ne contient pas d’autres
items.
Exemple 5.9 On construit l’AFD associ´e `a la grammaire dans l’exemple 5.4. Soient :
0 = {0, 1, 4, 5, 8, 9} 1 = {2, 7, 8, 9} 2 = {6} 3 = {4, 5, 8, 9, 11, 12} 4 = {3}
5 = {10} 6 = {7, 8, 9, 13} 7 = {14} 8 = {15}
Les transitions sont :
→ 0 1 2 3 4 5 6 7 8
0 S A a
1 a c A
2
3 A a S b
4
5
6 a b
7
8
On peut v´erifier que la grammaire est LR(0).
26Construction de l’APD On construit un APD qui accepte le langage g´en´er´e par une
grammaire LR(0).
– L’APD garde sur la pile un pr´efixe admissible γ = X1 · · · Xk. Plus pr´ecis´ement, on
intercale les symboles dans Γ avec les ´etats de l’AFD de fa¸con `a avoir q0X1q1 · · · Xkqk
avec qi+1 = δ(qi
, Xi+1), i = 0, . . . , k − 1.
– Si l’´etat au sommet de la pile est un ensemble compos´e d’un item complet, par exemple
qk = {A → Xi
· · · Xk·}, alors on effectue un reduce. La nouvelle pile a la forme
q0X1q1 · · · Xi−1qi−1Aq
o`u q = δ(qi−1, A).
– Si qk n’est pas complet on effectue un shift. Si a est le symbole lu, la nouvelle pile est
q0X1q1 · · · Xkqkaq si q = δ(qk, a).
– On accepte quand S symbole initial est sur la pile (le fait de faire un reduce sur le
symbole initial signifie que la d´erivation est termin´ee car le symbole initial ne peut pas
paraˆıtre `a droite d’une r`egle).
Exemple 5.10 On simule le comportement de l’APD associ´e `a la grammaire de l’exemple
5.4 sur l’entr´ee aababbc.
Pile Entr´ee Action
0 aababbc shift
0a3 ababbc shift
0a3a3 babbc shift
0a3a3b7 abbc reduce A → ab
0a3A2 abbc reduce S → A
0a3S6 abbc shift
0a3S6a3 bbc shift
0a3S6a3b7 bc reduce A → ab
0a3S6A5 bc reduce S → SA
0a3S6 bc shift
0a3S6b8 c reduce A → aSb
0A2 c reduce S → A
0S1 c shift
0S1c4 reduce S
0 → Sc
0S
0
accept
Exercice 5.11 On consid`ere la grammaire suivante avec symbole initial S :
S → A$ A → BA | B → aB | b
Expliquez pourquoi cette grammaire n’est pas LR(0).
Suggestion A → · est un item complet.
Exercice 5.12 On consid`ere la grammaire G suivante :
S → C, C → 0 | aCb .
1. Donnez la repr´esentation graphique de l’automate fini non-d´eterministe qui reconnaˆıt
les pr´efixes admissibles.
2. La grammaire est-elle LR(0) ? Expliquez.
273. D´erivez de l’analyse un automate `a pile d´eterministe qui accepte le langage g´en´er´e par
la grammaire.
Exercice 5.13 On consid`ere (`a nouveau) la grammaire :
S → A | B A → aAb | 0 B → aBbb | 1
V´erifiez que la grammaire est LR(0) et d´erivez l’automate `a pile d´eterministe qui accepte le
langage g´en´er´e par la grammaire.
Exercice 5.14 On consid`ere la grammaire suivante avec S symbole initial :
S → E$ E → id
E → id(E) E → E + id
1. Donnez la repr´esentation graphique d’un automate fini non-d´eterministe qui reconnaˆıt
les pr´efixes admissibles de la grammaire.
2. La grammaire est-elle LR(0) ? Justifiez votre r´eponse.
5.5 Grammaires LR(1)
Les principes de construction d´evelopp´es pour les grammaires LR(0) se g´en´eralisent aux
grammaires LR(1). Soient G = (V, Σ, S, R) une grammaire alg´ebrique et $ un nouveau symbole
qui servira `a marquer la fin du mot `a g´en´erer.
Item Un item est maintenant un couple (A → α · β, T) o`u A → αβ ∈ R est une r`egle de la
grammaire et T est un sous-ensemble de Σ ∪ {$}.
AFN On construit un AFN dont les ´etats Q sont les items plus un ´etat initial qo. La fonction
de transition δ a le type :
δ : Q × (V ∪ {}) → 2
Q
et elle est d´efinie par les conditions suivantes :
1. δ(q0, ) = {(S → ·α, {$}) | S → α ∈ R}.
2. δ((A → α · Bβ, T), ) = {(B → ·γ, Tβ) | B → γ ∈ R} o`u
Tβ =
(
First(β) ∪ T si null(β)
First(β) autrement
3. δ((A → α · Xβ, T), X) = {(A → αX · β, T)} o`u X ∈ V .
AFD On d´eterminise l’AFN pour obtenir un AFD ´equivalent. On dit que la grammaire est
LR(1) si : (i) le symbole initial ne paraˆıt pas `a droite d’une r`egle et (ii) si un ´etat de
l’AFD associ´e contient un item complet (A → α·, T) alors :
1. Si l’´etat contient un item (B → α
0
· a
0β
0
, T0
) alors a
0 ∈/ T.
2. Si l’´etat contient un item (B → α
0
·, T0
) alors T ∩ T
0 = ∅.
Intuitivement, la condition 1 ´evite les conflits reduce-shift et la condition 2 ´evite les
conflits reduce-reduce.
28APD Si la grammaire est LR(1) alors on peut construire un APD qui reconnaˆıt le langage
g´en´er´e par la grammaire et qui effectue des op´erations de shift et de reduce. La nouveaut´e
est que maintenant l’APD peut prendre en compte le prochain symbole en entr´ee.2
Comme dans le cas LR(0), la pile a la forme q0X1q1 · · · Xkqk o`u qi+1 = δ(qi
, Xi+1),
i = 0, . . . , k − 1 et δ est la fonction de transition de l’AFD. L’APD effectue trois types
d’actions.
reduce Si l’´etat au sommet de la pile contient un item complet (A → Xi
· · · Xk·, T)
avec A 6= S et si le prochain symbole en entr´ee appartient `a T alors on effectue une
action reduce et la nouvelle pile a la forme q0X1q1 · · · Xi−1qi−1Aq o`u q = δ(qi−1, A).
shift Si l’´etat au sommet de la pile contient un item (A → α · aB, T) et a est le
prochain symbole en entr´ee alors on effectue une action shift et la nouvelle pile est
q0X1q1 · · · Xkqkaq o`u q = δ(qk, a).
accept Si l’´etat au sommet de la pile contient un item (S → X1 · · · Xk·, {$}) et si le
prochain symbole en entr´ee est $ alors on accepte.
Les conditions qui d´efinissent une grammaire LR(1) assurent qu’`a chaque moment du
calcul au plus une action sera possible.
Exemple 5.15 On consid`ere la grammaire G :
S → A A → BA | B → aB | b
Cette grammaire g´en`ere le langage r´egulier (a
∗
b)
∗
. Ce langage n’a pas la propri´et´e du pr´efixe
et donc la grammaire G ne peut pas ˆetre LR(0). On pourrait consid´erer la grammaire G0
:
S → A$ A → BA | B → aB | b
mais il est facile de v´erifier que la grammaire obtenue n’est toujours pas LR(0).
On calcule les fonctions null , First et Follow .
null First Follow
S oui {a, b} ∅
A oui {a, b} ∅
B non {a, b} {a, b}
On peut v´erifier au passage que la grammaire G est LL(1). Il s’agit donc d’un exemple de
grammaire qui est LL(1) mais pas LR(0). On sait que les grammaires LL(1) et LR(0) sont
incomparables et qu’elles sont contenues strictement dans les grammaires LR(1).
Nous allons v´erifier que la grammaire G est LR(1). D’abord on construit l’AFN. Soient :
0 = q0 1 = (S → ·A, {$}) 2 = (S → A·, {$}) 3 = (A → ·BA, {$})
4 = (A → ·, {$}) 5 = (A → B · A, {$}) 6 = (B → ·aB, {a, b, $}) 7 = (B → ·b, {a, b, $})
8 = (A → BA·, {$}) 9 = (B → a · B, {a, b, $}) 10 = (B → b·, {a, b, $}) 11 = (B → aB·, {a, b, $})
Les transitions sont d´efinies par le tableau suivant :
2La technique utilis´ee pour se ramener `a un APD standard consiste `a ajouter le symbole sp´ecial $ `a l’entr´ee
et `a ‘m´emoriser’ le prochain symbole en entr´ee dans l’´etat de l’automate.
29→ 0 1 2 3 4 5 6 7 8 9 10 11
0
1 A
2
3 B
4
5 A
6 a
7 b
8
9 B
10
11
On construit l’AFD associ´e. Soient :
0 = {0, 1, 3, 4, 6, 7} 1 = {2} 2 = {3, 4, 5, 6, 7} 3 = {6, 7, 9} 4 = {10}
5 = {8} 6 = {11}
Les transitions sont :
→ 0 1 2 3 4 5 6
0 A B a b
1
2 B a b A
3 a b B
4
5
6
L’´etat 3 ne contient pas d’item complet. Les ´etats 1, 4, 5, 6 contiennent un seul item qui est
complet. Les ´etats 0 et 2 contiennent un seul item complet (A → ·, {$}) et dans les autres
items, $ ne paraˆıt pas `a droite de ·. Donc la grammaire G est LR(1).
On termine l’exemple en simulant le comportement de l’APD associ´e `a la grammaire sur
l’entr´ee aabb$.
Pile Entr´ee Action
0 aabb$ shift
0a3 abb$ shift
0a3a3 bb$ shift
0a3a3b4 b$ reduce B → b
0a3a3B6 b$ reduce B → aB
0a3B6 b$ reduce B → aB
0B2 b$ shift
0B2b4 $ reduce B → b
0B2B2 $ reduce A →
0B2B2A5 $ reduce A → BA
0B2A5 $ reduce A → BA
0A1 $ reduce S → A
0S $ accepte
306 Evaluation et typage d’un langage imp´eratif ´
On pr´esente les r`egles d’´evaluation et de typage d’un petit langage imp´eratif. Par rapport
au langage d’expressions consid´er´e dans la section 2, on voit paraˆıtre plusieurs concepts
nouveaux :
– la notion d’environnement qui sugg`ere une mise-en-oeuvre efficace de la substitution.
– la notion de m´emoire qui permet de mod´eliser l’affectation.
– la gestion du contrˆole : les branchements, les boucles, le goto,. . .
– le passage de param`etres aux proc´edures.
– la gestion de l’environnement ou comment associer une valeur `a un nom.
6.1 Syntaxe
Dans un souci de lisibilit´e, on utilise une syntaxe concr`ete, ´etant entendu que l’´evaluateur
op`ere sur l’arbre de syntaxe abstraite g´en´er´e par l’analyseur syntaxique.3
Types Les types comprennent deux types de base bool et int ainsi que les types produit et
r´ef´erence :
τ ::= bool | int | τ ∗ τ | ref τ
On d´enote avec (τ1, . . . , τn) → τ le type d’une op´eration qui re¸coit n arguments de type
τ1, . . . , τn et rend un r´esultat de type τ . On d´enote aussi avec (τ1, . . . , τn) le type d’une
proc´edure qui attend n param`etres de type τ1, . . . , τn (et ne rend pas de r´esultat).
Valeurs Soit Z l’ensemble des entiers avec ´el´ements n, m, . . . Soit Loc un ensemble infini de
locations avec ´el´ements `, `0
, . . .. Concr`etement on peut penser `a une location comme
`a une adresse de m´emoire. Les valeurs comprennent les valeurs de base, les couples de
valeurs et les locations :
v ::= true | false | n | Pair (v, v) | `
Soit Val l’ensemble des valeurs (qui contient l’ensemble des locations).
Expressions La cat´egorie syntaxique des expressions comprend des op´erateurs op sur les
types de base bool et int. Par exemple : +, ∗,∧, >, . . . A chaque op´erateur op on associe
l’interpr´etation attendue op. Par exemple, + est l’addition sur les entiers.
id ::= x | y | . . .
e ::= v | id | op(e1, . . . , en) | Pair (e, e) | Fst(e) | Snd(e) | ref e | !e
Les expressions comprennent aussi un constructeur de couple et les projections associ´ees
ainsi qu’un g´en´erateur de r´ef´erence et l’op´erateur de d´er´ef´erenciation associ´e.
D´eclarations Une d´eclaration est une liste d’associations entre identificateurs et expressions
:
D ::= | (let id = e); D
Commandes Les commandes comprennent une affectation et des op´erateurs de base pour
manipuler le flot du contrˆole :
S ::= id := e | (while e do S) | (if e then S else S) | S; S
3Dans la suite on adopte la notation de Backus-Naur : pour sp´ecifier une grammaire alg´ebrique on ´ecrit
S ::= · · · plutˆot que S → · · ·
31Programmes Un programme est constitu´e d’une d´eclaration suivie par une commande :
P ::= D; S
Exemple 6.1 Voici un exemple de programme :
let x = ref !input;
let y = ref 1;
(while !x > 0 do y := 2∗!y; x :=!x − 1);
output :=!y
Ici on suppose que certaines variables comme input et output sont pr´ed´efinies. Un programme
utilise ces variables pour lire l’entr´ee et ´ecrire le r´esultat du calcul.
6.2 Evaluation ´
Pour ´evaluer expressions, d´eclarations, commandes et programmes nous avons besoin de
deux param`etres : un environnement η et une m´emoire µ. Soit Id l’ensemble des identificateurs.
On d´efinit :
– Un environnement η : Id * Val comme une fonction partielle `a domaine fini de Id dans
Val.
– Une m´emoire µ : Loc * Val comme une fonction partielle `a domaine fini de Loc dans
Val.
On utilise les jugements suivants :
(e, η, µ) ⇓ (v, µ0
), (D, η, µ) ⇓ (η
0
, µ0
), (S, η, µ) ⇓ µ
0
, (P, η, µ) ⇓ µ
0
.
On ´ecrit ` = new(η, µ) pour dire que ` est une location qui ne parait pas dans im(η) ∪
dom(µ) ∪ im(µ). Cette op´eration peut toujours ˆetre effectu´ee car domaine et image sont des
ensembles finis et on suppose que Loc est un ensemble infini.
Expressions
(v, η, µ) ⇓ (v, µ)
η(x) d´efini
(x, η, µ) ⇓ (η(x), µ)
(e, η, µ) ⇓ (v, µ0
) ` = new(η, µ0
)
(ref e, η, µ) ⇓ (`, µ0
[v/`])
(e, η, µ) ⇓ (`, µ0
)
(!e, η, µ) ⇓ (µ
0
(`), µ0
)
(e1, η, µ) ⇓ (v1, µ1)· · ·(en, η, µn−1) ⇓ (vn, µn)
v1, . . . , vn dans le domaine de d´efinition de op
(op(e1, · · · , en), η, µ) ⇓ (op(v1, . . . , vn), µn)
(e1, η, µ) ⇓ (v1, µ1) (e2, η, µ1) ⇓ (v2, µ2)
(Pair (e1, e2), η, µ) ⇓ (Pair (v1, v2), µ2)
(e, η, µ) ⇓ (Pair (v1, v2), µ0
)
(Fst(e), η, µ) ⇓ (v1, µ0
)
(e, η, µ) ⇓ (Pair (v1, v2), µ0
)
(Snd(e), η, µ) ⇓ (v2, µ0
)
Exemple 6.2 On suppose η0(x) = `x et µ0(`x) = true. On d´erive :
(Snd(!(ref (Pair (3, !x)))), η0, µ0) ⇓ (true, µ0[Pair (3, true)/`1])
32D´eclarations
( , η, µ) ⇓ (η, µ)
(e, η, µ) ⇓ (v, µ0
) (D, η[v/x], µ0
) ⇓ (η
00, µ00)
(let x = e; D, η, µ) ⇓ (η
00, µ00)
Exercice 6.3 Evaluez la liste de d´eclarations suivante : ´
let x = ref 3;
let y =!x + 3 :
Remarque 6.4 Il est int´eressant de comparer le traitement du let ci-dessus avec celui d´ecrit
en section 2.5 pour le simple langage d’expressions. Dans le langage d’expressions on remplace,
par une op´eration de substitution, l’identificateur par une valeur. Cette op´eration de
substitution n’est pas triviale et elle peut s’av´erer coˆuteuse. Dans la pratique de la mise-enoeuvre,
il est pr´ef´erable d’introduire une notion d’environnement comme nous l’avons fait pour
le langage imp´eratif et d’enregistrer dans l’environnement l’association entre identificateur et
valeur. Bien sˆur on pourrait appliquer cette id´ee aussi au langage d’expressions de la section
2.5. Dans ce cas le jugement deviendrait (b, η) ⇓ (v, η0
) et la r`egle pour le let s’´ecrirait comme
suit :
(e
0
, η) ⇓ (v
0
, η0
) (b, η[v
0/x]) ⇓ (v, η00)
(let x = e
0
in b, η) ⇓ (v, η00)
Commandes
η(x) = ` (e, η, µ) ⇓ (v, µ0
)
(x := e, η, µ) ⇓ µ
0
[v/`]
(S1, η, µ) ⇓ µ1 (S2, η, µ1) ⇓ µ2
(S1; S2, η, µ) ⇓ µ2
(e, η, µ) ⇓ (false, µ0
)
(while e do S, η, µ) ⇓ µ
0
(e, η, µ) ⇓ (true, µ0
) (S; (while e do S), η, µ0
) ⇓ µ
00
(while e do S, η, µ) ⇓ µ
00
(e, η, µ) ⇓ (true, µ0
) (S1, η, µ0
) ⇓ µ
00
(if e then S1 else S2, η, µ) ⇓ µ
00
(e, η, µ) ⇓ (false, µ0
) (S2, η, µ0
) ⇓ µ
00
(if e then S1 else S2, η, µ) ⇓ µ
00
Exercice 6.5 Evaluez la commande suivante dans un environnement ´ η tel que η(x) = `x.
x := 1;
while !x > 0 do
x :=!x − 1
Programmes
(D, η, µ) ⇓ (η
0
, µ0
) (S, η0
, µ0
) ⇓ µ
00
(D; S, η, µ) ⇓ µ
00
Remarque 6.6 On notera que :
– L’´evaluation d’une expression n’affecte pas l’environnement et peut ´eventuellement produire
une extension de la m´emoire.
– L’´evaluation d’une d´eclaration peut modifier l’environnement et peut provoquer l’´evaluation
d’une expression.
33– L’´evaluation d’une commande peut modifier la m´emoire et peut provoquer l’´evaluation
d’une expression.
Exercice 6.7 Evaluez le programme de l’exemple 6.1 dans l’environnement ´ η0 et la m´emoire
µ0 tels que η0(input) = `0 et µ(`0) = 1.
Exercice 6.8 On modifie la cat´egorie syntaxique des commandes S en rempla¸cant la commande
while par la commande goto :
S ::= id := e | lab : S | goto lab | (if e then S) | S; S
Ici lab est une nouvelle cat´egorie syntaxique d’´etiquettes qu’on d´enote par a, b, c, . . .
Pour d´ecrire l’´evaluation de ces nouvelles commandes on ´elargit le domaine de d´efinition
des environnements aux ´etiquettes. Si a est une ´etiquette, η est un environnement et η(a)
est d´efini alors η(a) est une commande. Les r`egles d’´evaluation pour les deux nouvelles commandes
introduites sont alors les suivantes :
(S, η[S/a], µ) ⇓ µ
0
(a : S, η, µ) ⇓ µ
0
(η(a), η, µ) ⇓ µ
0
(goto a, η, µ) ⇓ µ
0
1. Compl´etez la description de l’´evaluation en donnant les r`egles pour l’affectation x := e,
le branchement (if e then S) et la s´equentialisation S1; S2.
2. Proposez un sch´ema de traduction de la commande (while e do S) dans le langage avec
goto.
3. Appliquez votre sch´ema de traduction `a la commande :
(while x do
(while y do S1)) ;
(while z do S2)
6.3 Extension avec proc´edures
On consid`ere maintenant une extension du langage avec proc´edures.
Syntaxe r´evis´ee
D´eclarations de proc´edure On ajoute les d´eclarations de proc´edure.
DP ::= | (procedure f(x1 : τ1, . . . , xn : τn) = D; S) ; DP
Une proc´edure se compose d’un nom, d’une liste de param`etres formels typ´es et d’un
corps de proc´edure D; S.
Commandes On ajoute l’appel de proc´edure `a la liste des commandes.
S ::= · · · |f(e1, . . . , en)
Programmes Maintenant, un programme se compose d’une liste ´eventuellement vide de
d´eclarations de proc´edure et d’un corps principal D; S.
P ::= DP; D; S
34Evaluation r´evis´ee ´ On d´efinit Pid comme l’ensemble des identificateurs de proc´edures.
On d´efinit VProc comme l’ensemble des couples de la forme (x1 · · · xn, D; S), c’est-`a-dire une
liste d’identificateurs et le ‘code’ d’un corps de proc´edure. Un environnement η : Id ∪ Pid *
Val ∪ VProc est maintenant une fonction partielle `a domaine fini qui associe une valeur aux
identificateurs et un ´el´ement de VProc aux identificateurs de proc´edure. Si η est un environnement,
on d´enote par η|Pid la restriction de η `a Pid. Il faut ajouter des r`egles pour la
d´eclaration de proc´edure et pour l’appel de proc´edure.
D´eclaration de proc´edure On introduit un jugement (DP, η) ⇓ η qui est d´efini par les
r`egles :
( , η) ⇓ η
(DP, η[(x, D; S)/f]) ⇓ η
0
((procedure f(x : ~τ ) = D; S); DP, η) ⇓ η
0
L’effet d’une d´eclaration de proc´edure est d’associer au nom de la proc´edure ses param`etres
formels et son code.
On remarquera que dans des langages plus g´en´eraux, cette information n’est pas suf-
fisante. Dans ces langages on a besoin de connaˆıtre aussi l’environnement dans lequel
la proc´edure doit ˆetre ´evalu´ee. On arrive ainsi `a la notion de clˆoture qui est un couple
(code, environnement). Cette notion sera d´evelopp´ee dans la suite du cours.
Appel de proc´edure Les valeurs qui correspondent aux param`etres actuels de la proc´edure
peuvent ˆetre des locations. Une proc´edure a donc la possibilit´e de retourner un r´esultat
en modifiant la valeur contenue dans une location qui lui est transmise en param`etre.
Au moment de l’appel de proc´edure il faut d´eterminer l’environnement dans lequel la
proc´edure est appel´ee. Dans notre cas cet environnement comprend uniquement les
noms des proc´edures.
η(f) = (x1 · · · xn, D; S)
(e1, η, µ) ⇓ (v1, µ1)· · ·(en, η, µn−1) ⇓ (vn, µn)
(D; S, η|Pid [v1/x1, . . . , vn/xn], µn) ⇓ µ
0
(f(e1, . . . , en), η, µ) ⇓ µ
0
Programme La commande principale S est ´evalu´ee dans un environnement o`u toutes les
proc´edures et les variables d´eclar´ees dans DP et D sont d´efinies.
(DP, η) ⇓ η
0
(D; S, η0
, µ) ⇓ µ
0
(DP; D; S, η, µ) ⇓ µ
0
Remarque 6.9 Il est important que dans l’´evaluation du corps d’une proc´edure on cache
l’environnement de l’appelant. Par exemple, dans
procedure f() = x :=!x + 1;
let x = ref 1;
f()
la variable x ne doit pas ˆetre visible dans le corps de f et donc l’appel de f devrait produire
une erreur au moment de l’ex´ecution.
35Exercice 6.10 Evaluez : ´
(procedure f (x : int, y : ref int) =
let i = ref x;
y := 1; (while !i > 0 do (y :=!i∗!y;i :=!i − 1)));
let out = ref 0; let in = 2;
f(in, out)
6.4 Mise-en-oeuvre
On peut ajouter des r`egles pour les situations anormales. On donne une ´evaluation `a erreur
toutes le fois qu’on rencontre une des situations suivantes :
– on ´evalue une variable qui n’est pas dans l’environnement.
– les arguments de op ont le mauvais type.
– l’argument de Fst ou Snd n’est pas une paire.
– on d´e-r´ef´erence une valeur qui n’est pas une location.
– on cherche la valeur associ´ee `a une location qui n’est pas d´efinie en m´emoire.
– on affecte une variable qui n’est pas d´efinie dans l’environnement ou qui est d´efinie mais
dont la valeur n’est pas une location.
– on a une condition de test pour while ou if then else qui n’est pas un bool´een.
– on appelle une proc´edure qui n’est pas d´efinie dans l’environnement ou on appelle une
proc´edure avec le mauvais nombre d’arguments.
Par ailleurs, si une des ´evaluations en hypoth`ese donne erreur alors la conclusion donne erreur.
Exemple 6.11 On introduit un symbole sp´ecial err et on admet des jugements de la forme :
(e, η, µ) ⇓ err , (DP, η) ⇓ err , (D, η, µ) ⇓ err , (S, η, µ) ⇓ err , (P, η, µ) ⇓ err .
Si, par exemple, on consid`ere la commande while on peut ajouter les r`egles suivantes :
(e, η, µ) ⇓ (v, µ0
) v /∈ {false, true}
(while e do S, η, µ) ⇓ err
(e, η, µ) ⇓ err
(while e do S, η, µ) ⇓ err
(e, η, µ) ⇓ (true, µ0
) (S; (while e do S), η, µ0
) ⇓ err
(while e do S, η, µ) ⇓ err
Exercice 6.12 Ecrire les r`egles qui traitent les erreurs pour d’autres constructions du langage ´
(expressions, d´eclarations de proc´edure, d´eclarations, commandes et programmes).
Remarque 6.13 On pourrait consid´erer d’autres types d’erreurs. Par exemple on peut associer
une taille `a chaque valeur.
|true| = |false| = |n| = |`| = 1
|Pair (v1, v2)| = 1 + |v1| + |v2|
L’espace allou´e pour m´emoriser une valeur serait proportionnel `a sa taille. On pourrait donner
une erreur si on alloue une valeur dont la taille exc`ede celle de la m´emoire allou´ee. Par
exemple
let x = ref 1;
x := Pair (!x, !x)
pourrait produire une erreur.
36La mise en oeuvre d’un ´evaluateur dans un langage qui permet les appels r´ecursifs est tr`es
directe. Il s’agit de fixer des structures de donn´ees pour la repr´esentation de l’environnement
et de la m´emoire et des op´erations associ´ees :
– g´en´erer une nouvelle location.
– cr´eer des nouvelles associations dans l’environnement ou en m´emoire.
– chercher une association dans l’environnement ou en m´emoire.
– mettre `a jour une association dans l’environnement ou en m´emoire.
Ensuite il suffit de d´efinir une fonction r´ecursive ‘Eval’ qui est dirig´ee par la syntaxe (abstraite).
6.5 Liaison et ´evaluation
Le langage imp´eratif consid´er´e repose sur la liaison statique et l’appel par valeur. On
analyse des variations possibles dans le cadre d’un simple langage d’expressions
e ::= ⊥ | n | Id | let Id = e in e | quote(e) | unquote(e)
o`u ⊥ repr´esente un calcul qui diverge, n est un entier et Id = {x, y, . . .} est l’ensemble des identificateurs.
L’op´erateur quote permet de bloquer l’´evaluation d’une expression et l’op´erateur
unquote permet de la d´ebloquer. Soit Exp l’ensemble des expressions. L’ensemble des valeurs
v est d´efini par
v ::= n | quote(e)
On consid`ere diff´erentes strat´egies d’´evaluation : avec liaison dynamique ou statique et avec
appel par nom ou par valeur.
Liaison dynamique Un environnement η est une fonction partielle de Id dans Exp. Soit
Env l’ensemble des environnements. La relation d’´evaluation ⇓ associe une valeur v `a un
couple (e, η) ∈ Exp × Env. La relation est d´efinie par les r`egles :
(v, η) ⇓ v
(η(x), η) ⇓ v
(x, η) ⇓ v
(e, η) ⇓ quote(e
0
) (e
0
, η) ⇓ v
(unquote(e), η) ⇓ v
(e, η) ⇓ n
(unquote(e), η) ⇓ n
et par la r`egle :
(par nom) (e, η[e
0/x]) ⇓ v,
(let x = e
0
in e, η) ⇓ v
(par valeur) (e
0
, η) ⇓ u (e, η[u/x]) ⇓ v
(let x = e
0
in e, η) ⇓ v
Liaison statique Dans ce cas l’ensemble des environnements Env est le plus petit ensemble
de fonctions partielles (sur Id) tel que la fonction `a domaine vide est un environnement et
si x1, . . . , xn ∈ Id, e1, . . . , en ∈ Exp et η1, . . . , ηn ∈ Env alors la fonction partielle telle que
η(xi) = (ei
, ηi) pour i = 1, . . . , n est un environnement. La relation d’´evaluation ⇓ associe
`a un couple (e, η) ∈ Exp × Env, un couple (v, η0
). On appelle aussi clˆoture un couple (e, η)
constitu´e d’un code (une expression dans notre cas) et d’un environnement.
37La relation d’´evaluation est d´efinie par les r`egles :
(v, η) ⇓ (v, η)
η(x) ⇓ (v, η0
)
(x, η) ⇓ (v, η0
)
(e, η) ⇓ (quote(e
0
), η0
) (e
0
, η0
) ⇓ (v, η00)
(unquote(e), η) ⇓ (v, η00)
(e, η) ⇓ (n, η0
)
(unquote(e), η) ⇓ (n, η0
)
et par la r`egle :
(par nom) (e, η[(e
0
, η)/x]) ⇓ (v, η1)
(let x = e
0
in e, η) ⇓ (v, η1)
(par valeur)
(e
0
, η) ⇓ (u, η2)
(e, η[(u, η2)/x]) ⇓ (v, η1)
(let x = e
0
in e, η) ⇓ (v, η1)
S´eparation On donne des exemples qui distinguent les diff´erentes strat´egies de liaison et
d’´evaluation.
– let x = ⊥ in 3 distingue appel par nom et appel par valeur dans les deux types de
liaison. A savoir, l’´evaluation converge par nom et diverge par valeur.
– Reste `a comparer (1) dynamique+nom et statique+nom et (2) dynamique+valeur et
statique+valeur. Soit :
e1 ≡ let x = 3 in e2, e2 ≡ let y = x in e3, e3 ≡ let x = 5 in y .
En dynamique par nom, (e1, ∅) ⇓ 5. En dynamique par valeur, (e1, ∅) ⇓ 3. En statique
par nom (e1, ∅) ⇓ (3, ∅). En statique par valeur (e1, ∅) ⇓ (3, ∅).
– Reste `a comparer dynamique par valeur et statique par valeur. Si l’on se restreint `a
des expressions sans quote, unquote alors les deux strat´egies co¨ıncident. En effet dans
la liaison statique on va associer `a une variable un nombre et donc l’environnement ne
joue pas de rˆole. On modifie donc l’exemple ci-dessus comme suit :
e1 ≡ let x = 3 in e2, e2 ≡ let y = quote(x) in e3, e3 ≡ let x = 5 in unquote(y) .
Maintenant (e1, ∅) s’´evalue en 5 en dynamique par valeur et en (3, ∅) en statique par
valeur.
386.6 Typage
On d´enote par Types l’ensemble des types et par ProcTypes les vecteurs de types qu’on
associe aux proc´edures. Un environnement de types est une fonction
E : Id ∪ Pid * Types ∪ ProcTypes
dont le domaine est fini avec E(Id) ⊆ Types et E(Pid) ⊆ ProcTypes. Un type est une
abstraction d’une valeur. De mˆeme, un environnement de types est une abstraction d’un
environnement.
Typage des expressions On consid`ere un jugement de la forme :
E ` e : τ
et on suppose que dans une expression on nomme jamais explicitement une location `. Les
r`egles de typage sont les suivantes :
E ` true : bool E ` false : bool E ` n : int
E(x) = τ
E ` x : τ
E ` ei
: τi i = 1, 2
E ` Pair (e1, e2) : τ1 ∗ τ2
E ` e : τ1 ∗ τ2
E ` Fst(e) : τ1
E ` e : τ1 ∗ τ2
E ` Snd(e) : τ2
E ` e : τ
E ` ref e : ref τ
E ` e : ref τ
E `!e : τ
Typage des environnements On consid`ere des jugements de la forme :
E ` D : E
0 E ` DP : E
0
Les r`egles de typage sont :
E ` : E
E ` e : τ E[τ /x] ` D : E0
E ` (let x = e) ; D : E0
E|Pid [(τ1, . . . , τn)/f, τ1/x1, . . . , τn/xn] ` D; S E[(τ1, . . . , τn)/f] ` DP : E00
E ` (procedure f(x1 : τ1, . . . , xn : τn) = D; S); DP : E00
Typage des commandes On consid`ere des jugements de la forme :
E ` S
Les r`egles de typage sont :
E(x) = ref τ E ` e : τ
E ` x := e
E ` e : bool E ` S
E ` while e do S
E ` e : bool E ` S1 E ` S2
E ` if e then S1 else S2
E(f) = (τ1, . . . , τn) E ` ei
: τi i = 1, . . . , n
E ` f(e1, . . . , en)
E ` S1 E ` S2
E ` S1; S2
39Typage des programmes On consid`ere un jugement de la forme :
E ` P
La r`egle de typage est :
E ` DP : E0 E0 ` D : E00 E00 ` S
E ` DP; D; S
Exercice 6.14 Typez, si possible, les programmes :
procedure f() = x :=!x + 1; (procedure f (x : int, y : ref int) =
let x = ref 1; let i = ref x;
f() y := 1; (while !i > 0 do (y :=!i∗!y;i :=!i − 1)));
let out = ref 0; let in = 2;
f(in, out)
V´erification de type L’application des r`egles de typage est dirig´ee par la syntaxe abstraite.
Il s’agit simplement de fixer une repr´esentation des environnements de type et d’´ecrire des
fonctions r´ecursives qui prennent en argument un environnement de type et v´erifient le bon
typage d’expressions, d´eclarations, commandes et programmes :
Propri´et´es du typage L’objectif des r`egles de typage est toujours de s’assurer que :
Un programme bien typ´e ne s’´evalue pas en erreur.
La formulation de cette propri´et´e et sa v´erification est maintenant beaucoup plus compliqu´ee
que dans le langage d’expressions consid´er´e dans la section 2. Par exemple, on peut commencer
par traiter un fragment du langage o`u :
v ::= n | `
e ::= v | id | ref e |!e
D ::= | (let id = e); D
P ::= D
On remarquera que l’´evaluation d’expressions peut produire des locations. On a donc besoin
de ‘typer les locations’. Plus en g´en´eral, on a besoin d’exprimer les propri´et´es de la m´emoire
qui sont pr´eserv´ees par l’´evaluation. On est donc amen´e `a formuler une notion de type de
m´emoire qui abstrait une m´emoire dans le mˆeme sens qu’un environnement de types abstrait
un environnement.
Exercice 6.15 On souhaite analyser les programmes suivants qui se composent d’une d´eclaration
de proc´edure f, d’une d´eclaration de variable x et d’un corps principal f().
Programme 1
procedure f() =
let x = ref 1;
let y = ref !x;
x :=!y;
let x = ref true;
f()
Programme 2
procedure f() =
let x = ref true;
let y = ref 2 :;
y :=!x;
let x = ref 1;
f()
Programme 3
procedure f() =
let y = ref !x;
x :=!y;
let x = ref 1;
f()
Pour chaque programme, pr´ecisez si :
401. Le programme est bien typ´e.
2. L’ex´ecution du programme est susceptible de produire une erreur.
Suggestion Vous pouvez r´epondre `a ces questions sans calculer formellement le typage et l’´evaluation des
programmes.
Exercice 6.16 On ´etend la cat´egorie syntaxique S des commandes du langage avec une commande
(repeat S until e) .
La s´emantique informelle de cette commande est la suivante : (A) On ex´ecute la commande S.
(B) On ´evalue l’expression e. (C) Si le r´esultat de l’´evaluation est true alors on termine, si le
r´esultat de l’´evaluation est false alors on saute au point (A), autrement on avorte l’ex´ecution
et on donne un message d’erreur.
1. Proposez un codage de la commande repeat dans le langage imp´eratif avec while qui respecte
la s´emantique informelle (on peut supposer que le langage comprend un op´erateur
not qui calcule la n´egation sur le type des bool´eens).
2. Donnez les r`egles d’´evaluation pour la commande repeat .
3. Donnez les r`egles de typage pour la commande repeat qui permettent d’´eviter la situation
d’erreur d´ecrite dans la s´emantique.
Exercice 6.17 On consid`ere le langage imp´eratif d´ecrit dans le cours. On ´etend la cat´egorie
syntaxique S des commandes avec une commande for de la forme
(for (id; S
0
) S) .
dont la s´emantique informelle est la suivante.
1. On v´erifie que la valeur associ´ee `a l’identificateur id est une r´ef´erence ` et que la valeur
v associ´ee `a la la r´ef´erence ` est un entier.
2. Si v n’est pas un entier on donne un message d’erreur.
3. Si v est ´egal `a 0 on termine l’ex´ecution de la commande.
4. Autrement, on ex´ecute la commande S suivie par la commande d’incr´ement S
0
et on
saute au point 1.
Vous devez :
1. Donner les r`egles formelles d’´evaluation pour la commande for.
2. Donner une r`egle de typage pour la commande for qui permet d’´eviter la situation d’erreur
d´ecrite dans la s´emantique informelle.
417 Evaluation et typage d’un langage `a objets ´
On suppose que le lecteur a d´ej`a pratiqu´e la programmation `a objets. On pr´esente la
syntaxe (plutˆot abstraite), les r`egles d’´evaluation et les r`egles de typage d’un micro-langage
`a objets librement inspir´e du langage Java.
Un objet est constitu´e d’un nom de classe et d’une liste de locations de m´emoire qu’on
appelle attributs. Une classe est une d´eclaration dans laquelle on sp´ecifie comment construire
et manipuler les objets de la classe. En particulier, on sp´ecifie les attributs de chaque objet
et les m´ethodes qui permettent de les manipuler.
Les langages `a objets reposent sur les notions d’h´eritage et de sous-typage. On rappelle
que la premi`ere est une relation entre les impl´ementations des classes alors que la deuxi`eme
est une relation entre les interfaces des classes. Nous d´ecrivons une approche ´el´ementaire dans
laquelle l’h´eritage est simple (au lieu d’ˆetre multiple) et la relation de sous-typage est d´eriv´ee
de l’h´eritage (en g´en´eral les deux notions peuvent ˆetre incomparables).
7.1 Syntaxe
Classes On suppose une classe Object sans attributs et sans m´ethodes. Chaque d´eclaration
de classe ´etend une autre classe. Par exemple, on peut d´eclarer une classe C qui h´erite de la
classe D et qui comprend un attribut f et une m´ethode m.
class C extends D = (
· · ·
var f : C
0
(d´eclaration d’attribut (field))
· · ·
methodm(x1 : D1, ..., xn : Dn) : D
0 = e (d´eclaration de m´ethode)
· · ·)
Les noms des classes seront les types de notre langage. On d´erive de l’h´eritage une relation
binaire de sous-typage ≤ sur les classes comme la plus petite relation r´eflexive et transitive
telle que C ≤ D si le programme contient une d´eclaration de la forme ci-dessus. Pour interdire
des h´eritages cycliques, on demande `a ce que C ≤ D et D ≤ C implique C = D. Sous cette
hypoth`ese, on peut repr´esenter la relation de sous-typage comme un arbre ayant la classe
Object `a sa racine (la racine ´etant ‘en haut’).
Valeurs, locations et m´emoires Nous allons supposer que tous les attributs sont modifiables.
On reprend et on adapte les notions de location et de m´emoire que nous avons
consid´er´e pour le langage imp´eratif. Soit Loc un ensemble infini de locations avec ´el´ements
`, `0
, . . . Une location est maintenant un pointeur (ou r´ef´erence) `a un objet. La valeur v d’un
objet prend la forme :
v ::= C(`1, . . . , `n) n ≥ 0
o`u C est le nom de la classe `a laquelle l’objet appartient et `1, . . . , `n sont les locations
associ´ees aux n attributs modifiables de l’objet. Une m´emoire µ est une fonction partielle `a
domaine fini qui associe `a une location la valeur d’un objet.
42Expressions et Commandes Les cat´egories syntaxiques des expressions e et des commandes
S sont d´efinies comme suit :
e ::= x | (variable)
v | (valeur)
new C(e1, . . . , en) | (g´en´eration d’objet)
e.f | (invocation d’attribut)
e.m(e1, . . . , en) | (invocation de m´ethode)
(e as C) | (coercition/downcasting)
S; e (commande-expression)
S ::= e.f := e | (affectation d’attribut)
S; S (s´equentialisation)
Conventions Parmi les variables, on r´eserve la variable this (on choisit aussi self) pour faire
r´ef´erence `a l’objet sur lequel la m´ethode est invoqu´ee. Par ailleurs, comme dans le langage
imp´eratif, on peut faire l’hypoth`ese que le programme source ne manipule pas directement
les locations.
Programme Un programme est constitu´e d’une liste de d´eclarations de classes, et d’une
expression. La valeur de l’expression est le r´esultat du programme. Un programme bien form´e
doit satisfaire certaines conditions :
1. Si C ≤ D alors C h´erite de tous les attributs de D. On demande `a qu’il n’y ait pas
de conflit de nom parmi les attributs. En d’autres termes, si on remonte un chemin de
l’arbre d’h´eritage on ne doit pas trouver deux attributs avec le mˆeme nom.
2. Si C ≤ D alors C h´erite aussi de toutes les m´ethodes de D, cependant C peut red´efinir
(override) une m´ethode `a condition que son type soit le mˆeme que le type de la m´ethode
h´erit´ee.
Il convient d’introduire un certain nombre de fonctions qui seront utilis´ees dans la formulation
des r`egles d’´evaluation et de typage.
– field(C) retourne la liste f1 : C1, . . . , fn : Cn des attributs accessibles par un objet de
la classe C. Si on g´en`ere un objet de la classe C on doit donc lui passer n arguments.
– mtype(m, C) retourne le type de la m´ethode m dans la classe C.
– override(m, D, C → C) est un pr´edicat qui v´erifie que si mtype(m, D) est d´efini alors il
co¨ıncide avec C → C.
– mbody(m, C) retourne le corps (x1, . . . , xn, e) de la m´ethode m dans la classe C ; ici
x1, . . . , xn sont les param`etres formels et e est l’expression associ´ee `a la m´ethode.
Exemple 7.1 On consid`ere une suite de d´eclarations de classes qui permettent de repr´esenter
les valeurs bool´eennes, le nombres naturels en notation unaire, les listes d’objets et les r´ef´erences.
class Bool extends Object = (
method ite(x:Object, y:Object): Object = new Object() )
43class True extends Bool = (
method ite(x:Object,y:Object): Object = x )
class False extends Bool = (
method ite(x:Object,y:Object): Object = y )
class Num extends Object = (
method iszero():Bool = new Bool()
method pred():Num = new Num() )
class Zero extends Num = (
method iszero():Bool = new True() )
class NotZero extends Num = (
var pd: Num
method pred() : Num = this.pd
method iszero(): Bool = new False() )
class List extends Object = (
method select(n:Num): Object = new Object()
method insert(c:Object): NotEmptyList = new NotEmptyList(c,this) )
class NotEmptyList extends List = (
var cl: Object
var follow: List
method select(n:Num): Object = n.iszero().ite( this.cl, this.follow.select(n.pred())) )
class Ref extends Object = (
var val : Object
read(): Object = this.val
write(x:Object):Object = this.val:=x; this )
Exercice 7.2 Compl´etez le code de l’exemple 7.1 en ´ecrivant les m´ethodes suivantes :
1. Une m´ethode cpl dans la classe Bool pour calculer le compl´ementaire d’un bool´een.
2. Une m´ethode add dans la classe Num avec un argument de type Num pour additionner.
3. Une m´ethode count dans la classe List pour compter le nombre d’´el´ements d’une liste.
7.2 Evaluation ´
Pour se rapprocher d’une mise-en-oeuvre de l’´evaluateur, il conviendra de formuler les
r`egles d’´evaluation par rapport `a un environnement η qui associe des valeurs aux variables.
Le jugements qu’on consid`ere ont la forme : (e, η, µ) ⇓ (v, µ0
) et (S, η, µ) ⇓ µ
0
. On ´evalue
les expressions et les commandes par rapport `a une m´emoire et un environnement. Dans
le premier cas le r´esultat de l’´evaluation est une valeur et une nouvelle m´emoire et dans
le deuxi`eme le r´esultat est une m´emoire. Les r`egles d’´evaluation sont les suivantes, o`u l’on
suppose que new(µ, n) = `1, . . . , `n si `1, . . . , `n sont n locations ‘nouvelles’ (pas d´ej`a utilis´ees
dans µ).
44(v, η, µ) ⇓ (v, µ) (x, η, µ) ⇓ (η(x), µ)
(e1, η, µ) ⇓ (v1, µ1), . . . ,(en, η, µn−1) ⇓ (vn, µn),
`1, . . . , `n = new(µ, n)
(new C(e1, . . . , en), η, µ) ⇓ (C(`1, . . . , `n), µn[v1, . . . , vn/`1, . . . , `n])
(e, η, µ) ⇓ (C(`1, . . . , `n), µ0
)
field(C) = f1 : C1, . . . , fn : Cn 1 ≤ i ≤ n
(e.fi, η, µ) ⇓ (µ
0
(`i), µ0
)
(e, η, µ) ⇓ (C(`), µ0) mbody(m, C) = (x1, . . . , xn, e0
)
(e1, η, µ0) ⇓ (v1, µ1)· · ·(en, η, µn−1) ⇓ (vn, µn)
(e
0
, η[v1, . . . , vn/x1, . . . , xn, C(`)/this], µn) ⇓ (v, µ0
)
(e.m(e1, . . . , en), η, µ) ⇓ (v, µ0
)
(e, η, µ) ⇓ (C(`), µ0
) C ≤ D
(e as D, η, µ) ⇓ (C(`), µ0
)
(S, η, µ) ⇓ µ
0
(e, η, µ0
) ⇓ (v, µ00)
(S; e, η, µ) ⇓ (v, µ00)
(e, η, µ) ⇓ (C(`1, . . . , `n), µ0
)
field(C) = f1 : C1, . . . , fn : Cn (e
0
, η, µ0
) ⇓ (v, µ00)
(e.fi := e
0
, η, µ) ⇓ µ
00[v/`i]
(S, η, µ) ⇓ µ
0
(S
0
, η, µ0
) ⇓ µ
00
(S; S
0
, η, µ) ⇓ µ
00
Exemple 7.3 On se r´ef`ere aux classes d´efinies dans l’exemple 7.1. Soient η un environnement
vide, µ une m´emoire vide et e l’expression new Ref(new True()).write(new False())).read().
On peut v´erifier que l’´evaluation de (e, η, µ) produit l’expression False() et la m´emoire µ[False()/`].
7.3 Typage
Un objectif g´en´eral des syst`emes de typage pour les langages `a objets est de garantir que
chaque invocation d’un attribut ou d’une m´ethode sur un objet est bien compatible avec
la classe `a laquelle l’objet appartient. Notons cependant qu’une mauvaise utilisation de la
coercition (downcasting) peut compromettre cette propri´et´e. Par exemple, on pourrait ´ecrire
l’expression :
(new Object() as Ref).read()
Pour ´eviter cette situation on pourrait envisager une r`egle de la forme :
E ` e : D D ≤ C
E ` (e as C) : C
Cependant cette r`egle s’av`ere trop contraignante. Par exemple, elle nous empˆeche de typer
l’expression :
(new True()).ite(new True(), new False ()) as Bool
car le r´esultat de la m´ethode ite appartient `a la classe Object et Object 6≤ Bool.
En Java la r`egle pour la coercition est plutˆot :
E ` e : D (C ≤ D ou D ≤ C)
E ` (e as C) : C
45En d’autres termes, la coercition descendante est interdite si C et D sont incomparables.
Cependant, cette propri´et´e n’est pas pr´eserv´ee par ´evaluation ! Soient A, B deux classes incomparables
et e une expression de type A. Alors l’expression ((e as Object) as B) est bien
typ´ee mais elle se simplifie en l’expression (e as B) qui ne l’est plus. En montant et descendant
dans l’arbre d’h´eritage, on peut arriver `a des classes incomparables. . .
Pour cette raison, on ´ecrit la r`egle de typage pour la coercition descendante comme suit :
E ` e : D
E ` (e as C) : C
Au moment du typage, on ne cherche pas a v´erifier que la valeur C
0
(`) qui r´esulte de
l’´evaluation de l’expression e est telle que C
0 ≤ C. En effet, on retarde cette v´erification
jusqu’au moment de l’´evaluation de la coercition. Si la condition n’est pas satisfaite on bloque
l’´evaluation (alternativement, on pourrait produire un message d’erreur).
Typage d’expressions et de commandes Un environnement de types E a la forme
x1 : C1, . . . , xn : Cn. On consid`ere les jugements de typage de la forme :
E ` e : C, E ` S .
On suppose que dans une expression on ne nomme jamais explicitement une location.
x : C ∈ E
E ` x : C
field(C) = f1 : D1, . . . , fn : Dn
E ` ei : Ci, Ci ≤ Di, 1 ≤ i ≤ n
E ` new C(e1, . . . , en) : C
E ` e : C field(C) = f1 : C1, . . . , fn : Cn
E ` e.fi : Ci
E ` e : C mtype(m, C) = (C1, . . . , Cn) → D
E ` ei : C
0
i C
0
i ≤ Ci 1 ≤ i ≤ n
E ` e.m(e1, . . . , en) : D
E ` e : D
E ` (e as C) : C
E ` S E ` e : C
E ` S; e : C
E ` e : C field(C) = f1 : C1, . . . , fn : Cn
E ` e
0
: Di Di ≤ Ci
E ` e.fi := e
0
E ` S1 E ` S2
E ` S1; S2
Remarque 7.4 (sous-typage) On remarquera que les r`egles de typage permettent d’utiliser
un objet de la classe C l`a o`u on attend un objet de la classe D `a condition que C soit une
sous-classe de D.
Typage de m´ethodes, de classes et de programmes Une m´ethode m de la forme
m(x1 : C1, . . . , xn : Cn) : C0 = e
dans une classe C qui h´erite de la classe D est bien typ´ee si :
1. override(m, D,(C1, . . . , Cn) → C0),
2. x1 : C1, . . . , xn : Cn, this : C ` e : C
0
0
et C
0
0 ≤ C0.
46Une classe est bien typ´ee si toutes ses m´ethodes sont bien typ´ees. Un programme est bien
typ´e si toutes ses classes sont bien typ´ees et si l’expression r´esultat est bien typ´ee dans
l’environnement de type vide.
Exemple 7.5 On peut typer les classes d´efinies dans l’exemple 7.1 et l’expression d´efinie
dans l’exemple 7.3. On remarque qu’on utilise les sous-typage True ≤ Object au moment de
la cr´eation de l’objet Ref et le sous-typage False ≤ Object au moment de l’invocation de la
m´ethode write. Par ailleurs, le type de l’expression e d´efinie est Object.
Exercice 7.6 D´efinissez une classe Bnum des nombres naturels en notation binaire avec des
m´ethodes pour incr´ementer, d´ecr´ementer, additionner et tester-le-z´ero.
Exercice 7.7 On consid`ere un fragment du langage `a objets auquel on a ajout´e les expressions
fail et catch(e, e0
) :
e ::= id | new C(e, . . . , e) | (e as C) | fail | catch(e, e0
)
Un jugement d’´evaluation pour les expressions a la forme (e, η, µ) ⇓ (u, µ0
) o`u η est un environnement,
µ et µ
0
sont des m´emoires et u est ou bien une valeur ou bien fail (donc fail n’est
pas une valeur).
Proposez des r`egles d’´evaluation pour les expressions qui respectent les conditions suivantes :
– L’´evaluation des expressions sans fail et catch se passe normalement.
– L’expression (D() as C) s’´evalue en fail si D n’est pas une sous-classe de C.
– Si l’expression e s’´evalue en une valeur alors l’expression catch(e, e0
) s’´evalue comme e.
– L’expression catch(fail, e0
) s’´evalue comme e
0
(L’id´ee est qu’un ´echec provoqu´e par fail
se propage et entraˆıne l’arrˆet du programme sauf s’il est trait´e par un catch).
On dispose de deux classes C et D sans attributs et telles que C ≤ D mais D 6≤ C.
Utilisez vos r`egles pour ´evaluer les expressions suivantes dans un environnement et une
m´emoire vides :
e1 = catch( (new D()) as C, new C() )
e2 = catch( fail, (new C()) as D )
e3 = catch( catch( fail, new C() ), new D() )
478 Evaluation et typage d’un langage fonctionnel ´
On suppose que le lecteur est familier avec un langage fonctionnel de la famille ML. On
consid`ere un langage d’expressions dans lequel on peut manipuler des fonctions de fonctions.
On dit que le langage est d’ordre sup´erieur. Il s’agit d’un langage minimal introduit par
Church en 1930 qu’on appelle ‘λ-calcul’.
id ::= x | y | . . .
e ::= id | (λid.e) | (ee)
Les seules op´erations du langage sont l’abstraction λx.e et l’application ee0
.
4 Une vari´et´e
d’autres op´erations peuvent ˆetre vues comme du sucre syntaxique. Par exemple, l’op´eration
let x = e in e
0
est repr´esent´ee par (λx.e0
)e.
8.1 Substitution
L’abstraction λx.e lie la variable x dans le terme e exactement comme dans la formule du
premier ordre ∀x.φ le quantificateur universel lie x dans φ. On d´enote par FV (e) l’ensemble
des variables qui paraissent libres dans le terme e. On dit que deux termes e, e0
sont α-
´equivalents, et on ´ecrit e =α e
0
si on peut obtenir l’un de l’autre par renommage des variables
li´ees. Par exemple, λf.λx.f(fx) =α λx.λy.x(xy).
A cause de la pr´esence de variables li´ees, la substitution [e
0/x]e doit ˆetre d´efinie avec un
peu d’attention (cf. section 2). Comment d´efinir [e
0/x](λy.e) si x 6= y et y ∈ FV (ee0
) ? Une
d´efinition possible est la suivante :
[e
0/x]x = e
0
[e
0/x]y = y si y 6= x
[e
0/x](e1e2) = [e
0/x]e1[e
0/x]e2
[e
0/x](λy.e) = λz.[e
0/x][z/y]e si z /∈ FV (ee0
)
Pour v´erifier qu’il s’agit bien d’une d´efinition inductive sur la structure d’un λ-terme, il
faut d’abord noter que [z/y]e a la mˆeme taille que e. Le lecteur peut aussi v´erifier que (i)
[e
0/x](λx.e) =α λx.e et (ii) si x 6= y et y /∈ FV (e
0
) alors [e
0/x](λy.e) =α λy.[e
0/x]e.
8.2 Appel par nom et appel par valeur
Les valeurs v, v0
, . . . sont les λ-termes d´efinis par la grammaire :
v ::= λid.e .
On sp´ecifie dans la table 2, les relations ⇓N et ⇓V qui d´efinissent l’´evaluation pour l’appel par
nom et par valeur, respectivement (la liaison ´etant toujours statique, cf section 6).
8.3 Typage
On d´efinit la collection des types par la grammaire :
τ ::= b | Tid | (τ → τ )
4En ML, on ´ecrit (function x → e) pour λx.e
48v ⇓N v
e ⇓N λx.e1 [e
0/x]e1 ⇓N v
ee0 ⇓N v
v ⇓V v
e ⇓V λx.e1 e
0 ⇓V v
0
[v
0/x]e1 ⇓V v
ee0 ⇓V v
Tab. 2 – Evaluation en appel par nom et par valeur ´
o`u Tid ::= t | s | . . . Un environnement de type E est toujours une fonction `a domaine fini
des variables aux types qu’on repr´esente aussi comme une liste de couples x1 : τ1, . . . , xn : τn
o`u toutes les variables x1, . . . , xn sont diff´erentes. On ´ecrit E, x : τ pour la fonction E[τ /x]
o`u x n’est pas dans le domaine de d´efinition de E. Les r`egles de typage sont les suivantes :
(ax )
E(x) = τ
E ` x : τ
(→I )
E[τ /x] ` e : τ
0
E ` λx.e : τ → τ
0
(→E)
E ` e : τ → τ
0 E ` e
0
: τ
E ` ee0
: τ
0
Nous v´erifions que le typage est pr´eserv´e par la relation d’´evaluation (cf. section 2).
D’abord on a besoin d’un lemme.
Lemme 8.1 (substitution) Si E, x : τ ` e : τ
0
et E ` e
0
: τ alors E ` [e
0/x]e : τ
0
.
Idee de la preuve ´ . Par induction sur la hauteur de la preuve de E, x : τ ` e : τ
0
. Par
exemple, supposons que la racine de l’arbre de preuve ait la forme :
E, x : τ, y : τ
0 ` e : τ
00
E, x : τ ` λy.e : τ
0 → τ
00
avec x 6= y. Par hypoth`ese de r´ecurrence, E, y : τ
0 ` [e
0/x]e : τ
00 et on conclut par (→I ). •
Proposition 8.2 (r´eduction du sujet) Si E ` e : τ et e ⇓S v o`u S ∈ {N, V } alors E ` v :
τ .
Idee de la preuve ´ . Par induction sur la hauteur de la preuve de e ⇓S v. On consid`ere le
cas o`u l’´evaluation est par valeur et la racine de la preuve a la forme :
e ⇓V λx.e1 e
0 ⇓V v
0
[v
0/x]e1 ⇓V v
ee0 ⇓V v
Alors E ` ee0
: τ implique E ` e : τ
0 → τ et E ` e
0
: τ
0 pour quelque τ
0
. Par hypoth`ese
inductive, E ` λx.e1 : τ
0 → τ et E ` v
0
: τ
0
. Alors on d´erive que E, x : τ
0 ` e1 : τ . Par le
lemme de substitution E ` [v
0/x]e1 : τ , et par hypoth`ese inductive E ` v : τ . •
Etant donn´e un terme ´ e et un contexte E, le probl`eme d’inf´erence de type est le probl`eme
de v´erifier qu’il y a un type τ tel que E ` e : τ . Etant donn´e un terme ´ e, une variante du
probl`eme est de chercher un type τ et un contexte E tel que E ` e : τ .
49Associ´e au probl`eme de l’inf´erence de type, on a le probl`eme de produire une information
int´eressante. Si un terme e est typable, on cherche une repr´esentation synth´etique de ses types
et s’il ne l’est pas on souhaite ´emettre un message d’erreur informatif.
Exercice 8.3 Montrez que si x1 : τ1, . . . , xn : τn ` e : τ est d´erivable alors (τ1 → · · ·(τn →
τ )· · ·) est une tautologie de la logique propositionnelle o`u l’on interpr`ete → comme une implication
et les types atomiques comme des variables propositionnelles.
Exercice 8.4 Trouvez un type τ tel que ∅ ` λx.λy.x(yx) : τ est d´erivable et explicitez la
d´erivation.
Exercice 8.5 On consid`ere le type :
σ ≡ (((τ → τ
0
) → τ
0
) → τ
0
) → (τ → τ
0
)
Pr´esentez un λ-terme ferm´e (c.a.d. sans variables libres) e tel que ∅ ` e : σ est d´erivable dans
le syst`eme ci-dessus.
Mˆeme question pour le type :
(τ1 → τ2) → ((τ2 → τ3) → (τ1 → τ3))
o`u τ1, τ2, τ3 sont trois types diff´erents.
8.4 Un ´evaluateur pour le langage fonctionnel
Nous allons consid´erer plus en d´etail un ´evaluateur pour le λ-calcul. On omet les types
et on se focalise sur les strat´egies d’´evaluation en appel par nom et par valeur. Nous allons
raffiner la description de l’´evaluateur en utilisant le concept de clˆoture que nous avons d´ej`a
´evoqu´e dans la section 6.5. On d´efinit environnements et clˆotures de la fa¸con suivante :
• Un environnement est une fonction partielle η : Var * Closures o`u dom(η) est fini
(en particulier la fonction qui est toujours ind´efinie est un environnement), et Closures est
l’ensemble des clˆotures.
• Une clˆoture c est un couple qu’on d´enote par e[η] o`u e est un terme et η est un environnement.
On ´evalue toujours des clˆotures e[η] telles que F V (e) ⊆ dom(η).
On peut reformuler les relations d’´evaluation sur les clˆotures. Maintenant, une valeur vc
est une clˆoture de la forme (λx.e)[η]. Les r`egles sont pr´esent´ees dans la table 3.
vc ⇓N vc
η(x) ⇓N vc
x[η] ⇓N vc
e[η] ⇓N λx.e1[η
0
] e1[η
0
[e
0
[η]/x]] ⇓N vc
(ee0
)[η] ⇓N vc
vc ⇓V vc
η(x) ⇓V vc
x[η] ⇓V vc
e[η] ⇓V λx.e1[η
0
] e
0
[η] ⇓V vc0
e1[η
0
[vc0/x]] ⇓V vc
(ee0
)[η] ⇓V vc
Tab. 3 – Evaluation des clˆotures en appel par nom et par valeur ´
50Exercice 8.6 On voit un environnement η comme une liste de couples (x1, c1), · · · ,(xn, cn)
o`u xi sont des variables et ci des clˆotures. Nous allons r´e-´ecrire les clˆotures en ´eliminant
les variables qui suivent imm´ediatement un ‘λ
0
(les param`etres formels) et en rempla¸cant les
autres variables (les occurrences dans les corps des fonctions) par des indices (des nombres
naturels) qui indiquent la distance entre la variable et la λ-abstraction correspondante ou
l’´el´ement de l’environnement correspondant. Par exemple, en d´enotant avec la liste vide, on
a la correspondance suivante :
Syntaxe clˆoture avec variables Syntaxe clˆoture avec indices
((λx.x)(λx.x))[ ] ((λ.0)(λ.0))[ ]
((λx.x)(λy.y))[ ] ((λ.0)(λ.0))[ ]
(λx.xy)[(z,(λw.w)[ ]),(y,(λw.w)[ ])] (λ.02)[(λ.0)[ ],(λ.0)[ ]]
(λx.xy)[(y,(λw.w)[ ]),(z,(λw.w)[ ])] (λ.01)[(λ.0)[ ],(λ.0)[ ]]
En utilisant cette nouvelle syntaxe, on peut r´e-´ecrire les r`egles d’´evaluation en appel par
valeur de la fa¸con suivante o`u η(i) d´enote l’i-`eme ´el´ement de la liste η (on compte `a partir
de 0) :
(λ.e)[η] ⇓ (λ.e)[η] i[η] ⇓ η(i)
e[η] ⇓ λ.e1[η1] e
0
[η] ⇓ v2[η2] e1[v2[η2] , η1] ⇓ v3[η3]
(ee0
)[η] ⇓ v3[η3]
1. Evaluez ´ ((λ.0)(λ.0))[ ].
2. Programmez l’´evaluateur dans le langage `a objets pr´esent´e en section 7. Plus pr´ecis´ement
vous devez programmer dans ce langage :
– Une classe Closure avec attributs de type Code et List et une m´ethode eval qui retourne
comme r´esultat l’´evaluation de la clˆoture.
– Une classe Code avec une m´ethode ev qui prend en argument un environnement (une
liste) et retourne le r´esultat de l’´evaluation du code par rapport `a l’environnement.
Par ailleurs la classe Code a comme sous-classes les classes Var, Lambda et Apl.
Il est conseill´e d’utiliser les d´eclarations de classe Bool, Num et List de l’exemple 7.1.
Dans votre programme, vous pouvez utiliser la notation let x=e in e’ comme abr´eviation
pour l’expression e’ o`u chaque occurrence de x est remplac´ee par l’expression e. Notez
que la m´ethode ite de la classe Bool ´evalue toujours les deux branches de l’if-then-else.
3. Pr´ecisez si l’op´eration de downcasting joue un rˆole dans le bon typage du programme.
4. Construisez l’expression e de type Closure qui correspond `a la clˆoture ((λ.0)(λ.0))[ ] et
v´erifiez qu’elle est bien typ´ee.
8.5 Vers une mise en oeuvre
Nous allons raffiner encore les ´evaluateurs d´ecrits dans la table 3 en introduisant une pile
qui maintient une trace des valeurs calcul´ees et des termes `a ´evaluer.
Dans la strat´egie en appel par nom, on visite un terme en cherchant une r´eduction possible
`a gauche de l’application. Pendant cette visite, les termes qui paraissent comme arguments
d’une application sont ins´er´es avec leurs environnements sur la pile.
Donc la pile (ou stack) s peut ˆetre vue comme une liste ´eventuellement vide de clˆotures
c1 : . . . : cn.
On d´ecrit le calcul comme un syst`eme de r´e´ecriture de couples (e[η], s) compos´ees d’une
clˆoture et d’une pile. La machine op`ere sur des termes clos. Au d´ebut du calcul la pile est
51vide et l’environnement est la fonction ind´efinie partout.
(x[η], s) → (η(x), s)
((ee0
)[η], s) → (e[η], e0
[η] : s)
((λx.e)[η], c : s) → (e
0
[η[c/x]], s)
Dans l’appel par valeur, on a besoin de savoir si le sommet de la pile est une fonction ou
un argument. Pour cette raison, on ins`ere dans la pile des marqueurs l (pour left) et r (pour
right) qui sp´ecifient si la prochaine clˆoture sur la pile est un argument gauche ou droite de
l’application. La pile devient alors une liste ´eventuellement vide de marqueurs m ∈ {l, r} et
clˆotures de la forme : m1 : c1 : . . . mn : cn. Le calcul est maintenant d´ecrit par les r`egles
suivantes :
(x[η], s) → (η(x), s)
((ee0
)[η], s) → (e[η], r : e
0
[η] : s)
(vc, r : c : s) → (c, l : vc : s)
(vc, l : (λx.e)[η] : s) → (e[η[vc/x]], s)
8.6 Mise en oeuvre de l’´evaluateur
Nous d´ecrivons une mise en oeuvre de l’´evaluateur pour l’appel par valeur. L’´evaluateur
g`ere une m´emoire qui est divis´ee en trois parties (voir aussi section 9) :
Statique Cette partie contient :
– Les instructions `a ex´ecuter.
– Un pointeur pt code `a la prochaine instruction `a ex´ecuter. Initialement ce pointeur
pointe `a la premi`ere instruction.
– Un pointeur pt stack au sommet de la pile (voir ci-dessous). Initialement ce pointeur
pointe `a la base de la pile.
– Un pointeur pt env `a l’environnement courant (qui est m´emoris´e dans le tas, voir
ci-dessous). Initialement ce pointeur est nil.
– Un pointeur pt free `a la premi`ere cellule libre du tas.
Pile Une zone contigu¨e de m´emoire dont le sommet est point´e par pt stack. Initialement la
pile est vide.
Tas Une zone contigu¨e de m´emoire. Initialement cette zone est li´ee pour former une liste de
cellules libres et le premier ´el´ement de la liste est point´e par pt free.
Les instructions de la partie statique, les ´el´ements de la pile et les ´el´ements du tas sont
structur´es comme des enregistrements (ou records) avec les champs suivants :
enregistrement code Il a trois champs : op l’´etiquette de l’instruction, left le pointeur
gauche et right le pointeur droit.
enregistrement pile Il a trois champs : marqueur m, pointeur au code code, pointeur `a
l’environnement env.
enregistrement tas Il a quatre champs : var nom de la variable, code pointeur au code, env
pointeur `a l’environnement et next pointeur au prochain ´el´ement du tas.
La description de l’´evaluateur peut ˆetre compl´et´ee pour traiter les probl`emes du d´ebordement
de la pile, du d´ebordement du tas et de la r´ecup´eration de la m´emoire du tas. On remarque
que la fonction Eval utilise seulement des goto’s ; en particulier, il n’y a pas d’appel r´ecursif
et donc il n’y a pas de pile cach´ee qui g`ere la r´ecursion.
52Eval : case pt code.op of
@ : let p = push() in
p.code := pt code.right;
p.env := pt env;
p.m := r;
pt code := pt code.left;
goto Eval
x : let p = access(x, pt env) in
pt code := p.code;
pt env := p.env;
goto Eval
λx : case
pt stack = ∅ : return(pt code, pt env)
pt stack.m = r :
aux1 := pt stack.code;
aux2 := pt stack.env;
pt stack.code := pt code;
pt stack.env := pt env;
pt stackpile.m := l;
pt code := aux1;
pt env := aux2;
goto Eval
pt stack.m = l, pt stack.code.op = λy :
let p = pop(pt free) in
p.code := pt code;
p.env := pt env;
p.var := y;
p.next := pt stack.env;
pt code := pt stack.code.right;
pt env := p;
pop(pt stack);
goto Eval
Tab. 4 – Mise en oeuvre de l’´evaluateur pour l’appel par valeur
53Remarque 8.7 L’´evaluateur que nous venons de d´ecrire n’est pas tr`es ´eloign´e d’une machine
virtuelle pour un langage fonctionnel. En particulier, la machine virtuelle d’un langage
fonctionnel manipule aussi une pile et un tas et la gestion des liaisons est bas´ee sur la notion
de clˆoture.
Exercice 8.8 Les r`egles suivantes d´ecrivent une variante —avec appel par nom— de l’´evaluateur
pour l’appel par valeur :
(1) (x[η], s) → (η(x), s)
(2) ((ee0
)[η], s) → (e[η], e0
[η] : s)
(3) ((λx.e)[η], c : s) → (e[η[c/x]], s)
o`u (i) x, ee0
, λx.e sont des λ-termes, (ii) η est un environnement c.a.d. une fonction partielle
qui associe une clˆoture `a une variable, (iii) c est une clˆoture c.a.d. un couple λ-termeenvironnement
(´ecrit e[η]) et (iv) s est une pile de clˆotures.
1. Evaluez la configuration ´ (e[∅], ∅) o`u e ≡ (((λx.λy.y)Ω)I), Ω ≡ (λx.xx)(λx.xx) et I ≡
λz.z.
2. Le r´esultat change-t-il si l’on utilise les r`egles pour l’appel par valeur ?
3. En vous inspirant de l’impl´ementation pour l’appel par valeur, d´ecrivez la partie de
l’implementation de l’´evaluateur qui correspond `a la r`egle (2). On suppose que pt code
est le pointeur au code, pt env est le pointeur `a l’environnement et pt stack est le pointeur
`a la pile.
549 Machine virtuelle et compilation
On d´ecrit une machine virtuelle et une fonction de compilation pour le langage imp´eratif.
La m´emoire de la machine virtuelle est organis´ee en 3 parties :
1. Une partie qui contient le code du programme. Cette partie est allou´ee statiquement et
elle n’est pas modifi´ee. Le code est naturellement divis´e en segments o`u chaque segment
correspond `a une proc´edure ou au corps principal du programme.
2. Une pile de blocs d’activation (ou frames). Un bloc d’activation est un triplet
(f, pc, v1 · · · vn)
o`u :
– f est l’adresse d’un segment de code qui correspond `a la proc´edure f,
– pc est un compteur ordinal qui varie sur les instructions du segment (`a partir de 1)
et
– v1 · · · vn est une pile de valeurs (le sommet est `a droite).
Les blocs d’activation sont empil´es selon l’ordre d’appel des proc´edures. Ainsi le bloc
au sommet correspond au dernier appel qui est actuellement en ex´ecution. Au d´ebut du
calcul, le bloc d’activation sur la pile est celui du corps principal du programme.
3. Un tas (ou heap) qui est une association entre locations et valeurs.
Remarque 9.1 On dispose d’une pile de blocs d’activation et dans chaque bloc d’activation
on dispose d’une pile de valeurs. Attention `a ne pas confondre les piles !
9.1 Instructions du code octet
La machine virtuelle ex´ecute un cycle standard de chargement ex´ecution (fetch and execute).
Si (f, pc, v1 · · · vn) est le bloc d’activation au sommet de la pile, la machine virtuelle
ex´ecute l’instruction d’adresse pc dans le segment d’instructions qui correspond `a f. Les
instructions et leur effet sur les piles sont d´ecrites ci-dessous.
– build c n : on remplace n valeurs v1 · · · vn au sommet de la pile par c(v1, . . . , vn) et on
incr´emente le compteur ordinal. Ici c est un constructeur. Par exemple, on peut ´ecrire :
(build true 0) ou (build Pair 2).
– load n : on copie l’n-i`eme valeur de la pile au sommet de la pile (de valeurs) et on
incr´emente le compteur ordinal.
– goto j : on affecte j au compteur ordinal.
– branch j : si la valeur au sommet de la pile est true on incr´emente le compteur ordinal
sinon on affecte le compteur ordinal `a j. Dans les deux cas on supprime la valeur au
sommet de la pile.
– op n : on remplace les n valeurs v1 · · · vn au sommet de la pile par op(v1, . . . , vn) et on
incr´emente le compteur ordinal.
– fst (snd) : si la valeur au sommet de la pile est Pair(v1, v2) alors on remplace cette valeur
par v1 (v2) et on incr´emente le compteur ordinal.
– stop : on arrˆete le calcul.
– call f n : on enl`eve les n valeurs v1 · · · vn au sommet de la pile, on incr´emente le compteur
ordinal et on empile un bloc d’activation (f, 1, v1 · · · vn). Cette instruction est utilis´ee
dans l’appel de proc´edure.
55– tcall f n : on s´electionne les n valeurs v1 · · · vn au sommet de la pile et on remplace le
bloc d’activation courant par le bloc (f, 1, v1 · · · vn). Cette instruction peut ˆetre utilis´ee
dans l’appel d’une proc´edure dont la r´ecursion est terminale.
– return on d´epile un bloc d’activation.
– new on g´en`ere une nouvelle location `, on copie la valeur au sommet de la pile dans la
location, on remplace la valeur par ` et on incr´emente le compteur ordinal.
– read si la valeur au sommet de la pile est une location `, on remplace ` par son contenu
et on incr´emente le compteur ordinal.
– write si les valeurs au sommet de la pile sont v · ` alors on ´ecrit v dans la location `, on
´elimine v et ` et on incr´emente le compteur ordinal.
On peut formaliser la s´emantique des instructions par des r`egles de r´e´ecriture. Par exemple :
– La r`egle pour l’instruction new est :
(S · (f, pc, v · v), µ) → (S · (f, pc + 1, v · `), µ[v/`])
o`u f[pc] = new, S est une pile (´eventuellement vide) de blocs d’activation, µ est une
m´emoire et ` est une nouvelle location.
– La r`egle pour l’instruction call est :
(S · (g, pc, u · v1 · · · vn), µ) → (S · (g, pc + 1, u) · (f, 1, v1 · · · vn), µ)
o`u g[pc] = (call f n).
Exercice 9.2 Formaliser la s´emantique de toutes les instructions d´ecrites ci-dessus.
9.2 Compilation
– Soit w une liste de variables. i(x, w) est la position la plus `a droite de x dans w. Par
exemple, i(x, y · x · z · x · w) = 4.
– On compile le corps principal du programme avec w liste vide et les corps des proc´edures
avec w ´egal `a la liste des param`etres formels.
– On compile les expressions comme suit :
C(n, w) = (build n 0)
C(x, w) = (load i(x, w))
C(op(e1, . . . , en), w) = C(e1, w)· · · C(en, w) · (op n)
C(Pair (e1, e2), w) = C(e1, w) · C(e2, w) · (build Pair 2)
C(Fst(e), w) = C(e, w) · (fst)
C(!e, w) = C(e, w) · (read)
C(ref e, w) = C(e, w) · (new)
– On compile une liste de d´eclarations de variables comme suit (on omet le let dans les
d´eclarations) :
C(y1 = e1; . . . ; yn = en, w) = C(e1, w)· · · C(en, w · y1 · · · yn−1)
– La compilation des commandes n´ecessite un param`etre additionnel κ qui repr´esente
l’adresse de l’instruction o`u il faut sauter pour poursuivre le calcul. Nous faisons l’hypoth`ese
que chaque segment de code de proc´edure contient une instruction return dont
l’adresse est d´enot´ee symboliquement par κreturn. De mˆeme nous supposons que le segment
du code principal contient une instruction stop dont l’adresse est d´enot´ee symboliquement
par κstop.
56– Consid´erez la compilation de la s´equentialisation de deux commandes comme, par
exemple, (if x then S11 else S12); S2. Ici on doit ex´ecuter une des branches S1j et
ensuite proc´eder `a l’ex´ecution de S2. A cette fin, on a besoin de connaˆıtre l’adresse de la
premi`ere instruction du code qui correspond `a la commande S2. D’autre part, la valeur
exacte de cette adresse va d´ependre du nombre d’instructions produites par la compilation
des branches S11 et S12. Pour ne pas alourdir la notation nous allons indiquer
de fa¸con symbolique la premi`ere adresse de la suite d’instructions qui correspond `a la
commande S2. Si on ´ecrit :
νκ0
C(S1, w, κ0
) κ
0
: C(S2, w, κ)
il est entendu que κ
0
est une nouvelle adresse `a partir de laquelle on m´emorise le code
associ´e `a la commande S2. Par ailleurs, en passant κ
0
comme param`etre `a la compilation
de la commande S1, on s’assure qu’une fois le calcul de S1 termin´e, le calcul va continuer
avec l’instruction d’adresse κ
0
.
– Avec les conventions qu’on vient de pr´esenter, on compile le corps principal y1 =
e1; . . . ; yn = en; S par
C(y1 = e1; . . . ; yn = en, w) · C(S, w · y1 · · · yn, κstop)
o`u w correspond aux variables pr´ed´efinies.
– On compile le corps d’une proc´edure
procedure f(x1 : τ1, . . . , xm : τm) = y1 = e1; · · · yn = en; S
par
C(y1 = e1; . . . ; yn = en, x1 · · · xm) · C(S, x1 · · · xm · y1 · · · yn, κreturn)
– Enfin on doit d´efinir la compilation d’une commande.
C(x := e, w, κ) = C(e, w) · (load i(x, w)) · (write) · (goto κ)
C(S1; S2, w, κ) = νκ0 C(S1, w, κ0
) κ
0
: C(S2, w, κ)
C(f(e1, . . . , en), w, κ) = C(e1, w)· · · C(en, w) · (call f n) · (goto κ)
C(while e do S, w, κ) = νκ0
(κ
0
: C(e, w) · (branch κ) · C(S, w, κ0
))
C(if e then S1 else S2, w, κ) = C(e, w) νκ0
(branch κ
0
) · C(S1, w, κ) κ
0
: C(S2, w, κ)
Exemple 9.3 On calcule la compilation du programme :
procedure f (x : int, y : ref int) =
if x 6= 0 then y :=!y + x; f(x − 1, y)
let z = ref 0;
f(3, z)
Ici on utilise une nouvelle commande if e then S. Elle peut ˆetre vue comme une abr´eviation
pour la commande if e then S else skip o`u skip est une commande qui n’a pas d’effet. On
pr´ef`ere utiliser une compilation optimis´ee :
C(if e then S, w, κ) = C(e, w) · (branch κ) · C(S, w, κ)
Dans la compilation, on remplace aussi tout code de la forme :
n : goto n + 1
n + 1 : instruction
57par le code : n : instruction. Avec ces conventions on obtient :
main 1 : build 0 0 f 1 : load 1
2 : new 2 : build 0 0
3 : build 3 0 3 : neq 2
4 : load 1 4 : branch 16
5 : call f 2 5 : load 2
6 : stop 6 : read
7 : load 1
8 : add 2
9 : load 2
10 : write
11 : load 1
12 : build − 1 0
13 : add 2
14 : load 2
15 : call f 2
16 : return
On remarquera que l’instruction 16 qui suit l’appel de fonction est un return. On est donc
en pr´esence d’une r´ecursion terminale et on pourrait remplacer les instructions 15 et 16 par
15 : tcall f 2, tout en rempla¸cant l’adresse 16 par l’adresse 15 dans l’instruction de saut
conditionn´e 4.
Exercice 9.4 On consid`ere un fragment de la compilation des commandes du langage imp´eratif :
C(x := e, w, κ) = C(e, w) · (load i(x, w)) · (write) · (goto κ)
C(S1; S2, w, κ) = νκ0
C(S1, w, κ0
) κ
0
: C(S2, w, κ)
C(while e do S, w, κ) = νκ0
(κ
0
: C(e, w) · (branch κ) · C(S, w, κ0
))
C(if e then S1 else S2, w, κ) = C(e, w) νκ0
(branch κ
0
) · C(S1, w, κ) κ
0
: C(S2, w, κ)
o`u certaines adresses sont trait´ees de fa¸con symbolique. Dans cet exercice, on souhaite
d´efinir une nouvelle fonction de compilation o`u les adresses sont toujours calcul´ees explicitement.
1. D´efinissez une fonction size(S) qui calcule le nombre d’instructions pr´esentes dans la
compilation de S (on suppose que la fonction size(e) est d´ej`a d´efinie sur les expressions).
2. Utilisez la fonction size pour d´efinir une fonction de compilation (sans adresses symboliques
!) C(S, w, i, κ) qui compile la commande S par rapport `a une liste de variables w,
en sachant que l’adresse de la premi`ere instruction du code compil´e est i et que l’adresse
de la premi`ere instruction `a ex´ecuter apr`es S est κ.
Par exemple, si size(e) = 1, alors la fonction C(x := e; y := e, w, 12, 33) pourrait ˆetre une liste d’instructions
de la forme suivante :
C(e, w) · (load i(x, w)) · (write) · (goto 16) · C(e, w) · (load i(y, w)) · (write) · (goto 33)
qui est m´emoris´ee entre les adresses 12 et 19.
9.3 Erreurs et typage du code octet
Comme dans l’´evaluation du code source, on peut rencontrer un certain nombre de situations
anormales ou erreurs, dans l’ex´ecution du code octet. Par exemple :
– On affecte au compteur ordinal une valeur qui d´epasse la taille du segment de code.
– On cherche une valeur sur la pile qui n’est pas pr´esente.
58– Les types des arguments sont incompatibles avec l’op´eration qu’on veut effectuer (projeter
un entier, lire un bool´een,. . .)
– On appelle une proc´edure qui n’existe pas ou on appelle une proc´edure avec le mauvais
nombre d’arguments.
Comme pour le code source, on peut envisager une analyse de typage au niveau du code
octet. Mˆeme si une analyse de typage est effectu´ee au niveau du code source, une telle analyse
peut ˆetre utile pour au moins deux raisons :
– Le compilateur peut introduire des erreurs de type.
– Le code octet peut avoir ´et´e manipul´e.
Comment typer un code octet ? L’id´ee est de calculer pour chaque instruction les types
des valeurs qui peuvent ˆetre sur la pile de valeurs quand l’instruction est ex´ecut´ee.
Exemple 9.5 Pour chaque instruction du code octet g´en´er´e dans l’exercice 9.3, on peut essayer
de pr´evoir le nombre et le type des valeurs pr´esentes sur la pile quand l’instruction est
ex´ecut´ee. Par exemple, pour le segment f on peut calculer :
f 1 : load 1 int, ref (int)
2 : build 0 0 int, ref (int), int
3 : neq 2 int, ref (int), int, int
4 : branch 16 int, ref (int), bool
5 : load 2 int, ref (int),
6 : read int, ref (int), ref (int)
7 : load 1 int, ref (int), int
8 : add 2 int, ref (int), int, int
9 : load 2 int, ref (int), int
10 : write int, ref (int), int, ref (int)
11 : load 1 int, ref (int)
12 : build −1 0 int, ref (int), int
13 : add 2 int, ref (int), int, int
14 : load 2 int, ref (int), int
15 : call f 2 int, ref (int), int, ref (int)
16 : return int, ref (int)
Remarque 9.6 Le probl`eme de la d´efinition d’une machine virtuelle et de la g´en´eration de
code pour le langage `a objet discut´e en section 7 peuvent constituer la base pour un mini-projet
de compilation. Il s’agit d’adapter les concepts d´ej`a pr´esent´es pour le langage imp´eratif.
Exercice 9.7 On consid`ere la commande S suivante :
while !x > 0 do
x :=!x−!y;
y :=!y+!y
Proposez une compilation de la commande S dans le code octet. La compilation de S est
relative `a une liste de variables x · y et `a une continuation κ.
Exercice 9.8 D´ecrivez la fonction de compilation de la commande repeat pr´esent´ee dans
l’exercice 6.16. Vous pouvez utiliser les instructions goto et branch dont la description suit :
– goto j : on affecte j au compteur ordinal.
– branch j : si la valeur au sommet de la pile est true on incr´emente le compteur ordinal
sinon on affecte le compteur ordinal `a j. Dans les deux cas on supprime la valeur au
sommet de la pile.
59Exercice 9.9 On se place dans le cadre (d’un fragment) du langage imp´eratif auquel on
ajoute les commandes skip, fail et catch(S, S0
). La syntaxe des commandes est sp´ecifi´ee par
la grammaire ci-dessous :
S ::= id := n | S; S | skip | fail | catch(S, S)
L’´evaluation des commandes est d´ecrite par un jugement de la forme (S, η, µ) ⇓ (X, µ0
) o`u µ,
µ
0
sont des m´emoires et X ∈ {fail, skip} indique si le calcul termine normalement (skip) ou
si une exception (non-captur´ee) a ´et´e lev´ee (fail). Les r`egles d’´evaluation sont les suivantes :
X ∈ {fail, skip}
(X, η, µ) ⇓ (X, µ) (x := n, η, µ) ⇓ (skip, µ0
[n/η(x)])
(S1, η, µ) ⇓ (skip, µ0
) (S2, η, µ0
) ⇓ (X, µ00)
(S1; S2, η, µ) ⇓ (X, µ00)
(S1, η, µ) ⇓ (fail, µ0
)
(S1; S2, η, µ) ⇓ (fail, µ0
)
(S1, η, µ) ⇓ (skip, µ0
)
(catch(S1, S2), η, µ) ⇓ (skip, µ0
)
(S1, η, µ) ⇓ (fail, µ0
) (S2, η, µ0
) ⇓ (X, µ00)
(catch(S1, S2), η, µ) ⇓ (X, µ00)
Appliquez les r`egles d’´evaluation aux commandes ci-dessous `a partir d’un environnement η0
qui associe aux variables a, b, c, d les locations distinctes `1, `2, `3, `4 et une m´emoire µ0 qui
associe aux locations `i, i = 1, 2, 3, 4, la valeur 5.
S1 = catch(a := 1; fail; b := 2 , c := 3)
S2 = catch(a := 1; fail , catch(b := 2; fail; c := 3 , d := 4))
On ajoute une instruction fail qui arrˆete le calcul dans un ´etat d’´echec (alors que l’instruction
stop arrˆete le calcul avec succ`es).
D´efinissez une fonction de compilation C(S, w, κ, κ0
) o`u S est la commande `a compiler,
w est une liste de variables, κ est l’adresse `a laquelle continuer le calcul si l’´evaluation de S
termine normalement et κ
0
est l’adresse `a laquelle continuer le calcul si l’´evaluation de S l`eve
une exception.
Calculez la compilation des commandes S1 et S2 d´ecrites ci-dessus avec param`etres, w =
abcd, κ = 100, κ
0 = 200 et en supposant que la premi`ere instruction est m´emoris´ee `a l’adresse
1.
Exercice 9.10 On se place dans le cadre du langage `a objets ´etudi´e dans la section 7. On
consid`ere les expressions suivantes :
e ::= id | new C(e, . . . , e) | e.f
o`u id est la cat´egorie syntaxique des identificateurs et f celle des attributs. L’objectif est de
d´efinir une fonction de compilation C(e, w), o`u w est une liste d’identificateurs, pour une machine
virtuelle qui s’inspire de celle ´etudi´ee pour le langage imp´eratif. Dans la suite on rappelle
et, au passage, on adapte certaines instructions de la machine virtuelle. Un bloc d’activation
a la forme (. . . , pc, u1, . . . , um) o`u pc est le compteur ordinal et ui d´enote soit une valeur
C(`1, . . . , `n) d’un objet soit une location `.
– build C n : on remplace n locations `1 · · · `n au sommet de la pile par la valeur C (`1, . . . , `n) et
on incr´emente le compteur ordinal. Ici C est le nom d’une classe.
– load n : on copie l’n-i`eme ´el´ement de la pile au sommet de la pile et on incr´emente le compteur
ordinal.
60– prj j : si l’´el´ement au sommet de la pile est une valeur D(`1, . . . , `n) avec 1 ≤ j ≤ n alors on
remplace cette valeur par `j et on incr´emente le compteur ordinal.
– new on g´en`ere une nouvelle location `, on ´ecrit la valeur au sommet de la pile dans la location,
on remplace la valeur par ` au sommet de la pile et on incr´emente le compteur ordinal.
– read si la valeur au sommet de la pile est une location `, on remplace ` par son contenu et on
incr´emente le compteur ordinal.
Donnez les r`egles pour la compilation des expressions.
G´en´erez le code associ´e `a l’expression e = (new C(new D(), x)).f, par rapport `a la liste
d’identificateurs w = x · y · x o`u l’on sait que f correspond au premier attribut de la classe C.
6110 Gestion de la m´emoire
Le code ex´ecutable g´en´er´e par un compilateur est un processus qui tourne au dessus d’un
syst`eme d’exploitation. Le processus dispose d’un certain segment de m´emoire virtuelle qui
doit ˆetre g´er´e de fa¸con ´economique.
Les machines virtuelles des langages de programmation courants (C, Java, ML,. . .) distinguent
trois zones de m´emoire : une zone statique qui contient le code, les variables globales,
les tampons d’entr´ee-sortie,. . . une pile (ou stack) qui contient la pile des blocs d’activation
des proc´edures et un tas (ou heap) qui contient des donn´ees dont la taille ou la dur´ee de vie
ne sont pas pr´evisibles.
La gestion de la pile est simple. Il suffit de garder un pointeur au sommet de la pile. Pour
allouer un bloc de b cellules on incr´emente le compteur de b en v´erifiant qu’il n’y a pas de
d´ebordement, pour enlever un bloc de b cellules on d´ecr´emente le pointeur de b.
La gestion du tas est plus compliqu´ee. Le probl`eme est de d´eterminer le moment auquel
on peut r´ecup´erer une certaine partie de la m´emoire. Plusieurs options ont ´et´e consid´er´ees :
– On ne r´ecup`ere jamais la m´emoire. Ceci est correct mais peut produire une saturation
de la m´emoire.
– Le programmeur indique explicitement quand une cellule peut ˆetre dispos´ee. C’est l’option
prise par C mais elle a des inconv´enients majeurs : on peut oublier de r´ecup´erer
une cellule et pire on peut r´ecup´erer une cellule qui est encore accessible avec des
cons´equences catastrophiques sur le comportement du programme.
– On analyse statiquement le programme pour d´eterminer les r´egions du tas qui peuvent
ˆetre r´ecup´er´ees. Cette approche a ´et´e experiment´ee dans un langage de la famille ML
(ML-Kit) mais elle n’est pas encore tr`es r´epandue.
– La machine virtuelle appelle un programme dit ramasse miettes (ou garbage collector)
pour r´ecup´erer les cellules inaccessibles. C’est l’option choisie par les langages modernes
comme ML et Java et c’est l’option sur laquelle nous allons nous concentrer.
Le probl`eme d’´ecrire un bon ramasse miette est encore le sujet de recherches. Nous allons
juste consid´erer trois m´ethodes de base.
La m´emoire est mod´elis´ee par un graphe dirig´e avec racines. Les noeuds du graphe sont
les cellules de la m´emoire, les arˆetes dirig´ees repr´esentent les pointeurs et les racines sont les
cellules dans la zone statique et dans la pile. Une cellule dans le tas est r´ecup´erable si elle
n’est pas accessible `a partir des racines.
Au d´ebut du calcul toutes les cellules libres du tas sont connect´ees dans une liste. Quand
une nouvelle cellule est n´ecessaire, on extrait un ´el´ement de la liste. S’il n’y a plus de cellules
disponibles dans la liste, on peut interrompre l’ex´ecution du programme et appeler le ramasse
miettes pour v´erifier si une partie de la m´emoire du tas peut ˆetre r´ecup´er´ee et ins´er´ee `a
nouveau dans la liste des cellules libres.
Dans la suite on suppose que toutes les cellules ont la mˆeme taille. En g´en´eral il faut
consid´erer l’allocation de cellules de taille variable (par exemple pour l’allocation de tableaux).
10.1 Marquage et balayage (mark and sweep)
On suppose que toutes les cellules comprennent un bit de marquage qui est initialement
`a 0. La m´ethode de marquage et balayage fonctionne en deux phases.
Marquage On visite le graphe en commen¸cant par les racines et on met `a 1 les bits de
marquage de toutes les cellules accessibles.
62Balayage On va parcourir toutes les cellules du tas et pour chaque cellule on effectue les
op´erations suivantes :
– Si le bit de marquage est `a 0 alors on ins`ere la cellule dans la liste des cellules libres.
– Si le bit de marquage est `a 1 on le remet `a 0.
La phase de marquage est normalement effectu´ee par une visite en profondeur d’abord du
graphe :
Init : sp := nil;
procedure DF(v)
if v points to heap and v.mark = 0 then
begin
push(v, sp);
while sp 6= nil do
begin
v := pop(sp);
v.mark := 1;
∀w(w pointer in cell v and w.mark = 0) do
push(w, sp);
end
end
On doit appeler la proc´edure DF(v) sur chaque adresse v du tas qui est contenue dans
une cellule dans la zone statique ou dans la pile.
Exercice 10.1 Comment peut-on modifier les structures de donn´ees de cet algorithme pour
qu’il visite le graphe en largeur ?
Rappel : consid´erez un arbre binaire avec racine 1 dont les fils sont 2 et 3, et tel que les fils de 2 sont 4
et 5 et les fils de 3 sont 6 et 7. Dans une visite en profondeur (de gauche a droite) on visite les noeuds dans
l’ordre 1,2,4,5,3,6,7 alors que dans une visite en largeur on visite les noeuds dans l’ordre 1,2,3,4,5,6,7.
La phase de ramassage est impl´ement´ee simplement. On suppose que fl pointe `a la liste
des cellules libres du tas.
Init : p := ‘lower address of heap’;
while p < ‘upper address of heap’ do
begin
if p.mark = 1 then p.mark := 0
else insert(p, fl);
p := p + ‘cell size’;
end
Le coˆut de la m´ethode de marquage et ramassage est d´etermin´e facilement. Soit R le
nombre de cellules dans le tas qui sont accessibles `a partir de la zone statique et de la pile.
Soit H le nombre total de cellules disponibles dans le tas. Alors le coˆut est donn´e par :
c1R + c2H
pour des facteurs constants c1 et c2, o`u c1R est le coˆut du marquage qui est proportionnel au
nombre de cellules accessibles et c2H est le coˆut du ramassage du tas.
63Il est int´eressant de consid´erer le coˆut par cellule r´ecup´er´ee. Il est exprim´e par
(c1R + c2H)/(H − R)
car (H − R) est exactement le nombre de cellules r´ecup´er´ees. On remarque que si H ≈ R
alors le coˆut est ´elev´e et que si H >> R alors le coˆut s’approche de c2.
Ceci sugg`ere que il n’est pas tr`es int´eressant d’ex´ecuter la m´ethode de ramasse miettes
quand une grande partie du tas est accessible. Dans ce cas, la machine virtuelle passe son
temps `a essayer de r´ecup´erer un nombre r´eduit de cellules. Quand cette situation se v´erifie,
la machine virtuelle peut essayer d’obtenir de la m´emoire virtuelle additionnelle du syst`eme
d’exploitation.
10.2 Comptage des r´ef´erences (reference counting)
Un probl`eme avec la m´ethode de marquage et ramassage est que son ex´ecution provoque
l’arrˆet de l’ex´ecution du programme pour un temps proportionnel `a la taille du tas. Cet
arrˆet peut ˆetre inacceptable pour des programmes qui doivent respecter des contraintes de
temps r´eel. La m´ethode du comptage des r´ef´erences r`egle partiellement ce probl`eme. Voici les
ingr´edients de la m´ethode :
– Chaque cellule du tas comprend un champ compteur qui compte le nombre de pointeurs
`a la cellule.
– Initialement le compteur est `a 0.
– Pour chaque instruction, le compilateur g´en`ere un certain nombre d’instructions qui
maintiennent le compteur `a jour.
Par exemple, consid´erons la situation suivante :
cell address env field in cell counter field in cell
x y n1
y nil n2
p nil n3
On suppose que le programme comprend l’instruction x.env := p. Le compilation doit
g´en´erer la s´equence suivante d’instructions o`u, comme dans la section pr´ec´edente, on suppose
que fl pointe `a la liste de cellule libres dans le tas.
x.env.counter := x.env.counter − 1;
if x.env.counter = 0 then
begin
insert(x.env, fl);
recursively update counters of cells pointed by x.env
end
x.env := p;
p.count := p.count + 1
Maintenant la gestion de la pile est interlac´ee avec l’ex´ecution du programme. On dit que
la m´ethode du comptage de r´ef´erences est une m´ethode de ramasse miettes incr´ementale. On
peut remarquer un certain nombre de limites de la m´ethodes :
1. Comme illustr´e dans l’exemple, la m´ethode est coˆuteuse.
2. La mise `a jour r´ecursive des compteurs des cellules point´ees par x.env peut prendre un
certain temps. Si n´ecessaire, on peut suspendre cette mise `a jour et la reprendre plus
tard.
643. On ne r´ecup`ere pas toujours la m´emoire disponible.
Pour illustrer le dernier point, on suppose ˆetre dans la configuration :
cell address env field in cell counter field in cell
r p 1
p x 1
x y 2
y x 1
avant d’ex´ecuter le code associ´e `a l’affectation r := nil. Maintenant consid´erons le code
g´en´er´e. Comme r pointe `a p, on d´ecr´emente p.counter . Comme p.counter va `a 0 on r´ecup`ere
p. De plus, comme p pointe `a x on d´ecr´emente x.counter qui va `a 1. Maintenant ni x ni y sont
accessibles mais ces cellules ne peuvent pas ˆetre r´ecup´er´ees car leurs compteurs ne sont pas
`a 0. Le point est que le comptage de r´ef´erences ne voit pas l’inaccessibilit´e de structures avec
cycles et donc il peut ne pas r´ecup´erer des cellules qui ne sont plus accessibles. En pratique,
un ramasse miettes qui utilise le comptage des r´ef´erences fait aussi appel p´eriodiquement `a
une autre m´ethode de ramasse miettes.
10.3 R´ecup´eration par copie (copying collection)
La m´ethode de marquage et ramassage a deux probl`emes additionnels :
– Pour marquer le graphe on a besoin d’une pile dont la taille est born´ee par le nombre
de cellules du tas. Donc on peut avoir besoin de beaucoup de m´emoire juste au moment
o`u la m´emoire est ´epuis´ee.5
– La m´emoire r´ecup´er´ee peut ˆetre de plus en plus fragment´ee ce qui est un probl`eme si
on a besoin d’allouer des donn´ees de taille variable sur des blocs de cellules contigu¨es.
Ces deux probl`emes sont r´egl´es par la m´ethode de r´ecup´eration par copie que nous allons
pr´esenter.
Le tas est maintenant divis´e en deux moiti´es compos´ees de cellules contigu¨es. On appelle
la premi`ere moitie ‘from space’ et la deuxi`eme ‘to space’.
Initialement, on alloue dans la zone ‘from space’. Quand cette zone est satur´ee, le ramasse
miette traverse la partie accessible de ‘from space’ et construit une copie isomorphe dans un
segment initial de la zone ‘to space’. L’algorithme qui traverse les noeuds accessibles et qui
g´en`ere la copie isomorphe est la partie int´eressante de la m´ethode.
La premi`ere fois qu’on arrive `a une cellule accessible de la zone ‘from space’ on copie son
contenu dans la premi`ere cellule disponible dans la zone ‘to space’. La cellule dans la zone
‘from space’ est alors marqu´ee et un pointeur `a sa copie dans la zone ‘to space’ est ins´er´e. Le
marquage est important pour ´eviter que la cellule soit recopi´ee plusieurs fois. On remarque
que le probl`eme de la fragmentation dans la zone ‘to space’ a disparu.
Une fois que la phase de copie est compl´et´ee, on ne proc`ede pas `a une phase de ramassage.
En effet, il suffit d’invertir simplement le rˆole de ‘from space’ et de ‘to space’ et de continuer
l’ex´ecution du programme. Ceci veut dire que si R est le nombre de cellules accessibles dans
la zone ‘from space’ alors le coˆut de la m´ethode est cR pour une constante c et le coˆut par
cellule r´ecup´er´ee est cR/((H/2) − R). Si H >> R alors le coˆut approche 0, mais en pratique
R est plutˆot proportionnel `a H.
5Nous verrons qu’il y a une m´ethode dite d’inversion des pointeurs qui, plutˆot qu’utiliser une pile, utilise
les cellules accessibles pour effectuer une visite en profondeur.
65On d´ecrit maintenant l’algorithme qui copie la partie accessible de ‘from space’ dans
‘to space’. On suppose que chaque cellule contient un champ f1. Il peut s’agir d’un champ
sp´ecial ou du premier champ de la cellule s’il y en a un. On suppose que next et scan sont
deux pointeurs qui pointent initialement `a l’adresse de base de ‘to space’. D’abord on doit
d´efinir une proc´edure Fwd qui va cr´eer une copie s’il n’y en a pas d´ej`a une.
function Fwd(p) = case
p points to from space and p.f1 points to to space :
p.f1
p points to from space and p.f1 does not point to to space :
copy(p, next);
p.f1 := next;
increment(next);
p.f1
else : p
Soit r la racine du graphe ‘from space’. On ex´ecute :
Fwd(r); (this increments next)
while scan < next do
begin
∀ pointer field f in the cell pointed by scan do
scan.f := Fwd(scan.f);
increment(scan);
end
Un point int´eressant de l’algorithme est qu’il n’utilise pas de m´emoire additionnelle pour
visiter le graphe dans ‘from space’ (ce qui n’´etait pas le cas pour la m´ethode de marquage et
ramassage). La raison est que les ´el´ements `a visiter sont m´emoris´es dans la zone ‘to space’
entre les pointeurs scan et next.
Exemple 10.2 En ex´ecutant la m´ethode de ramassage par copie sur l’exemple :
Address Field f1 Field f2
7 9 11
9 7 9
11 9 7
et en supposant que la racine r est 7 et que l’adresse de base de ‘to space’ est 12 on produit la copie suivant
dans la zone ‘to space’ :
Address Field f1 Field f2
12 13 14
13 12 13
14 13 12
Exercice 10.3 (1) D´eterminez sous quelles conditions le coˆut en temps d’ex´ecution d’une
m´ethode de mark and sweep est inf´erieur `a celui d’une m´ethode de copying collection.
(2) Un coll`egue, sugg`ere d’intercaler l’ex´ecution du programme principal et de la proc´edure de
mark and sweep qui de cette fa¸con op`erent comme deux processus concurrents et interruptibles
qui agissent sur une structure partag´ee (la m´emoire). Expliquez `a votre coll`egue les probl`emes
qui pourraient se pr´esenter suite `a une interruption du processus de mark and sweep (on
vous demande de d´eterminer des probl`emes, pas de trouver des solutions. . .)
66Exercice 10.4 On dispose d’un tableau qui contient des blocs de taille variable. Si p est
l’adresse du premier mot d’un bloc alors on d´enote avec p.statut son statut qui peut ˆetre libre
ou occup´e et avec p.long sa longueur. D´ecrivez un algorithme lin´eaire dans la taille du tableau
qui permet de compacter la m´emoire, c’est-`a-dire de faire en sorte que les blocs occup´es sont
contigus et pr´ec`edent un bloc libre. Voici un exemple de tableau avant et apr`es compactage
o`u X d´enote des informations non significatives m´emoris´ees dans les blocs libres et a, b, c, . . .
d´enotent des informations significatives m´emoris´ees dans les blocs occup´es.
1 : (libre, 2) 1 : (occup´e, 2)
2 : X 2 : a
3 : (occup´e, 2) 3 : (occup´e, 3)
4 : a 4 : b
5 : (libre, 1) 5 : c
6 : (occup´e, 3) 6 : (libre, 5)
7 : b 7 : X
8 : c 8 : X
9 : (libre, 1) 9 : X
10 : (libre, 1) 10 : X
Avant Apr`es
10.4 Inversion de pointeurs
Nous pr´esentons une m´ethode pour visiter en profondeur un graphe qui n’utilise pas une
pile mais qui demande de r´eserver un petit nombre de bits pour chaque cellule du tas.
Pour simplifier, on suppose que chaque cellule point´ee par x contient deux pointeurs au
tas qu’on d´esigne par x.f0 et x.f1. En plus, chaque cellule contient un champ d’un bit mark
et un champ de 2 bits done (en g´en´eral, le nombre de bits dans ce champ est logarithmique
dans le nombre de pointeurs au tas dans la cellule).
local current, pred, next, i;
current := root; current.done := 0; current.mark := 1; pred := nil;
while true do
i := current.done;
if i < 2
then
next := current.fi
if next.mark = 0
then
current.f i := pred; pred := current; (1)
current := next; current.mark := 1; current.done := 0;
else
current.done := i + 1;
else
next := current;
current := pred;
if current = nil then STOP;
i := current.done;
pred := current.fi;
current.fi := next; (2)
current.done := i + 1 ;
Dans (1), current.f i est sauv´e dans next et il pointe ensuite `a la cellule d’o`u current a ´et´e
acc´ed´e. Dans (2), la valeur originale de current.f i est restaur´ee. Le tableau suivant d´ecrit la
67suite de valeurs contenus dans les pointeurs et les noeuds quand l’algorithme est ex´ecut´e sur
le graphe G = {(1, 2),(1, 4),(2, 3),(2, 4),(3, 1),(3, 2),(4, 1),(4, 3)}.
current 1, 2, 3, 2, 4, 2, 1, nil (→ STOP)
next 2, 3, 2, 1, 3, 4, 3, 1, 4, 2, 4, 1
pred nil, 1, 2, 1, 2, 1, nil
mark done f0 f1
1 0, 1 , 0, 1, 2 2, nil, 2 4
2 0, 1 , 0, 1, 2 3, 1, 3 4, 1, 4
3 0, 1 , 0, 1, 2 2 1
4 0, 1 , 0, 1, 2 3 1
68
Une histoire de la micro´electronique
Philippe Matherat
To cite this version:
Philippe Matherat. Une histoire de la micro´electronique. Ecole d’ing´enieur. Ecole nationale ´
sup´erieure des t´el´ecommunications, depuis 1998, 2007, pp.32.
HAL Id: cel-00157199
https://cel.archives-ouvertes.fr/cel-00157199
Submitted on 25 Jun 2007
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Une histoire de la micro´electronique
Philippe Matherat
GET - T´el´ecom-Paris - Comelec / CNRS - LTCI (UMR 5141)
http://www.comelec.enst.fr/∼matherat/
R´esum´e
Ce texte est une esquisse d’histoire de la micro´electronique, c’est-`a-dire d’un demisi`ecle
de d´eveloppement des circuits int´egr´es, aussi appel´es puces ´electroniques. Cette
technique est `a la source d’une nouvelle r´evolution industrielle, en liaison avec le
d´eveloppement des logiciels et des communications. L’accroissement exponentiel du
nombre de transistors par puce, aussi appel´e loi de Moore, a entraˆın´e un d´eveloppement
du mˆeme ordre pour toutes les techniques li´ees et les march´es associ´es. Le d´eveloppement
de ce syst`eme technique est `a l’origine de bouleversements ´economiques et sociaux sans
´equivalent dans l’histoire de l’humanit´e.
Ce texte est issu d’un enseignement donn´e aux ´el`eves de premi`ere ann´ee de l’ENST depuis
1998. Notre r´edaction initiale du support de cours devait beaucoup `a l’ouvrage publi´e par
les laboratoires Bell `a l’occasion du cinquantenaire de l’invention du transistor [1]. Il a ´et´e
ensuite remani´e et r´eguli`erement mis `a jour. Il se veut une introduction pour un public large,
mais suppose un d´ebut de familiarit´e avec le vocabulaire r´epandu dans le domaine de la
micro-informatique.
1 Une nouvelle r´evolution industrielle
1.1 Introduction
Un demi-si`ecle apr`es l’invention du transistor (qui a eu lieu en 1947), les circuits int´egr´es
comportaient de l’ordre de cent millions de transistors par puce (108
). A partir de l’invention
du circuit int´egr´e (interconnexion de plusieurs transistors sur une mˆeme puce) en 1958,
l’accroissement s’est fait de fa¸con exponentielle, par un doublement tous les 18 mois. Ce
rythme avait ´et´e remarqu´e d`es 1965 par G. Moore (d’o`u le nom de loi de Moore). Il s’est
toujours maintenu depuis et les pr´edictions parient sur son maintien pendant une dizaine
d’ann´ees encore.
1Aucune autre technique n’a connu un d´eveloppement aussi rapide dans l’histoire de l’humanit´e.
Cette variation exponentielle s’applique `a tous les param`etres caract´erisant l’´electronique :
dimensions des transistors (dont la surface est divis´ee par 2 tous les 3 ans), prix de chaque
transistor qui diminue (le prix d’une puce est rest´e constant), march´e mondial des semiconducteurs
(multipli´e par 3 tous les 8 ans), etc.
Le nombre total de transistors en service en 1997 ´etait estim´e `a 2.1017, soit 40 millions
par habitant de la plan`ete. Le march´e mondial des semi-conducteurs en 2004 ´etait de 210
milliards d’euros, et ceci constitue environ 20 % du march´e de l’´electronique.
Cette ´evolution a rendu possible le d´eveloppement des ordinateurs, de l’informatique, des
logiciels. La premi`ere calculatrice ´electronique date de 1945, 2 ans seulement avant l’invention
du transistor. Elle comportait 18 000 tubes `a vide, moins puissante qu’une calculette, et son
MTBF (”Mean Time Between Failure” ou ”temps moyen entre pannes”) ne d´epassait pas
quelques dizaines de minutes. Sans transistor, il n’aurait pas ´et´e possible de d´evelopper des
ordinateurs d’une puissance et d’une fiabilit´e suffisantes pour envisager le d´eveloppement de
l’industrie du logiciel. En retour, les puces actuelles ne peuvent ˆetre con¸cues qu’avec l’aide
de programmes de CAO (Conception Assist´ee par Ordinateur) sophistiqu´es permettant de
g´erer leur complexit´e.
Cette ´evolution a ´egalement rendu possible le d´eveloppement des t´el´ecommunications et des
r´eseaux. Sans ´electronique complexe, pas de centraux t´el´ephoniques modernes, pas d’informatique
distribu´ee, pas d’internet, pas de t´el´ephone mobile, pas de multim´edia...
Tout cet ensemble de techniques aux d´eveloppements imbriqu´es, associant ordinateurs, logiciels,
´electronique, Silicium, et transport de l’information forment un ”syst`eme technique” [2],
qui transforme en profondeur la soci´et´e en un temps tr`es court, d’o`u le nom de ”r´evolution”.
On parle de ”deuxi`eme r´evolution industrielle”, en comparaison avec la premi`ere survenue
au 19`eme si`ecle et li´ee au syst`eme technique fond´e sur : moteurs, ´energie, m´etaux, machinesoutils,
transport des mati`eres et des personnes, extraction mini`ere, etc.
1.2 Les principales innovations de la micro´electronique
Le terme ”´electronique” trouve son origine dans l’utilisation des tubes `a vide (les ”lampes” des
anciens postes de radio) dont le fonctionnement repose sur un courant d’´electrons (”rayons
cathodiques” d´ecouverts par J. J. Thomson en 1897). Pourtant, la moiti´e de l’histoire de
l’´electronique, et l’explosion de ses applications sont dˆus `a l’utilisation des mat´eriaux semiconducteurs,
principalement le Silicium (figure 1).
D`es 1925, J. E. Lilienfeld avait propos´e l’utilisation d’un ”effet de champ” dans un semiconducteur
pour moduler un courant par une tension, comme dans un tube `a vide. Mais le
premier ”effet transistor” n’a ´et´e observ´e qu’en 1947, dans les laboratoires de Bell (par J.
Bardeen, W. Brattain et W. Shockley, qui ont re¸cu pour cette invention le prix Nobel en
2Fig. 1 – Un si`ecle d’´electronique
31956) avec un montage `a pointe dont le fonctionnement a ´et´e compris l’ann´ee suivante, grˆace
`a une th´eorie de Shockley. Cette invention a d´ebouch´e sur les ”transistors bipolaires”, dans
lesquels la borne d’entr´ee (appel´ee ”base”) n’est pas isol´ee, et qui ont constitu´e longtemps le
seul type de transistors commercialis´es. Le premier transistor `a effet de champ n’a fonctionn´e
qu’en 1959 (par Atalla). Il est nomm´e MOS-FET (pour Metal Oxyde Semiconductor-Field
Effect Transistor) que l’on a ensuite abr´eg´e en MOS.
Un transistor est constitu´e de jonctions, c’est-`a-dire de contacts entre des zones de semiconducteurs
(tel que le Silicium) dont le dopage est diff´erent. Le dopage est l’op´eration qui
consiste `a ins´erer dans le r´eseau cristallin (du Silicium) des atomes ´etrangers (de Bore ou
d’Arsenic), afin de permettre une circulation de charges ´electriques (positives ou n´egatives
suivant la nature du dopant).
Les premi`eres jonctions ´etaient obtenues par soudure, puis par dopage lors de la cristallisation
(permettant en 1952 des bases de 10 microns dans des transistors bipolaires fonctionnant `a
10 MHz), puis par d´epˆot d’impuret´es en surface (1954, 500 MHz).
En 1955, Shockley part pour l’ouest, monter sa soci´et´e en Californie, `a Palo Alto, ce qui
sera `a l’origine de la ”Silicon Valley”. En 1957, plusieurs ing´enieurs (dont G. Moore et R.
Noyce) quittent cette soci´et´e pour cr´eer Fairchild, qui se d´eveloppe rapidement grˆace `a une
importante commande de transistors de la part d’IBM. C’est aussi l’ann´ee du premier satellite
artificiel (sovi´etique : Sputnik), ce qui va pousser les Etats-Unis d’Am´erique `a investir dans ´
la miniaturisation de l’´electronique.
Photolithogravure et proc´ed´e planar
Une ´etape importante a ´et´e franchie en 1955 par l’utilisation de la photolithogravure : gravure
s´elective (par exemple ici de la silice, figure 2) `a travers un masque de r´esine, elle-mˆeme
grav´ee apr`es exposition `a la lumi`ere `a travers un masque photographique. La r´esine doit
donc ˆetre photosensible. La silice (SiO2) est au pr´ealable obtenue par oxydation de la surface
du silicium et constituera l’isolant principal des transistors.
Nous avons repr´esent´e (figure 3) une succession d’op´erations (de fa¸con tr`es simplifi´ee) pouvant
conduire `a la r´ealisation d’un transistor.
– A la premi`ere des 5 ´etapes, on a refait pousser un peu d’oxyde au fond du tro ` u, trou
pr´ec´edemment ouvert par une op´eration de gravure. Ce nouvel oxyde est appel´e oxyde
mince et deviendra l’isolant de l’´electrode de grille.
– A l’´etape suivante, on a d´epos´e sur cet oxyde mince une ´electrode conduct ` rice (dessin´ee en
rouge) en silicium polycristallin, qui sera l’´electrode de grille du transistor. Pour r´ealiser
un tel d´epˆot, il faut d´eposer une couche uniforme sur toute la surface de la puce et ensuite
graver cette couche `a l’aide d’un nouveau masque de photolithogravure. Apr`es la r´ealisation
de cette ´electrode de grille, on enl`eve l’oxyde mince sur les cˆot´es de la grille. Il suffit pour
cela d’attaquer l’oxyde sur toute la puce, la grille sert de masque. (C’est ce qu’on appelle
une technologie ”auto-align´ee”, car on est sˆur ainsi que la grille et son isolant se superposent
4Fig. 2 – Photolithogravure
5Fig. 3 – Exemple de proc´ed´e planar
6exactement.)
– A l’´etape suivante, on projette partout les atomes de dopant. Ils n’ont d’effet ` que l`a o`u le
silicium est nu, c’est-`a-dire sur les cˆot´es de la grille. Apr`es un recuit (passage dans un four),
les dopants p´en`etrent plus profond´ement dans le silicium par diffusion et constitueront les
zones conductrices appel´ees drain et source (zones repr´esent´ees en jaune). A partir de `
cette ´etape, le transistor est fonctionnel, il reste `a connecter ses 3 ´electrodes (grille, drain
et source) au monde ext´erieur.
– A l’´etape 4, on d´epose de la silice sur toute la surface de la puce pour obtenir une is ` olation
´electrique compl`ete. Il faut ensuite percer des trous dans cette silice pour effectuer les
interconnexions. Ceci n´ecessite un masque de photolithogravure.
– Sur le dernier dessin, on a repr´esent´e les connections metalliques termin´ees. Ceci est fait
en d´eposant de l’aluminium sur toute la surface de la puce (`a l’endroit d’un trou dans la
silice, l’aluminium p´en`etre jusqu’au contact avec l’´electrode), puis en gravant cette couche
d’aluminium `a l’aide d’un nouveau masque de photolithogravure.
Au cours du processus que nous venons de d´ecrire, il a ´et´e utilis´e 4 masques de photolithogravure
: ouverture du premier trou dans l’oxyde ´epais, gravure du silicium polycristallin,
ouverture des trous dans l’oxyde d´epos´e, gravure de l’aluminium. Ce processus est voisin
(quoique tr`es simplifi´e) de celui utilis´e dans les ann´ees 70 sous le nom de ”MOS canal N,
Grille Si” et qui utilisait 8 masques. Les proc´ed´es modernes utilisent 25 masques (CMOS `a
plusieurs niveaux de m´etal d’interconnexion).
C’est un exemple de proc´ed´e dit ”planar” (invent´e en 1958 par Hoerni), car la plan´eit´e
permet l’interconnexion par l’aluminium. Cette plan´eit´e est rendue possible par le fait que
la premi`ere couche d’oxyde est de mˆeme ´epaisseur sur la totalit´e de la puce et qu’elle sert de
masque pour le dopage des drains et sources des transistors. Ce proc´ed´e n’a ´et´e invent´e que
10 ans apr`es le transistor. Auparavant, les dopages ´etaient r´ealis´es au d´ebut du proc´ed´e de
fabrication. Les transistors voisins n’´etaient pas isol´es les uns des autres. Pour les faire coexister
au sein d’une mˆeme puce, il ´etait n´ecessaire de graver entre eux une profonde vall´ee.
Cette vall´ee interdisait l’interconnexion entre deux transistors voisins en raison du manque
de plan´eit´e. Ainsi, chaque transistor ´etait dispos´e sur un ”plateau” sur´elev´e, s´epar´e de ses
voisins par des vall´ees servant `a d´elimiter les zones dop´ees. Les transistors ´etaient ensuite
dissoci´es pour ˆetre mont´es dans des boˆıtiers individuels.
A la fin des ann´ees 50, on comprit que la silice pouvait servir de masque pour d´epos ` er
s´electivement les impuret´es dopantes `a la surface du silicium. Ainsi, deux transistors voisins
ne risquaient plus d’ˆetre reli´es ´electriquement puisque la zone interm´ediaire n’´etait pas dop´ee
si elle ´etait couverte de silice. La surface de silicium n’´etait plus creus´ee de vall´ees, d’o`u ce
nom de technologie ”planar”.
Cette possibilit´e d’interconnecter `a volont´e les bornes des transistors voisins par une couche
de m´etal (Aluminium) photograv´e a permis l’apparition du ”circuit int´egr´e”, invent´e en 1958
par Noyce. Une autre m´ethode d’interconnexion entre les transistors d’une mˆeme puce avait
´et´e d´evelopp´ee un peu avant par Kilby (Texas Instruments), ce qui lui vaut d’ˆetre reconnu
comme l’inventeur du circuit int´egr´e. Cette m´ethode consistait `a utiliser des fils soud´es pour
7interconnecter les transistors. Ces fils devaient ˆetre pos´es un par un. Cette technique n’est pas
compatible avec la photolithogravure et n’a donc pas ´et´e retenue pour les circuits int´egr´es,
mais elle a ´et´e utilis´ee pour les circuits dits ”hybrides” (plusieurs puces interconnect´ees dans
un mˆeme boˆıtier).
Rendement de fabrication et miniaturisation
Le rendement de fabrication d’un transistor isol´e (probabilit´e qu’il fonctionne correctement)
´etant alors de 0, 2 = 20%, on pensait que le rendement pour un circuit int´egr´e comportant 2
transistors serait de 0, 2 × 0, 2 = 0, 04 soit 4%, et ainsi de suite avec une chute exponentielle
du rendement en fonction du nombre de transistors reli´es. C’est en 1964 que l’on comprit
(Murphy) que le rendement ´etait surtout gouvern´e par la densit´e de poussi`eres par unit´e de
surface de silicium. En effet, pour qu’une puce soit correctement r´ealis´ee, il faut qu’il n’y ait
pas eu de poussi`ere sur toute sa surface pendant sa fabrication. Il y a donc une relation entre
le rendement et l’aire totale de chaque puce. A nombre de transistors donn´e, plus la puce est `
petite et plus son rendement de fabrication est grand car la probabilit´e de pr´esence d’une
poussi`ere est plus faible. Ceci a pouss´e `a la miniaturisation et a conduit `a la construction
d’usines de plus en plus propres (”salles blanches”) permettant actuellement des rendements
de 95% sur des circuits tr`es complexes et tr`es gros.
Longtemps, les transistors et les puces ont n´ecessit´e d’ˆetre enferm´es sous des capots ´etanches,
comme l’´etaient les tubes `a vides. En effet, les semi-conducteurs tr`es purs voient leurs propri´et´es
rapidement modifi´ees par les impuret´es de l’air ambiant (vapeur d’eau, ´el´ements
divers en particulier Sodium). Ce probl`eme n’a ´et´e compl`etement r´esolu que 20 ans plus
tard. Dans un premier temps (`a l’apparition de la technologie planar), on comprit que le
fait de laisser la silice sur le silicium est une bonne protection. Ensuite, on a recouvert la
puce d’une couche suppl´ementaire de nitrure de silicium (passivation, 1966 par Dalton) qui
prot`ege compl`etement le circuit et permet, si on le d´esire, de l’enrober ult´erieurement dans
une mati`ere plastique pour former un ”boˆıtier plastique”, plus ´economique que le ”boˆıtier
c´eramique”.
A. Grove, G. Moore et R. Noyce fondent la soci´et´e Intel en 1968 dans le but de commercialiser
des m´emoires MOS. Ils sortiront la 2115 (1 Kbits) en mˆeme temps que Fairchild sort la 93415
(de mˆeme capacit´e, mais en bipolaire). C’est le d´ebut de l’`ere LSI (Large Scale Integration).
Puis Intel sort la premi`ere m´emoire dynamique (DRAM pour Dynamic Random Access
Memory) en 1970 : la 1103 de 1 Kbits. Chaque cellule de 1 bit comporte 3 transistors (au
lieu de 6 pour les m´emoires statiques). Le circuit complet comporte 5 000 transistors. La
technologie est PMOS grille Si. Le premier microprocesseur est le 4004 de Intel en 1971 (mots
de 4 bits).
A cette ´epoque, bien que la loi de Moore soit connue et se r´ev`ele correcte depuis une dizaine
d’ann´ees, il n’´etait pas clair que la diminution des dimensions puisse toujours ˆetre
aussi b´en´efique aux caract´eristiques ´electriques des transistors qu’`a la diminution du taux
de d´efauts dˆus aux poussi`eres. Mais un article de 1974 (par Dennard et al) montra comment
8utiliser le facteur d’´echelle pour modifier les principaux param`etres de fabrication et ainsi
gagner sur tous les tableaux : augmentation de la densit´e des transistors par unit´e de surface,
diminution des capacit´es ´electriques, diminution des temps de basculement et de propagation,
diminution de la consommation, augmentation des rendements, diminution des coˆuts.
A partir de ce moment, il devenait clair que l’am´elioration des performances technologiques
et ´economiques allaient de pair avec la poursuite de la miniaturisation.
Loi de Moore et g´en´erations successives
A partir de 1970, le d´eveloppement suit le rythme exponentiel repr´esent´e figure 4. C’est ce
rythme de croissance qui est appel´e : ”loi de Moore”.
Fig. 4 – Evolution du nombre de transistors par circuit ´
Le produit essentiel de cette industrie est la m´emoire. Il dispose d’un tr`es grand march´e
(tous les montages ont besoin de m´emoire), concentre toutes les difficult´es technologiques (si
l’on recherche une densit´e maximum) et pousse constamment `a la modernisation des usines.
En 1974, Intel introduit la DRAM de 4 Kbits. Une cellule m´emoire n’est plus constitu´ee
alors que d’un seul transistor associ´e `a un condensateur. La technologie est MOS canal N
grille Si. Ce sera ´egalement la technologie des microprocesseurs 8 bits. Dans cette technologie,
la dissipation n’est pas n´egligeable en l’absence d’horloge, alors qu’elle l’est dans le
CMOS (MOS compl´ementaire), mais les r´ealisations CMOS occupent alors trop de surface.
Ce compromis sera renvers´e au d´ebut des ann´ees 80, date `a partir de laquelle l’utilisation
du CMOS devient universelle pour les circuits logiques. En 1984, les m´emoires atteignent le
cap de 1 Mbits, c’est l’`ere VLSI (Very Large Scale Integration).
9La loi de Moore n’est pas r´ealis´ee comme une ´evolution continue, mais comme une succession
de paliers (ou g´en´erations). A chaque palier, les industriels se fixent comme objectif de diviser
la surface d’un transistor par 2, ce qui revient `a diviser la largeur des motifs gra
√
v´es par
2 dans chaque dimension. Comme, en outre, et grˆace `a l’am´elioration du rendement de
fabrication, on arrive `a doubler la surface des puces `a chaque g´en´eration, cela donne un
facteur 4 pour le nombre de transistors par puce `a chaque g´en´eration (figure 5 et 6). Depuis
plus de 30 ans, les g´en´erations se sont succ´ed´ees au rythme d’une tous les trois ans. Ces
derni`eres ann´ees, elles se sont plutˆot raproch´ees, au rythme d’une tous les deux ans entre
1995 et 2001 (sans toutefois augmenter la surface des puces).
Fig. 5 – Evolution pour une g´en´eration ´
Fig. 6 – Evolution pour 12 g´en´erations ´
Les technologies successives (`a chaque g´en´eration) sont nomm´ees par la largeur du plus petit
motif que l’on peut graver (largeur sur le masque de photogravure). La technologie utilis´ee
en production actuellement est de 0,09 micron (90 nanom`etres) ou de 0,065 micron. La
longueur d’un canal de transistor (largeur d’une connexion de grille apr`es gravure effective)
est encore moiti´e plus faible : 45 nm ou 35 nm. L’´epaisseur de l’oxyde de grille est de moins
de 4 nm, soit une douzaine de couches atomiques. Les interconnexions sont r´ealis´ees par 7 `a
10 niveaux de m´etal, isol´es par des couches de silice d’une ´epaisseur de un micron environ.
L’ensemble du traitement n´ecessite 25 masques, ce qui repr´esente plus de 500 op´erations
diff´erentes, s’´etalant sur un mois. En effet, pour utiliser un masque, il faut une succession
d’op´erations telles que : nettoyage, s´echage, d´epˆot de la r´esine photosensible, cuisson de la
r´esine, exposition de la r´esine `a travers le masque, d´eveloppement, nettoyage, attaque de la
couche situ´ee sous la r´esine, nettoyage, enl`evement de la r´esine, sans compter les op´erations
d’oxydation, ou de dopage, ou de d´epˆot de couches (m´etal par exemple). Cela repr´esente en
moyenne 20 op´erations par masque.
Quelques exemples de difficult´es rencontr´ees
Jusqu’au milieu des ann´ees 70, les largeurs de motifs ´etaient sup´erieures `a 5 microns, les
10masques photographiques ´etaient en verre, `a l’´echelle 1, et appliqu´es au contact de la
r´esine lors de l’exposition. La totalit´e du ”wafer” (disque de Silicium d’un demi millim`etre
d’´epaisseur tranch´e dans un barreau cylindrique) ´etait expos´ee en une seule op´eration. Les
masques ´etaient endommag´es lors de ce contact et les d´efauts se reportaient d’un wafer
au suivant. Les masques devaient ˆetre renouvel´es tr`es fr´equemment (apr`es 25 `a 50 utilisations).
Actuellement, les masques sont `a l’´echelle 5. L’exposition de la r´esine se fait `a travers
une optique de projection qui r´eduit du rapport 5. Les circuits sont expos´es un par un,
par une machine d´epla¸cant correctement le wafer (”step and repeat”), avec une pr´ecision
bien meilleure que le dixi`eme de micron ! Les masques photographiques `a l’´echelle 5 sont
eux-mˆemes r´ealis´es `a l’aide d’un faisceau d’´electrons d’un diam`etre de 1 micron.
L’optique de projection doit avoir une grande ouverture pour minimiser la diffraction. Dans
la pratique, on arrive `a ce que la largeur minimum des motifs grav´es soit du mˆeme ordre que
la longueur d’onde de la lumi`ere qui sert `a exposer la r´esine. La technologie 0,25 micron ´etait
expos´ee `a l’aide d’une raie `a 0,248 micron (ultraviolet profond) du fluorure de krypton. La
technologie 130 nm est expos´ee `a l’aide d’une raie `a 0,193 micron du fluorure d’Argon (ArF),
qui est utilisable pour la technologie 90 nm. P´eriodiquement, il faut diminuer la longueur
d’onde de la lumi`ere qui expose la r´esine et donc changer ´egalement la composition chimique
de la r´esine. Aux longueurs d’onde ultraviolettes, les verres optiques (mˆeme en quartz) sont
de plus en plus opaques. Il faut utiliser des optiques en CaF2 (fluorite) et il faudra passer `a
l’utilisation de miroirs, usin´es avec une pr´ecision du quart de longueur d’onde, sur des grands
diam`etres !
La gravure `a travers les ouvertures cr´e´ees dans la r´esine se faisait initialement en phase
liquide (attaque par un acide). Tout allait bien quand les largeurs des ouvertures (5 `a 10
microns) ´etaient grandes devant les ´epaisseurs des couches (moins que un micron, figure 7).
Aujourd’hui, l’ordre est invers´e (largeur de 0,13 micron pour une ´epaisseur de 0,5 micron par
exemple) et la gravure doit se faire par plasma, qui permet une attaque anisotrope (figure
8). Cette technique se r´ealise en phase gazeuse `a basse pression, et les processus d’attaque
sont interm´ediaires entre un bombardement physique et une r´eaction chimique.
Fig. 7 – Gravure par un liquide
Pour l’apport d’atomes dopants, au d´ebut on laissait diffuser les impuret´es provenant d’un
11Fig. 8 – Gravure par plasma
gaz `a la surface du silicium, prot´eg´e s´electivement par l’oxyde (l’oxyde s’oppose `a la diffusion
des dopants). On a ´egalement utilis´e le d´epˆot d’un verre apportant les dopants par contact
(phosphosilicate). Aujourd’hui, on acc´el`ere des ions pour les projeter `a la surface du wafer
(implantation ionique). La quantit´e d’ions est contrˆol´ee tr`es pr´ecis´ement par l’int´egrale du
courant re¸cu par le wafer.
Autre difficult´e, les connexions m´etalliques des VLSIs (en Aluminium principalement) sont
travers´ees par des courants tr`es denses (leur section est bien inf´erieure au micron2
!), mille fois
plus denses que dans les fils ´electriques des habitations (10 amp`eres par mm2
). Ceci entraˆıne
des ruptures par ”´electro-migration” (l’´energie cin´etique des ´electrons est communiqu´ee aux
atomes). Pour r´esoudre ce probl`eme, on doit envelopper ces conducteurs dans un sandwich
compos´e de tungst`ene et de nitrure de titane.
Fig. 9 – Coˆut des usines
La r´esistivit´e et la capacit´e de ces connexions font que le temps de propagation `a longue
distance (1 cm) devient beaucoup trop grand devant la p´eriode d’horloge. C’est ce qui a
conduit en 1998 `a la mise au point d’une interconnexion par le cuivre qui est meilleur
12conducteur. Cela ne s’est pas fait sans difficult´e car le cuivre est tr`es polluant pour le silicium.
Ces quelques ´el´ements ne sont que des exemples de la complexit´e de ces technologies. Tous
ces aspects doivent ˆetre mis `a jour `a chaque g´en´eration de circuits. Les machines qui r´ealisent
ces op´erations coˆutent chacune plusieurs millions d’euros et leur dur´ee de vie est de 3 `a 5 ans.
Les usines (chacune coˆute actuellement plusieurs milliards d’euros) doivent ˆetre suffisamment
modulaires pour s’adapter constamment (figure 9). Les techniques pour g´erer ces centres de
production sont aussi complexes que celles utilis´ees pour fabriquer les circuits.
1.3 La loi de Moore
Nous avons d´ej`a vu quelques exemples de formulations de la loi de Moore. Initialement,
il s’agissait de mod´eliser l’´evolution du nombre de transistors par puce. Mais comme tous
les param`etres ´evoluent de fa¸con exponentielle, on a pris l’habitude de les porter sur des
graphiques o`u l’abscisse porte la date (ann´ee de lancement d’un circuit), et o`u l’ordonn´ee
porte un param`etre quelconque en ´echelle logarithmique, afin de pouvoir dessiner l’´evolution
sous forme d’une droite.
Fig. 10 – R`egle de dessin
Tout d’abord, l’essentiel du progr`es vient de la r´eduction des dimensions, de la finesse de
gravure (”r`egle de dessin”). Le plus petit motif que l’on peut graver est utilis´e pour d´efinir
la longueur d’un canal de transistor (largeur de grille). Cette distance est divis´ee par 1,4
tous les 3 ans (figure 10). Parall`ellement, l’am´elioration du savoir-faire en mati`ere de d´efauts
permet d’augmenter la surface maximale des puces r´ealisables. On a pu ainsi passer d’une
surface maximale de 5 mm2
en 1970 `a une surface de 5 cm2
en 2000. (En fait, les machines
13d’exposition par ”step and repeat” conduisent `a une normalisation des tailles de puces, ce
qui limite `a des surfaces de l’ordre de 2 cm2 pour les circuits produits en grande quantit´e.)
En parall`ele, on innove pour simplifier la structure des motifs ´el´ementaires, rendre les transistors
des m´emoires plus ”verticaux”, et pour augmenter le nombre de niveaux d’interconnexions
(mieux utiliser la 3`eme dimension). Cette innovation permet une augmentation de
densit´e plus rapide. Ainsi, on consid`ere que le facteur 4 du tableau de la figure 5 concernant
l’´evolution du nombre de transistors `a chaque g´en´eration est constitu´e en fait d’un facteur
2 li´e `a la gravure (aire de chaque transistor), d’un facteur √
2 li´e `a l’augmentation de l’aire
totale de la puce, et d’un autre facteur √
2 li´e `a l’innovation sur la structure des motifs
´el´ementaires.
Comme le coˆut de traitement d’un wafer est `a peu pr`es constant, on obtient une baisse
exponentielle du coˆut du bit de m´emoire (environ -25% par an), figure 11, o`u les coˆuts sont
exprim´es en micro-euros par bit de m´emoire.
Fig. 11 – Coˆut du bit de m´emoire ´electronique
L’augmentation des vitesses d’horloge et l’augmentation de complexit´e des puces permet une
augmentation exponentielle de la puissance des microprocesseurs, compt´ee en IPS (Instructions
par seconde), figure 12.
Le march´e de la micro-´electronique augmente d’un facteur environ 3 tous les 8 ans (figure
13), ce qui repr´esente une moyenne de 17% par an sur 40 ans.
Le fait que ce march´e soit aussi important que celui du p´etrole, loin devant l’aviation, l’armement,
ou le lancement de satellites fait nommer le Silicium ”l’or gris” (figure 14).
14Fig. 12 – Puissance de calcul des processeurs
Fig. 13 – Croissance (sur 50 ans) du march´e des semi-conducteurs
15Fig. 14 – March´es respectifs en 1995
1.4 Liens avec l’informatique et les t´el´ecommunications
Le d´eveloppement de la micro-´electronique a permis le d´eveloppement des ordinateurs, des
logiciels et des t´el´ecommunications. Inversement, la micro-´electronique n’aurait pas pu se
d´evelopper sans le d´eveloppement conjoint de ces techniques.
Le premier commutateur t´el´ephonique (appel´e aussi ”standard” t´el´ephonique) `a utiliser
l’´electronique, `a la place des simples contacteurs, est contemporain de la premi`ere calculatrice
´electronique (1945). Ces deux r´ealisations utilisaient des tubes `a vide. La recherche
sur les premiers transistors (chez Bell, un op´erateur des t´el´ephones ! ) ´etait motiv´ee par le
d´esir de remplacer les tubes `a vide dans ces machines, pour am´eliorer leur fiabilit´e. Ces
deux techniques (calcul et communication) ´etaient d´ej`a li´ees : on faisait communiquer par
t´el´ephone les premi`eres calculatrices `a relais en 1939.
La premi`ere calculatrice ´electronique (ENIAC) ne poss´edait pas de programme enregistr´e.
Elle ex´ecutait des instructions sp´ecifi´ees `a la main sur un tableau de contacteurs. Il n’y
avait pratiquement pas de m´emoire, seulement quelques registres de quelques bits. Puis, les
m´emoires ont ´et´e r´ealis´ees `a l’aide de dispositifs physiques particuliers, pr´esentant naturellement
un effet de m´emoire, par exemple grˆace `a une propri´et´e magn´etique comme les tores
de ferrites. Le passage des fils de cuivre dans chaque tore ´etait r´ealis´e `a la main. La capacit´e
de ces m´emoires ´etait n´ecessairement tr`es faible.
16Cette situation n’a vraiment chang´e qu’avec l’apparition des m´emoires MOS au d´ebut des
ann´ees 70. Les ´ecrans graphiques `a balayage t´el´evision qui n´ecessitent de stocker l’image dans
une m´emoire de l’ordre de 100 Kbits au minimum ne sont apparus qu’`a la fin des ann´ees 70.
Avec des ordinateurs poss´edant peu de m´emoire et des fr´equences d’horloge faibles, les logiciels
sont n´ecessairement tr`es simples, souvent d´evelopp´es instruction par instruction (voire
bit par bit), sans interface graphique. Dans les ann´ees 70, on utilisait des compilateurs occupant
4 K octets par exemple. Les applications ne pouvaient disposer d’interfaces conviviales
et ne pouvaient s’adresser `a un large public, l’informatique restait une affaire de sp´ecialistes.
Les choses ont chang´e au d´ebut des ann´ees 80 avec l’apparition des premiers PCs, devenus
possibles avec l’apparition de microprocesseurs de puissance suffisante (8 `a 16 bits `a des
fr´equences de 2 `a 5 MHz) et de m´emoires de taille correcte (64 K octets). Auparavant, utiliser
un ordinateur consistait `a ´ecrire un programme pour chaque besoin, il n’y avait pas
de march´e du logiciel. Quand le nombre d’utilisateurs de PCs s’est d´evelopp´e rapidement,
l’usage courant est devenu l’installation et le lancement d’applications standard (traitement
de textes, tableur), permis par le d´emarrage d’une industrie du logiciel. Ensuite, la croissance
conjugu´ee des tailles m´emoires, des puissances de microprocesseurs, et des tailles et
complexit´e des logiciels se sont soutenues mutuellement pour suivre ensemble la loi de Moore.
La complexit´e croissante des circuits int´egr´es n´ecessitait en parall`ele un d´eveloppement des
outils de conception de circuits. Dans les ann´ees 70, on dessinait les transistors `a la main sur
du papier millim´etr´e avant de taper au clavier les coordonn´ees des polygones. On v´erifiait
la base de donn´ees ainsi cr´e´ee en dessinant les quelques milliers de transistors sur une table
tra¸cante `a feutres. Les seules simulations ´electriques possibles concernaient des assemblages
´el´ementaires de moins de 10 transistors.
Les t´el´ecommunications ont profit´e de ces d´eveloppements. En 1960, les commutateurs
t´el´ephoniques ont utilis´e des processeurs r´ealis´es avec des transistors discrets et des m´emoires
`a tores de ferrite. En 1976, on a commenc´e `a num´eriser la voix pour faire du multiplexage
temporel entre autocommutateurs, et utiliser des supports divers : fibre optique, radio, etc.
Ces techniques ont permis ensuite d’utiliser les mˆemes communications pour transmettre de
fa¸con num´erique des donn´ees, du son, des images (figure 15), et ont permis d’interconnecter
largement les ordinateurs pour d´evelopper des r´eseaux informatiques, eux-mˆemes interconnect´es
ensuite pour devenir l’Internet. Ces r´eseaux permettent le d´eveloppement d’un march´e
global qui est en train de profond´ement bouleverser les soci´et´es humaines.
Fig. 15 – Besoins en capacit´es et d´ebits
17La micro-´electronique ne concerne pas que les PCs. Le nombre de processeurs embarqu´es
dans toutes sortes d’appareils est bien sup´erieur. Dans une automobile, on compterait une
soixantaine de processeurs. Il faut consid´erer que le nombre de processeurs en service est de
l’ordre de 1000 fois le nombre d’objets identifi´es comme ”ordinateurs”.
2 Histoire des architectures de circuits
2.1 Introduction aux architectures de puces
Plus on peut mettre de transistors sur une seule puce, et plus le nombre de puces diff´erentes
que l’on peut imaginer est grand (la relation est exponentielle). Pourtant, le nombre de types
de puces diff´erentes commercialis´ees est relativement faible : on trouve quelques microprocesseurs,
quelques m´emoires, des FPGAs (les sigles sont d´efinis un peu plus bas), quelques
circuits sp´ecialis´es, et des m´ethodes pour r´ealiser des circuits `a la demande (ASICs). La
raison de cette faible diversit´e est que la rentabilit´e d’un circuit particulier n’est obtenue
que si le nombre d’exemplaires commercialis´es est tr`es grand, afin d’amortir les coˆuts de
d´eveloppement (´economies d’´echelle). Or, pour qu’un circuit ait un tr`es grand march´e, il
faut qu’il puisse se monter sur des cartes destin´ees `a des applications tr`es vari´ees.
Historiquement, les premiers circuits int´egr´es num´eriques commercialis´es (ann´ees 60) furent
des portes logiques ´el´ementaires (comme le 7400 de Texas Instruments qui contenait quatre
NON-ETs `a 2 entr´ees) ou des bascules ´el´ementaires (comme le 7474 qui contenait 2 bascules
D). C’´etait l’´epoque SSI (Simple Scale Integration). Toutes les fonctions ´electroniques
logiques ´etaient r´ealis´ees par l’assemblage de ces ”briques ´el´ementaires” choisies dans un
catalogue d’une vingtaine de circuits diff´erents.
Puis apparurent des circuits un peu plus complexes, tels que : compteur 4 bits, registre
`a d´ecalage 4 bits, UAL 4 bits (Unit´e Arithm´etique et Logique), m´emoire de 16 mots de
4 bits. Chaque circuit pouvait contenir une centaine de portes logiques. C’´etait l’´epoque
MSI (Middle Scale Integration). Le catalogue des circuits s’enrichissait de nouvelles fonctions,
montant en complexit´e, mais aussi en sp´ecialisation. La r´ealisation d’une application
´electronique (le m´etier d’´electronicien num´erique) consistait en l’assemblage de ces circuits
´el´ementaires.
Au d´ebut des ann´ees 70 apparurent les premiers microprocesseurs (4 bits, 1000 portes) et
les premi`eres m´emoires denses (1K bits). C’´etait le d´ebut de l’`ere LSI (Large Scale Integration).
On comprit alors que de nombreuses applications ´electroniques, quoique sp´ecialis´ees,
pouvaient se r´ealiser avec une carte microprocesseur standard programm´ee d’une fa¸con particuli`ere.
Le m´etier d’´electronicien se diversifia, incluant les techniques de programmation,
associ´ees jusqu’alors au m´etier d’informaticien. Le march´e de ces nouveaux circuits LSI (microprocesseurs
et m´emoires) ´etait large (sp´ecialisation faible). Les circuits SSI et MSI ´etaient
18toujours indispensables pour connecter ensemble des circuits LSI d’une fa¸con particuli`ere.
Au d´ebut des ann´ees 80, alors que les circuits LSI montaient en complexit´e (microprocesseurs
plus complexes et plus rapides, m´emoires plus denses), les circuits SSI et MSI commen¸caient
`a ˆetre remplac´es par des PLAs (Programmable Logic Arrays), qui sont des r´eseaux de portes
logiques dont l’interconnexion ´etait programmable par des liens fusibles. Ces circuits sont
configurables une fois, et permettent de r´ealiser des fonctions de complexit´e MSI avec un
catalogue de circuits de base tr`es r´eduit. Leur march´e ´etait donc bien plus large que les
circuits MSI pr´ec´edents puisque leur sp´ecialisation ´etait faible.
Parall`element, la conception d’un circuit int´egr´e LSI devenait accessible pour des applications
sp´ecialis´ees. En effet, au lieu de se contenter d’assembler des circuits int´egr´es standard sur une
carte imprim´ee sp´ecialis´ee, pourquoi ne pas assembler les transistors d’une fa¸con particuli`ere
(ASIC : Application Specific Integrated Circuit). Le coˆut de d´eveloppement est beaucoup plus
grand, mais cela peut ˆetre int´eressant si le nombre d’exemplaires fabriqu´es est assez grand,
ou si la miniaturisation est indispensable. Pour l’industrie du circuit int´egr´e, le m´etier n’est
plus de concevoir et de vendre des ”fonctions logiques”, mais devient d’une part un m´etier
de sous-traitant ”fondeur de silicium” qui r´ealise des circuits qu’il n’a pas con¸cus, et d’autre
part un m´etier de conception-vente de logiciels de CAO pour aider les clients `a concevoir
leur propre circuit.
Fig. 16 – R´epartition du march´e en 2001 (total 138 Milliards d’euros)
A la fin des ann´ees 80, l’accroissement des densit´es d’int´egration permet des r´eseaux de
portes programmables (FPGA : Field Programmable Gate Array) qui ´elargissent le march´e
des PLAs jusqu’`a des complexit´es LSI. Ces circuits sont reprogrammables ´electriquement `a
volont´e, et concurrencent tr`es s´erieusement les ASICs grˆace `a un temps de d´eveloppement
plus court (donc un coˆut plus adapt´e aux petites s´eries). Leur programmabilit´e n’est pas
celle d’un microprocesseur (o`u la circuiterie est fixe et le contenu de la m´emoire variable),
mais consiste en la modification des connexions entre les portes logiques (modification de la
circuiterie). Ils ne concurrencent donc pas les microprocesseurs. N´eanmoins, ils couvrent un
19champ d’application tr`es large, depuis le remplacement (regroupement) des circuits SSI-MSI,
jusqu’au remplacement d’ASICs.
Aujourd’hui, une carte ´electronique sp´ecialis´ee quelconque se r´ealise souvent en assemblant
un microprocesseur, une m´emoire, et un FPGA ou un ASIC. Ces 4 types de circuits r´esument
grosso-modo les principaux segments du march´e des circuits int´egr´es. Pour une r´epartition du
march´e des semiconducteurs suivant les types de circuits, on peut se reporter `a la figure 16.
Les FPGAs et les ASICs y sont regroup´es sous ”Autres circuits logiques...”. ”Opto” d´esigne
les composants opto´electroniques, tels que les diodes ´electro-luminescentes, les diodes laser,
les photo-diodes, etc.
En r´esum´e de cette introduction, et pour illustrer comment l’ing´enieur op`ere ses choix architecturaux
face au besoin d’´economie d’´echelle, on peut dire rapidement :
– Pour les m´emoires, il est clair que la plupart des applications de l’´electronique n´ecessitent
de stocker des donn´ees, et autant le faire dans des circuits g´en´eraux plutˆot que dans des
m´emoires sp´ecialis´ees `a une application.
– Pour les microprocesseurs, l’adaptabilit´e aux applications diverses est bien entendu li´ee
`a leur programmabilit´e. L’adaptabilit´e est limit´ee uniquement par la vitesse maximum
d’ex´ecution d’un algorithme particulier. Mais plus les microprocesseurs vont vite, et plus
leur march´e s’accroˆıt, face `a des circuits plus sp´ecialis´es.
– Tout ce qui ne peut pas ˆetre fait avec un microprocesseur et un programme dans une
m´emoire doit ˆetre fait avec un circuit sp´ecialis´e. Mais les circuits sp´ecialis´es utilisent des
portes logiques et des bascules, ce que contiennent les FPGAs en quantit´e de plus en plus
importante. Ces FPGAs voient donc leur march´e augmenter, rempla¸cant progressivement
de plus en plus de circuits sp´ecialis´es.
– Enfin, dans tous les cas de circuits sp´ecialis´es o`u les FPGAs sont inadapt´es en performance
(vitesse, miniaturisation) ou en coˆut (grandes s´eries), il faudra d´evelopper un circuit ASIC.
2.2 Esquisse d’une histoire des microprocesseurs
La soci´et´e Intel a ´et´e fond´ee en 1968 avec pour objectif d’utiliser la technologie MOS pour
r´ealiser des m´emoires denses (1 Kbits `a l’´epoque). Elle r´ealisait ´egalement des circuits `a la
demande, et parmi ceux-ci une commande de la soci´et´e Busicom pour une famille de circuits
permettant une reconfiguration par programmation. Apr`es l’abandon de la commande par
Busicom, Intel mit cette famille (de r´ef´erence 400X) `a son catalogue. Le circuit comportant
une UAL (Unit´e Arithm´etique et Logique) et un s´equenceur ´etait le 4004, et devint le premier
”microprocesseur”, calculant sur 4 bits (sorti en 1971). Il comporte 2 300 transistors,
fonctionne `a 108 kHz et occupe 12 mm2
en technologie PMOS 10 microns.
Puis Intel sort en 1972 le premier microprocesseur 8 bits : le 8008. Il comporte 3 500 transistors,
en technologie PMOS 10 microns. Les dimensions de la puce sont de 4, 9 × 6, 7 mm2
.
Il fonctionne `a 200 kHz et ex´ecute 60 000 instructions par seconde. Il comporte un registre
accumulateur de 8 bits et 6 registres g´en´eraux. L’adressage m´emoire est cod´e sur 14 bits
20(16 K octets).
Les applications de ces circuits ne concernaient pas ce que l’on appelait alors ”informatique”.
Les machines que l’on nommaient ”ordinateurs” ´etaient alors des machines tr`es volumineuses
et tr`es consommatrices d’´energie. Les plus puissants ex´ecutaient quelques millions
d’instructions 32 bits par seconde et poss´edaient de l’ordre de 1 Moctets de m´emoire, ce qui
d´epassait de beaucoup les possibilit´es des microprocesseurs. Les applications de ces derniers
concernaient donc les applications d’´electronique sp´ecialis´ee qui pouvaient se contenter d’une
fr´equence assez faible. N´eanmoins, quelques soci´et´es commenc`erent `a proposer des ”ordinateurs
individuels” `a base de microprocesseurs 8 bits. La premi`ere fut la soci´et´e fran¸caise
Micral, suivie par Alta¨ır en Californie.
Le premier ”microcontrˆoleur” (ordinateur complet sur une puce) fut le TMS1000 de Texas
Instruments, 4 bits, 1 K de ROM (Read Only Memory), 32 octets de RAM (Random Access
memory).
Puis, en 1974, sortirent 2 microprocesseurs 8 bits en technologie NMOS 6 microns, avec un
espace d’adressage de 64 Koctets : le 8080 de Intel (2 MHz), et le 6800 de Motorola (avec
2 accumulateurs 8 bits et un registre d’index 16 bits). Ils furent les coeurs des PCs Alta¨ır
8800 et Alta¨ır 6800. Ils furent d´eclin´es dans des versions microcontrˆoleurs (8051 et 6801)
utilis´es pour des automatismes (dans l’automobile par exemple). Les concepteurs du 6800
partent de Motorola en 1975 pour fonder Mostek, et sortent le 6502, utilis´e dans l’ordinateur
Apple II. Sur cet ordinateur, on pouvait ex´ecuter le programme ”Visicalc”, premier tableur,
et v´eritable d´ebut de la ”bureautique”.
Le premier microprocesseur 16 bits fut le TMS9900 de Texas Instruments, qui avait la particularit´e
de ne pas poss´eder de registre interne, et d’adresser tous ses op´erandes directement
en m´emoire g´en´erale. Mais les premiers microprocesseurs qui ont vraiment fait d´ecoller les
PCs et rapproch´e ces circuits des applications informatiques furent les 16 bits 8086 (de Intel)
et 68000 (de Motorola), apparus vers 1980.
Ils d´ecid`erent IBM (jusqu’alors sp´ecialiste de gros ordinateurs) `a se lancer sur le march´e des
PCs, avec un premier micro-ordinateur bas´e sur le 8088 (version `a bus externe de 8 bits du
8086), 64 Koctets de RAM et 40 Koctets de ROM. Le syst`eme d’exploitation (MSDOS) avait
´et´e sous-trait´e `a une petite soci´et´e (Microsoft), qui avait en fait adapt´e le syst`eme CP/M-86
achet´e pr´ec´edemment `a la soci´et´e SCP (Seattle Computer Products). D`es 1982 apparurent
des clones, utilisant la compatibilit´e permise par l’ouverture du syst`eme d’entr´ees-sorties
BIOS (Basic I/O System). IBM sortit le mod`ele XT en 1983 (avec un disque dur de 10 Mo),
puis le AT en 1984 avec le processeur 80286.
Apple r´epliqua par la machine LISA en 1983 (68000 `a 5 MHz, 1 Moctets de RAM, disque dur 5
Mo) qui innovait principalement par son interface graphique moderne (GUI : Graphical User
Interface) inspir´ee des syst`emes d´evelopp´es `a Xerox-PARC `a la fin des ann´ees 70 (PARC :
Palo Alto Research Center). LISA eut moins de succ`es que son petit compagnon ”Macintosh”
sorti un an apr`es (1984) avec un 68000 `a 8 MHz et 128 K de RAM.
21Avant ces machines, l’utilisateur voyait surtout l’ordinateur, produit final qu’il programmait
directement, par exemple en langage ”Basic”, et ignorait souvent la nature du microprocesseur.
Le syst`eme d’exploitation ´etait d´evelopp´e par le fabricant de l’ordinateur. A partir de
ces machines 16 bits, la compatibilit´e avec le code microprocesseur et le syst`eme d’exploitation
devenait cruciale en raison de l’usage de logiciels commerciaux, et l’utilisateur s’int´eressa
davantage au microprocesseur et au syst`eme d’exploitation. Ceci entraˆına une course `a la
puissance entre Intel (IBM-PC et ”compatibles”) et Motorola (Apple et stations de travail
sous Unix) et une comp´etition entre les syst`emes d’exploitation (Unix, MacOS et MSDOS
puis Windows). La compatibilit´e avec les PCs d’IBM fit passer au second plan le nom du
constructeur de l’ordinateur, et d´ecouragea mˆeme IBM de poursuivre cette comp´etition.
Dans cette p´eriode, l’informatique se transformait avec l’apparition de logiciels cl´es en mains
`a grand march´e comme Word (Microsoft) et Pagemaker en 1985 (Adobe) qui lan¸cait le
traitement de texte et la PAO.
En parall`ele, le microprocesseur 68000 ´etait utilis´e dans des ordinateurs professionnels plus
puissants (Apollo, Sun, Silicon Graphics, HP) destin´es `a ex´ecuter le syst`eme Unix pour des
ing´enieurs (stations de travail). Une des applications ´etait le d´eveloppement d’outils de CAO
pour concevoir des circuits LSI, lanc´ee principalement par l’ouvrage de Mead et Conway
paru en 1980 [3] et r´epandue `a l’universit´e (principalement Berkeley). Ceci conduisit `a une
prolif´eration de conceptions de processeurs, en liaison avec la recherche d’efficacit´e lors de la
compilation, et d´eboucha sur les architectures RISC. Expliquons de quoi il s’agit.
Les gros ordinateurs des g´en´erations pr´ec´edentes ´etaient micro-programm´es : le d´ecodage et
l’ex´ecution d’une instruction ´etaient r´ealis´es par un microprogramme qui pouvait fonctionner
5 `a 10 fois plus vite car la m´emoire de microprogramme et les registres ´etaient plus petits
que la m´emoire g´en´erale. Mais au d´ebut des ann´ees 80, les m´emoires rapides devenaient plus
grosses (ce qui permettait d’avoir de gros microprogrammes), et les m´emoires de grande taille
devenaient plus rapides, si bien que le rapport de vitesse entre les deux ne justifiait plus le
d´ecodage micro-programm´e des instructions. Par ailleurs, certains compilateurs produisaient
directement du code pour le microprogramme. On en vint `a supprimer un des deux niveaux en
choisissant un jeu d’instructions simple, facile `a d´ecoder, plus proche des micro-instructions,
nomm´e RISC (Reduced Instruction Set Computer : ordinateur `a jeu d’instructions r´eduit).
C’est le jeu d’instructions qui est ”r´eduit”, il y a peu d’instructions diff´erentes. La fr´equence
d’horloge pouvait ˆetre ´elev´ee grˆace `a la simplicit´e de d´ecodage de l’instruction. Par ailleurs,
l’ex´ecution des instructions se prˆete `a une structure mat´erielle dite ”pipe-lin´ee”, qui permet
un parall´elisme d’ex´ecution des ´etapes successives d’instructions successives.
Cette architecture RISC d´eboucha sur de nouveaux microprocesseurs (comme ceux de la
soci´et´e MIPS par ex.) qui ´equip`erent les stations de travail `a partir de 1985. Sun introduisit
le SPARC en 1987.
Parall`element, Intel et Motorola continuaient vers les 16-32 bits avec des architectures plus
classiques (dites alors CISC par opposition `a RISC, le C ´etant mis pour ”complex”), en
gardant la compatibilit´e logicielle avec les 16 bits, mais en permettant un espace d’adressage
plus grand et la gestion d’une m´emoire virtuelle avec un cache d’instructions, en profitant de
22la plus grande densit´e d’int´egration et de l’augmentation des fr´equences d’horloge. En 1985,
le Intel 80386 est r´ealis´e en technologie 1 micron, contient 300 K transistors et fonctionne `a
20 MHz. Il est pipe-lin´e en 5 ´etages :
1. Lecture de l’instruction en m´emoire,
2. D´ecodage de l’instruction et lecture des registres,
3. Ex´ecution ou calcul d’adresse,
4. Lecture/´ecriture des op´erandes en m´emoire,
5. Ecriture dans les registres. ´
Il contient tout le CPU (Central Processing Unit), avec le cache, mais pas le FPU (Floating
Point Unit, ext´erieur, 80387), ni le MMU (Management Memory Unit). Le circuit Motorola
´equivalent est le 68030 (le 68020 de 1984 ´etait le premier CPU `a inclure le cache, ce qui
acc´el`ere beaucoup car permet de disposer d’un bus large en interne et ainsi d’augmenter le
d´ebit). Le CMOS se g´en´eralise car le NMOS dissipe trop pour les boˆıtiers 2 Watts.
La g´en´eration suivante (1991 : Intel 486 et Motorola 68040) contient 1,2 M transistors et
int`egre le FPU.
Un grande augmentation de la fr´equence est obtenue lorsque Digital sort l’alpha 21064 `a
150 MHz en 1992. Motorola se tourne alors vers les RISC, dans une alliance avec IBM et
Apple pour les puces PowerPC. Intel inclut des id´ees issues du RISC dans son P5 (Pentium)
en 1993 (60 MHz).
En 1996 apparaˆıt le alpha 21164, technologie 0,35 microns, 9,3 M transistors, 500 MHz,
200 mm2
, 100 Koctets de cache, bus 128 bits.
Les adresses sont maintenant (depuis quelques ann´ees) sur 64 bits, ce qui permet de d´epasser
4 Goctets d’espace d’adressage. En 1997, les pipe-lines faisaient jusqu’`a 14 ´etages, maintenant
jusqu’`a 20.
Aujourd’hui, le quasi-monopole du syst`eme d’exploitation Windows de Microsoft assure
la supr´ematie des puces x86-Pentium (Intel, AMD, etc.). Elles incluent des instructions
sp´ecifiques pour le graphique et le multim´edia (MMX). La dissipation du CMOS a beaucoup
augment´e (plus de 100 Watts) en raison de l’augmentation des fr´equences d’horloge, et
malgr´e la diminution de la tension d’alimentation. Cela n´ecessite un gros radiateur assist´e
d’un ventilateur.
Cet ´etat de fait peut encore beaucoup ´evoluer, voire ˆetre compl`etement transform´e, avec
d’une part le fort d´eveloppement des logiciels libres et en particulier du syst`eme d’exploitation
Linux qui est port´e sur tous les types de processeurs et est accompagn´e de toutes les
applications logicielles souhait´ees. D’autre part, Apple utilise ´egalement un syst`eme d’exploitation
bas´e sur Unix : Mac OS X (en partie unix-libre car bas´e sur FreeBSD) et a r´ecemment
23converti toute sa gamme aux processeurs Intel. Le couple Unix-Intel semble actuellement
avoir le vent en poupe.
Les usages des PCs se modifient ´enorm´ement et tr`es rapidement avec le d´eveloppement
d’Internet via l’ADSL, les assistants personnels, les t´el´ephones mobiles, les baladeurs MP3,
les jeux en r´eseaux, les appareils photo num´eriques. Tout ceci peut influencer beaucoup `a
l’avenir les syst`emes d’exploitation et les processeurs.
3 Le futur de la micro-´electronique
3.1 Pouvons-nous pr´edire la suite ?
Depuis plusieurs d´ecennies, la pr´evision de l’avenir de la micro-´electronique a consist´e `a
extrapoler la loi de Moore. On peut continuer `a le faire, en ayant conscience de ce que
cela suppose d’innovations techniques `a venir pour r´esoudre de nombreuses difficult´es. Les
pr´evisions (en 2004) de l’ITRS (International Technology Roadmap for Semiconductors)
sont r´esum´ees dans le tableau de la figure 17, et concernent une dizaine d’ann´ees. (”Ann´ee
de d´ebut de production” signifie qu’une compagnie est capable de produire 10 000 circuits
par mois dans la nouvelle technologie, et qu’elle sera rejointe dans les trois mois par une
autre compagnie.)
Fig. 17 – Pr´evisions de l’ITRS en 2004
24Il est clair que ce tableau est all´echant puisqu’il promet toujours davantage de puissance de
calcul, davantage de miniaturisation, `a des coˆuts toujours plus bas. Il est vraisemblable que
cette ´evolution exponentielle pourra continuer encore pendant une dizaine d’ann´ees. Mais,
les difficult´es sont de 3 ordres :
1. La miniaturisation approche des limites physiques : la longueur d’un canal de transistor
est de l’ordre de la centaine de distances atomiques. L’´epaisseur de la couche d’oxyde
de grille (de l’ordre du nm) correspond `a quelques couches atomiques. Les temps de
propagation sur des distances de plus d’un centim`etre sont grands devant la p´eriode
d’horloge.
2. Complexit´e de conception : faire fonctionner ensemble plusieurs centaines de millions
de transistors dans des structures peu r´ep´etitives comme celles des microprocesseurs
devient de plus en plus complexe, et les m´ethodes de conception deviennent difficiles
`a g´erer.
3. Les enjeux financiers sont colossaux. Le coˆut d’une usine de production atteind la
dizaine de milliards d’euros, et une partie des machines doit ˆetre chang´ee `a chaque
g´en´eration (2 ou 3 ans). Le changement de diam`etre des wafers (comme le r´ecent
passage de 200 `a 300 mm) demande de changer une grande proportion de machines en
un temps court.
Toutes ces difficult´es, dont nous allons d´etailler ci-dessous les deux premi`eres, peuvent apparaˆıtre
´enormes, mais elles sont proportionnellement du mˆeme ordre que celles qui ont ´et´e
surmont´ees dans le pass´e. Elles constituent une liste de d´efis qui montre la vitalit´e de ce secteur,
et il est bien difficile de pr´edire ceux qui seront relev´es rapidement et ceux qui resteront
des points durs.
3.2 Limites physiques
Les limites physiques sont des limites qu’impose la nature `a l’augmentation de densit´e des
composants. Il est clair qu’une diminution exponentielle de la largeur des motifs grav´es va
rencontrer rapidement les dimensions atomiques et qu’alors les hypoth`eses qui fondent la
micro´electronique ne tiendront plus. La figure 18 permet de se faire une id´ee des dimensions
des objets rencontr´es.
On peut citer quelques exemples des difficult´es d’ordre physique (li´ees `a la taille des transistors)
que l’on va rencontrer pour continuer `a suivre la loi de Moore.
1) La dissipation thermique. Dans un circuit ´electronique num´erique de calcul (qui n’attaque
pas une charge demandant de la puissance), toute l’´energie ´electrique consomm´ee
est transform´ee en chaleur. Si la puissance consomm´ee est ´elev´ee, cela pose deux types de
probl`emes. D’une part, il faut fournir cette puissance ´electrique, ce qui est probl´ematique
25Fig. 18 – Dimensions caract´eristiques
pour tout ce qui est portable, `a cause des difficult´es li´ees au poids et `a l’entretien des batteries
ainsi qu’`a la dur´ee d’autonomie. D’autre part, il faut extraire la chaleur ´emise depuis
un volume toujours plus petit. Au del`a de 2 Watts par circuit, il faut un radiateur. Au del`a
de 10 Watts, il faut en outre un ventilateur. Tout ceci ajoute du volume, du poids, de la
complexit´e, du bruit, des coˆuts, etc.
Pour du CMOS, la puissance thermique dissip´ee (puissance ´electrique consomm´ee) est en
gros de la forme :
P = f × N × C × V
2
avec :
– f : fr´equence d’horloge
– N : nombre de portes
– C : capacit´e ´el´ementaire
– V : tension d’alimentation
Quand on r´eduit les dimensions des transistors et la tension d’alimentation (figure 19), on
r´eduit la consommation de chaque porte, car celle-ci est proportionnelle `a CV 2
. Ainsi, si on
passe d’une technologie ”0,5 microns, 5 Volts” `a une technologie ”0,05 microns, 1 Volt”, on
gagne un facteur 250 pour chaque porte. Mais dans le mˆeme temps, la finesse de gravure nous
26permet de multiplier par plus de 500 le produit f × N. Le r´esultat global est grosso-modo
un doublement de la consommation (pour les composants les plus performants du moment)
en 18 ans. Mais il ne faut pas oublier que cette petite augmentation r´esulte d’une presque
compensation de deux facteurs ´enormes.
Fig. 19 – Evolution de la dissipation sur 18 ans ´
Actuellement, la puissance P a atteint un mur car elle est limit´ee par les possibilit´es d’´evacuation
de la chaleur par les radiateurs. On consid`ere qu’il n’est pas raisonnable de d´epasser 200 W
par puce. La fa¸con dont se manifeste cette limite est alors la suivante : comme on ne peut pas
augmenter la dissipation totale d’un circuit, et comme le terme CV 2 ne baisse pas assez vite
(V ne peut plus diminuer), alors on ne peut pas utiliser pleinement les capacit´es d’int´egration
que permet la finesse de gravure.
2) Temps de propagation et vitesse d’horloge. Pour une technologie 0,25 micron, si
les connexions sont espac´ees au minimum possible, le temps de propagation sur 1 cm est
de 10 ns. Si on ´ecarte les connexions, ce d´elai diminue, mais alors la densit´e est plus faible.
Distribuer une horloge `a plus de 1 GHz dans un circuit o`u les temps de propagation internes
sont de l’ordre de plusieurs nanosecondes est vraiment tr`es complexe. Cela peut conduire `a
changer les mat´eriaux pour changer les constantes di´electriques et changer ainsi la vitesse
de propagation. Mais la vitesse de propagation des signaux ´electriques est born´ee par la
vitesse de la lumi`ere dans le vide qui n’est que 30 cm par ns (nanoseconde), il n’y a donc
pas beaucoup de marge.
Cette contrainte conduit `a ne laisser que des communications locales, mais cela change le
mod`ele de calcul vers un mod`ele comportant davantage de parall´elisme, plus difficile `a programmer
efficacement. On tend actuellement vers des structures dites ”GALS” (Globalement
Asynchrone et Localement Synchrone), ce qui signifie qu’une puce est un r´eseau de processeurs
synchrones interconnect´es par des bus asynchrones. Il s’agit bien de parall´elisme, de
plus en plus massif. Mais on sait bien que l’association de n processeurs ne permet que
dans des cas tr`es particuliers d’obtenir n fois la puissance d’un processeur (loi de Amdhal).
Ceci avait dans le pass´e fait repousser les solutions parall`eles au profit de l’augmentation
des performances permise par la loi de Moore. Le fait d’aller maintenant vers davantage de
parall´elisme est donc un symptˆome d’arriv´ee en but´ee de l’utilisation de la loi de Moore.
3) Gravure. Les verres optiques (mˆeme le quartz) deviennent opaques pour des lumi`eres
27de longueurs d’onde inf´erieures `a 0,2 microns. On utilise actuellement des optiques en CaF2.
La gravure par rayons X a ´et´e ´etudi´ee, avec des masques `a l’´echelle 1, situ´es `a 10 microns
de la r´esine. Mais tout cela est tr`es complexe, difficile `a rendre ´economiquement viable.
L’insolation par un faisceau d’´electrons, sans masque mais par balayage, est trop lente pour
ˆetre rentable (elle est utilis´ee pour des ASICs en petite s´erie).
4) Dispersion des caract´eristiques physiques. Des transistors de 0,06 micron fonctionnent
`a 120 GHz. Mais le dopage du canal est fait en implantant moins de 200 atomes de
dopant. La variabilit´e statistique de ce nombre fait qu’il y a une tr`es grande dispersion entre
les transistors voisins dans un mˆeme circuit (RAM 256 G bits ou microprocesseur de 1,4 G
transistors).
Peut-ˆetre que certaines de ces difficult´es pourront ˆetre r´esolues en cr´eant des structures
redondantes pour tol´erer les pannes o`u se reconfigurer dynamiquement ?
3.3 Gestion de la complexit´e de conception
Concevoir une puce de 100 millions de transistors, tout comme ´ecrire un programme de
100 millions de lignes, ne peut se faire sans une structuration qui divise la complexit´e afin
de localiser les difficult´es pour les rendre g´erables. (On peut se faire une id´ee grossi`ere de
l’´evolution de cette complexit´e en consid´erant qu’on multiplie par un facteur 50 le nombre
de transistors par puce tous les 10 ans et en essayant d’imaginer la complexit´e permise par
les technologies `a venir.)
Cette structuration n´ecessaire passe par l’´etablissement de normes qui d´efinissent des objets
communs `a tous les concepteurs. Par exemple, dans les ann´ees 60-70, l’utilisation des fonctions
SSI-MSI cr´eaient une biblioth`eque de briques de base commune `a tous les ´electroniciens.
Ceci a ´et´e remplac´e ensuite par des biblioth`eques de cellules standard, qui n’´etaient plus des
circuits complets, mais des ´el´ements de base `a assembler pour cr´eer un circuit LSI. Ces
cellules se comportent comme des mots d’un vocabulaire qui permet de d´ecrire le fonctionnement
d’un circuit en termes de transferts entre blocs (langage RTL : Register Transfer
Level).
De nombreuses normes jouent ce rˆole structurant qui permet de g´erer une complexit´e plus
grande. On peut citer (en vrac, et dans des ordres de natures et de dimensions tr`es vari´ees) :
- La norme TTL : A l’´epoque des circuits SSI-MSI, la tension d’alimentation ´etait de 5
Volts, et les signaux d’entr´ee-sortie ´etaient calibr´es en tension et en courant par cette norme.
Cela ´etait issu de ce qui ´etait r´ealisable avec les transistors bipolaires des ann´ees 60, dont
la technologie s’appelait Transistor-Transistor-Logic. Cette norme de calibrage de signaux
d’entr´ee-sortie a continu´e longtemps `a s’appliquer, alors que les circuits ´etaient MOS, car
elle permettait d’interconnecter des circuits de toute provenance et de toute fonction.
28- La norme RS-232 : norme de formatage des ´echanges de caract`eres alphanum´eriques sur
une ligne s´erie. Initialement destin´ee `a connecter un terminal de type machine `a ´ecrire `a un
ordinateur distant `a l’aide de 3 fils, elle s’est adapt´ee `a toutes sortes d’´echanges de donn´ees
entre toutes sortes d’appareils num´eriques, et a facilit´e la conception mat´erielle et logicielle
de ces appareils.
- De la mˆeme fa¸con, Ethernet, et l’interconnexion en r´eseau local, a jou´e un rˆole similaire.
Plus largement, la norme TCP/IP, celle de l’Internet, et les protocoles client/serveur ont
permis de connecter tous ces r´eseaux locaux afin de cr´eer un r´eseau mondial, dans lequel le
mode d’´echange entre deux ordinateurs quelconques est simple et banalis´e.
- Les langages de description de mat´eriel (tels que VHDL), soit `a un niveau ´elev´e ext´erieur
(comportemental), soit `a un niveau plus fin d’impl´ementation (structurel), facilitent l’´echange
entre les ing´enieurs et/ou entre les projets, en permettant notamment de hi´erarchiser la
description des circuits complexes.
- Au sein des circuits int´egr´es, on cherche `a r´eutiliser, lors de la conception d’un nouveau
circuit, de gros blocs d´ej`a ´evalu´es. Pour ce faire, on doit pouvoir ignorer l’int´erieur du bloc
pour ne g´erer que son interface avec le reste du circuit. Ceci permet en particulier d’utiliser
des blocs con¸cus par des tierces parties qui peuvent vouloir prot´eger leur droits d’auteurs,
comme s’il s’agissait de produits isol´es (on parle de circuits IP, pour ”Intellectual Property”).
Ceci n´ecessite la mise au point d’un norme : VSIA (Virtual Socket Interface Alliance).
Chaque norme cr´ee un langage pour d´ecrire des circuits `a un niveau hi´erarchique plus ou
moins ´elev´e. A ces normes correspondent des outils de CAO qui peuvent v´erifier ou traduire `
des descriptions de circuits afin de faciliter la tˆache de conception.
Au niveau le plus bas, il s’agit de dessiner les transistors pour cr´eer des portes logiques,
en respectant les r`egles de dessin impos´ees par la technologie (succession de photolithogravures).
Les outils utilis´es sont des ´editeurs graphiques, ou des ´editeurs symboliques (qui
font des tassements automatiques), des v´erificateurs de dessins (qui contrˆolent que les r`egles
technologiques sont respect´ees), des extracteurs (qui d´eduisent la fonction logique `a partir
du dessin), des simulateurs ´electriques (qui utilisent des mod`eles physiques des transistors
pour simuler et v´erifier le fonctionnement logique).
A un niveau plus ´elev´e, il n’est plus possible de simuler physiquement tous les transistor ` s, et
les simulations seront soit purement logiques, soit tenant compte d’un temps de propagation
qui sera ajout´e `a la travers´ee de chaque porte sur chaque trajet.
Mais en fait, comme les temps de propagation r´eels sont tr`es d´ependants de la disposition `a
la surface du silicium (apr`es ”placement” des blocs et ”routage” des fils), il n’est pas possible
de simuler ces temps sur un gros circuit au d´ebut de la conception. Il faut donc commencer
par valider la r´ealisation logique, puis faire le placement-routage, puis en extraire des temps
de propagation plus r´ealistes qui seront report´es dans les simulations ... et qui pourront
remettre en cause les structures logiques, ce qui oblige `a reparcourir plusieurs fois la chaˆıne
29de conception suivante :
– D´efinition de la fonction `a int´egrer, ´ecriture de sp´ecifications,
– Ecriture de la fonction en un langage de description de mat´eriel (VHDL, Verilog ou Sys ´ -
tem C) et simulation logique,
– Synth`ese logique, simulations,
– Placement-routage,
– Extraction et v´erification des r`egles de dessin, simulations ´electriques,
– Commande des masques.
A un niveau encore plus ´elev´e, il faut pouvoir simuler ensemble le circuit et le logiciel qui
l’utilise pour v´erifier si le d´ecoupage choisi pour les fonctions est efficace (on parle alors de
”co-design hardware-software”).
Par ailleurs, il faut pr´evoir, d`es la conception d’un circuit, comment seront valid´es (test´es)
les circuits en fin de chaˆıne de fabrication (tri entre les ”bons” pour la vente et les ”mauvais”
pour la poubelle), car le rendement n’est jamais de 100%. Or, plus un circuit r´ealise une
fonction complexe, plus son test peut ˆetre complexe. On utilise des m´ethodes sp´ecifiques, qui
consistent souvent `a ajouter de la circuiterie pour faciliter le test, soit en permettant l’acc`es
`a certains signaux internes autrement cach´es, soit en faisant r´ealiser des tests automatiques
par le circuit lui-mˆeme.
Tous les outils impliqu´es n´ecessitent des temps de calcul qui croissent rapidement avec la
complexit´e des circuits `a concevoir. Certaines ´etapes de simulation peuvent n´ecessiter des
mois de calcul.
A toutes les phases de la conception se posent des questions cruciales comme par exe ` mple celle
du partitionnement d’une fonction en plusieurs puces. Pour un certain nombre de transistors,
`a la g´en´eration N, il vaut mieux partitionner en deux circuits, et `a la g´en´eration suivante
N + 1, il vaut mieux int´egrer tout sur une seule puce. Ce ”il vaut mieux” s’appuie sur une
fonction de coˆut qui prend en compte le coˆut de d´eveloppement et le coˆut de production,
qui est lui fonction du nombre de pi`eces `a fabriquer et du rendement de fabrication. Un
circuit qui est en limite de ce que la technologie permet aura un rendement de fabrication
tr`es faible, alors qu’`a la g´en´eration suivante, le mˆeme circuit ne posera pas de probl`eme.
Ces probl`emes de complexit´e de conception sont souvent analys´es comme constituant une
limite `a l’accroissement de densit´e, un peu comme pour les limites physiques. En effet, l’´ecart
semble se creuser entre les possibilit´es offertes par la technologie de r´ealisation de circuits et
ce qu’il est possible de concevoir avec des ´equipes de taille r´ealiste.
304 Conclusion
L’accroissement exponentiel de l’activit´e autour de la micro-´electronique et l’informatique
engendre une r´evolution industrielle d’une ampleur nouvelle car aucun autre syst`eme technique
n’avait permis dans le pass´e une ´evolution si rapide de la soci´et´e, et cette fois `a l’´echelle
de la plan`ete. A titre de comparaison, la premi`ere r´evolution industrielle s’est ´etendue sur `
pr`es de deux si`ecles, si on la fait d´ebuter vers le milieu du 18`eme si`ecle avec les machines de
Watt, et si on fixe sa fin vers le milieu du 20`eme avec la g´en´eralisation des r´eseaux de transport
de mati`ere et d’´energie. On peut aussi consid´erer comme un autre syst`eme technique
les d´eveloppements de l’industrie automobile et de l’aviation, qui, entre les premiers essais et
la maturit´e, ont occup´e moins d’un si`ecle. Le syst`eme technique li´e `a la micro-´electronique
et `a l’informatique s’est d´evelopp´e et a transform´e le monde en moins de 40 ans.
Ce syst`eme technique est-il arriv´e `a maturit´e, ou bien le d´eveloppement exponentiel va-t-il
continuer encore longtemps ? Quand on dit ”les limites semblent devoir ˆetre atteintes dans
moins de 10 ans”, on prononce une phrase qu’on entend depuis plus de 20 ans ! Certes, cette
sentence ne restera pas toujours fausse car on ne peut que se rapprocher de limites, qui n’ont
pas l’air d’ˆetre illusoires. Mais mˆeme si on se borne `a l’horizon 2015, on constate que la
technologie rec`ele encore des possibilit´es extraordinaires. Certes, les difficult´es `a surmonter
sont ´enormes, mais on peut les supposer comparables `a celles qui ont ´et´e surmont´ees dans le
pass´e.
Quels sont les d´eveloppements pr´evisibles ? Depuis peu, les d´ebits de transmission sur les
r´eseaux permettent de passer de la vid´eo de bonne r´esolution en temps r´eel. Les PCs auront
bientˆot des capacit´es (puissance de calcul et taille m´emoire) suffisantes pour manipuler
confortablement des fichiers contenant des videos. De nombreux appareils utilis´es au quotidien
contiennent de l’´electronique communicante. Les automobiles comportent des syst`emes
de navigation et des automatismes de s´ecurit´e sophistiqu´es. Ces syst`emes se banalisent, et les
puces ´electroniques sont partout, mˆeme dans des objets tr`es bon march´e, comme les puces
RFID (Radio Frequency Identification Device) qui ´equipent certains badges et qui remplaceront
les ´etiquettes code-barre dans les supermarch´es. On envisage mˆeme de d´evelopper des
bombes de peinture o`u chaque goutelette serait un microprocesseur communicant !
R´ef´erences
[1] The Transistor, Bell Labs Technical Journal, Vol 2, n. 4, automne 1997, (http://www3.
interscience.wiley.com/cgi-bin/jissue/97518232).
[2] Bertrand Gille, Histoire des techniques, Encyclop´edie de la pl´eiade.
[3] Carver Mead & Lynn Conway, Introduction to VLSI Systems, Addison Wesley, 1980.
[4] Les donn´ees ´economiques sont de source Dataquest et WSTS (http://www.wsts.org/).
31[5] Les pr´evisions concernant l’´evolution des technologies futures sont tir´ees du rapport de
l’ITRS : International Technology Roadmap for Semiconductors (http://public.itrs.
net/).
32
Syst`emes Multi-Agents
Badr Benmammar
To cite this version:
Badr Benmammar. Syst`emes Multi-Agents. Ecole d’ing´enieur. 2009. ´
HAL Id: cel-00660066
https://cel.archives-ouvertes.fr/cel-00660066
Submitted on 15 Jan 2012
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Systèmes Multi Systèmes Multi-Agents
Badr Benmammar
bbm@badr-benmammar.comDéfinition d’un SMA
Un système multi-agents est un ensemble organisé d’agents.
Il est constitué d’une ou plusieurs organisations qui structurent les règles de
cohabitation et de travail collectif entre agents.
Dans un même système, un agent peut appartenir à plusieurs
organisations.Communication entre agents
Un agent doit être capable de communiquer avec les autres agents.
Les agents doivent avoir des capacités à manipuler un langage commun.
2 types de communication :
Communication indirecte : Partage d’informations
via l’environnement,
Communication directe :
envoi de messages, Communication entre agents
L’agent peut participer à un dialogue en étant passif ou actif.
Un agent passif doit accepter les questions des autres agents et répondre
à leur questions.
Un agent actif doit proposer et envoyer des interrogations.
Dans un dialogue les agents alternent des rôles actifs et passifs, et
échangent des séries de messages en respectant des protocoles biens précis,
ce sont les protocoles de coordination, de coopération et de négociation.Communication entre agents
La coordination
La coopération
La négociationLes protocoles de coordination
Les protocoles de coordination aident les agents à gérer leurs engagements.
Les protocoles de coordination lui permettent de gérer ces engagements
dans le cas où les circonstances circonstances dans lesquelles lesquelles ils ont été élaborés, élaborés,
évoluent.
Ils définissent aussi sous quelles conditions les engagements peuvent être
revus et quelles sont alors les actions à prendre.Les protocoles de coopération
La coopération entre les agents consiste à décomposer les
tâches en sous-tâches puis à les répartir entre les différents
agents, il existe plusieurs décompositions possibles, le
processus processus de décomposition décomposition doit donc tenir compte des
ressources disponibles et des compétences des agents.La négociation
La négociation intervient lorsque des agents interagissent pour prendre des
décisions communes, alors qu’ils poursuivent des buts différents.
Les deux principales voies sur la négociation sont :
Les langages de négociation
Le processus de négociationLa négociation
Les langages de négociation : il s’agit d’étudier les primitives de
communication pour la négociation, leur sémantique et leur usage dans
les protocoles.
Le processus de négociation : il s’agit de proposer des modèles
généraux de comportements des agents en situation de négociation.La négociation
Deux techniques de négociation :
La négociation centrée sur l’environnement : adapter le contexte ou
l’environnement à la négociation.
La négociation centrée sur l’agent : adapter le comportement de l’agent
compte-tenu des propriétés du contexte donné.Communication entre agents
La communication inter-agent est fondamentale à la réalisation du
paradigme agent, tout comme le développement du langage humain était
la clé du développement de l’intelligence humaine et des sociétés.
Pour échanger les informations et les connaissances, les agents utilisent
des ACL (Agent Communication Language).Évolution ACL
Partage de
Partage
d’objet
-> Partage des objets, des appels de procédure
et de SDD (CORBA, RPC, …) -> Partage des connaissances (faits, règles,
?
Partage de
K
Partage des
intentions -> Partage des connaissances (faits, règles, contraintes, procédures, …) KIF, KQML, FIPA, …. -> Partage des intentions (croyances, buts,
intentions) => Niveau intentionnel
Théorie BDI
-> Que peut-on partager d’autre ?
Expériences, Stratégies…Le modèle BDI et la communication
Communication
Révéler à l’autre l’état de nos croyances, désires et intentions.
Essayer d’influencer l’état des croyances, désires et intentions de
l’autre.
Un agent a des croyances sur le monde (son environnement), sur les
croyances des autres agents et sur les croyances qu’ont les autres agents
sur lui …
Efficient C++ finite element computing with Rheolef
Pierre Saramito
To cite this version:
Pierre Saramito. Efficient C++ finite element computing with Rheolef. DEA. Grenoble, France,
2012, pp.161.
HAL Id: cel-00573970
https://cel.archives-ouvertes.fr/cel-00573970v11
Submitted on 15 Apr 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Efficient C++ finite element
computing with Rheolef
Pierre Saramito
version 6.6 update 15 April 2014Copyright (c) 2003-2013 Pierre Saramito
Permission is granted to copy, distribute and/or modify this document under the terms of the
GNU Free Documentation License, Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy
of the license is included in the section entitled "GNU Free Documentation License".2 Rheolef version 6.6 update 15 April 2014
Introduction
Rheolef is a programming environment for finite element method computing.
This book presents in details how some simple and more complex problems from solid and fluid
mechanics can be solved, most of them in less than 20 lines of code. The concision and readability
of codes written with Rheolef is certainly a major keypoint of this environment (see Fig. 1).
Xh.block ("boundary");
space Xh (omega, argv[2]);
geo omega (argv[1]);
environment rheolef (argc, argv);
int main (int argc, char** argv) {
field uh (Xh);
uh ["boundary"] = 0;
solver sa (a.uu());
uh.u = sa.solve (lh.u());
dout ≪ uh;
}
field lh = integrate (v);
form a = integrate (dot(grad(u),grad(v)));
trial u (Xh); test v (Xh);
Example: find u such that −∆u = 1 in Ω and u = 0 on ∂Ω
Let Ω ⊂ R
N , N = 1, 2, 3
Xh = {v ∈ H
1
(Ω); v|K ∈ Pk, ∀K ∈ Th}
Vh = Xh ∩ H
1
0 (Ω)
a(u, v) = R
Ω ∇u.∇v dx
l(v) = R
Ω
v dx
(P) : find uh ∈ Vh such that
a(uh, vh) = l(vh), ∀vh ∈ Vh
Figure 1: Example of a Rheolef code for solving the Poisson problem with homogeneous boundary
conditions. The right column shows the one-to-one line correspondence between the code and the
variational formulation of the problem.
Let us quote B. Stroustrup [55], the conceptor of the c++ language:
"The time taken to write a program is at best roughly proportional to the number of
lines written, and so is the number of errors in that code. If follows that a good way
of writing correct programs is to write short programs. In other words, we need good
libraries to allow us to write correct code that performs well. This in turn means that
we need libraries to get our programs finished in a reasonable time. In many fields,
such c++ libraries exist."
Rheolef is an attempt to provide such a library in the field of finite element methods for partial
differential equations. As a Lego game, the Rheolef bricks allow the user to solve most complex
nonlinear problems. Rheolef provides both a c++ library and a set of unix commands for shell
programming, providing data structures and algorithms [58].
• Data structures fit the variational formulation concept: fields, bilinear forms and functional
spaces, are c++ types for variables. They can be combined in expressions, as you write
it on the paper.
• Algorithms refer to the most up-to-date ones: preconditioned sparse matrix solvers for linear
systems, distributed memory and parallel computations, high order polynomial approximations,
incompressible elasticity, Stokes and Navier-Stokes flows, characteristic method for
convection dominated heat problems, etc. Also linear and nonlinear generic algorithms such
as fixed point and damped Newton methods.Rheolef version 6.6 update 15 April 2014 3
An efficient usage of Rheolef supposes a raisonable knowledge of the c++ programming language
(see e.g. [50, 54]) and also of the classical finite element method and its variational principles.4 Rheolef version 6.6 update 15 April 2014
Contacts
email Pierre.Saramito@imag.fr
home page http://www-ljk.imag.fr/membres/Pierre.Saramito/rheolef
Please send all comments and bug reports by electronic mail to
rheolef@grenet.fr
The Rheolef present contributors
from 2008 Ibrahim Cheddadi: discontinuous Galerkin method for transport problems.
from 2010 Mahamar Dicko: finite element methods for equations on surfaces.
from 2002 Jocelyn Étienne: characteristic method for time-dependent problems.
from 2000 Pierre Saramito: project leader: main developments and code maintainer.
Past contributors
2010 Lara Abouorm: banded level set method for equations on surfaces.
2000 Nicolas Roquet: initial versions of Stokes and Bingham flow solvers.Contents
Notations 8
I Getting started with simple problems 11
1 Getting started with Rheolef 15
1.1 The model problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.2 Approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.3 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.4 How to compile the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.5 How to run the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.6 Stereo visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.7 High-order finite element methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.8 Tridimensional computations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.9 Quadrangles, prisms and hexahedra . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.10 Direct versus iterative solvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.11 Distributed and parallel runs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2 Standard boundary conditions 27
2.1 Non-homogeneous Dirichlet conditions . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2 Non-homogeneous Neumann boundary conditions for the Helmholtz operator . . . 35
2.3 The Robin boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.4 Neumann boundary conditions for the Laplace operator . . . . . . . . . . . . . . . 39
3 Non-constant coefficients and multi-regions 43
II Fluids and solids computations 49
4 The linear elasticity and the Stokes problems 51
4.1 The linear elasticity problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.2 Computing the stress tensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.3 Mesh adaptation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.4 The Stokes problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.5 Computing the vorticity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.6 Computing the stream function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
56 Rheolef version 6.6 update 15 April 2014
5 Nearly incompressible elasticity and the stabilized Stokes problems 71
5.1 The incompressible elasticity problem . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.2 The P1b − P1 element for the Stokes problem . . . . . . . . . . . . . . . . . . . . . 73
5.3 Axisymmetric geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.4 The axisymmetric stream function and stress tensor . . . . . . . . . . . . . . . . . 79
6 Time-dependent problems 83
6.1 The heat equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
6.2 The convection-diffusion problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.3 The Navier-Stokes problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
III Advanced and highly nonlinear problems 101
7 Equation defined on a surface 103
7.1 Approximation on an explicit surface mesh . . . . . . . . . . . . . . . . . . . . . . 103
7.2 Building a surface mesh from a level set function . . . . . . . . . . . . . . . . . . . 112
7.3 The banded level set method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
7.4 A direct solver for the banded level set method . . . . . . . . . . . . . . . . . . . . 117
8 The highly nonlinear p-laplacian problem 123
8.1 Problem statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
8.2 The fixed-point algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
8.3 The Newton algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
8.4 The damped Newton algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
8.5 Error analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
IV Technical appendices 145
A How to write a variational formulation ? 147
A.1 The Green formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
A.2 The vectorial Green formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
A.3 The Green formula on a surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
B How to prepare a mesh ? 149
B.1 Bidimensional mesh with bamg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
B.2 Unidimensional mesh with gmsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
B.3 Bidimensional mesh with gmsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
B.4 Tridimensional mesh with gmsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
C Migrating to Rheolef version 6.0 155
C.1 What is new in Rheolef 6.0 ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
C.2 What should I have to change in my 5.x code ? . . . . . . . . . . . . . . . . . . . . 155
C.3 New features in Rheolef 6.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
D GNU Free Documentation License 159Rheolef version 6.6 update 15 April 2014 7
List of example files 168
List of commands 170
Index 1728 Rheolef version 6.6 update 15 April 2014
Notations
Rheolef mathematics description
d d ∈ {1, 2, 3} dimension of the physical space
dot(u,v) u.v =
X
d−1
i=0
uivi vector scalar product
ddot(sigma,tau) σ : τ =
X
d−1
i,j=0
σi,j τi,j tensor scalar product
tr(sigma) tr(σ) = X
d−1
i=0
σi,i trace of a tensor
trans(sigma) σ
T
tensor transposition
sqr(phi)
norm2(phi) φ
2
square of a scalar
norm2(u) |u|
2 =
X
d−1
i=0
u
2
i
square of the vector norm
norm2(sigma) |σ|
2 =
X
d−1
i,j=0
σ
2
i,j square of the tensor norm
abs(phi)
norm(phi) |φ| absolute value of a scalar
norm(u) |u| =
X
d−1
i=0
u
2
i
!1/2
vector norm
norm(sigma) |σ| =
X
d−1
i,j=0
σ
2
i,j
1/2
tensor norm
grad(phi) ∇φ =
∂φ
∂xi
06i 1.
Xh . block (" boundary ");
The homogeneous Dirichlet conditions are declared on the boundary.
trial u ( Xh ); test v ( Xh );
form a = integrate ( dot ( grad ( u ) , grad ( v )));
The bilinear form a(., .) is the energy form: it is defined for all functions u and v in Xh.
field lh = integrate ( v );
The linear form lh(.) is associated to the constant right-hand side f = 1 of the problem. It is
defined for all v in Xh.
field uh ( Xh );
The field uh contains the the degrees of freedom.
uh [" boundary "] = 0;
Some degrees of freedom are prescribed as zero on the boundary.
Let (ϕi)06i 3, a faster iterative strategy is automatically preferred by the solver class for solving
the linear system: in that case, the preliminary step build an incomplete Choleski factorization
preconditioner, while the second step runs an iterative method: the preconditioned conjugate
gradient algorithm. Finally, the field is printed to standard output:
dout << uh ;
The dout stream is a specific variable defined in the Rheolef library: it is a distributed and
parallel extension of the usual cout stream in C++
1.4 How to compile the code
First, create a file ‘Makefile’ as follow:
include $(shell rheolef-config --libdir)/rheolef/rheolef.mk
CXXFLAGS = $(INCLUDES_RHEOLEF) -I../malib
LDLIBS = $(LIBS_RHEOLEF)
default: dirichlet
Then, enter:
make dirichlet
Now, your program, linked with Rheolef, is ready to run on a mesh.Rheolef version 6.6 update 15 April 2014 19
1.5 How to run the program
Figure 1.1: Solution of the model problem for d = 2: (left) P1 element; (right) P2 element.
Enter the commands:
mkgeo_grid -t 10 > square.geo
geo square.geo
The first command generates a simple 10x10 bidimensional mesh of Ω =]0, 1[2 and stores it in the
file square.geo. The second command shows the mesh. It uses gnuplot visualization program
by default.
The next command performs the computation:
./dirichlet square.geo P1 > square.field
field square.field20 Rheolef version 6.6 update 15 April 2014
1.6 Stereo visualization
Figure 1.2: Alternative representations of the solution of the model problem (d = 2 and the P1
element): (left) in black-and-white; (right) in elevation and stereoscopic anaglyph mode.
Also explore some graphic rendering modes (see Fig. 1.2):
field square.field -bw
field square.field -gray
field square.field -paraview
field square.field -paraview -elevation -nofill -stereo
The last command shows the solution in elevation and in stereoscopic anaglyph mode (see Fig. 1.4,
left). The anaglyph mode requires red-cyan glasses: red for the left eye and cyan for the right one,
as shown on Fig. 1.3.
Figure 1.3: Red-cyan anaglyph glasses for the stereoscopic visualization.
In the book, stereo figures are indicated by the logo in the right margin. See http:
//en.wikipedia.org/wiki/Anaglyph_image for more and http://www.alpes-stereo.com/Rheolef version 6.6 update 15 April 2014 21
lunettes.html for how to find anaglyph red-cyan glasses. Please, consults the corresponding
unix manual page for more on field, geo and mkgeo_grid:
man mkgeo_grid
man geo
man field
1.7 High-order finite element methods
Turning to the P2 or P3 approximations simply writes:
./dirichlet square.geo P2 > square-P2.field
field square-P2.field
Fig. 1.1.right shows the result. You can replace the P2 command-line argument by any Pk, where
k > 1. Now, let us consider a mono-dimensional problem Ω =]0, 1[:
mkgeo_grid -e 10 > line.geo
geo line.geo
./dirichlet line.geo P1 | field -
The first command generates a subdivision containing ten edge elements. The last two lines show
the mesh and the solution via gnuplot visualization, respectively.
Conversely, the P2 case writes:
./dirichlet line.geo P2 | field -
1.8 Tridimensional computations
Let us consider a three-dimensional problem Ω =]0, 1[3
. First, let us generate a mesh:
mkgeo_grid -T 10 > cube.geo
geo cube.geo
geo cube.geo -paraview
geo cube.geo -paraview -fill
geo cube.geo -paraview -cut
geo cube.geo -paraview -shrink
geo cube.geo -paraview -shrink -cut
These commands present some cuts (-cut) inside the internal mesh structure: a simple click on
the central arrow draws the cut plane normal vector or its origin, while the red square allows a
translation. The following command draws the mesh with all internal edges (-full), together
with the stereoscopic anaglyph (-stereo).
geo cube.geo -paraview -stereo -full22 Rheolef version 6.6 update 15 April 2014
Figure 1.4: Solution of the model problem for d = 3 and the P1 element : (left) mesh; (right)
isovalue, cut planes and stereo anaglyph renderings.
Then, we perform the computation and the visualization:
./dirichlet cube.geo P1 > cube.field
field cube.field
The visualization presents an isosurface. Also here, you can interact with the cutting plane. On
the Properties of the paraview window, select Contour, change the value of the isosurface and
click on the green Apply button. Finally exit from the visualization and explore the stereoscopic
anaglyph mode (see Fig. 1.4, right):
field cube.field -stereo
It is also possible to add a second isosurface (Contour) or a cutting plane (Slice) to this scene
by using the corresponding Properties menu. Finally, the following command, with the -volume
option, allows a 3D color light volume graphical rendering:
field cube.field -volume
After this exploration of the 3D visualization capacities of our environment, let us go back to the
Dirichlet problem and perform the P2 approximation:
./dirichlet cube.geo P2 | field -
1.9 Quadrangles, prisms and hexahedra
Quadrangles and hexahedra are also supported in meshes:
mkgeo_grid -q 10 > square.geo
geo square.geo
mkgeo_grid -H 10 > cube.geo
geo cube.geoRheolef version 6.6 update 15 April 2014 23
Notices also that the one-dimensional exact solution writes:
u(x) = x(1 − x)
2
while the two-and three dimensional ones support a Fourier expansion (see e.g. [51], annex).
1.10 Direct versus iterative solvers
10−3
100
103
103 104 105 106 107
n
T(n)
d = 2
1
1.5
direct/factorize
direct/solve
iterative/solve
10−3
100
103
103 104 105 106
n
T(n)
d = 3 2
1.33
direct/factorize
direct/solve
iterative/solve
Figure 1.5: Compared performance between direct and iterative solvers: (left) d = 2; (right) d = 3.
In order to measure the performances of the solver, the dirichlet.cc (page 16) has been modified
as:
double t0 = dis_time ();
solver_option_type sopt ;
sopt . iterative = false ; // or true
sopt . tol = 1 -5; // when iterative
solver sa ( a . uu () , sopt );
Float t_factorize = dis_time () - t0 ;
uh . set_u () = sa . solve ( lh . u () - a. ub ()* uh . b ());
double t_solve = dis_time () - t_factorize ;
derr << " time " << t_factorize << " " << t_solve << endl ;
The dis_time function returns the synchronized clock in seconds, while the solver_option_type
enable to choose explicitly a direct or iterative solver method: by default Rheolef selects a direct
method when d = 2 and an iterative one when d = 3. For a large 3D mesh, the compilation and
run writes:
make dirichlet
mkgeo_grid -T 60 > cube-60.geo
./dirichlet cube-60.geo P1 > cube-60.field
Fig. 1.5 plots the performances of the direct and iterative solvers used in Rheolef. The computing
time T(n) is represented versus size n of the linear system, says Ax = b. Notice that for a
square-k.geo or cube-k.geo mesh, we have n = (k − 1)d
. For the direct method, two times
are represented: first, the time spend to factorize A = LDLT
, where L is lower triangular and
D is diagonal, and second, the time used to solve LDLT = x (in three steps: solving Lz = b,
then Dy = z and finally L
T x = y). For the iterative method, the conjugate gradient algorithm is
considered, without building any preconditionner, so there is nothing to initialize, and only one
time is represented. The tolerance on the residual term is set to 10−5
.24 Rheolef version 6.6 update 15 April 2014
In the bidimensional case, the iterative solver presents asymptotically, for large n, a computing
time similar to the factorization time of the direct solver, roughly O(n
3/2
) while the time to solve
by the direct method is dramatically lower, roughly O(n). As the factorization can be done one
time for all, the direct method is advantageous most of the time.
In the threedimensional case, the situation is different. The factorization time is very time consuming
roughly O(n
2
), while the time to solve for both direct and iterative methods behave as
O(n
4/3
). Thus, the iterative method is clearly advantageous for threedimensionnal problems.
Future works will improve the iterative approach by building preconditionners.
The asymptotic behaviors of direct methods strongly depends upon the ordering strategy used for
the factorization. For the direct solver, Rheolef was configured with the mumps [3, 4] library and
mumps was configured with the parallel scotch [40] ordering library. For a regular grid and in the
bidimensional case, there exists a specific ordering called nested disection [20, 26] that minimize
the fillin of the sparse matrix during the factorization. For threedimensional case this ordering is
called nested multi-section [6]. Asymptotic computing time for these regular grid are then explicity
known:
d direct/factorize direct/solve iterative
1 n n n
2
2 n
3/2 n log n n
3/2
3 n
2 n
4/3 n
4/3
The last column gives the asymptotic computing time for the conjugate gradient on a general
mesh [50]. Remark that these theoretical results are consistent with numerical experiments presented
on Fig. 1.5.
1.11 Distributed and parallel runs
For large meshes, a computation in a distributed and parallel environment is profitable:
mpirun -np 8 ./dirichlet cube-60.geo P1 > cube-60.field
mpirun -np 16 ./dirichlet cube-60.geo P1 > cube-60.field
The computing time T(n, p) depends now upon the linear system size n and the number of processes
p. For a fixed system n, the speedup S(p) when using p processors is defined by the ratio of the time
required by a sequential computation with the time used by a parallel one: S(p) = T(n, 1)/T(n, p).
The speedup is presented on Fig 1.6 for the two phases of the computation: the assembly phase
and the solve one, and for d = 2 (direct solver) and 3 (iterative solver). The ideal speedup
S(p) = p and the null speedup S(p) = 1 are represented by dotted lines. Observe on Fig 1.6
that for too small meshes, using too much processes is not profitable, as more time is spend by
communications rather by computations, especially for the solve phase. Conversely, when the
mesh size increases, using more processes leads to a remarkable speedup for both d = 2 and 3.
The largest mesh used here contains about three millions of elements. The speedup behavior is
roughly linear up to a critical number of processor denotes as pc. Then, there is a transition to a
plateau (the Amdahl’s law), where communications dominate. Notice that pc increases with the
mesh size: larger problems lead to a higher speedup. Also pc increases also with the efficiency of
communications.
Present computation times are measured on a BullX DLC supercomputer (Bull Newsca) composed
of nodes having two intel sandy-bridge processors and connected to a FDR infiniband non-blocking
low latency network. The assembly phase corresponds to dirichlet.cc (page 16) line 7 to 13
and the solve phase to lines 14 and 151
.
1
Input and output are poorly paralleliazed yet and the corresponding speedup is not presented here. Future
version of Rheolef will consider mpi_io.Rheolef version 6.6 update 15 April 2014 25
0
1
8
16
24
32
0 8 16 24 32
p
S(p)
assembly d = 2
square-40
square-80
square-160
square-320
square-640
square-1280
0
1
8
16
24
32
0 8 16 24 32
p
S(p)
assembly d = 3
cube-10
cube-20
cube-40
cube-60
0
1
8
16
24
32
0 8 16 24 32
p
S(p)
direct solve d = 2
square-40
square-80
square-160
square-320
square-640
square-1280
0
1
8
16
24
32
0 8 16 24 32
p
S(p)
direct solve d = 3
cube-10
cube-20
cube-40
cube-60
0
1
8
16
24
32
0 8 16 24 32
p
S(p)
iterative solve d = 2
square-40
square-80
square-160
square-320
square-640
square-1280
0
1
8
16
24
32
0 8 16 24 32
p
S(p)
iterative solve d = 3
cube-10
cube-20
cube-40
cube-60
Figure 1.6: Distributed and massively parallel resolution of the model problem with P1 element:
speedup S(p) versus the number of processors p during : (left-right) for d = 2 and 3, respectively
; (top) the assembly phase ; (center-bottom) the solve phase, direct and iterative solvers,
respectively.26 Rheolef version 6.6 update 15 April 2014Chapter 2
Standard boundary conditions
We show how to deal with various non-homogeneous boundary conditions of Dirichlet, Neuman
and Robin type.
2.1 Non-homogeneous Dirichlet conditions
Formulation
We turn now to the case of a non-homogeneous Dirichlet boundary conditions. Let f ∈ H−1
(Ω)
and g ∈ H
1
2 (∂Ω). The problem writes:
(P2) find u, defined in Ω such that:
−∆u = f in Ω
u = g on ∂Ω
The variational formulation of this problem expresses:
(V F2) find u ∈ V such that:
a(u, v) = l(v), ∀v ∈ V0
where
a(u, v) = Z
Ω
∇u.∇v dx
l(v) = Z
Ω
f v dx
V = {v ∈ H1
(Ω); v|∂Ω = g}
V0 = H1
0
(Ω)
Approximation
As usual, we introduce a mesh Th of Ω and the finite dimensional space Xh:
Xh = {v ∈ H1
(Ω); v/K ∈ Pk, ∀K ∈ Th}
Then, we introduce:
Vh = {v ∈ Xh; v|∂Ω = πh(g)}
V0,h = {v ∈ Xh; v|∂Ω = 0}
2728 Rheolef version 6.6 update 15 April 2014
where πh denotes the Lagrange interpolation operator. The approximate problem writes:
(V F2)h: find uh ∈ Vh such that:
a(uh, vh) = l(vh), ∀vh ∈ V0,h
The following C++ code implement this problem in the Rheolef environment.
Example file 2.1: dirichlet-nh.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " cosinusprod_laplace . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 size_t d = omega . dimension ();
9 space Xh ( omega , argv [2]);
10 Xh . block (" boundary ");
11 trial u ( Xh ); test v ( Xh );
12 form a = integrate ( dot ( grad ( u ) , grad ( v )));
13 field lh = integrate ( f (d )* v );
14 field uh ( Xh );
15 space Wh ( omega [" boundary "] , argv [2]);
16 uh [" boundary "] = interpolate ( Wh , g ( d ));
17 solver sa ( a . uu ());
18 uh . set_u () = sa . solve ( lh . u () - a . ub ()* uh . b ());
19 dout << uh ;
20 }
Let us choose Ω ⊂ R
d
, d = 1, 2, 3 with
f(x) = d π2
d
Y−1
i=0
cos(πxi) and g(x) =
d
Y−1
i=0
cos(πxi) (2.1)
Remarks the notation x = (x0, . . . , xd−1) for the Cartesian coordinates in R
d
: since all arrays
start at index zero in C++ codes, and in order to avoid any mistakes between the code and the
mathematical formulation, we also adopt this convention here. This choice of f and g is convenient,
since the exact solution is known:
u(x) =
d
Y−1
i=0
cos(πxi)
The following C++ code implement this problem by using the concept of function object, also
called class-function (see e.g. [34]). A convenient feature is the ability for function objects to store
auxiliary parameters, such as the space dimension d for f here, or some constants, as π for f and
g.
Example file 2.2: cosinusprod_laplace.icc
1 struct f : field_functor {
2 Float operator () ( const point & x ) const {
3 return d * pi * pi * cos ( pi * x [0])* cos ( pi * x [1])* cos ( pi * x [2]); }
4 f ( size_t d1 ) : d ( d1 ) , pi ( acos ( Float ( -1))) {}
5 size_t d ; const Float pi ;
6 };
7 struct g : field_functor {
8 Float operator () ( const point & x ) const {
9 return cos ( pi * x [0])* cos ( pi * x [1])* cos ( pi * x [2]); }
10 g ( size_t d1 ) : pi ( acos ( Float ( -1))) {}
11 const Float pi ;
12 };Rheolef version 6.6 update 15 April 2014 29
Comments
The class point describes the coordinates of a point (x0, . . . , xd−1) ∈ R
d as a d-uplet of Float.
The Float type is usually a double. This type depends upon the Rheolef configuration (see [48],
installation instructions), and could also represent some high precision floating point class. The
dirichlet-nh.cc code looks like the previous one dirichlet.cc related to homogeneous boundary
conditions. Let us comments the changes. The dimension d comes from the geometry Ω:
size_t d = omega . dimension ();
The linear form l(.) is associated to the right-hand side f and writes:
field lh = integrate ( f (d )* v );
Notice that the function object f is build with the dimension d as parameter. Notice also the use
of field_functor1
in the definition of the class f: this trick allows us to mixt functions, fields and
test-functions in the same expression, as f(d) ∗ v.
The space Wh of piecewise Pk functions defined on the boundary ∂Ω is defined by:
space Wh ( omega [" boundary "] , argv [2]);
where Pk is defined via the second command line argument argv[2]. This space is suitable for
the Lagrange interpolation of g on the boundary:
uh [" boundary "] = interpolate ( Wh , g( d ));
The values of the degrees of freedom related to the boundary are stored into the field uh.b, where
non-homogeneous Dirichlet conditions applies. The rest of the code is similar to the homogeneous
Dirichlet case.
2.1.1 How to run the program
First, compile the program:
make dirichlet-nh
Running the program is obtained from the homogeneous Dirichlet case, by replacing dirichlet
by dirichlet-nh:
mkgeo_grid -e 10 > line.geo
./dirichlet-nh line.geo P1 > line.field
field line.field
for the bidimensional case:
mkgeo_grid -t 10 > square.geo
./dirichlet-nh square.geo P1 > square.field
field square.field
and for the tridimensional case:
mkgeo_grid -T 10 > box.geo
./dirichlet-nh box.geo P1 > box.field
field box.field -volume
The optional -volume allows a 3D color light volume graphical rendering. Here, the P1 approximation
can be replaced by P2, P3, etc, by modifying the command-line argument.
1The actual implementation of a field_functor class bases on the curiously recurring template pattern (CRTP)
C++ idiom: the definition of the class f derives from field_functor that depend itself upon f. So,
be carrefull when using copy-paste, as there a no checks if you write e.g. field_functor with another
function g instead of f.30 Rheolef version 6.6 update 15 April 2014
2.1.2 Error analysis
Principle
Since the solution u is regular, the following error estimates holds:
ku − uhk0,2,Ω ≈ O(h
k+1)
ku − uhk0,∞,Ω ≈ O(h
k+1)
ku − uhk1,2,Ω ≈ O(h
k
)
providing the approximate solution uh uses Pk continuous finite element method, k > 1. Here,
k.k0,2,Ω, k.k0,∞,Ω and k.k1,2,Ω denotes as usual the L
2
(Ω), L∞(Ω) and H1
(Ω) norms.
By denoting πh the Lagrange interpolation operator, the triangular inequality leads to:
ku − uhk0,2,Ω 6 k(I − πh)(u)k0,2,Ω + kuh − πhuk0,2,Ω
From the fundamental properties of the Laplace interpolation πh, and since u is smooth enough,
we have k(I −πh)(u)k0,2,Ω ≈ O(h
k+1). Thus, we have just to check the kuh −πhuk0,2,Ω term. The
following code implement the computation of the error.
Example file 2.3: cosinusprod_error.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " cosinusprod . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 Float error_linf_expected = ( argc > 1) ? atof ( argv [1]) : 1 e +38;
8 field uh ; din >> uh ;
9 space Xh = uh . get_space ();
10 size_t d = Xh . get_geo (). dimension ();
11 field pi_h_u = interpolate ( Xh , u_exact ( d ));
12 field eh = uh - pi_h_u ;
13 trial u ( Xh ); test v ( Xh );
14 form m = integrate ( u * v );
15 form a = integrate ( dot ( grad ( u ) , grad ( v )));
16 dout << " error_l2 " << sqrt ( m ( eh , eh )) << endl
17 << " error_linf " << eh . max_abs () << endl
18 << " error_h1 " << sqrt ( a ( eh , eh )) << endl ;
19 return ( eh . max_abs () <= error_linf_expected ) ? 0 : 1;
20 }
Example file 2.4: cosinusprod.icc
1 struct u_exact : field_functor < u_exact ,Float > {
2 Float operator () ( const point & x ) const {
3 return cos ( pi * x [0])* cos ( pi * x [1])* cos ( pi * x [2]); }
4 u_exact ( size_t d1 ) : d ( d1 ) , pi ( acos ( Float ( -1.0))) {}
5 size_t d ; Float pi ;
6 };
The m(., .) is here the classical scalar product on L
2
(Ω), and is related to the mass form.
Running the program
make dirichlet-nh cosinusprod_error
After compilation, run the code by using the command:
mkgeo_grid -t 10 > square.geo
./dirichlet-nh square.geo P1 | ./cosinusprod_errorRheolef version 6.6 update 15 April 2014 31
10−10
10−8
10−6
10−4
10−2
10−2 10−1
h
kuh − πh(u)k0,2,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
10−10
10−8
10−6
10−4
10−2
10−2 10−1
h
kuh − πh(u)k0,∞,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
10−8
10−6
10−4
10−2
100
10−2 10−1
h
|uh − πh(u)|1,2,Ω
1 = k
2
3
k = 1
k = 2
k = 3
Figure 2.1: Strait geometry: error analysis in L
2
, L∞ and H1 norms.32 Rheolef version 6.6 update 15 April 2014
The three L
2
, L∞ and H1
errors are printed for a h = 1/10 uniform mesh. Note that an unstructured
quasi-uniform mesh can be simply generated by using the mkgeo_ugrid command:
mkgeo_ugrid -t 10 > square.geo
geo square.geo
Let nel denotes the number of elements in the mesh. Since the mesh is quasi-uniform, we have
h ≈ n
1
d
el where d is the physical space dimension. Here d = 2 for our bidimensional mesh. Figure 2.1
plots in logarithmic scale the error versus n
1
2
el for both Pk approximations, k = 1, 2, 3 and the
various norms. Observe that the error behaves as predicted by the theory.
Curved domains
The error analysis applies also for curved boundaries and high order approximations.
Example file 2.5: cosinusrad_laplace.icc
1 struct f : field_functor {
2 Float operator () ( const point & x ) const {
3 Float r = sqrt (sqr( x [0])+ sqr( x [1])+ sqr( x [2]));
4 Float sin_over_ar = ( r == 0) ? 1 : sin ( a * r )/( a * r );
5 return sqr( a )*(( d -1)* sin_over_ar + cos ( a * r )); }
6 f ( size_t d1 ) : d ( d1 ) , a ( acos ( Float ( -1.0))) {}
7 size_t d ; Float a ;
8 };
9 struct g : field_functor {
10 Float operator () ( const point & x ) const {
11 return cos ( a * sqrt (sqr( x [0])+ sqr( x [1])+ sqr( x [2]))); }
12 g ( size_t =0) : a ( acos ( Float ( -1.0))) {}
13 Float a ;
14 };
Example file 2.6: cosinusrad.icc
1 struct u_exact : field_functor < u_exact ,Float > {
2 Float operator () ( const point & x ) const {
3 Float r = sqrt (sqr( x [0])+ sqr( x [1])+ sqr( x [2]));
4 return cos ( a * r ); }
5 u_exact ( size_t =0) : a ( acos ( Float ( -1.0))) {}
6 Float a ;
7 };
First, generate the test source file and compile it:
sed -e ’s/sinusprod/sinusrad/’ < dirichlet-nh.cc > dirichlet_nh_ball.cc
sed -e ’s/sinusprod/sinusrad/’ < cosinusprod_error.cc > cosinusrad_error.cc
make dirichlet_nh_ball cosinusrad_error
Then, generates the mesh of a circle and run the test case:
mkgeo_ball -order 1 -t 10 > circle-P1.geo
geo circle-P1
./dirichlet_nh_ball circle-P1.geo P1 | ./cosinusrad_error
For a high order k = 3 isoparametric approximation:
mkgeo_ball -order 3 -t 10 > circle-P3.geo
geo circle-P3
./dirichlet_nh_ball circle-P3.geo P3 | ./cosinusrad_error
Observe Fig. 2.2: for meshes based on triangles: the error behave as expected when k = 1, 2, 3, 4.
A similar result occurs for quadrangles, as shown on Fig. 2.3.Rheolef version 6.6 update 15 April 2014 33
10−10
10−8
10−6
10−4
10−2
100
10−2 10−1
h
kuh − πh(u)k0,2,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
k = 4
10−10
10−8
10−6
10−4
10−2
100
10−2 10−1
h
kuh − πh(u)k0,∞,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
k = 4
10−8
10−6
10−4
10−2
100
10−2 10−1
h
|uh − πh(u)|1,2,Ω
1 = k
2
3
k = 1
k = 2
k = 3
k = 4
Figure 2.2: Curved domains (triangles): error analysis in L
2
, L∞ and H1 norms.34 Rheolef version 6.6 update 15 April 2014
10−10
10−8
10−6
10−4
10−2
10−2 10−1
h
kuh − πh(u)k0,2,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
k = 4
10−10
10−8
10−6
10−4
10−2
100
10−2 10−1
h
kuh − πh(u)k0,∞,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
k = 4
10−8
10−6
10−4
10−2
10−2 10−1
h
|uh − πh(u)|1,2,Ω
1 = k
2
3
k = 1
k = 2
k = 3
k = 4
Figure 2.3: Curved domains (quadrangles): error analysis in L
2
, L∞ and H1 norms.Rheolef version 6.6 update 15 April 2014 35
mkgeo_ball -order 3 -q 10 > circle-q-P3.geo
geo circle-q-P3
./dirichlet_nh_ball circle-q-P3.geo P3 | ./cosinusrad_error
These features are currently in development for arbitrarily Pk high order approximations and
three-dimensional geometries.
2.2 Non-homogeneous Neumann boundary conditions for
the Helmholtz operator
Formulation
Let us show how to insert Neumann boundary conditions. Let f ∈ H−1
(Ω) and g ∈ H− 1
2 (∂Ω).
The problem writes:
(P3): find u, defined in Ω such that:
u − ∆u = f in Ω
∂u
∂n = g on ∂Ω
The variational formulation of this problem expresses:
(V F3): find u ∈ H1
(Ω) such that:
a(u, v) = l(v), ∀v ∈ H1
(Ω)
where
a(u, v) = Z
Ω
(u v + ∇u.∇v) dx
l(v) = Z
Ω
f v dx +
Z
∂Ω
g v ds36 Rheolef version 6.6 update 15 April 2014
Approximation
As usual, we introduce a mesh Th of Ω and the finite dimensional space Xh:
Xh = {v ∈ H1
(Ω); v/K ∈ Pk, ∀K ∈ Th}
The approximate problem writes:
(V F3)h: find uh ∈ Xh such that:
a(uh, vh) = l(vh), ∀vh ∈ Xh
Example file 2.7: neumann-nh.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " sinusprod_helmholtz . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 size_t d = omega . dimension ();
9 space Xh ( omega , argv [2]);
10 trial u ( Xh ); test v ( Xh );
11 form a = integrate ( u * v + dot ( grad ( u ) , grad ( v )));
12 field lh = integrate ( f (d )* v ) + integrate (" boundary ", g (d )* v );
13 field uh ( Xh );
14 solver sa ( a . uu ());
15 uh . set_u () = sa . solve ( lh . u () - a . ub ()* uh . b ());
16 dout << uh ;
17 }
Let us choose Ω ⊂ R
d
, d = 1, 2, 3 and
f(x) = (1 + dπ2
)
d
Y−1
i=0
sin(πxi)
g(x) =
−π when d = 1
−π
X
d−1
i=0
sin(πxi)
!
when d = 2
−π
X
d−1
i=0
sin(πxi) sin(x(i+1)mod d
!
when d = 3
This example is convenient, since the exact solution is known:
u(x) =
d
Y−1
i=0
sin(πxi) (2.2)Rheolef version 6.6 update 15 April 2014 37
Example file 2.8: sinusprod_helmholtz.icc
1 struct f : field_functor {
2 Float operator () ( const point & x ) const {
3 switch ( d ) {
4 case 1: return (1+ d * pi * pi )* sin ( pi * x [0]);
5 case 2: return (1+ d * pi * pi )* sin ( pi * x [0])* sin ( pi * x [1]);
6 default : return (1+ d * pi * pi )* sin ( pi * x [0])* sin ( pi * x [1])* sin ( pi * x [2]);
7 }}
8 f ( size_t d1 ) : d ( d1 ) , pi ( acos ( Float ( -1.0))) {}
9 size_t d ; const Float pi ;
10 };
11 struct g : field_functor {
12 Float operator () ( const point & x ) const {
13 switch ( d ) {
14 case 1: return - pi ;
15 case 2: return - pi *( sin ( pi * x [0]) + sin ( pi * x [1]));
16 default : return - pi *( sin ( pi * x [0])* sin ( pi * x [1])
17 + sin ( pi * x [1])* sin ( pi * x [2])
18 + sin ( pi * x [2])* sin ( pi * x [0]));
19 }}
20 g ( size_t d1 ) : d ( d1 ) , pi ( acos ( Float ( -1.0))) {}
21 size_t d ; const Float pi ;
22 };
Comments
The neumann-nh.cc code looks like the previous one dirichlet-nh.cc. Let us comments only
the changes.
form a = integrate ( u * v + dot ( grad ( u ) , grad ( v )));
The bilinear form a(., .) is defined. Notes the flexibility of the integrate function that takes as
argument an expression involving the trial and test functions. The right-hand side is computed
as:
field lh = integrate ( f (d )* v ) + integrate (" boundary ", g (d )* v );
The second integration is perfomed on ∂Ω. The additional first argument of the integrate
function is here the name of the integration domain.
2.2.1 How to run the program
First, compile the program:
make neumann-nh
Running the program is obtained from the homogeneous Dirichlet case, by replacing dirichlet
by neumann-nh.
2.3 The Robin boundary conditions
Formulation
Let f ∈ H−1
(Ω) and Let g ∈ H
1
2 (∂Ω). The problem writes:
(P4) find u, defined in Ω such that:
−∆u = f in Ω
∂u
∂n + u = g on ∂Ω38 Rheolef version 6.6 update 15 April 2014
The variational formulation of this problem expresses:
(V F4): find u ∈ H1
(Ω) such that:
a(u, v) = l(v), ∀v ∈ H1
(Ω)
where
a(u, v) = Z
Ω
∇u.∇v dx +
Z
∂Ω
uv ds
l(v) = Z
Ω
uv dx +
Z
∂Ω
gv ds
Approximation
As usual, let
Xh = {v ∈ H1
(Ω); v/K ∈ Pk, ∀K ∈ Th}
The approximate problem writes:
(V F4)h: find uh ∈ Xh such that:
a(uh, vh) = l(vh), ∀vh ∈ Xh
Example file 2.9: robin.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " cosinusprod_laplace . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 size_t d = omega . dimension ();
9 space Xh ( omega , argv [2]);
10 trial u ( Xh ); test v ( Xh );
11 form a = integrate ( dot ( grad ( u ) , grad ( v ))) + integrate (" boundary ", u * v );
12 field lh = integrate ( f (d )* v ) + integrate (" boundary ", g (d )* v );
13 field uh ( Xh );
14 solver sa ( a . uu ());
15 uh . set_u () = sa . solve ( lh . u () - a . ub ()* uh . b ());
16 dout << uh ;
17 }
Comments
The code robin.cc looks like the previous one neumann-nh.cc. Let us comments the changes.
form a = integrate ( dot ( grad ( u ) , grad ( v ))) + integrate (" boundary ", u * v );
This statement reflects directly the definition of the bilinear form a(., .), as the sum of two integrals,
the first one over Ω and the second one over its boundary.
2.3.1 How to run the program
First, compile the program:
make robin
Running the program is obtained from the homogeneous Dirichlet case, by replacing dirichlet
by robin.Rheolef version 6.6 update 15 April 2014 39
2.4 Neumann boundary conditions for the Laplace operator
In this chapter we study how to solve a ill-posed problem with a solution defined up to a constant.
Formulation
Let Ω be a bounded open and simply connected subset of R
d
, d = 1, 2 or 3. Let f ∈ L
2
(Ω) and
g ∈ H
1
2 (∂Ω) satisfying the following compatibility condition:
Z
Ω
f dx +
Z
∂Ω
g ds = 0
The problem writes:
(P5)h: find u, defined in Ω such that:
−∆u = f in Ω
∂u
∂n = g on ∂Ω
Since this problem only involves the derivatives of u, it is clear that its solution is never unique [23,
p. 11]. A discrete version of this problem could be solved iteratively by the conjugate gradient
or the MINRES algorithm [39]. In order to solve it by a direct method, we turn the difficulty by
seeking u in the following space
V = {v ∈ H1
(Ω); b(v, 1) = 0}
where
b(v, µ) = Z
Ω
v dx, ∀v ∈ L
2
(Ω), ∀µ ∈ R
The variational formulation of this problem writes:
(V F5): find u ∈ V such that:
a(u, v) = l(v), ∀v ∈ V
where
a(u, v) = Z
Ω
∇u.∇v dx
l(v) = m(f, v) + mb(g, v)
m(f, v) = Z
Ω
fv dx
mb(g, v) = Z
∂Ω
gv ds
Since the direct discretization of the space V is not an obvious task, the constraint b(u, 1) = 0
is enforced by a Lagrange multiplier λ ∈ R. Let us introduce the Lagrangian, defined for all
v ∈ H1
(Ω) and µ ∈ R by:
L(v, µ) = 1
2
a(v, v) + b(v, µ) − l(v)
The saddle point (u, λ) ∈ H1
(Ω) × R of this Lagrangian is characterized as the unique solution of:
a(u, v) + b(v, λ) = l(v), ∀v ∈ H1
(Ω)
b(u, µ) = 0, ∀µ ∈ R
It is clear that if (u, λ) is solution of this problem, then u ∈ V and u is a solution of (V F5).
Conversely, let u ∈ V the solution of (V F5). Choosing v = v0 where v0(x) = 1, ∀x ∈ Ω leads to
λ meas(Ω) = l(v0). From the definition of l(.) and the compatibility condition between the data f
and g, we get λ = 0. Notice that the saddle point problem extends to the case when f and g does
not satisfies the compatibility condition, and in that case λ = l(v0)/meas(Ω).40 Rheolef version 6.6 update 15 April 2014
Approximation
As usual, we introduce a mesh Th of Ω and the finite dimensional space Xh:
Xh = {v ∈ H1
(Ω); v/K ∈ Pk, ∀K ∈ Th}
The approximate problem writes:
(V F5)h: find (uh, λh) ∈ Xh × R such that:
a(uh, v) + b(v, λh) = lh(v), ∀v ∈ Xh
b(uh, µ) = 0, ∀µ ∈ R
where
lh(v) = m(Πhf, vh) + mb(πhg, vh)
Example file 2.10: neumann-laplace.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 size_t d ;
5 Float f ( const point & x ) { return 1; }
6 Float g ( const point & x ) { return -0.5/ d ; }
7 int main (int argc , char ** argv ) {
8 environment rheolef ( argc , argv );
9 geo omega ( argv [1]);
10 d = omega . dimension ();
11 space Xh ( omega , argv [2]);
12 trial u ( Xh ); test v ( Xh );
13 form m = integrate ( u * v );
14 form a = integrate ( dot ( grad ( u ) , grad ( v )));
15 field b = m * field ( Xh ,1);
16 field lh = integrate ( f *v ) + integrate (" boundary ", g * v );
17 csr A = {{ a . uu () , b . u ()} ,
18 { trans ( b . u ()) , 0 }};
19 vec B = { lh . u () , 0 };
20 A . set_symmetry ( true );
21 solver sa = ldlt ( A );
22 vec U = sa . solve ( B );
23 field uh ( Xh );
24 uh . set_u () = U [ range (0 , uh . u (). size ())];
25 Float lambda = ( U . size () == uh . u (). size ()+1) ? U [ uh . u (). size ()] : 0;
26 # ifdef _RHEOLEF_HAVE_MPI
27 mpi :: broadcast ( U . comm () , lambda , U . comm (). size () - 1);
28 # endif // _RHEOLEF_HAVE_MPI
29 dout << uh
30 << " lambda " << lambda << endl ;
31 }
Comments
Let Ω ⊂ R
d
, d = 1, 2, 3. We choose f(x) = 1 and g(x) = −1/(2d). This example is convenient,
since the exact solution is known:
u(x) = −
1
12
+
1
2d
X
d
i=1
xi(1 − xi)
The code looks like the previous ones. Let us comment the changes. The discrete bilinear form b
is computed as bh ∈ Xh that interprets as a linear application from Xh to R: bh(vh) = m(vh, 1).
Thus bh is computed as
field b = m * field ( Xh ,1.0);Rheolef version 6.6 update 15 April 2014 41
where the discrete bilinear form m is identified to its matrix and field(Xh,1.0) is the constant
vector equal to 1. Let
A =
a.uu trans(b.u)
b.u 0
, U =
uh.u
lambda
, B =
lh.u
0
The problem admits the following matrix form:
A U = B
The matrix and right-hand side of the system are assembled by concatenation:
csr A = {{ a . uu , b . u } ,
{ trans ( b . u ) , 0 }};
vec B = { lh .u , 0 };
where csr and vec are respectively the matrix and vector classes. The csr is the abbreviation of
compressed sparse row, a sparse matrix compression standard format. Notice that the matrix A is
symmetric and non-singular, but indefinite : it admits eigenvalues that are either strictly positive
or strictly negative. While the Choleski factorization is not possible, its variant the LDLT one is
performed, thanks to the ldlt function:
solver sa = ldlt ( A );
Then, the uh.u vector is extracted from the U one:
uh . u = U [ range (0 , uh . u . size ())];
The extraction of lambda from U is more technical in a distributed environment. In a sequential
one, since it is stored after the uh.u values, it could be simply written as:
Float lambda = U [ uh . u . size ()];
In a distributed environment, lambda is stored in U on the last processor, identified by
U.comm().size()-1. Here U.comm() denotes the communicator, from the boost::mpi library
and U.comm().size() is the number of processors in use, e.g. as specified by the mpirun command.
On this last processor, the array U has size equal to uh.u.size()+1 and lambda is stored
in U[uh.u.size()]. On the others processors, the array U has size equal to uh.u.size() and
lambda is not available. The following statement extract lambda on the last processor and set it
to zero on the others:
Float lambda = ( U . size () == uh . u . size ()+1) ? U [ uh . u . size ()] : 0;
Then, the value of lambda is broadcasted on the others processors:
mpi :: broadcast ( U . comm () , lambda , U . comm (). size () - 1);
The preprocessing guards #idef. . .#endif assure that this example compile also when the library
is not installed with the MPI support. Finally, the statement
dout << catchmark (" u ") << uh
<< catchmark (" lambda ") << lambda << endl ;
writes the solution (uh, λ). The catchmark function writes marks together with the solution in
the output stream. These marks are suitable for a future reading with the same format, as:
din >> catchmark (" u") >> uh
>> catchmark (" lambda ") >> lambda ;
This is useful for post-treatment, visualization and error analysis.
2.4.1 How to run the program
As usual, enter:
make neumann-laplace
mkgeo_grid -t 10 > square.geo
./neumann-laplace square P1 | field -42 Rheolef version 6.6 update 15 April 2014Chapter 3
Non-constant coefficients and
multi-regions
This chapter is related to the so-called transmission problem. We introduce some new concepts:
problems with non-constant coefficients, regions in the mesh, weighted forms and discontinuous
approximations.
Formulation
Let us consider a diffusion problem with a non-constant diffusion coefficient η in a domain bounded
Ω ⊂ R
d
, d = 1, 2, 3:
(P): find u defined in Ω such that:
−div(η∇u) = f in Ω (3.1)
u = 0 on Γleft ∪ Γright (3.2)
∂u
∂n = 0 on Γtop ∪ Γbottom when d > 2 (3.3)
∂u
∂n = 0 on Γfront ∪ Γback when d = 3 (3.4)
where f is a given source term.
4344 Rheolef version 6.6 update 15 April 2014
west
east
bottom
right
top
left
Figure 3.1: Transmission problem: the domain Ω partition: (Ωwest and Ωeast).
We consider here the important special case when η is piecewise constant:
η(x) =
ε when x ∈ Ωwest
1 when x ∈ Ωeast
where (Ωwest, Ωeast) is a partition of Ω in two parts (see Fig. 3.1). This is the so-called transmission
problem: the solution and the flux are continuous on the interface Γ0 = ∂Ωeast ∩ ∂Ωwest
between the two domains where the problem reduce to a constant diffusion one:
uΩwest = uΩeast on Γ0
ε
∂u/Ωwest
∂n =
∂uΩeast
∂n on Γ0
It expresses the transmission of the quantity u and its flux across the interface Γ0 between two
regions that have different diffusion properties: Notice that the more classical problem, with
constant diffusion η on Ω is obtained by simply choosing when ε = 1.
The variational formulation of this problem expresses:
(V F): find u ∈ V such that:
a(u, v) = l(v), ∀v ∈ V
where the bilinear forms a(., .) and the linear one l(.) are defined by
a(u, v) = Z
Ω
η ∇u.∇v dx, ∀u, v ∈ H1
(Ω)
l(v) = Z
Ω
f v dx, ∀v ∈ L
2
(Ω)
V = {v ∈ H1
(Ω); v = 0 on Γleft ∪ Γright}
The bilinear form a(., .) defines a scalar product in V and is related to the energy form. This form
is associated to the −div η∇ operator.
The approximation of this problem could performed by a standard Lagrange Pk continuous approximation.Rheolef
version 6.6 update 15 April 2014 45
Example file 3.1: transmission.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 int main (int argc , char ** argv ) {
5 environment rheolef ( argc , argv );
6 const Float epsilon = 0.01;
7 geo omega ( argv [1]);
8 space Xh ( omega , argv [2]);
9 Xh . block (" left ");
10 Xh . block (" right ");
11 string eta_approx = " P " + itos ( Xh . degree () -1) + " d ";
12 space Qh ( omega , eta_approx );
13 field eta_h ( Qh );
14 eta_h [" east "] = 1;
15 eta_h [" west "] = epsilon ;
16 trial u ( Xh ); test v ( Xh );
17 form a = integrate ( eta_h * dot ( grad ( u ) , grad ( v )));
18 field lh = integrate ( v );
19 field uh ( Xh );
20 uh [" left "] = uh [" right "] = 0;
21 solver sa ( a . uu ());
22 uh . set_u () = sa . solve ( lh . u () - a . ub ()* uh . b ());
23 dout << catchmark (" epsilon ") << epsilon << endl
24 << catchmark (" u ") << uh ;
25 }
Comments
This file is quite similar to those studied in the first chapters of this book. Let us comment only
the changes. The Dirichlet boundary condition applies no more on the whole boundary ∂Ω but
on two parts Γleft and Γright. On the other boundary parts, an homogeneous Neumann boundary
condition is used: since these conditions does not produce any additional terms in the variational
formulation, there are also nothing to write in the C++ code for these boundaries. We choose
f = 1: this leads to a convenient test-problem, since the exact solution is known when Ω =]0, 1[d
:
u(x) =
x0
2ε
1 + 3ε
2(1 + ε)
− x0
when x0 < 1/2
1 − x0
2
x0 +
1 − ε
2(1 + ε)
otherwise
The field η belongs to a discontinuous finite element Pk−1 space denoted by Qh:
string eta_approx = " P " + itos ( Xh . degree () -1) + " d ";
space Qh ( omega , eta_approx );
field eta ( Qh );
For instance, when argv[2] contains "P2", i.e. k = 2, then the string eta_approx takes value
"P1d". Then η is initialized by:
eta [" east "] = 1;
eta [" weast "] = epsilon ;
The energy form a is then constructed with η as additional parameter that acts as a integration
weight:
form a = integrate ( eta_h * dot ( grad ( u ) , grad ( v )));
Such forms with a additional weight function are called weighted forms in Rheolef.46 Rheolef version 6.6 update 15 April 2014
How to run the program ?
Build the program as usual: make transmission. Then, creates a one-dimensional geometry with
two regions:
mkgeo_grid -e 100 -region > line.geo
geo line.geo
The trivial mesh generator mkgeo_grid, defines two regions east and west when used with the
-region option. This correspond to the situation:
Ω = [0, 1]d
, Ωwest = Ω ∩ {x0 < 1/2} and Ωeast = Ω ∩ {x0 > 1/2}.
In order to avoid mistakes with the C++ style indexes, we denote by (x0, . . . , xd−1) the Cartesian
coordinate system in R
d
.
Finally, run the program and look at the solution:
make transmission
./transmission line.geo P1 > line.field
field line.field
Since the exact solution is a piecewise second order polynomial and the change in the diffusion
coefficient value fits the element boundaries, we obtain the exact solution for all the degrees of
freedom of any Pk approximation, k > 1, as shown on Fig. 3.2 when k = 1. Moreover, when k > 2
then uh = u since Xh contains the exact solution u.
0
1
2
3
0 0.25 0.5 0.75 1
exact
h = 1/6
h = 1/10
h = 1/14
Figure 3.2: Transmission problem: uh = πh(u) (ε = 10−2
, d = 1, P1 approximation).
The two dimensional case corresponds to the commands:
mkgeo_grid -t 10 -region > square.geo
geo square.geo
./transmission square.geo P1 > square.field
field square.field -elevationRheolef version 6.6 update 15 April 2014 47
while the tridimensional to
mkgeo_grid -T 10 -region > cube.geo
./transmission cube.geo P1 > cube.mfield
field cube.field
As for all the others examples, you can replace P1 by higher-order approximations, change elements
shapes, such as q, H or P, and run distributed computations computations with mpirun.48 Rheolef version 6.6 update 15 April 2014Part II
Fluids and solids computations
49Chapter 4
The linear elasticity and the Stokes
problems
4.1 The linear elasticity problem
Formulation
The total Cauchy stress tensor expresses:
σ(u) = λ div(u).I + 2µD(u) (4.1)
where λ and µ are the Lamé coefficients. Here, D(u) denotes the symmetric part of the gradient
operator and div is the divergence operator. Let us consider the elasticity problem for the
embankment, in Ω =]0, 1[d
, d = 2, 3. The problem writes:
(P): find u = (u0, . . . , ud−1), defined in Ω, such that:
− div σ(u) = f in Ω,
∂u
∂n
= 0 on Γtop ∪ Γright
u = 0 on Γleft ∪ Γbottom,
u = 0 on Γfront ∪ Γback, when d = 3
(4.2)
where f = (0, −1) when d = 2 and f = (0, 0, −1) when d = 3. The Lamé coefficients are assumed
to satisfy µ > 0 and λ + µ > 0. Since the problem is linear, we can suppose that µ = 1 without
any loss of generality.
5152 Rheolef version 6.6 update 15 April 2014
x2
x1
left right
bottom
top
front
x1
bottom x0
left right
top
x0
back
Figure 4.1: The boundary domains for the square and the cube.
recall that, in order to avoid mistakes with the C++ style indexes, we denote by (x0, . . . , xd−1) the
Cartesian coordinate system in
mathbbRd
.
For d = 2 we define the boundaries:
Γleft = {0}×]0, 1[, Γright = {1}×]0, 1[
Γbottom = ]0, 1[×{0}, Γtop = ]0, 1[×{1}
and for d = 3:
Γback = {0}×]0, 1[2
, Γfront = {1}×]0, 1[2
Γleft = ]0, 1[×{0}×]0, 1[, Γright = ]0, 1[×{1}×]0, 1[
Γbottom = ]0, 1[2×{0}, Γtop = ]0, 1[2×{1}
These boundaries are represented on Fig. 4.1.
The variational formulation of this problem expresses:
(V F): find u ∈ V such that:
a(u, v) = l(v), ∀v ∈ V, (4.3)
where
a(u, v) = Z
Ω
(λdiv u div v + 2D(u) : D(v)) dx,
l(v) = Z
Ω
f.v dx,
V = {v ∈ (H1
(Ω))2
; v = 0 on Γleft ∪ Γbottom}, when d = 2
V = {v ∈ (H1
(Ω))3
; v = 0 on Γleft ∪ Γbottom ∪ Γright ∪ Γback}, when d = 3
Approximation
We introduce a mesh Th of Ω and for k > 1, the following finite dimensional spaces:
Xh = {vh ∈ (H1
(Ω))d
; vh/K ∈ (Pk)
d
, ∀K ∈ Th},
Vh = Xh ∩ V
The approximate problem writes:
(V F)h: find uh ∈ Vh such that:
a(uh, vh) = l(vh), ∀vh ∈ VhRheolef version 6.6 update 15 April 2014 53
Example file 4.1: embankment.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " embankment . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 space Xh = embankment_space ( omega , argv [2]);
9 Float lambda = ( argc > 3) ? atof ( argv [3]) : 1;
10 size_t d = omega . dimension ();
11 point f (0 ,0 ,0);
12 f [d -1] = -1;
13 trial u ( Xh ); test v ( Xh );
14 form a = integrate ( lambda *div( u )* div( v ) + 2* ddot (D( u ) ,D( v )));
15 field lh = integrate ( dot (f , v ));
16 solver sa ( a . uu ());
17 field uh ( Xh , 0);
18 uh . set_u () = sa . solve ( lh . u () - a . ub ()* uh . b ());
19 dout << catchmark (" inv_lambda ") << 1/ lambda << endl
20 << catchmark (" u ") << uh ;
21 }
Example file 4.2: embankment.icc
1 space embankment_space ( const geo& omega , string approx ) {
2 space Xh ( omega , approx , " vector ");
3 Xh . block (" left ");
4 if ( omega . dimension () >= 2)
5 Xh . block (" bottom ");
6 if ( omega . dimension () == 3) {
7 Xh . block (" right ");
8 Xh . block (" back ");
9 }
10 return Xh ;
11 }
Comments
The space is defined in a separate file ‘embankment.icc’, since it will be reused in others examples
along this chapter:
space Vh ( omega , " P2 ", " vector ");
Note here the multi-component specification "vector" as a supplementary argument to the space
constructor. The boundary condition contain a special cases for bi- and tridimensional cases. The
right-hand-side fh represents the dimensionless gravity forces, oriented on the vertical axis: the
last component of fh is set to −1 as:
fh [d -1] = -1;
The code for the bilinear form a(., .) and the linear one l(.) are closed to their mathematical
definitions:
form a = integrate ( lambda *div( u )* div( v ) + 2* ddot (D( u ) ,D( v )));
field lh = integrate ( dot (f , v ));
Finally, the 1/λ parameter and the multi-field result are printed, using mark labels, thanks to the
catchmark stream manipulator. Labels are convenient for post-processing purpose, as we will see
in the next paragraph.54 Rheolef version 6.6 update 15 April 2014
How to run the program
Figure 4.2: The linear elasticity for λ = 1 and d = 2 and d = 3: both wireframe and filled surfaces
; stereoscopic anaglyph mode for 3D solutions.
Compile the program as usual (see page 18):
make embankment
and enter the commands:
mkgeo_grid -t 10 > square.geo
geo square.geo
The triangular mesh has four boundary domains, named left, right, top and bottom. Then,
enter:
./embankment square.geo P1 > square-P1.fieldRheolef version 6.6 update 15 April 2014 55
The previous command solves the problem for the corresponding mesh and writes the multicomponent
solution in the ‘.field’ file format. Run the deformation vector field visualization
using the default gnuplot render:
field square-P1.field
field square-P1.field -nofill
Note the graphic options usage ; the unix manual for the field command is available as:
man field
The view is shown on Fig. 4.2. A specific field component can be also selected for a scalar
visualization:
field -comp 0 square-P1.field
field -comp 1 square-P1.field
Next, perform a P2 approximation of the solution:
./embankment square.geo P2 > square-P2.field
field square-P2.field -paraview -nofill
Finally, let us consider the three dimensional case
mkgeo_grid -T 10 > cube.geo
./embankment cube.geo P1 > cube-P1.field
field cube-P1.field -stereo
field cube-P1.field -stereo -fill
The two last commands show the solution in 3D stereoscopic anaglyph mode. The graphic is
represented on Fig. 4.2. The P2 approximation writes:
./embankment cube.geo P2 > cube-P2.field
field cube-P2.field
4.2 Computing the stress tensor
Formulation and approximation
The following code computes the total Cauchy stress tensor, reading the Lamé coefficient λ and
the deformation field uh from a ‘.field’ file. Let us introduce:
Th = {τh ∈ (L
2
(Ω))d×d
; τh = τ
T
h and τh;ij/K ∈ Pk−1, ∀K ∈ Th, 1 6 i, j 6 d}
This computation expresses:
find σh such that:
m(σh, τ ) = b(τ, uh), ∀τ ∈ Th
where
m(σ, τ ) = Z
Ω
σ : τ dx,
b(τ, u) = Z
Ω
(2D(u) : τ dx + λdiv(u) tr(τ )) dx,
where tr(τ ) = Pd
i=1 τii is the trace of the tensor τ .56 Rheolef version 6.6 update 15 April 2014
Example file 4.3: stress.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 int main (int argc , char ** argv ) {
5 environment rheolef ( argc , argv );
6 Float inv_lambda ;
7 field uh ;
8 din >> catchmark (" inv_lambda ") >> inv_lambda
9 >> catchmark (" u ") >> uh ;
10 const geo & omega = uh . get_geo ();
11 const space & Xh = uh . get_space ();
12 string grad_approx = " P " + itos ( Xh . degree () -1) + " d ";
13 space Th ( omega , grad_approx , " tensor ");
14 size_t d = omega . dimension ();
15 tensor I = tensor :: eye ( d );
16 field sigma_h = ( inv_lambda == 0) ?
17 interpolate ( Th , 2*D( uh )) :
18 interpolate ( Th , 2*D( uh ) + (1/ inv_lambda )* div ( uh )* I );
19 dout << catchmark (" s ") << sigma_h ;
20 }
Comments
In order to our code stress.cc to apply also for the forthcomming incompressible case λ = +∞,
the Lamé coefficient is introduced as 1/λ. Its value is zero in the incompressible case. By this
way, the previous code applies for any deformation field, and is not restricted to our embankment
problem. The stress tensor is obtained by a direct interpolation of the uh first derivatives. As
uh is continuous and piecewise polynomial Pk, its derivatives are also piecewise polynomials with
degree k − 1, but discontinuous at inter-element boundaries : this approximation is denoted as
Pk−1,d. Thus, the stress tensor belongs to the space Th with the Pk−1,d element.
How to run the program
Figure 4.3: The stress tensor visualization (linear elasticity λ = 1).
First, compile the program:
make stressRheolef version 6.6 update 15 April 2014 57
The visualization for the stress tensor as ellipses writes:
./stress < square-P1.field > square-stress-P1.field
./stress < square-P2.field > square-stress-P2.field
field square-stress-P1.field -paraview
field square-stress-P2.field -paraview
The visualization based on paraview requires the TensorGlyph plugin1
If this plugin is not available
on our installation, turns to the mayavi render:
field square-stress-P1.field -proj -mayavi
field square-stress-P2.field -proj -mayavi
Recall that the stress, as a derivative of the deformation, is P0 (resp. P1d) and discontinuous when
the deformation is P1 (resp. P2) and continuous. The approximate stress tensor field is projected
on a continuous piecewise linear space, using the -proj option. Conversely, the 3D visualization
bases on ellipsoids:
./stress < cube-P1.field > cube-stress-P1.field
field cube-stress-P1.field -stereo
Also, if the TensorGlyph plugin is not available in your paraview installation, and the -mayavi
option in the previous command.
1 http://paraview.org/Wiki/ParaView/User_Created_Plugins The tensor glyph paraview plugin is still not
part of the paraview distribution and its installation requires a compilation from paraview source code.58 Rheolef version 6.6 update 15 April 2014
Figure 4.4: The σ01 stress component (linear elasticity λ = 1): d = 2 (top) and d = 3 (bottom) ;
P0 (left) and P1 discontinuous approximation (right).
You can observe a discontinuous constant or piecewise linear representation of the approximate
stress component σ01 (see Fig. 4.4):
field square-stress-P1.field -comp 01
field square-stress-P2.field -comp 01 -elevation
field square-stress-P2.field -comp 01 -elevation -stereo
Notice that the -stereo implies the -paraview one: this feature available with paraview and
mayavi renders. The approximate stress field can be also projected on a continuous piecewise
space:
field square-stress-P2.field -comp 01 -elevation -proj
The tridimensional case writes simply (see Fig. 4.4):
./stress < cube-P1.field > cube-stress-P1.field
./stress < cube-P2.field > cube-stress-P2.field
field cube-stress-P1.field -comp 01 -stereo
field cube-stress-P2.field -comp 01 -stereoRheolef version 6.6 update 15 April 2014 59
and also the P1-projected versions write:
field cube-stress-P1.field -comp 01 -stereo -proj
field cube-stress-P2.field -comp 01 -stereo -proj
These operations can be repeated for each σij components and for both P1 and P2 approximation
of the deformation field.
4.3 Mesh adaptation
The main principle of the auto-adaptive mesh writes [9, 13, 25, 45, 56]:
cin >> omega;
uh = solve(omega);
for (unsigned int i = 0; i < n; i++) {
ch = criterion(uh);
omega = adapt(ch);
uh = solve(omega);
}
The initial mesh is used to compute a first solution. The adaptive loop compute an adaptive
criterion, denoted by ch, that depends upon the problem under consideration and the polynomial
approximation used. Then, a new mesh is generated, based on this criterion. A second solution
on an adapted mesh can be constructed. The adaptation loop converges generally in roughly 5 to
20 iterations.
Let us apply this principle to the elasticity problem.60 Rheolef version 6.6 update 15 April 2014
Example file 4.4: embankment_adapt.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " elasticity_solve . icc "
5 # include " elasticity_criterion . icc "
6 # include " embankment . icc "
7 int main (int argc , char ** argv ) {
8 environment rheolef ( argc , argv );
9 const Float lambda = 1;
10 geo omega ( argv [1]);
11 adapt_option_type options ;
12 string approx = ( argc > 2) ? argv [2] : " P1 ";
13 options . err = ( argc > 3) ? atof ( argv [3]) : 5e -3;
14 size_t n_adapt = ( argc > 4) ? atoi ( argv [4]) : 5;
15 options . hmin = 0.004;
16 for ( size_t i = 0; true ; i ++) {
17 space Xh = embankment_space ( omega , approx );
18 field uh = elasticity_solve ( Xh , lambda );
19 odiststream of ( omega . name () , " field ");
20 of << catchmark (" lambda ") << lambda << endl
21 << catchmark (" u ") << uh ;
22 if ( i == n_adapt ) break ;
23 field ch = elasticity_criterion ( lambda , uh );
24 omega = adapt ( ch , options );
25 odiststream og ( omega . name () , " geo ");
26 og << omega ;
27 }
28 }
Example file 4.5: elasticity_solve.icc
1 field elasticity_solve ( const space & Xh , Float lambda ) {
2 size_t d = Xh . get_geo (). dimension ();
3 point f (0 ,0 ,0);
4 f [d -1] = -1;
5 trial u ( Xh ); test v ( Xh );
6 field lh = integrate ( dot (f , v ));
7 form a = integrate ( lambda *div( u )* div( v ) + 2* ddot (D( u ) ,D( v )));
8 solver sa ( a . uu ());
9 field uh ( Xh , 0);
10 uh . set_u () = sa . solve ( lh . u () - a . ub ()* uh . b ());
11 return uh ;
12 }
Example file 4.6: elasticity_criterion.icc
1 field elasticity_criterion ( Float lambda , const field & uh ) {
2 string grad_approx = ( uh . get_approx () == " P2 ") ? " P1d " : " P0 ";
3 space Xh ( uh . get_geo () , grad_approx );
4 if ( grad_approx == " P0 ") return interpolate ( Xh , norm ( uh ));
5 space T0h ( uh . get_geo () , grad_approx );
6 size_t d = uh . get_geo (). dimension ();
7 tensor I = tensor :: eye ( d );
8 return interpolate ( T0h , sqrt (2* norm2 (D( uh )) + lambda *sqr(div( uh ))));
9 }
Comments
The criterion is here:
ch =
|uh| when using P1
(σ(uh) : D(uh))1/2 when using P2
The elasticity_criterion function compute it as
return interpolate ( Xh , norm ( uh ));
when using P1, and asRheolef version 6.6 update 15 April 2014 61
return interpolate ( T0h , sqrt (2* norm2 (D( uh )) + lambda *sqr(div( uh ))));
when using P2. The sqr function returns the square of a scalar. Conversely, the norm2 function
returns the square of the norm. In the min programm, the result of the elasticity_criterion
function is send to the adapt function:
field ch = elasticity_criterion ( lambda , uh );
omega = adapt ( ch , options );
The adapt_option_type declaration is used by Rheolef to send options to the mesh generator.
The err parameter controls the error via the edge length of the mesh: the smaller it is, the smaller
the edges of the mesh are. In our example, is set by default to one. Conversely, the hmin parameter
controls minimal edge length.
How to run the program
P1: 6661 elements, 3620 vertices P2: 1734 elements, 969 vertices
Figure 4.5: Adapted meshes: the deformation visualization for P1 and P2 approximations.
The compilation command writes:
make embankment_adapt
The mesh loop adaptation is initiated from a bamg mesh (see also appendix B.1).
bamg -g square.bamgcad -o square.bamg
bamg2geo square.bamg square.dmn > square.geo
./embankment_adapt square P1 2e-2
The last command line argument is the target error. The code performs a loop of five mesh adaptations:
the corresponding meshes are stored in files, from square-1.geo.gz to square-5.geo.gz,
and the associated solutions in files, from square-1.field.gz to square-5.field.gz. The additional
‘.gz’ suffix expresses that the files are compressed using gzip.
geo square-5.geo
field square-5.field -paraview -nofill62 Rheolef version 6.6 update 15 April 2014
Note that the ‘.gz’ suffix is automatically assumed by the geo and the field commands.
For a piecewise quadratic approximation:
./embankment_adapt square P2 5e-3
Then, the visualization writes:
geo square-5.geo
field square-5.field -paraview -nofill
A one-dimensional mesh adaptive procedure is also possible:
gmsh -1 line.mshcad -o line.msh
msh2geo line.msh > line.geo
geo line.geo
./embankment_adapt line P2
geo line-5.geo
field line-5.field -comp 0 -elevation
The three-dimensional extension of this mesh adaptive procedure is in development.
4.4 The Stokes problem
Formulation
Let us consider the Stokes problem for the driven cavity in Ω =]0, 1[d
, d = 2, 3. The problem
writes:
(S) find u = (u0, . . . , ud−1) and p defined in Ω such that:
− div(2D(u)) + ∇p = 0 in Ω,
− div u = 0 in Ω,
u = (1, 0) on Γtop,
u = 0 on Γleft ∪ Γright ∪ Γbottom,
∂u0
∂n
=
∂u1
∂n
= u2 = 0 on Γback ∪ Γfront when d = 3,
where D(u) = (∇u + ∇u
T
)/2. The boundaries are represented on Fig. 4.1, page 52.
The variational formulation of this problem expresses:
(V F S) find u ∈ V(1) and p ∈ L
2
0
(Ω) such that:
a(u, v) + b(v, p) = 0, ∀v ∈ V(0),
b(u, q) = 0, ∀q ∈ L
2
0
(Ω),
where
a(u, v) = Z
Ω
2D(u) : D(v) dx,
b(v, q) = −
Z
Ω
div(v) q dx.
V(α) = {v ∈ (H1
(Ω))2
; v = 0 on Γleft ∪ Γright ∪ Γbottom and v = (α, 0) on Γtop}, when d = 2,
V(α) = {v ∈ (H1
(Ω))3
; v = 0 on Γleft ∪ Γright ∪ Γbottom,
v = (α, 0, 0) on Γtop and v2 = 0 on Γback ∪ Γfront}, when d = 3,
L
2
0
(Ω) = {q ∈ L
2
(Ω); Z
Ω
q dx = 0}.Rheolef version 6.6 update 15 April 2014 63
Approximation
The Taylor-Hood [27] finite element approximation of the Stokes problem is considered. We
introduce a mesh Th of Ω and the following finite dimensional spaces:
Xh = {v ∈ (H1
(Ω))d
; v/K ∈ (P2)
d
, ∀K ∈ Th},
Vh(α) = Xh ∩ V(α),
Qh = {q ∈ L
2
(Ω)) ∩ C
0
(Ω); ¯ q/K ∈ P1, ∀K ∈ Th},
The approximate problem writes:
(V F S)h find uh ∈ Vh(1) and p ∈ Qh such that:
a(uh, v) + b(v, ph) = 0, ∀v ∈ Vh(0),
b(uh, q) = 0, ∀q ∈ Qh.
(4.4)
Example file 4.7: cavity.icc
1 space cavity_space ( const geo& omega_h , std :: string approx ) {
2 space Xh ( omega_h , approx , " vector ");
3 Xh . block (" top "); Xh . block (" bottom ");
4 if ( omega_h . dimension () == 3) {
5 Xh . block (" back "); Xh . block (" front ");
6 Xh [1]. block (" left "); Xh [1]. block (" right ");
7 } else {
8 Xh . block (" left "); Xh . block (" right ");
9 }
10 return Xh ;
11 }
12 field cavity_field ( const space & Xh , Float alpha ) {
13 field uh ( Xh , 0.);
14 uh [0][ " top "] = alpha ;
15 return uh ;
16 }
Example file 4.8: stokes_cavity.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " cavity . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 space Xh = cavity_space ( omega , " P2 ");
9 space Qh ( omega , " P1 ");
10 trial u ( Xh ) , p ( Qh ); test v ( Xh ) , q ( Qh );
11 form a = integrate (2* ddot (D( u ),D( v )));
12 form b = integrate ( -div( u )* q );
13 form mp = integrate ( p * q );
14 field uh = cavity_field ( Xh , 1);
15 field ph ( Qh , 0.);
16 solver_abtb stokes ( a . uu () , b . uu () , mp . uu ());
17 stokes . solve ( -( a . ub ()* uh . b ()) , -( b . ub ()* uh . b ()) ,
18 uh . set_u () , ph . set_u ());
19 dout << catchmark (" u ") << uh
20 << catchmark (" p ") << ph ;
21 }
Comments
The spaces and boundary conditions and grouped in specific functions, defined in file ‘cavity.icc’.
This file is suitable for a future re-usage. Next, forms are defined as usual, in file
‘stokes_cavity.cc’.64 Rheolef version 6.6 update 15 April 2014
The problem admits the following matrix form:
a.uu trans(b.uu)
b.uu 0
uh.u
ph.u
=
−a.ub ∗ uh.b
−b.ub ∗ uh.b
An initial value for the pressure field is provided:
field ph ( Qh , 0);
The main Stokes solver call writes:
solver_abtb stokes ( a . uu () , b . uu () , mp . uu ());
stokes . solve ( -( a . ub ()* uh . b ()) , -( b . ub ()* uh . b ()) ,
uh . set_u () , ph . set_u ());
For tridimensional geometries (d = 3), this system is solved by the preconditioned conjugate
gradient algorithm. the preconditioner is here the mass matrix mp.uu for the pressure: as showed
in [29], the number of iterations need by the conjugate gradient algorithm to reach a given precision
is then independent of the mesh size. For more details, see the Rheolef reference manual related
to mixed solvers, available e.g. via the unix command:
man solver_abtb
When d = 2, it is interesting to turn to direct methods and factorize the whole matrix of the linear
system. As the pressure is defined up to a constant, the whole matrix is singular. By adding a
Lagrange multiplier that impose a null average pressure value, the system becomes regular and
the modified matrix can be inverted. Such a technique has already been presented in section 2.4
for the Neumann-Laplace problem. Finally, he choice between iterative and direct algorithm for
the Stokes solver is automatically done, regarding the geometry dimension.
How to run the program
Figure 4.6: The velocity visualization for d = 2 and d = 3 with stereo anaglyph.
We assume that the previous code is contained in the file ‘stokes_cavity.cc’. Then, compile the
program as usual (see page 18):
make stokes_cavityRheolef version 6.6 update 15 April 2014 65
and enter the commands:
mkgeo_grid -t 10 > square.geo
./stokes_cavity square > square.field
The previous command solves the problem for the corresponding mesh and writes the solution in
a ‘.field’ file. Run the velocity vector visualization :
field square.field -velocity
Run also some scalar visualizations:
field square.field -comp 0
field square.field -comp 1
field square.field -catchmark p
Note the -catchmark option to the field command: the file reader jumps to the label and then
starts to read the selected field. Next, perform another computation on a finer mesh:
mkgeo_grid -t 20 > square-20.geo
./stokes_cavity square-20.geo > square-20.field
and observe the convergence.
Finally, let us consider the three dimensional case:
mkgeo_grid -T 5 > cube.geo
./stokes_cavity cube.geo > cube.field
and the corresponding visualization:
field cube.field -velocity
field cube.field -comp 0
field cube.field -comp 1
field cube.field -comp 2
field cube.field -catchmark p
4.5 Computing the vorticity
Formulation and approximation
When d = 2, we define [23, page 30] for any distributions φ and v:
curl φ =
∂φ
∂x1
, −
∂φ
∂x0
,
curl v =
∂v1
∂x0
−
∂v0
∂x1
,
and when d = 3:
curl v =
∂v2
∂x1
−
∂v1
∂x2
,
∂v0
∂x2
−
∂v2
∂x0
,
∂v1
∂x0
−
∂v0
∂x1
Let u be the solution of the Stokes problem (S). The vorticity is defined by:
ω = curl u when d = 2,
ω = curl u when d = 3.66 Rheolef version 6.6 update 15 April 2014
Since the approximation of the velocity is piecewise quadratic, we are looking for a discontinuous
piecewise linear vorticity field that belongs to:
Yh = {ξ ∈ L
2
(Ω); ξ/K ∈ P1, ∀K ∈ Th}, when d = 2
Yh = {ξ ∈ (L
2
(Ω))3
; ξi/K ∈ P1, ∀K ∈ Th}, when d = 3
The approximate variational formulation writes:
ωh ∈ Yh,
R
Ω
ωh ξ dx =
R
Ω
curl uh ξ dx, ∀ξ ∈ Yh when d = 2,
ω ∈ Yh,
R
Ω ωh.ξ dx =
R
Ω
curl uh.ξ dx, ∀ξ ∈ Yh when d = 3.
Example file 4.9: vorticity.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 int main (int argc , char ** argv ) {
5 environment rheolef ( argc , argv );
6 field uh ;
7 din >> uh ;
8 const space & Xh = uh . get_space ();
9 string grad_approx = " P " + itos ( Xh . degree () -1) + " d ";
10 string valued = ( uh . size () == 3) ? " vector " : " scalar ";
11 space Lh ( uh . get_geo () , grad_approx , valued );
12 field curl_uh = interpolate ( Lh , curl ( uh ));
13 dout << catchmark (" w ") << curl_uh ;
14 }
Comments
As for the stress tensor (see stress.cc, page 56), the vorticity is obtained by a direct interpolation
of the uh first derivatives and its approximation is discontinuous at inter-element boundaries.
How to run the program
Figure 4.7: The vorticity: elevation view for d = 2 and vector representation for d = 3 (with
anaglyph).Rheolef version 6.6 update 15 April 2014 67
For d = 2, just enter:
make vorticity
./vorticity < square.field | field -elevation -stereo -
and you observe a discontinuous piecewise linear representation of the approximate vorticity. Also,
the vorticity presents two sharp peaks at the upper corners of the driven cavity: the vorticity is
unbounded and the peaks will increase with mesh refinements. This singularity of the solution is
due to the boundary condition for the first component of the velocity u0 that jumps from zero to
one at the corners. The approximate vorticity field can also be projected on a continuous piecewise
linear space, using the -proj option (See Fig. 4.7 left):
./vorticity < square.field | field -elevation -stereo -nofill -
./vorticity < square.field | field -elevation -stereo -proj -
For d = 3, the whole vorticity vector can also be visualized (See Fig. 4.7 right):
./vorticity < cube.field | field -proj -velocity -stereo -
In the previous command, the -proj option has been used: since the 3D render has no support for
discontinuous piecewise linear fields, the P1-discontinuous field is transformed into a P1-continuous
one, thanks to a L
2 projection. P1 The following command shows the second component of the
vorticity vector, roughly similar to the bidimensional case.
./vorticity < cube.field | field -comp 1 -
./vorticity < cube.field | field -comp 1 -proj -
4.6 Computing the stream function
Formulation and approximation
When d = 3, the stream function is a vector-valued field ψ that satisfies [23, page 90]: curl ψ = u
and div ψ = 0. From the identity:
curl curl ψ = −∆ψ + ∇(div ψ)
we obtain the following characterization of ψ :
−∆ ψ = curl u in Ω,
ψ = 0 on Γback ∪ Γfront ∪ Γtop ∪ Γbottom,
∂ψ
∂n = 0 on Γleft ∪ Γright.
When d = 2, the stream function ψ is a scalar-valued field the solution of the following problem [23,
page 88]:
−∆ ψ = curl u in Ω,
ψ = 0 on ∂Ω.68 Rheolef version 6.6 update 15 April 2014
Example file 4.10: streamf_cavity.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 int main (int argc , char ** argv ) {
5 environment rheolef ( argc , argv );
6 field uh ;
7 din >> uh ;
8 const space & Xh = uh . get_space ();
9 size_t d = uh . get_geo (). dimension ();
10 string valued = ( d == 3) ? " vector " : " scalar ";
11 space Ph ( uh . get_geo () , " P2 ", valued );
12 Ph . block (" top "); Ph . block (" bottom ");
13 if ( d == 3) {
14 Ph . block (" back "); Ph . block (" front ");
15 } else {
16 Ph . block (" left "); Ph . block (" right ");
17 }
18 trial u ( Xh ) , psi ( Ph ); test phi ( Ph );
19 form a = ( d == 3) ? integrate ( ddot ( grad ( psi ) , grad ( phi )))
20 : integrate ( dot ( grad ( psi ) , grad ( phi )));
21 form b = ( d ==3) ? integrate ( dot ( curl ( u ) , phi ))
22 : integrate ( curl ( u )* phi );
23 field psi_h ( Ph , 0.);
24 field lh = b * uh ;
25 solver sa ( a . uu ());
26 psi_h . set_u () = sa . solve ( lh . u () - a . ub ()* psi_h . b ());
27 dout << catchmark (" psi ") << psi_h ;
28 }
How to run the program
Figure 4.8: The stream function visualization: isolines for d = 2, and combined vectors and
isonorm surface for d = 3.
For d = 2, just enter (see Fig. 4.8 left):
make streamf_cavity
./streamf_cavity < square.field | field -bw -Rheolef version 6.6 update 15 April 2014 69
For d = 3, the whole stream function vector can be visualized:
./streamf_cavity < cube.field | field -velocity -
The second component of the stream function is showed by:
./streamf_cavity < cube.field | field -comp 1 -
The combined representation of Fig. 4.8.right has been obtained in two steps. First, enter:
./streamf_cavity < cube.field | field -comp 1 -noclean -noexecute -
mv output.vtk psi1.vtk
./streamf_cavity < cube.field | field -velocity -
The -noclean -noexecute options cause the creation of the ‘.vtk’ file for the second component,
without running the paraview visualization. Next, in the paraview window associated to
the whole stream function, select the File->Open menu and load ‘psi1.vtk’ and click on the
green button Apply. Finally, select the Filters/Common/Contours menu: the isosurface appears.
Observe that the 3D stream function is mainly represented by its second component.70 Rheolef version 6.6 update 15 April 2014Chapter 5
Nearly incompressible elasticity and
the stabilized Stokes problems
5.1 The incompressible elasticity problem
Formulation
Let us go back to the linear elasticity problem.
When λ becomes large, this problem is related to the incompressible elasticity and cannot be
solved as it was previously done. To overcome this difficulty, the pressure is introduced :
p = −λdiv u
and the problem becomes:
(E) find u and p defined in Ω such that:
− div(2D(u)) + ∇p = f in Ω,
− div u −
1
λ
p = 0 in Ω,
+B.C.
The variational formulation of this problem expresses:
(V F E) find u ∈ V (1) and p ∈ L
2
(Ω) such that:
a(u, v) + b(v, p) = m(f, v), ∀v ∈ V (0),
b(u, q) − c(p, q) = 0, ∀q ∈ L
2
0
(Ω),
where
m(u, v) = Z
Ω
u.v dx,
a(u, v) = Z
Ω
D(u) : D(v) dx,
b(v, q) = −
Z
Ω
div(v) q dx.
c(p, q) = 1
λ
Z
Ω
p q dx.
V = {v ∈ (H1
(Ω))2
; v = 0 on Γlef t ∪ Γbottom}
When λ becomes large, we obtain the incompressible elasticity problem, that coincides with the
Stokes problem.
7172 Rheolef version 6.6 update 15 April 2014
Approximation
As for the Stokes problem, the Talor-Hood [27] finite element approximation is considered. We
introduce a mesh Th of Ω and the following finite dimensional spaces:
Xh = {v ∈ (H1
(Ω)); v/K ∈ (P2)
2
, ∀K ∈ Th},
Vh(α) = Xh ∩ V,
Qh = {q ∈ L
2
(Ω)) ∩ C
0
(Ω); ¯ q/K ∈ P1, ∀K ∈ Th},
The approximate problem writes:
(V F E)h find uh ∈ Vh(1) and p ∈ Qh such that:
a(uh, v) + b(v, ph) = 0, ∀v ∈ Vh(0),
b(uh, q) − c(p, q) = 0, ∀q ∈ Qh.
Example file 5.1: incompressible-elasticity.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " embankment . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 Float inv_lambda = ( argc > 2 ? atof ( argv [2]) : 0);
9 size_t d = omega . dimension ();
10 space Xh = embankment_space ( omega , " P2 ");
11 space Qh ( omega , " P1 ");
12 point f (0 ,0 ,0);
13 f [d -1] = -1;
14 trial u ( Xh ) , p ( Qh ); test v ( Xh ) , q ( Qh );
15 field lh = integrate ( dot (f , v ));
16 form a = integrate (2* ddot (D( u ) ,D( v )));
17 form b = integrate ( -div ( u )* q );
18 form mp = integrate ( p * q );
19 form c = inv_lambda * mp ;
20 field uh ( Xh , 0) , ph (Qh , 0);
21 solver_abtb elasticity ( a . uu () , b . uu () , c . uu () , mp . uu ());
22 elasticity . solve ( lh . u () - a . ub ()* uh . b () , -(b . ub ()* uh . b()) ,
23 uh . set_u () , ph . set_u ());
24 dout << catchmark (" inv_lambda ") << inv_lambda << endl
25 << catchmark (" u ") << uh
26 << catchmark (" p ") << ph ;
27 }
Comments
The problem admits the following matrix form:
a.uu trans(b.uu)
b.uu −c.uu uh.u
ph.u
=
lh.u − a.ub ∗ uh.b
−b.ub ∗ uh.b
The problem is similar to the Stokes one (see page 64). This system is solved by:
solver_abtb elasticity ( a . uu () , b . uu () , c . uu () , mp . uu ());
elasticity . solve ( lh . u () - a . ub ()* uh . b () , -(b . ub ()* uh . b()) ,
uh . set_u () , ph . set_u ());
For two-dimensional problems, a direct solver is used by default. In the three-dimensional case,
an iterative algorithm is the default: the preconditioned conjugate gradient. The preconditioner
is here the mass matrix mp.uu for the pressure. As showed in [29], the number of iterations need
by the conjugate gradient algorithm to reach a given precision is then independent of the mesh
size and is uniformly bounded when λ becomes small, i.e. in the incompressible case.Rheolef version 6.6 update 15 April 2014 73
How to run the program
Figure 5.1: The incompressible linear elasticity (λ = +∞) for N = 2 and N = 3.
We assume that the previous code is contained in the file ‘incompressible-elasticity.cc’.
Compile the program as usual (see page 18):
make incompressible-elasticity
and enter the commands:
mkgeo_grid -t 10 > square.geo
./incompressible-elasticity square.geo 0 > square.field
field square.field -parview -nofill
mkgeo_grid -T 10 > cube.geo
./incompressible-elasticity cube.geo 0 > cube.field
field cube.field -parview -fill -scale 2
The visualization is performed as usual: see section 4.1, page 54. Compare the results on Fig. 5.1,
obtained for λ = +∞ with those of Fig. 4.2, page 54, obtained for λ = 1.
Finally, the stress computation and the mesh adaptation loop is left as an exercise to the reader.
5.2 The P1b − P1 element for the Stokes problem
Formulation and approximation
Let us go back to the Stokes problem. In section 4.4, page 62, the Taylor-Hood finite element was
considered. Here, we turn to the mini-element [5] proposed by Arnold, Brezzi and Fortin, also
well-known as the P1-bubble element. This element is generally less precise than the Taylor-Hood
one, but becomes popular, mostly because it is easy to implement in two and three dimensions
and furnishes a P1 approximation of the velocity field. Moreover, this problem develops some links
with stabilization technique and will presents some new Rheolef features.74 Rheolef version 6.6 update 15 April 2014
We consider a mesh Th of Ω ⊂ R
d
, d = 2, 3 composed only of simplicial elements: triangles when
d = 2 and tetrahedra when d = 3. The following finite dimensional spaces are introduced:
X
(1)
h = {v ∈ (H1
(Ω))d
; v/K ∈ (P1)
d
, ∀K ∈ Th},
Bh = {β ∈ (C
0
(Ω)) ¯ d
; β/K ∈ B(K)
d
, ∀K ∈ Th}
Xh = X
(1)
h ⊕ Bh
Vh(α) = Xh ∩ V(α),
Qh = {q ∈ L
2
(Ω)) ∩ C
0
(Ω); ¯ q/K ∈ P1, ∀K ∈ Th},
where B(K) = vect(λ1 × . . . × λd+1) and λi are the barycentric coordinates of the simplex K.
The B(K) space is related to the bubble local space. The approximate problem is similar to (4.4),
page 63, up to the choice of finite dimensional spaces.
Remark that the velocity field splits in two terms: uh = u
(1)
h +u
(b)
h
, where u
(1)
h ∈ X
(1)
h
is continuous
and piecewise linear, and u
(b)
h ∈ Bh is the bubble term.
We consider the abrupt contraction geometry:
Ω =]−Lu, 0[×]0, c[ ∪ [0, Ld[×]0, 1[
where c > 1 stands for the contraction ratio, and Lu, Ld > 0, are the upstream and downstream
tube lengths. The boundary conditions on u = (u0, u1) for this test case are:
u0 = upoiseuille and u1 = 0 on Γupstream
u = 0 on Γwall
∂u0
∂x1
= 0 and u1 = 0 on Γaxis
∂u
∂n = 0 on Γdownstream
where
Γupstream = {−Lu}×]0, c[
Γdownstream = {Ld}×]0, 1[
Γaxis = ]−Lu, Ld[×{0}
Γwall = ]−Lu, 0[×{c} ∪ {0}×]1, c[ ∪ ]0, Ld[×{1}
The matrix structure is similar to those of the Taylor-Hood element (see section 4.4, page 62).
Since Xh = X
(1)
h ⊕ Bh, any element uh ∈ Xh can be written as a sum uh = u1,h + ub,h where
u1,h ∈ X
(1)
h
and ub,h ∈ Bh. Remark that
a(u1,h, vb,h) = 0, ∀u1,h ∈ X
(1)
h
, ∀vb,h ∈ Bh.
Thus, the form a(., .) defined over Xh × Xh writes simply as the sum of the forms a1(., .) and
ab(., .), defined over X
(1)
h × X
(1)
h
and Bh × Bh respectively. Finaly, the form b(., .) defined over
Xh × Qh writes as the sum of the forms b1(., .) and bb(., .), defined over X
(1)
h × Qh and Bh × Qh
respectively. Then, the linear system admits the following block structure :
A1 0 BT
1
0 Ab BT
b
B1 Bb 0
U1
Ub
P
=
L1
Lb
Lp
An alternative and popular implementation of this element eliminates the unknowns related to
the bubble components (see e.g. [1], page 24). Remark that, on any element K ∈ Th, any bubbleRheolef version 6.6 update 15 April 2014 75
function vK that belongs to B(K) vanishes on the boundary of K and have a compact support in
K. Thus, the Ab matrix is block-diagonal. Moreover, Ab is invertible and Ub writes :
Ub = A
−1
b
(B
T
b p − Lb)
As Ab is block-diagonal, its inverse can be efficiently inverted at the element level during the
assembly process. Then, Ub can be easily eliminated from the system that reduces to:
A1 BT
1
B1 −C
U1
P
=
L1
L˜
p
where L˜
p = Lp − A
−1
b Lp and C = BbA
−1
b BT
b
. Remarks that the matrix structure is similar to
those of the nearly incompressible elasticity (see 5.1, page 5.1). This reduced matrix formulation
of the P1b − P1 element is similar to the direct P1 − P1 stabilized element, proposed by Brezzi
and Pitkäranta [12].
Example file 5.2: stokes_contraction_bubble.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " poiseuille . h "
5
6 int main (int argc , char ** argv ) {
7 environment rheolef ( argc , argv );
8 geo omega ( argv [1]);
9 space X1h ( omega , " P1 ", " vector ");
10 space Bh ( omega , " bubble ", " vector ");
11 space Qh ( omega , " P1 ");
12 space Wh ( omega [" upstream "] , " P1 ");
13 X1h . block (" wall ");
14 X1h . block (" upstream ");
15 X1h [1]. block (" axis ");
16 X1h [1]. block (" downstream ");
17 trial u1 ( X1h ) , ub ( Bh ) , p ( Qh );
18 test v1 ( X1h ) , vb ( Bh ) , q ( Qh );
19 form mp = integrate ( p * q );
20 form b1 = integrate ( -div( u1 )* q );
21 form bb = integrate ( -div( ub )* q );
22 form a1 = integrate (2* ddot (D( u1 ) ,D( v1 )));
23 form_option_type fopt ;
24 fopt . invert = true ;
25 form inv_ab = integrate (2* ddot (D( ub ) ,D( vb )) , fopt );
26 form c = bb * inv_ab * trans ( bb );
27 field u1h ( X1h , 0) , ph ( Qh , 0);
28 string sys_coord = omega . coordinate_system_name ();
29 Float cr = omega . xmax ()[1];
30 u1h [0][ " upstream "] = interpolate ( Wh , u_poiseuille ( cr , sys_coord ));
31 solver_abtb stokes ( a1 . uu () , b1 . uu () , c . uu () , mp . uu ());
32 stokes . solve ( -( a1 . ub ()* u1h . b ()) , -( b1 . ub ()* u1h . b ()) ,
33 u1h . set_u () , ph . set_u ());
34 dout << catchmark (" inv_lambda ") << 0 << endl
35 << catchmark (" u ") << u1h
36 << catchmark (" p ") << ph ;
37 }
Comments
First, A
−1
b
is computed as:
form_option_type fopt ;
fopt . invert = true ;
form inv_ab = integrate (2* ddot (D( ub ) ,D( vb )) , fopt );
Notice the usage of the optional parameter fopt to the integrate function. As the form is
bloc-diagonal, its inverse is computed element-by-element during the assembly process. Next, the
C = BbA
−1
b BT
b
form is simply computed as:76 Rheolef version 6.6 update 15 April 2014
form c = bb * inv_ab * trans ( bb );
Notice also the automatic computation of the geometric coordinate system and contraction ratio
c from the input mesh, as:
string sys_coord = omega . coordinate_system_name ();
Float cr = omega . xmax ()[1];
These parameters are send to the function that computes the Poiseuille input flow boundary
condition:
u1h [0][ " upstream "] = interpolate ( Wh , u ( cr , sys_coord ));
The file poiseuille.h contains code for the velocity and stream function boundary conditions.
Example file 5.3: poiseuille.h
1 struct u_poiseuille : field_functor < u_poiseuille ,Float > {
2 Float operator () ( const point & x ) const {
3 return a *( c + x [1])*( c - x [1]); }
4 u_poiseuille ( const Float & c1 , std :: string sc ) : c ( c1 )
5 { a = ( sc == " cartesian ") ? 3/(2* pow (c ,3)) : 4/ pow (c ,4); }
6 protected : Float c , a ;
7 };
8 struct psi_poiseuille : field_functor < psi_poiseuille ,Float > {
9 Float operator () ( const point & x ) const {
10 return xy ? a *sqr(c - x [1])*(2* c + x [1]) : a *sqr(c - x [1])* sqr( c + x [1]); }
11 psi_poiseuille ( const Float & c1 , std :: string sc )
12 : c ( c1 ) , xy ( sc == " cartesian ")
13 { a = xy ? -1/(2* pow (c ,3)) : -1/ pow (c ,4); }
14 protected : Float c , a ; bool xy ;
15 };
The Poiseuille velocity upstream boundary condition upoiseuille has been scaled such that the total
flow rate is equal to one. The stream function is equal to −1 on the axis and to zero on the wall.
This file contains also a treatment of the axisymmetric variant of the geometry: this case will be
presented in the next paragraphs.
How to run the program
The boundary conditions in this example are related to an abrupt contraction geometry with a
free surface. The corresponding mesh ‘contraction.geo’ can be easily builded from the geometry
description file ‘contraction.mshcad’, which is provided in the example directory of the Rheolef
distribution. The building mesh procedure is presented with details in appendix B, page B.
gmsh -2 contraction.mshcad -o contraction.msh
msh2geo contraction.msh > contraction.geo
geo contraction.geo
The mesh is represented on Fig. 5.2.top. Then, the computation and the visualization writes:
make stokes_contraction_bubble
./stokes_contraction_bubble contraction.geo > contraction-P1.field
field contraction-P1.field -paraview -velocity
The visualization of the velocity field brings few informations about the properties of the flow.
The stream function is more relevant for stationary flow visualization.Rheolef version 6.6 update 15 April 2014 77
ψmax = 1.109 × 10−3
ψmax = 1.118 × 10−3
Figure 5.2: Solution of the Stokes problem in the abrupt contraction: (top) the mesh; (center) the
P1 stream function associated to the P1b−P1 element; (bottom) the P2 stream function associated
to the P2 − P1 Taylor-Hood element.78 Rheolef version 6.6 update 15 April 2014
Example file 5.4: streamf_contraction.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " poiseuille . h "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 field uh ;
8 din >> uh ;
9 const geo & omega = uh . get_geo ();
10 size_t d = omega . dimension ();
11 string sys_coord = omega . coordinate_system_name ();
12 Float c = omega . xmax ()[1];
13 string approx = " P " + itos ( uh . get_space (). degree ());
14 space Ph ( omega , approx );
15 Ph . block (" upstream ");
16 Ph . block (" wall ");
17 Ph . block (" axis ");
18 space Wh ( omega [" upstream "] , approx );
19 const space & Xh = uh . get_space ();
20 field psi_h ( Ph , 0);
21 psi_h [" upstream "] = interpolate ( Wh , psi_poiseuille (c , sys_coord ));
22 psi_h [" wall "] = 0;
23 psi_h [" axis "] = -1;
24 form_option_type fopt ;
25 fopt . ignore_sys_coord = true ;
26 trial psi ( Ph ) , u ( Xh );
27 test xi ( Ph ) , v ( Xh );
28 form a = ( d == 3) ? integrate ( ddot ( grad ( psi ) , grad ( xi )))
29 : integrate ( dot ( grad ( psi ) , grad ( xi )) , fopt );
30 field lh = integrate ( dot ( uh , bcurl ( xi )));
31 solver sa ( a . uu ());
32 psi_h . set_u () = sa . solve ( lh . u () - a . ub ()* psi_h . b ());
33 dout << catchmark (" psi ") << psi_h ;
34 }
Notice the usage of the optional parameter fopt to the integrate function.
fopt . ignore_sys_coord = true ;
In the axisymmetric coordinate system, there is a specific definition of the stream function, together
with the use of a variant of the curl operator, denoted as bcurl in Rheolef.
field lh = integrate ( dot ( uh , bcurl ( xi )));
The axisymmetric case will be presented in the next section. By this way, our code is abble to
deal with both cartesian and axisymmetric geometries.
The stream function ψ (see also section 4.6) is computed and visualized as:
make streamf_contraction
./streamf_contraction < contraction-P1.field > contraction-P1-psi.field
field contraction-P1-psi.field -paraview
field contraction-P1-psi.field -n-iso 15 -n-iso-negative 10 -bw
The P1 stream function is represented on Fig. 5.2.center. The stream function is zero along the wall
and the line separating the main flow and the vortex located in the outer corner of the contraction.
Thus, the isoline associated to the zero value separates the main flow from the vortex. In order
to observe this vortex, an extra -n-iso-negative 10 option is added: ten isolines are drawn
for negatives values of ψ, associated to the main flow, and n_iso-10 for the positives values,
associated to the vortex.
A similar computation based on the Taylor-Hood P2 − P1 element is implemented in
stokes_contraction.cc. The code is similar, up to the boundary conditions, to
stokes_cavity.cc (see page 63): thus it is not listed here but is available in the Rheolef example
directory.Rheolef version 6.6 update 15 April 2014 79
make stokes_contraction
./stokes_contraction contraction.geo > contraction-P2.field
field contraction-P2.field -paraview -velocity
./streamf_contraction < contraction-P2.field > contraction-P2-psi.field
field contraction-P2-psi.field -n-iso-negative 10 -bw
The associated P2 stream function is represented on Fig. 5.2.bottom. Observe that the two solutions
are similar and that the vortex activity, defined as ψmax, is accurately computed with the
two methods (see also [47], Fig. 5.11.a, page 143).
field contraction-P1-psi.field -max
field contraction-P2-psi.field -max
Recall that the stream function is negative in the main flow and positive in the vortex located
in the outer corner of the contraction. Nevertheless, the Taylor-Hood based solution is more
accurate : this is perceptible on the graphic, in the region where the upstream vortex reaches the
boundary.
5.3 Axisymmetric geometries
Axisymmetric geometries are fully supported in Rheolef: the coordinate system is associated
to the geometry description, stored together with the mesh in the ‘.geo’ and this information is
propagated in spaces, forms and fields without any change in the code. Thus, a code that works in
plane a 2D plane geometry is able to support a 3D axisymmetric one without changes. A simple
axisymmetric geometry writes:
mkgeo_grid -t 10 -zr > square-zr.geo
more square-zr.geo
Remark the additional line in the header:
coordinate_system zr
The axis of symmetry is denoted as z while the polar coordinates are (r, θ). By symmetry, the
problem is supposed to be independent upon θ and the computational domain is described by
(x0, x1) = (z, r). Conversely, in some cases, it could be convenient to swap the order of the
coordinates and use (r, z): this feature is obtained by the -rz option:
mkgeo_grid -t 10 -rz > square-rz.geo
more square-rz.geo
Axisymmetric problems uses L
2
functional space equipped with the following weighted scalar
product
(f, g) = Z
Ω
f(z, r) g(z, r) r drdz
and all usual bilinear forms support this weight. Thus, the coordinate system can be chosen
at run time and we can expect an efficient source code reduction.
5.4 The axisymmetric stream function and stress tensor
In the axisymmetric case, the velocity field u = (uz, ur) can be expressed in terms of the Stokes
stream function ψ by (see Batchelor [8, p.453] and [57]):
u = (uz, ur) =
1
r
∂ψ
∂r , −
1
r
∂ψ
∂z
(5.1)80 Rheolef version 6.6 update 15 April 2014
Recall that in the axisymmetric case:
curl ψ =
1
r
∂(rψ)
∂r , −
∂ψ
∂z
Thus, from this definition, in axisymmetric geometries u 6= curl ψ and the definition of ψ differs
from the 2D plane or 3D cases (see section 4.6, page 67).
Let us turn to a variational formulation in order to compute ψ from u. For any ξ ∈ H1
(Ω), let
us multiply (5.1) by v = (∂rξ, −∂zξ) and then integrate over Ω with the r dr dz weight. For any
known u velocity field, the problem writes:
(P): find ψ ∈ Ψ(ψΓ) such that
a(ψ, ξ) = l(ξ), ∀ξ ∈ Ψ(0)
where we have introduced the following bilinear forms:
a(ψ, ξ) = Z
Ω
∂ψ
∂r
∂ξ
∂r +
∂ψ
∂z
∂ξ
∂z
dr dz
l(ξ) = Z
Ω
∂ξ
∂r uz −
∂ξ
∂z ur
r dr dz
These forms are defined in ‘streamf_contraction.cc’ as:
form_option_type fopt ;
fopt . ignore_sys_coord = true ;
form a = integrate ( dot ( grad ( psi ), grad ( xi )) , fopt );
and
field lh = integrate ( dot ( uh , bcurl ( xi )));
The fopt.ignore_sys_coord alows us to drops the r integration weight, i.e. replace r dr dz by
dr dz when computing the a(., .) form. Conversely, l involves the bcurl operator defined as:
bcurl ξ =
∂ξ
∂r , −
∂ξ
∂z
It is is closely related but differs from the standard curl operator:
curl ξ =
1
r
∂(rξ)
∂r , −
∂ξ
∂z
The bcurl operator is a specific notation introduced in Rheolef: it coincides with the usual curl
operator except for axisymmetric geometries. In tht case, it refers to the Batchelor trick, suitable
for the computation of the stream function.
As an example, let us reconsider the contraction geometry (see section 5.2, page 73), extended in
the axisymmetric case. In that case, the functional space is defined by:
Ψ(ψΓ) = {ϕ ∈ H1
(Ω); ϕ = ψΓ on Γupstream ∪ Γwall ∪ Γaxis}
with
ψΓ =
ψpoiseuile on Γupstream
0 on Γwall
−1 on Γaxis
This space corresponds to the imposition of Dirichlet boundary conditions on Γupstream, Γwall and
Γaxis and a Neumann boundary condition on Γdownstream.
The following unix commands generate the axisymmetric geometry:Rheolef version 6.6 update 15 April 2014 81
ψmax = 1.84 × 10−3
Figure 5.3: Solution of the axisymmetric Stokes problem in the abrupt contraction: (top) the P2
stream function associated to the P2 − P1 element; (bottom) comparison with the 2D Cartesian
solution (in red).
gmsh -2 contraction.mshcad -o contraction.msh
msh2geo -zr contraction.msh > contraction-zr.geo
more contraction-zr.geo
geo contraction-zr.geo
The previous code stokes_contraction.cc and streamf_contraction.cc are both reused as:
./stokes_contraction contraction-zr.geo > contraction-zr-P2.field
./streamf_contraction < contraction-zr-P2.field > contraction-zr-P2-psi.field
field contraction-zr-P2-psi.field -n-iso-negative 10 -bw
The solution is represented on Fig. 5.3: it slightly differs from the 2D Cartesian solution, as
computed in the previous section (see Fig. 5.2). The vortex size is smaller but its intensity
ψmax = 1.84 × 10−3
is higher. Despite the stream functions looks like similar, the plane solutions
are really different, as we can observe from a cut of the first component of the velocity along the
axis (see Fig. 5.4):
field contraction-P2.field -comp 0 -cut -normal 0 1 -origin 0 1e-15
field contraction-zr-P2.field -comp 0 -cut -normal 0 1 -origin 0 1e-15
The 1e-15 argument replace the zero value, as the mesh intersection cannot yet be done exactly
on the boundary. Notice that the stokes_contraction_bubble.cc can be also reused in a similar
way:
./stokes_contraction_bubble contraction-zr.geo > contraction-zr-P1.field
./streamf_contraction < contraction-zr-P1.field > contraction-zr-P1-psi.field
field contraction-zr-P1-psi.field -n-iso-negative 10 -bw82 Rheolef version 6.6 update 15 April 2014
0
1
2
3
4
-8 -4 0 2
z
u0(z, 0) axisymetric
cartesian
-2
-1
0
-8 -4 0 2
z
τθθ(z, 0)
Figure 5.4: Solution of the plane and axisymmetric Stokes problem in the abrupt contraction: cut
along the axis of symmetry: (left): u0; (right) τθθ.
There is another major difference with axisymmetric problems: the rate of deformation tensor
writes:
τ = 2D(u) =
τzz τrz 0
τrz τrr 0
0 0 τθθ
Thus, there is an additional non-zero component τθθ that is automatically integrated into the
computations in Rheolef. The incompressibility relation leads to tr(τ ) = τzz + τrr + τθθ = 0.
Here σtot = −p.I +τ is the total Cauchy stress tensor (by a dimensionless procedure, the viscosity
can be taken as one). By reusing the stress.cc code (see page 56) we are able to compute the
tensor components:
make stress
./stress < contraction-zr-P1.field > contraction-zr-P1-tau.field
The visualization along the axis of symmetry for the τθθ component is obtained by (see Fig. 5.4):
field contraction-zr-P1-tau.field -comp 22 -proj -cut -normal 0 1 -origin 0 1e-15
Recall that the τzz and τrr components are obtained by the -comp 00 and -comp 11 options,
respectively. The non-zero values along the axis of symmetry expresses the elongational effects in
the entry region of the abrupt contraction.Chapter 6
Time-dependent problems
6.1 The heat equation
Formulation
Let T > 0, Ω ⊂ R
d
, d = 1, 2, 3 and fdefined in Ω. The heat problem writes:
(P): find u, defined in Ω×]0, T[, such that
∂u
∂t − ∆u = f in Ω×]0, T[,
u(0) = 0 in Ω,
u(t) = 0 on ∂Ω×]0, T[.
where f is a known function. In the present example, we consider f = 1.
Approximation
Let ∆t > 0 and tn = n∆t, n > 0. The problem is approximated with respect to time by the
following first-order implicit Euler scheme:
u
n+1 − u
n
∆t
− ∆u
n+1 = f(tn+1) in Ω
where u
n ≈ u(n∆t) and u
(0) = 0. The variational formulation of the time-discretized problem
writes:
(V F)n: Let u
n being known, find u
n+1 ∈ H1
0
(Ω) such that
a (u
n+1, v) = l
(n)
(v), ∀v ∈ H1
0
(Ω).
where
a(u, v) = Z
Ω
(uv + ∆t ∇u.∇v) v dx
l
(n)
(v) = Z
Ω
(u
n + ∆t f(tn+1)) v dx
This is a Poisson-like problem. The discretization with respect to space of this problem is similar
to those presented in section 1.1, page 15.
8384 Rheolef version 6.6 update 15 April 2014
Example file 6.1: heat.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 int main (int argc , char ** argv ) {
5 environment rheolef ( argc , argv );
6 geo omega ( argv [1]);
7 size_t n_max = ( argc > 2) ? atoi ( argv [2]) : 100;
8 Float delta_t = 0.5/ n_max ;
9 space Xh ( omega , " P1 ");
10 Xh . block (" boundary ");
11 trial u ( Xh ); test v ( Xh );
12 form a = integrate ( u * v + delta_t * dot ( grad ( u ) , grad ( v )));
13 solver sa = ldlt ( a . uu ());
14 field uh ( Xh , 0);
15 branch event (" t "," u ");
16 dout << event (0 , uh );
17 for ( size_t n = 1; n <= n_max ; n ++) {
18 field rhs = uh + delta_t ;
19 field lh = integrate ( rhs * v );
20 uh . set_u () = sa . solve ( lh . u () - a. ub ()* uh . b ());
21 dout << event (n * delta_t , uh );
22 }
23 }
Comments
Notice the use of the branch class:
branch event (" t "," u ");
this is a wrapper class that is used here to print the branch of solution (tn, un)n>0, on the standard
output in the ‘.branch’ file format. An instruction as:
dout << event (t , uh );
is equivalent to the formatted output
dout << catchmark (" t ") << t << endl
<< catchmark (" u ") << uh ;Rheolef version 6.6 update 15 April 2014 85
How to run the program
Figure 6.1: Animation of the solution of the heat problem.
We assume that the previous code is contained in the file ‘heat.cc’. Then, compile the program
as usual (see page 18):
make heat
For a one dimensional problem, enter the commands:
mkgeo_grid -e 100 > line.geo
./heat line.geo > line.branch
The previous commands solve the problem for the corresponding mesh and write the solution in
the field-family file format ‘.branch’. For a bidimensional one:
mkgeo_grid -t 10 > square.geo
./heat square.geo > square.branch
For a tridimensional one:
mkgeo_grid -T 10 > box.geo
./heat box.geo > box.branch86 Rheolef version 6.6 update 15 April 2014
How to run the animation
branch line.branch -gnuplot -umax 0.125
A gnuplot window appears. Enter q to exit the window. For a bidimensional case, a more
sophisticated procedure is required. Enter the following unix commands:
branch square.branch -paraview
paraview &
A window appears, that looks like a video player. Then, open the File->open menu and
load square-..vtk. The first ’.’ stands for a wildcard, i.e. the time index family. Then,
press the apply green button and, click a first time on the video play button, at the top
of the window. Next, go to the object inspector window, select display and click on the
re-scale to data range button. Then click a second time on the video play button. An elevation
view can be also obtained: Select the Filter->alphabetical->wrap(scalar) menu, choose
10 as scale factor and press the apply green button. Then, click on the graphic window, rotate
the view and finally re-play the animation
To generate an animation file1
, go to the File->save animation menu and enter as file name
square and as file type jpeg. A collection of jpeg files are generated by paraview. Then, run
the unix command:
ffmpeg -r 2 -i ’square.%04d.jpg’ square.mov
The animation file square.mov can now be started from any video player, such as vlc:
vlc --loop square.mov
For the tridimensional case, the animation feature is similar.
6.2 The convection-diffusion problem
Formulation
Let T > 0 and ν > 0. The convection-diffusion problem writes:
(P): find φ, defined in Ω×]0, T[, such that
∂φ
∂t + u.∇φ − ν∆φ + σφ = 0 in Ω×]0, T[
φ(0) = φ0 in Ω
φ(t) = φΓ(t) on ∂Ω×]0, T[
where u, σ > 0, φ0 and φΓ being known. Notice the additional u.∇ operator.
Time approximation
This problem is approximated by the following first-order implicit Euler scheme:
φ
n+1 − φ
n ◦ Xn
∆t
− ν∆φ
n+1 + σφn+1 = 0 in Ω
1At this time, the avi output feature is broken in paraview, and an alternate mpeg output is here suggested.Rheolef version 6.6 update 15 April 2014 87
where ∆t > 0, φ
n ≈ φ(n∆t) and φ
(0) = φ0.
Let tn = n∆t, n > 0. The term Xn(x) is the position at tn of the particle that is in x at tn+1
and is transported by u
n. Thus, Xn(x) = X(tn, x) where X(t, x) is the solution of the differential
equation
( dX
dt
= u(X(t, x), t) p.p. t ∈ ]tn, tn+1[,
X(tn+1, x) = x.
Then Xn(x) is approximated by the first-order Euler approximation
Xn
(x) ≈ x − ∆t n
n
(x).
This algorithm has been introduced by O. Pironneau (see e.g. [41]), and is known as the method
of characteristic in the finite difference context and as the Lagrange-Galerkin in the finite element
one. The efficient evaluation of φh ◦ Xn(x) in an unstructured mesh involves a hierarchical d-tree
(quadtree, octree) data structure for the localization of the element K of the mesh that contains
x. When d = 3 requires also sophisticated geometric predicates to test whether x ∈ K without
rounding errors, and avoid to conclude that no elements contains a point x close to ∂K up to
rounding errors. This problems is addressed in Rheolef based on the cgal library.
The following code implements the classical rotating Gaussian hill test case (see e.g. [46]).
Example file 6.2: convect.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " rotating - hill . h "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 string approx = ( argc > 2) ? argv [2] : " P1 ";
9 Float nu = ( argc > 3) ? atof ( argv [3]) : 1e -2;
10 size_t n_max = ( argc > 4) ? atoi ( argv [4]) : 50;
11 size_t d = omega . dimension ();
12 Float delta_t = 2* acos ( -1.)/ n_max ;
13 space Vh ( omega , approx , " vector ");
14 field uh = interpolate (Vh , u ( d ));
15 space Xh ( omega , approx );
16 Xh . block (" boundary ");
17 field phi_h = interpolate ( Xh , phi (d , nu ,0));
18 characteristic X ( - delta_t * uh );
19 quadrature_option_type qopt ;
20 qopt . set_family ( quadrature_option_type :: gauss_lobatto );
21 qopt . set_order ( Xh . degree ());
22 trial phi ( Xh ); test psi ( Xh );
23 branch event (" t "," phi ");
24 dout << catchmark (" nu ") << nu << endl
25 << event (0 , phi_h );
26 for ( size_t n = 1; n <= n_max ; n ++) {
27 Float t = n * delta_t ;
28 Float c1 = 1 + delta_t * phi :: sigma (d , nu , t );
29 Float c2 = delta_t * nu ;
30 form a = integrate ( c1 * phi * psi + c2 * dot ( grad ( phi ) , grad ( psi )) , qopt );
31 field lh = integrate ( compose ( phi_h , X )* psi , qopt );
32 solver sa ( a . uu ());
33 phi_h . set_u () = sa . solve ( lh . u () - a . ub ()* phi_h . b ());
34 dout << event (t , phi_h );
35 }
36 }
Comments
The characteristic variable X implements the localizer Xn(x):
characteristic X ( - delta_t * uh );88 Rheolef version 6.6 update 15 April 2014
Combined with the compose function, it perform the composition φh ◦ Xn. The right-hand side
is then computed by using the integrate function:
field lh = integrate ( compose ( phi_h , X )* psi , qopt );
Notice the additional qopt argument to the integrate function. By default, when this argument
is omitted, a Gauss quadrature formulae is assumed, and the number of point is computed such
that it integrate exactlty 2k + 1 polynoms, where k is the degree of polynoms in Xh. The GaussLobatto
quadrature formule is recommended for Lagrange-Galerkin methods. Recall that this
choice of quadrature formulae guaranties inconditional stability at any polynomial order. Here,
we specifies a Gauss-Lobatto quadrature formulae that should be exact for k order polynoms. The
bilinear form is computed via the same quadrature formulae:
form a = integrate ( c1 * phi * psi + c2 * dot ( grad ( phi ) , grad ( psi )) , qopt );
A test case is described in [42]: we take Ω =] − 2, 2[d and T = 2π. This problem provides an
example for a convection-diffusion equation and a known analytical solution:
φ(t, x) = exp
−λt − r(t)|x − x0(t)|
2
where λ = 4νt0 > 0 with t0 > 0 and ν > 0, x0(t) is the moving center of the hill and r(t) =
1/(t0 + 4νt). The source term is time-dependent: σ(t) = λ − 2dνr(t) and has been adjusted such
that the right-hand side is zero. The moving center of the hill x0(t) is associated to the velocity
field u(t, x) as:
d u(t, x) x0(t)
1 1/(2π) t/(2π) − 1/2
2 (y, −x) (− cos(t)/2, sin(t)/2)
3 (y, −x, 0) (− cos(t)/2, sin(t)/2, 0)
Example file 6.3: rotating-hill.h
1 struct u : field_functor {
2 point operator () ( const point & x ) const {
3 return ( d == 1) ? point ( u0 ) : point ( x [1] , -x [0]); }
4 u ( size_t d1 ) : d ( d1 ) , u0 (0.5/ acos ( Float ( -1))) {}
5 protected : size_t d ; Float u0 ;
6 };
7 struct phi : field_functor < phi ,Float > {
8 static Float sigma ( size_t d , Float nu1 , Float t ) {
9 const Float t0 = 0.2;
10 return 4* nu1 / t0 - 2* d * nu1 /( t0 + 4* nu1 * t ); }
11 Float operator () ( const point & x ) const {
12 point x0t ;
13 if ( d == 1) { x0t = point ( x0 [0] + u0 * t ); }
14 else { x0t = point ( x0 [0]* cos ( t) + x0 [1]* sin ( t ),
15 - x0 [0]* sin ( t ) + x0 [1]* cos ( t ));
16 }
17 return exp ( -4* nu *( t/ t0 ) - dist2 (x , x0t )/( t0 +4* nu * t ));
18 }
19 phi ( size_t d1 , Float nu1 , Float t1 ) : d ( d1 ) , nu ( nu1 ) , t ( t1 ) ,
20 t0 (0.2) , u0 (0.5/ acos ( Float ( -1))) , x0 ( -0.5 ,0) {}
21 protected : size_t d ; Float nu , t , t0 , u0 ; point x0 ;
22 };
Notice the use of a class-function phi for the implementation of φ(t) as a function of x. Such
programming style has been introduced in the standard template library [35], which is a part of
the standard C++ library. By this way, for a given t, φ(t) can be interpolated as an usual function
on a mesh.
How to run the program
We assume that the previous code is contained in the file ‘convect.cc’. Then, compile the program
as usual (see page 18):Rheolef version 6.6 update 15 April 2014 89
Figure 6.2: Animation of the solution of the rotating hill problem.
make convect
and enter the commands: Running the one-dimensional test case:
mkgeo_grid -e 500 -a -2 -b 2 > line2.geo
./convect line2.geo P1 > line2.branch
branch line2.branch -gnuplot
Notice the hill that moves from x = −1/2 to x = 1/2. Since the exact solution is known, it is
possible to analyze the error:90 Rheolef version 6.6 update 15 April 2014
Example file 6.4: convect_error.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " rotating - hill . h "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 Float tol = ( argc > 1) ? atof ( argv [1]) : 1e -10;
8 Float nu ;
9 din >> catchmark (" nu ") >> nu ;
10 branch get (" t "," phi ");
11 branch put (" t "," phi_h "," pi_h_phi ");
12 derr << " # t \ terror_l2 \ terror_linf " << endl ;
13 field phi_h ;
14 Float err_l2_l2 = 0;
15 Float err_linf_linf = 0;
16 for ( Float t = 0 , t_prec = 0; din >> get (t , phi_h ); t_prec = t ) {
17 const space & Xh = phi_h . get_space ();
18 size_t d = Xh . get_geo (). dimension ();
19 field pi_h_phi = interpolate ( Xh , phi (d , nu ,t ));
20 trial phi ( Xh ); test psi ( Xh );
21 form m = integrate ( phi * psi );
22 field eh = phi_h - pi_h_phi ;
23 Float err_l2 = sqrt ( m ( eh , eh ));
24 Float err_linf = eh . max_abs ();
25 err_l2_l2 += sqr( err_l2 )*( t - t_prec );
26 err_linf_linf = max ( err_linf_linf , err_linf );
27 dout << put (t , phi_h , pi_h_phi );
28 derr << t << " \ t " << err_l2 << " \ t " << err_linf << endl ;
29 }
30 derr << " # error_l2_l2 = " << sqrt ( err_l2_l2 ) << endl ;
31 derr << " # error_linf_linf = " << err_linf_linf << endl ;
32 return ( err_linf_linf <= tol ) ? 0 : 1;
33 }
The numerical error φh − πh(φ) is computed as:
field pi_h_phi = interpolate ( Xh , phi (d , nu ,t ));
field eh = phih - pi_h_phi ;
and its L
2 norm is printed on the standard error. Observe the use of the branch class as both
input and output field stream.
make convect_error
./convect_error < line2.branch > line2-cmp.branch
branch line2-cmp.branch -gnuplot
The instantaneous L
2
(Ω) norm is printed at each time step and the total error in L
2
(]0, T[;L
2
(Ω))
is finally printed at the end of the stream.Rheolef version 6.6 update 15 April 2014 91
kφh − πh(φ)kL2(L2) kφh − πh(φ)kL∞(L∞)
0.001
0.01
0.1
1
0.001 0.01 0.1 1
h
∆t = 2π/50
∆t = 2π/100
∆t = 2π/200
2
2
P1
P2
0.001
0.01
0.1
1
0.001 0.01 0.1 1
h
∆t = 2π/50
∆t = 2π/100
∆t = 2π/200
P1
P2
Figure 6.3: Diffusion-convection when d = 1 and ν = 10−2
: convergence versus h and ∆t for P1
and P2 elements: (left) in L
2
(L
2
) norm; (right) in L∞(L∞) norm.
A P2 approximation can be used as well:
./convect line2.geo P2 > line2.branch
branch line2.branch -gnuplot
./convect_error < line2.branch > line2-cmp.branch
On Fig. 6.3.left we observe the L
2
(L
2
) convergence versus h for the P1 and P2 elements when
d = 1: the errors reaches a plateau that decreases versus ∆t. On Fig. 6.3.right the L∞(L∞) norm
of the error presents a similar behavior. Since the plateau are equispaced, the convergence versus
∆t is of first order.
These computation was performed for a convection-diffusion problem with ν = 10−2
. The pure
transport problem (ν = 0, without diffusion) computation is obtained by:
./convect line2.geo P1 0 > line2.branch
branch line2.branch -gnuplot
Let us turn to the two-dimensional test case:
mkgeo_grid -t 80 -a -2 -b 2 -c -2 -d 2 > square2.geo
./convect square2.geo P1 > square2.branch
branch square2.branch -paraview
paraview &
The visualization and animation are similar to those of the head problem previously presented
in paragraph 6.1. Observe the rotating hill. The result is shown on Fig. 6.2. The error analysis
writes:
./convect_error < square2.branch > square2-cmp.branch
branch square2-cmp.branch -paraview
From the paraview menu, you can visualize simultaneously both the approximate solution and the
Lagrange interpolate of the exact one. Finally, the three-dimensional case:
mkgeo_grid -T 15 -a -2 -b 2 -c -2 -d 2 -f -2 -g 2 > cube2.geo
./convect cube2.geo P1 > cube2.branch
The visualization is similar to the two-dimensional case.92 Rheolef version 6.6 update 15 April 2014
6.3 The Navier-Stokes problem
Formulation
This longer example combines most functionalities presented in the previous examples.
Let us consider the Navier-Stokes problem for the driven cavity in Ω =]0, 1[d
, d = 2, 3. Let Re > 0
be the Reynolds number, and T > 0 a final time. The problem writes:
(NS): find u = (u0, . . . , ud−1) and p defined in Ω×]0, T[ such that:
Re
∂u
∂t + u.∇u
− div(2D(u)) + ∇p = 0 in Ω×]0, T[,
− div u = 0 in Ω×]0, T[,
u(t= 0) = 0 in Ω × {0, T},
u = (1, 0) on Γtop×]0, T[,
u = 0 on (Γleft ∪ Γright ∪ Γbottom)×]0, T[,
∂u0
∂n
=
∂u1
∂n
= u2 = 0 on (Γback ∪ Γfront)×]0, T[ when d = 3,
where D(u) = (∇u + ∇u
T
)/2. This nonlinear problem is the natural extension of the linear
Stokes problem, as presented in paragraph 6.3, page 92. The boundaries are represented on
Fig. 4.1, page 52.
Time approximation
Let ∆t > 0. Let us consider the following backward second order scheme, for all φ ∈ C
2
([0, T]) :
dφ
dt
(t) = 3φ(t) − 4φ(t − ∆t) + φ(t − 2∆t)
2∆t
+ O(∆t
2
)
The problem is approximated by the following second-order implicit scheme (BDF2):
Re3u
n+1 − 4u
n ◦ Xn + u
n−1 ◦ Xn−1
2∆t
− div(2D(u
n+1)) + ∇p
n+1 = 0 in Ω,
− div u
n+1 = 0 in Ω,
u
n+1 = (1, 0) on Γtop,
u
n+1 = 0 on Γleft ∪ Γright ∪ Γbottom,
∂un+1
0
∂n
=
∂un+1
1
∂n
= u
n+1
2 = 0 on Γback ∪ Γfront when d = 3,
where, following [10, 18]:
Xn
(x) = x − ∆t u
∗
(x)
Xn−1
(x) = x − 2∆t u
∗
(x)
u
∗ = 2u
n − u
n−1
It is a second order extension of the method previously introduced in paragraph 6.2 page 86. The
scheme defines a second order recurrence for the sequence (u
n)n>−1, that starts with u
−1 = u
0 = 0.
Variational formulation
The variational formulation of this problem expresses:
(NS)∆t: find u
n+1 ∈ V(1) and p
n+1 ∈ L
2
0
(Ω) such that:
a(u
n+1
, v) + b(v, pn+1) = m(f
n, v), ∀v ∈ V(0),
b(u
n+1, q) = 0, ∀q ∈ L
2
0
(Ω),Rheolef version 6.6 update 15 April 2014 93
where
f
n =
Re
2∆t
4 u
n
◦ Xn − u
n−1
◦ Xn
and
a(u, v) = 3Re
2∆t
Z
Ω
u.v dx +
Z
Ω
2D(u) : D(v) dx
and b(., .) and V(α) was already introduced in paragraph 4.4, page 62, while studying the Stokes
problem.
Space approximation
The Taylor-Hood [27] finite element approximation of this generalized Stokes problem was also
considered in paragraph 4.4, page 62. We introduce a mesh Th of Ω and the finite dimensional
spaces Xh, Vh(α) and Qh. The approximate problem writes:
(NS)∆t,h: find u
n+1
h ∈ Vh(1) and p
n+1 ∈ Qh such that:
a(u
n+1
h
, v) + b(v, pn+1
h
) = m(f
n
h
, v), ∀v ∈ Vh(0),
b(u
n+1
h
, q) = 0, ∀q ∈ Qh.
(6.1)
where
f
n
h =
Re
2∆t
4 u
n
h ◦ Xn − u
n−1
h
◦ Xn
The problem reduces to a sequence resolution of a generalized Stokes problems.94 Rheolef version 6.6 update 15 April 2014
Example file 6.5: navier_stokes_solve.icc
1 using namespace std ;
2 int navier_stokes_solve (
3 Float Re , Float delta_t , field l0h , field & uh , field & ph ,
4 size_t & max_iter , Float & tol , odiststream * p_derr =0) {
5 const space & Xh = uh . get_space ();
6 const space & Qh = ph . get_space ();
7 string label = " navier - stokes - " + Xh . get_geo (). name ();
8 quadrature_option_type qopt ;
9 qopt . set_family ( quadrature_option_type :: gauss_lobatto );
10 qopt . set_order ( Xh . degree ());
11 trial u ( Xh ) , p ( Qh );
12 test v ( Xh ) , q ( Qh );
13 form mp = integrate ( p *q , qopt );
14 form m = integrate ( dot (u , v ) , qopt );
15 form a = integrate (2* ddot (D( u ),D( v )) + 1.5*( Re / delta_t )* dot (u , v ) , qopt );
16 form b = integrate ( -div( u )* q , qopt );
17 solver sa ( a . uu ());
18 solver_abtb stokes ( a . uu () , b . uu () , mp . uu ());
19 if ( p_derr != 0) * p_derr << " [ " << label << " ] # n | du / dt |" << endl ;
20 field uh1 = uh ;
21 for ( size_t n = 0; true ; n ++) {
22 field uh2 = uh1 ;
23 uh1 = uh ;
24 field uh_star = 2.0* uh1 - uh2 ;
25 characteristic X1 ( - delta_t * uh_star );
26 characteristic X2 ( -2.0* delta_t * uh_star );
27 field l1h = integrate ( dot ( compose ( uh1 , X1 ) , v ), qopt );
28 field l2h = integrate ( dot ( compose ( uh2 , X2 ) , v ), qopt );
29 field lh = l0h + ( Re / delta_t )*(2* l1h - 0.5* l2h );
30 stokes . solve ( lh . u () - a . ub ()* uh . b () , -( b . ub ()* uh . b ()) ,
31 uh . set_u () , ph . set_u ());
32 field duh_dt = (3* uh - 4* uh1 + uh2 )/(2* delta_t );
33 Float residual = sqrt ( m ( duh_dt , duh_dt ));
34 if ( p_derr != 0) * p_derr << " [ " << label << " ] " << n << " " << residual << endl ;
35 if ( residual < tol ) {
36 tol = residual ;
37 max_iter = n ;
38 return 0;
39 }
40 if ( n == max_iter -1) {
41 tol = residual ;
42 return 1;
43 }
44 }
45 }
Comments
The navier_stokes_solve function is similar to the ‘stokes_cavity.cc’. It solves here a generalized
Stokes problem and manages a right-hand side fh:
characteristic X1 ( - delta_t * uh_star );
characteristic X2 ( -2.0* delta_t * uh_star );
field l1h = integrate ( compose ( uh1 , X1 )* v , qopt );
field l2h = integrate ( compose ( uh2 , X2 )* v , qopt );
field lh = l0h + ( Re / delta_t )*(2* l1h - 0.5* l2h );
This last computation is similar to those done in the ‘convect.cc’ example. The generalized
Stokes problem is solved by the solver_abtb class. The stopping criterion is related to the
stationary solution or the maximal iteration number.Rheolef version 6.6 update 15 April 2014 95
Example file 6.6: navier_stokes_cavity.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " navier_stokes_solve . icc "
5 # include " navier_stokes_criterion . icc "
6 # include " cavity . icc "
7 int main (int argc , char ** argv ) {
8 environment rheolef ( argc , argv );
9 if ( argc < 2) {
10 cerr << " usage : " << argv [0] << " < n_adapt > " << endl ;
11 exit (1);
12 }
13 geo omega ( argv [1]);
14 adapt_option_type options ;
15 Float Re = ( argc > 2) ? atof ( argv [2]) : 100;
16 options . err = ( argc > 3) ? atof ( argv [3]) : 1e -2;
17 size_t n_adapt = ( argc > 4) ? atoi ( argv [4]) : 5;
18 Float delta_t = 0.05;
19 options . hmin = 0.004;
20 options . hmax = 0.1;
21 space Xh = cavity_space ( omega , " P2 ");
22 space Qh ( omega , " P1 ");
23 field uh = cavity_field ( Xh , 1.0);
24 field ph ( Qh , 0);
25 field fh ( Xh , 0);
26 for ( size_t i = 0; true ; i ++) {
27 size_t max_iter = 1000;
28 Float tol = 1e -5;
29 navier_stokes_solve ( Re , delta_t , fh , uh , ph , max_iter , tol , & derr );
30 odiststream o ( omega . name () , " field ");
31 o << catchmark (" Re ") << Re << endl
32 << catchmark (" delta_t ") << delta_t << endl
33 << catchmark (" u ") << uh
34 << catchmark (" p ") << ph ;
35 o . close ();
36 if ( i >= n_adapt ) break ;
37 field ch = navier_stokes_criterion ( Re , uh );
38 omega = adapt ( ch , options );
39 o . open ( omega . name () , " geo ");
40 o << omega ;
41 o . close ();
42 Xh = cavity_space ( omega , " P2 ");
43 Qh = space ( omega , " P1 ");
44 uh = cavity_field ( Xh , 1.0);
45 ph = field ( Qh , 0);
46 fh = field ( Xh , 0);
47 }
48 }
Example file 6.7: navier_stokes_criterion.icc
1 field navier_stokes_criterion ( Float Re , const field & uh ) {
2 space T0h ( uh . get_geo () , " P1d ");
3 return interpolate ( T0h , sqrt ( Re * norm2 ( uh ) + 4* norm2 (D( uh ))));
4 }
Comments
The code performs a computation by using adaptive mesh refinement, in order to capture recirculation
zones. The adapt_option_type declaration is used by rheolef to send options to the
mesh generator. The code reuse the file ‘cavity.icc’ introduced page 63. This file contains two
functions that defines boundary conditions associated to the cavity driven problem.
The criteria function computes the adaptive mesh refinement criteria:
ch = (Re|uh|
2 + 2|D(uh)|
2
)
1/296 Rheolef version 6.6 update 15 April 2014
The criteria function is similar to those presented in the ‘embankment_adapt.cc’ example.
How to run the program
Re = 100: 4804 elements, 2552 vertices ψmax = 9.5 × 10−6
, ψmin = −0.103
Re = 400: 5233 elements, 2768 vertices ψmax = 6.4 × 10−4
, ψmin = −0.111
Figure 6.4: Meshes and stream functions associated to the solution of the Navier-Stokes equations
for Re = 100 (top) and Re = 400 (bottom).Rheolef version 6.6 update 15 April 2014 97
Re = 1000: 5873 elements, 3106 vertices ψmax = 1.64 × 10−3
, ψmin = −0.117
Figure 6.5: Meshes and stream functions associated to the solution of the Navier-Stokes equations
for Re = 1000.
The mesh loop adaptation is initiated from a bamg mesh (see also appendix B.1).
bamg -g square.bamgcad -o square.bamg
bamg2geo square.bamg square.dmn > square.geo
Then, compile and run the Navier-Stokes solver for the driven cavity for Re = 100:
make navier_stokes_cavity
./navier_stokes_cavity square.geo 100
The program performs a computation with Re = 100. By default the time step is ∆t = 0.05
and the computation loops for five mesh adaptations. At each time step, the program prints an
approximation of the time derivative, and stops when a stationary solution is reached. Then, we
visualize the ‘square-5.geo’ adapted mesh and its associated solution:
geo square-5.geo
field square-5.field.gz -velocity -scale 4 -paraview
Notice the -scale option that applies a multiplicative factor to the arrow length when plotting.
The representation of the stream function writes:
make streamf_cavity
zcat square-5.field.gz | ./streamf_cavity | field -bw -n-iso-negative 10 -
The programs ‘streamf_cavity.cc’, already introduced page 68, is here reused. The last options
of the field program draws isocontours of the stream function using lines, as shown on Fig. 6.4.
The zero isovalue separates the main flow from recirculations, located in corners at the bottom of
the cavity.
For Re = 400 and 1000 the computation writes:
./navier_stokes_cavity square.geo 400
./navier_stokes_cavity square.geo 100098 Rheolef version 6.6 update 15 April 2014
0
0.5
1
-0.5 0 0.5 1
u0(0.5, x1)
x1
Re = 100
Comparison: Re = 100
Re = 400
Comparison: Re = 400
Re = 1000
Comparison: Re = 1000
-0.5
0
0.5
0 0.5 1
x0
u1(x0, 0.5)
Re = 100
Re = 100, comparison
Re = 400
Re = 400, comparison
Re = 1000
Re = 1000, comparsion
Figure 6.6: Navier-Stokes: velocity profiles along lines passing thought the center of the cavity,
compared with data from [22]: (a) u0 along the vertical line; (b) u1 along the horizontal line line.
The visualization of the cut of the horizontal velocity along the vertical median line writes:
field square-5.field.gz -comp 0 -cut -normal -1 0 -origin 0.5 0
field square-5.field.gz -comp 1 -cut -normal 0 1 -origin 0 0.5
Fig. 6.6 compare the cuts with data from [22], table 1 and 2 (see also [24]). Observe that the
solution is in good agreement with these previous computations.
Re xc yc −ψmin ψmax
100 present 0.613 0.738 0.103 9.5 × 10−6
Labeur and Wells [31] 0.608 0.737 0.104 -
Donea and Huerta [16] 0.62 0.74 0.103 -
400 present 0.554 0.607 0.111 5.6 × 10−4
Labeur and Wells [31] 0.557 0.611 0.115 -
Donea and Huerta [16] 0.568 0.606 0.110 -
1000 present 0.532 0.569 0.117 1.6 × 10−3
Labeur and Wells [31] 0.524 0.560 0.121 -
Donea and Huerta [16] 0.540 0.573 0.110 -
Figure 6.7: Cavity flow: primary vortex position and stream function value.
Finally, table 6.7 compares the primary vortex position and its associated stream function value.
Notice also the good agreement with previous simulations. The stream function extremal values
are obtained by:
zcat square-5.field.gz | ./streamf_cavity | field -min -
zcat square-5.field.gz | ./streamf_cavity | field -max -
The maximal value has not yet been communicated to our knowledge and is provided in table 6.7
for cross validation purpose. The small program that computes the primary vortex position is
showed below.Rheolef version 6.6 update 15 April 2014 99
make vortex_position
zcat square-5.field.gz | ./streamf_cavity | ./vortex_position
Example file 6.8: vortex_position.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 int main (int argc , char ** argv ) {
4 environment rheolef ( argc , argv );
5 check_macro ( communicator (). size () == 1 , " please , use sequentially ");
6 field psi_h ;
7 din >> psi_h ;
8 size_t idof_min = 0;
9 Float psi_min = std :: numeric_limits :: max ();
10 for ( size_t idof = 0 , ndof = psi_h . ndof (); idof < ndof ; idof ++) {
11 if ( psi_h . dof ( idof ) >= psi_min ) continue ;
12 psi_min = psi_h . dof ( idof );
13 idof_min = idof ;
14 }
15 const array & xdof = psi_h . get_space (). get_xdofs ();
16 point xmin = xdof [ idof_min ];
17 dout << " xc \ t \ tyc \ t \ tpsi " << std :: endl
18 << xmin [0] << " \t " << xmin [1] << " \ t " << psi_min << std :: endl ;
19 }
For higher Reynolds number, Shen [53] showed in 1991 that the flow converges to a stationary state
for Reynolds numbers up to 10 000; for Reynolds numbers larger than a critical value 10 000 <
Re1 < 10 500 and less than another critical value 15 000 < Re2 < 16 000, these authors founded
that the flow becomes periodic in time which indicates a Hopf bifurcation; the flow loses time
periodicity for Re ≥ Re2. In 1998, Ould Salihi [38] founded a loss of stationarity between 10 000
and 20 000. In 2002, Auteri et al. [7] estimated the critical value for the apparition of the first
instability to Re1 ≈ 8018. In 2005, Erturk et al. [17] computed steady driven cavity solutions up
to Re 6 21 000. Also in 2005, this result was infirmed by [19]: these authors estimated Re1 close
to 8000, in agreement with [7]. The 3D driven cavity has been investigated in [33] by the method
of characteristic (see also [32] for 3D driven cavity computations). In conclusion, the exploration
of the driven cavity at large Reynolds number is a fundamental challenge in computational fluid
dynamics.100 Rheolef version 6.6 update 15 April 2014Part III
Advanced and highly nonlinear
problems
101Chapter 7
Equation defined on a surface
This chapter deals with equations defined on a closed hypersurface. We present three different
numerical methods: the direct resolution of the problem on an explicit surface mesh generated
independently of Rheolef, the direct resolution on a surface mesh generated by Rheolef from a
volume mesh, and finally a level set type method based on a volume mesh in an h-narrow band
containing the surface. This last method allows to define hybrid operators between surface and
volume-based finite element fields. These methods are demonstrated on two model problems and
two different surfaces.
Let us consider a closed surface Γ ∈ R
d
, d = 2 or 3 and Γ is a connected C
2
surface of dimension
d − 1 with ∂Γ = 0. We first consider the following problem:
(P1) find u, defined on Γ such that:
u − ∆su = f on Γ (7.1)
where f ∈ L
2
(Γ). For all function u defined on Γ, ∆s denotes the Laplace-Beltrami operator:
∆su = divs(∇su)
where ∇s and divs are the tangential derivative and the surface divergence along Γ, defined
respectively, for all scalar field ϕ and vector field v by:
∇sϕ = (I − n ⊗ n) ∇ϕ
divs v = (I − n ⊗ n) : ∇v
Here, n denotes a unit normal on Γ.
We also consider the following variant of this problem:
(P2) find u, defined on Γ such that:
−∆su = f on Γ (7.2)
This second problem is similar to the first one: the Helmholtz operator I − ∆s has been replaced
by the Laplace-Beltrami one −∆s. In that case, the solution is defined up to a constant: if u is
a solution, then u + c is also a solution for any constant c ∈ R. Thus, we refers to (P1) as the
Helmholtz-Beltrami problem and to (P2) as the Laplace-Beltrami one.
7.1 Approximation on an explicit surface mesh
The Helmholtz-Beltrami problem
Tanks to the surface Green formula (see appendix A.3), the variational formulation of problem
(P1) writes:
103104 Rheolef version 6.6 update 15 April 2014
(V F1): find u ∈ H1
(Γ) such that:
a(u, v) = l(v), ∀v ∈ H1
(Γ)
where for all u, v ∈ H1
(Γ),
a(u, v) = Z
Γ
(u v + ∇su.∇sv) ds
l(v) = Z
Γ
f v ds
Let k > 1 and consider a k-th order curved surface finite element mesh Γh of Γ. We define the
space Wh:
Wh =
vh ∈ H1
(Γh); v|S ∈ Pk, ∀S ∈ Γh
The approximate problem writes:
(V F1)h: find uh ∈ Wh such that:
a(uh, vh) = l(vh), ∀vh ∈ Wh
Example file 7.1: helmholtz_s.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " sphere . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo gamma ( argv [1]);
8 size_t d = gamma . dimension ();
9 space Wh ( gamma , argv [2]);
10 trial u ( Wh ); test v ( Wh );
11 form a = integrate ( u * v + dot ( grad_s ( u ) , grad_s ( v )));
12 field lh = integrate ( f (d )* v );
13 field uh ( Wh );
14 solver sa ( a . uu ());
15 uh . set_u () = sa . solve ( lh . u () - a . ub ()* uh . b ());
16 dout << uh ;
17 }
Comments
The problem involves the Helmholtz operator and thus, the code is similar to ‘neumann-nh.cc’
presented page 36. Let us comments the only differences:
form a = integrate ( u * v + dot ( grad_s ( u ) , grad_s ( v )));
The form refers to the grad_s operator instead of the grad one, since only the coordinates related
to the surface are involved.
field lh = integrate ( f (d )* v );
The right-hand-side does not involve any boundary term, since the surface Γ is closed: the boundary
domain ∂Γ = ∅. As test problem, the surface Γ is the unit circle when d = 2 and the unit
sphere when d = 3. The data f has been chosen as in [14, p. 17]. This choice is convenient since
the exact solution is known. Recall that the spherical coordinates (ρ, θ, φ) are defined from the
artesian ones (x0, x1, x2) by:
ρ =
q
x
2
0 + x
2
1 + x
2
2
, φ = arccos (x2/ρ), θ =
arccos
x0/
p
x
2
0 + x
2
1
when x1 > 0
2π − arccos
x0/
p
x
2
0 + x
2
1
otherwiseRheolef version 6.6 update 15 April 2014 105
Example file 7.2: sphere.icc
1 struct p : field_functor
{
2 Float operator () ( const point & x ) const {
3 if ( d == 2) return 26*( pow ( x [0] ,5) - 10* pow ( x [0] ,3)* sqr( x [1])
4 + 5* x [0]* pow ( x [1] ,4));
5 else return 3* sqr( x [0])* x [1] - pow ( x [1] ,3);
6 }
7 p ( size_t d1 ) : d ( d1 ) {}
8 protected : size_t d ;
9 };
10 struct f : field_functor {
11 Float operator () ( const point & x ) const {
12 if ( d == 2) return _p ( x )/ pow ( norm ( x ) ,5);
13 else return alpha * _p ( x );
14 }
15 f ( size_t d1 ) : d ( d1 ) , _p ( d1 ) {
16 Float pi = acos ( Float ( -1));
17 alpha = -(13./8.)* sqrt (35./ pi );
18 }
19 protected : size_t d ; p _p ; Float alpha ;
20 };
21 struct u_exact : field_functor < u_exact ,Float > {
22 Float operator () ( const point & x ) const {
23 if ( d == 2) return _f ( x )/(25+ sqr( norm ( x )));
24 else return sqr ( norm ( x ))/(12+ sqr( norm ( x )))* _f ( x );
25 }
26 u_exact ( size_t d1 ) : d ( d1 ) , _f ( d1 ) {}
27 protected : size_t d ; f _f ;
28 };
29 Float phi ( const point & x ) { return norm ( x ) - 1; }
How to run the program
The program compile as usual:
make helmholtz_s
A mesh of a circle is generated by:
mkgeo_ball -s -e 100 > circle.geo
geo circle
The mkgeo_ball is a convenient script that generates a mesh with the gmsh mesh generator. Then,
the problem resolution writes:
./helmholtz_s circle P1 > circle.field
field circle.field
field circle.field -elevation
The tridimensional case is similar:
mkgeo_ball -s -t 10 > sphere.geo
geo sphere.geo -stereo
./helmholtz_s sphere.geo P1 > sphere.field
field sphere.field -paraview
field sphere.field -stereo -gray
The solution is represented on Fig .7.1.left.106 Rheolef version 6.6 update 15 April 2014
Figure 7.1: Helmholtz-Beltrami problem: high-order curved surface mesh and its corresponding
isoparametric solution: (top) order = 1; (bottom) order = 3.
Higher-order isoparametric finite elements can be considered for the curved geometry:
mkgeo_ball -s -e 30 -order 3 > circle-P3.geo
geo circle-P3.geo -subdivide 10
Observe the curved edges (see Fig .7.1). The -subdivide option allows a graphical representation
of the curved edges by subdividing each edge in ten linear parts, since graphical softwares are not
yet able to represent curved elements. The computation with the P3 isoparametric approximation
writes:
./helmholtz_s circle-P3 P3 > circle-P3.field
field circle-P3.field -elevation
Notice that both the curved geometry and the finite element are second order. The tridimensional
counterpart writes simply:
mkgeo_ball -s -t 10 -order 3 > sphere-P3.geo
geo sphere-P3.geo
./helmholtz_s sphere-P3 P3 > sphere-P3.fieldRheolef version 6.6 update 15 April 2014 107
field sphere-P3.field -paraview
field sphere-P3.field -stereo -gray
The solution is represented on Fig .7.1).right-bottom. The graphical representation is not yet able
to represent the high-order approximation: each elements is subdivided and a piecewise linear
representation is used in each sub-elements.
Since the exact solution is known, the error can be computed: this is done by the program
helmholtz_s_error.cc. This file is not presented here, as it is similar to some others examples,
but can be founded in the Rheolef example directory. Figure 7.2 plots the error in various norms
versus element size for different isoparametric approximations.108 Rheolef version 6.6 update 15 April 2014
10−8
10−6
10−4
10−2
10−2 10−1
h
kuh − πh(u)k0,2,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
10−8
10−6
10−4
10−2
10−2 10−1
h
kuh − πh(u)k0,∞,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
10−8
10−6
10−4
10−2
100
10−2 10−1
h
|uh − πh(u)|1,2,Ω
1 = k
2
3
k = 1
k = 2
k = 3
Figure 7.2: Curved non-polynomial surface: error analysis in L
2
, L∞ and H1 norms.Rheolef version 6.6 update 15 April 2014 109
The Laplace-Beltrami problem
This problem has been introduced in (7.2), page 103. While the treatment of the HelmholtzBeltrami
problem was similar to the Helmholtz problem with Neumann boundary conditions, here,
the treatment of the Laplace-Beltrami problem is similar to the Laplace problem with Neumann
boundary conditions: see section 2.4, page 39. Notice that for both problems, the solution is
defined up to a constant. Thus, the linear problem has a singular matrix. The ‘laplace_s.cc’
code is similar to the ‘neumann-laplace.cc’ one, as presented in section 2.4. The only change
lies one the definition of the right-hand side.
Example file 7.3: laplace_s.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " torus . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo gamma ( argv [1]);
8 size_t d = gamma . dimension ();
9 space Wh ( gamma , argv [2]);
10 trial u ( Wh ); test v ( Wh );
11 form m = integrate ( u * v );
12 form a = integrate ( dot ( grad_s ( u ), grad_s ( v )));
13 field b = m * field ( Wh ,1);
14 field lh = integrate ( f (d )* v );
15 csr A = {{ a . uu () , b . u ()} ,
16 { trans ( b . u ()) , 0 }};
17 vec B = { lh . u () , 0 };
18 solver sa ( A );
19 vec U = sa . solve ( B );
20 field uh ( Wh );
21 uh . set_u () = U [ range (0 , uh . u (). size ())];
22 dout << uh ;
23 }110 Rheolef version 6.6 update 15 April 2014
Example file 7.4: torus.icc
1 static const Float R = 1;
2 static const Float r = 0.6;
3 Float phi ( const point & x ) {
4 return sqr( sqrt (sqr (x [0])+ sqr( x [1])) - sqr( R )) + sqr( x [2]) - sqr( r );
5 }
6 void get_torus_coordinates ( const point & x ,
7 Float & rho , Float & theta , Float & phi ) {
8 static const Float pi = acos ( Float ( -1));
9 rho = sqrt (sqr( x [2]) + sqr( sqrt (sqr ( x [0]) + sqr( x [1])) - sqr( R )));
10 phi = atan2 ( x [1] , x [0]);
11 theta = atan2 ( x [2] , sqrt (sqr( x [0]) + sqr ( x [1])) - R );
12 }
13 struct u_exact : field_functor < u_exact ,Float > {
14 Float operator () ( const point & x ) const {
15 Float rho , theta , phi ;
16 get_torus_coordinates (x , rho , theta , phi );
17 return sin (3* phi )* cos (3* theta + phi );
18 }
19 u_exact ( size_t d =3) {}
20 };
21 struct f : field_functor {
22 Float operator () ( const point & x ) const {
23 Float rho , theta , phi ;
24 get_torus_coordinates (x , rho , theta , phi );
25 Float fx = (9* sin (3* phi )* cos (3* theta + phi ))/ sqr (r )
26 - ( -10* sin (3* phi )* cos (3* theta + phi ) - 6* cos (3* phi )* sin (3* theta + phi ))
27 /sqr( R + r * cos ( theta ))
28 - (3* sin ( theta )* sin (3* phi )* sin (3* theta + phi ))
29 /( r *( R + r * cos ( theta )));
30 return fx ;
31 }
32 f ( size_t d =3) {}
33 };
As test problem, the surface Γ is the a torus when d = 3. The data f has been chosen as
in [37, p. 3355]. This choice is convenient since the exact solution is known. Let R and r denotes
the large and small torus radii, respectively. The torus coordinates (ρ, θ, φ) are defined linked to
the Cartesian ones by:
x0
x1
x2
= R
cos(φ)
sin(φ)
0
+ ρ
cos(φ) cos(θ)
sin(φ) cos(θ)
sin(θ)
Here ρ is the distance from the point to the circle in the x0x1 plane around 0 with radius R,
θ is the angle from the positive (x0, x1, 0) to x0 and φ is the angle from the positive x0 axis to
(x0, x1, 0).Rheolef version 6.6 update 15 April 2014 111
How to run the program ?
Figure 7.3: Laplace-Beltrami problem on a torus: high-order curved surface mesh and its corresponding
isoparametric solution: (top) order = 1; (bottom) order = 2.
The surface mesh of the torus is generated by:
gmsh -2 torus.mshcad -o torus.msh
msh2geo torus.msh > torus.geo
geo torus.geo -stereo
The ‘torus.mshcad’ is not presented here: it can be founded in the Rheolef example directory.
Then, the computation and visualization writes:
make laplace_s
./laplace_s torus.geo P1 > torus.field
field torus.field -paraview
field torus.field -stereo -gray
For a higher-order approximation:
gmsh -2 -order 2 torus.mshcad -o torus-P2.msh
msh2geo torus-P2.msh > torus-P2.geo
geo torus-P2.geo
./laplace_s torus-P2.geo P2 > torus-P2.field
field torus-P2.field -paraview
The solution is represented on Fig. 7.3. By editing ‘torus.mshcad’ and changing the density of
discretization, we can improve the approximate solution and converge to the exact solution. Due
to a bug [52] in the current gmsh version 2.5.1 the convergence is not optimal O(h
k
) for higher
values of k.112 Rheolef version 6.6 update 15 April 2014
7.2 Building a surface mesh from a level set function
The previous method is limited to not-too-complex surface Γ, that can be described by a regular
finite element surface mesh Γh. When the surface change, as in a time-dependent process, complex
change of topology often occurs and the mesh Γh can degenerate or be too complex to be efficiently
meshed. In that case, the surface is described implicitly as the zero isosurface, or zero level set, of
a function:
Γ = {x ∈ Λ; φ(x) = 0}
where Λ ⊂ R
d
is a bounding box of the surface Γ.
The following code automatically generates the mesh Γh of the surface described by the zero
isosurface of a discrete φh ∈ Xh level set function:
Γh = {x ∈ Λ; φh(x) = 0}
where Xh is a piecewise affine functional space over a mesh Th of Λ:
Xh = {ϕ ∈ L
2
(Λ) ∩ C
0
(Λ); ϕ/K ∈ P1, ∀K ∈ Th}
The polynomial approximation is actually limited here to first order: building higher order curved
finite element surface meshes from a level set function is planed for the future versions of Rheolef.
Finally, a computation, as performed in the previous paragraph can be done using Γh. We also
point out the limitations of this approach.
Example file 7.5: level_set_sphere.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " sphere . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo lambda ( argv [1]);
8 level_set_option_type opts ;
9 opts . split_to_triangle
10 = ( argc > 2 && argv [2] == std :: string (" - tq ")) ? false : true ;
11 space Xh ( lambda , " P1 ");
12 field phi_h = interpolate (Xh , phi );
13 geo gamma = level_set ( phi_h , opts );
14 dout << gamma ;
15 }
Comments
All the difficult work of building the intersection mesh Γh, defined as the zero level set of the φh
function, is performed by the level_set function:
geo gamma = level_set ( phi_h , opts );
When d = 3, intersected tetrahedra leads to either triangular or quadrangular faces. By default,
quadrangular faces are split into two triangles. An optional -tq program flag allows to conserve
quadrangles in the surface mesh: it set the split_to_triangle optional field to false.
How to run the program ?
After the compilation, generates the mesh of a bounding box Λ = [−2, 2]d of the surface and run
the program:Rheolef version 6.6 update 15 April 2014 113
make level_set_sphere
mkgeo_grid -t 20 -a -2 -b 2 -c -2 -d 2 > square2.geo
./level_set_sphere square2.geo > circle.geo
geo circle.geo -stereo
The computation of the previous paragraph can be reused:
./helmholtz_s circle.geo P1 | field -
Notice that, while the bounding box mesh was uniform, the intersected mesh could present arbitrarily
small edge length (see also Fig. 7.4):
geo -min-element-measure circle.geo
geo -max-element-measure circle.geo
Let us turn to the d = 3 case:
mkgeo_grid -T 20 -a -2 -b 2 -c -2 -d 2 -f -2 -g 2 > cube2.geo
./level_set_sphere cube2.geo | geo -upgrade - > sphere.geo
geo sphere.geo -stereo
./helmholtz_s sphere.geo P1 | field -paraview -
This approach can be extended to the Laplace-Beltrami problem on a torus:
sed -e ’s/sphere/torus/’ < level_set_sphere.cc > level_set_torus.cc
make level_set_torus
./level_set_torus cube2.geo | geo -upgrade - > torus.geo
geo torus.geo -stereo
./laplace_s torus.geo P1 | field -paraview -
While the bounding box mesh was uniform, the triangular elements obtained by intersecting the
3D bounding box mesh with the level set function can present arbitrarily irregular sizes nd shapes
(see also Fig. 7.4):
geo -min-element-measure -max-element-measure sphere.geo
geo -min-element-measure -max-element-measure torus.geo
Thus, there is no theoretical guaranties for the finite element method to converge on these irregular
families of meshes, despite, most of the time, the computations run well. This is the major
drawback of this method.114 Rheolef version 6.6 update 15 April 2014
Figure 7.4: Building an explicit surface mesh from level set: (top) circle; (center) sphere; (bottom)
torus.Rheolef version 6.6 update 15 April 2014 115
7.3 The banded level set method
The banded level set method presents the advantages of the two previous methods without their
drawback: it applies to very general geometries, as described by a level set funtion, and has
theoretical fundations, as usual finite element methods. The previous drawback of the intersection
mesh can be circumvented by enlarging the surface Γh to a band βh containing all the intersected
elements of Th (see [2, 15, 37]):
βh = {K ∈ Th; K ∩ Γh 6= ∅}
Then, we introduce Bh the piecewise affine functional space over βh:
Bh = {v ∈ L
2
(βh) ∩ C
0
(βh); v/K ∈ P1, ∀K ∈ Th}
The problem is extended from Γh to βh as:
(V F)h: find uh ∈ Bh such that:
a(uh, vh) = l(vh), ∀vh ∈ Bh
where, for all u, v ∈ Bh,
a(u, v) = Z
Γh
(u v + ∇su.∇sv) ds
l(v) = Z
Γh
f v ds
for all uh, vh ∈ Bh. Notice that while uh and vh are defined over βh, the summations in the
variational formulations are restricted only to Γh ⊂ βh.
Example file 7.6: helmholtz_band_iterative.cc
1 # include " rheolef . h "
2 using namespace std ;
3 using namespace rheolef ;
4 # include " sphere . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo lambda ( argv [1]);
8 size_t d = lambda . dimension ();
9 space Xh ( lambda , " P1 ");
10 field phi_h = interpolate (Xh , phi );
11 band gamma_h ( phi_h );
12 space Bh ( gamma_h . band () , " P1 ");
13 trial u ( Bh ); test v ( Bh );
14 form a = integrate ( gamma_h , u * v + dot ( grad_s ( u ) , grad_s ( v )));
15 field lh = integrate ( gamma_h , f ( d )* v );
16 field uh ( Bh ,0);
17 size_t max_iter = 10000;
18 Float tol = 1e -10;
19 pminres ( a . uu () , uh . set_u () , lh . u () , eye () , max_iter , tol , & derr );
20 dout << catchmark (" phi ") << phi_h
21 << catchmark (" u ") << uh ;
22 }
Comments
The band is build directly from the level set function as:
band gamma_h ( phi_h );
The band structure is a small class that groups the surface mesh Γh, available as
gamma_h.level_set(), and the βh mesh, available as gamma_h.band(). It also manages some116 Rheolef version 6.6 update 15 April 2014
correspondance between both meshes. Then, the space of piecewise affine functions over the band
is introduced:
space Bh ( gamma_h . band () , " P1 ");
Next, two forms are computed by using the integrate function, with the band gamma_h as a
domain-like argument:
form m = integrate ( gamma_h , u * v );
form a = integrate ( gamma_h , dot ( grad_s ( u ) , grad_s ( v )));
The right-hand side also admits the gamma_h argument:
field lh = integrate ( gamma_h , f ( d )* v );
Recall that summations for both forms and right-hand side will be performed on Γh, represented
by gamma_h.level_set(), while the approximate functional space is Bh. Due to this summation
on Γh instead of βh, the matrix of the system is singular [2, 36, 37] and the MINRES algorithm
has been chosen to solve the linear system:
pminres ( a . uu () , uh . set_u () , lh . u () , eye () , max_iter , tol , & derr );
The eye() argument represents here the identity preconditioner, i.e. no preconditioner at all. It
has few influence of the convergence properties of the matrix and could be replaced by another
simple one: the diagonal of the matrix diag(a.uu()) without sensible gain of performance:
pminres ( a . uu () , uh . set_u () , lh . u () , diag ( a . uu ()) , max_iter , tol , & derr );
How to run the program
The compilation and run writes:
make helmholtz_band_iterative
mkgeo_grid -T 20 -a -2 -b 2 -c -2 -d 2 -f -2 -g 2 > cube-20.geo
./helmholtz_band_iterative cube-20.geo > sphere-band.field
The run generates also two meshes (see Fig. 7.5): the intersection mesh and the band around it.
The solution is here defined on this band: this extension has no interpretation in terms of the
initial problem and can be restricted to the intersection mesh for visualization purpose:
make proj_band
./proj_band < sphere-band.field | field -paraview -
The ‘proj_band.cc’ is presented below. The run generates also the Γh mesh (see Fig. 7.5), required
for the visualization. The two-dimensional case is obtained simply by replacing the 3D bounding
box by a 2D one:
mkgeo_grid -t 20 -a -2 -b 2 -c -2 -d 2 > square-20.geo
./helmholtz_band_iterative square-20.geo > circle-band.field
./proj_band < circle-band.field | field -paraview -
./proj_band < circle-band.field | field -paraview -elevation -bw -stereoRheolef version 6.6 update 15 April 2014 117
Example file 7.7: proj_band.cc
1 # include " rheolef . h "
2 using namespace std ;
3 using namespace rheolef ;
4 int main (int argc , char ** argv ) {
5 environment rheolef ( argc , argv );
6 field phi_h ;
7 din >> catchmark (" phi ") >> phi_h ;
8 const space & Xh = phi_h . get_space ();
9 band gamma_h ( phi_h );
10 space Bh ( gamma_h . band () , " P1 ");
11 field uh ( Bh );
12 din >> catchmark (" u ") >> uh ;
13 space Wh ( gamma_h . level_set () , " P1 ");
14 gamma_h . level_set (). save ();
15 dout << interpolate ( Wh , uh );
16 }
7.4 A direct solver for the banded level set method
The iterative algorithm previously used for solving the linear system is not optimal: for 3D
problems on a surface, the bidimensionnal connectivity of the sparse matrix suggests that a direct
sparse factorisation would be much more efficent.
Recall that φh = 0 on Γh. Thus, if uh ∈ Bh is solution of the problem, then uh + αφh|βh ∈ Bh
is also solution for any α ∈ R, where φh|βh ∈ Bh denotes the restriction of the level set function
φh ∈ Xh on the band βh. Thus there is multiplicity of solutions and the matrix of the problem
is singular. The direct resolution is still possible on a modified linear system with additional
constraints in order to recover the unicity of the solution. We impose the constraint that the
solution uh should be othogonal to φh|βh ∈ Bh. In some special cases, the band is composed of
several connected components (see Fig. 7.6): this appends when a vertex of the bounding box
mesh belongs to Γh. In that case, the constaint sould be expressed on each connected component.
Fig. 7.6 shows also the case when a full side of an element is included in Γh: such an element of
the band is called isolated.118 Rheolef version 6.6 update 15 April 2014
Example file 7.8: helmholtz_band.cc
1 # include " rheolef . h "
2 using namespace std ;
3 using namespace rheolef ;
4 # include " sphere . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo lambda ( argv [1]);
8 size_t d = lambda . dimension ();
9 space Xh ( lambda , " P1 ");
10 field phi_h = interpolate (Xh , phi );
11 band gamma_h ( phi_h );
12 field phi_h_band = phi_h [ gamma_h . band ()];
13 space Bh ( gamma_h . band () , " P1 ");
14 Bh . block (" isolated ");
15 Bh . unblock (" zero ");
16 trial u ( Bh ); test v ( Bh );
17 form a = integrate ( gamma_h , u * v + dot ( grad_s ( u ) , grad_s ( v )));
18 field lh = integrate ( gamma_h , f ( d )* v );
19 vector > b ( gamma_h . n_connected_component ());
20 vector z ( gamma_h . n_connected_component () , 0);
21 for ( size_t i = 0; i < b . size (); i ++) {
22 const domain & cci = gamma_h . band () [" cc "+ itos ( i )];
23 field phi_h_cci ( Bh , 0);
24 phi_h_cci [ cci ] = phi_h_band [ cci ];
25 b [ i ] = phi_h_cci . u ();
26 }
27 csr A = { { a . uu () , trans ( b )} ,
28 { b , 0 } };
29 vec F = { lh . u () , z };
30 A . set_symmetry ( true );
31 solver sa = ldlt ( A );
32 vec U = sa . solve ( F );
33 field uh ( Bh ,0);
34 uh . set_u () = U [ range (0 , uh . u (). size ())];
35 dout << catchmark (" phi ") << phi_h
36 << catchmark (" u ") << uh ;
37 }
Comments
The management of the special sides and vertices that are fully included in Γh is perfomed by:
Bh . block (" isolated ");
Bh . unblock (" zero ");
The addition of linear constraints is similar to the ‘neumann-laplace.cc’ code, as presented in
section 2.4:
csr A = { { a . uu () , trans ( b )} ,
{ b , 0 } };
Here b is a vector >, i.e. a vector of linear constraints, one per connected component
of the band βh.
How to run the program
The commands are similar to the previous iterative implementation, just replacing
helmholtz_band_iterative by helmholtz_band.
This approach could be also adapted to the Laplace-Beltrami problem on the torus.Rheolef version 6.6 update 15 April 2014 119
Example file 7.9: laplace_band.cc
1 # include " rheolef . h "
2 using namespace std ;
3 using namespace rheolef ;
4 # include " torus . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo lambda ( argv [1]);
8 size_t d = lambda . dimension ();
9 space Xh ( lambda , " P1 ");
10 field phi_h = interpolate (Xh , phi );
11 band gamma_h ( phi_h );
12 field phi_h_band = phi_h [ gamma_h . band ()];
13 space Bh ( gamma_h . band () , " P1 ");
14 Bh . block (" isolated ");
15 Bh . unblock (" zero ");
16 trial u ( Bh ); test v ( Bh );
17 form m = integrate ( gamma_h , u * v );
18 form a = integrate ( gamma_h , dot ( grad_s ( u ) , grad_s ( v )));
19 field lh = integrate ( gamma_h , f ( d )* v );
20 vector > b ( gamma_h . n_connected_component ());
21 vector z ( gamma_h . n_connected_component () , 0);
22 for ( size_t i = 0; i < b . size (); i ++) {
23 const domain & cci = gamma_h . band () [" cc "+ itos ( i )];
24 field phi_h_cci ( Bh , 0);
25 phi_h_cci [ cci ] = phi_h_band [ cci ];
26 b [ i ] = phi_h_cci . u ();
27 }
28 field c = m * field ( Bh ,1);
29 csr A = { { a . uu () , trans ( b ) , c . u ()} ,
30 { b , 0 , 0 } ,
31 { trans ( c. u ()) , 0 , 0 } };
32 vec F = { lh . u () , z , 0};
33 A . set_symmetry ( true );
34 solver sa = ldlt ( A );
35 vec U = sa . solve ( F );
36 field uh ( Bh ,0);
37 uh . set_u () = U [ range (0 , uh . u (). size ())];
38 dout << catchmark (" phi ") << phi_h
39 << catchmark (" u ") << uh ;
40 }
Comments
The code is simlar to the previous one helmholtz_band.cc. Since the solution is defined up to a
constant, an additional linear constraint has to be inserted:
Z
Γh
uh dx = 0
This writes:
field c = m * field ( Bh ,1);
csr A = { { a . uu () , trans ( b ) , c . u ()} ,
{ b , 0 , 0 } ,
{ trans ( c. u ()) , 0 , 0 } };
How to run the program
make laplace_band
mkgeo_grid -T 20 -a -2 -b 2 -c -2 -d 2 -f -2 -g 2 > cube-20.geo
./laplace_band cube-20.geo > torus-band.field
./proj_band < torus-band.field | field -stereo -120 Rheolef version 6.6 update 15 April 2014
The solution is represented on Fig. 7.5.bottom.Rheolef version 6.6 update 15 April 2014 121
Figure 7.5: The banded level set method: (top) circle; (center) sphere; (bottom) torus.122 Rheolef version 6.6 update 15 April 2014
cc0
cc1
cc2
cc3
cc4
cc5
cc6
cc7
cc8
cc9
isolated
zero
Figure 7.6: The banded level set method: the band is composed of several connected components.Chapter 8
The highly nonlinear p-laplacian
problem
8.1 Problem statement
Let us consider the classical p-Laplacian problem with homogeneous Dirichlet boundary conditions
in a domain bounded Ω ⊂ R
d
, d = 1, 2, 3:
(P): find u, defined in Ω such that:
−div
η
|∇u|
2
∇u
= f in Ω
u = 0 on ∂Ω
where η : z ∈ R
+ 7−→ z
p−2
2 ∈ R
+. Several variants of the η can be considered: see [49] for practical
and usefull examples. Here p ∈]1, +∞[ and f are known. For the computational examples, we
choose f = 1. When p = 2, this problem reduces to the linear Poisson problem with homogeneous
Dirichlet boundary conditions. Otherwise, for any p > 1, the nonlinear problem is equivalent to
the following minimization problem:
(MP): find u ∈ W
1,p
0
(Ω) such that:
u = arg min
v∈W1,p
0
(Ω)
1
2
Z
Ω
H
|∇v|
2
dx −
Z
Ω
f v dx,
where H denotes the primitive of η:
H(z) = Z z
0
η(z) dz =
2z
p
p
Here W
1,p
0
(Ω) denotes the usual Sobolev spaces of functions in W1,p(Ω) We also assume that f ∈
W−1,p(Ω), where W
−1,p
0
(Ω) denotes the dual space of W
1,p
0
(Ω) that vanishes on the boundary [11,
p. 118]. The variational formulation of this problem expresses:
(VF): find u ∈ W
1,p
0
(Ω) such that:
a(u; u, v) = l(v), ∀v ∈ W
1,p
0
(Ω)
where a(., .) and l(.) are defined for any u0, u, v ∈ W1,p(Ω) by
a(u0; u, v) = Z
Ω
η
|∇u0|
2
∇u.∇v dx, ∀u, v ∈ W
1,p
0
(Ω) (8.1)
l(v) = Z
Ω
f v dx, ∀u, v ∈ L
2
(Ω) (8.2)
The quantity a(u; u, u)
1/p = k∇uk0,p,Ω induces a norm in W
1,p
0
, equivalent to the standard norm.
The form a(.; ., .) is bilinear with respect to the two last variable and is related to the energy form.
123124 Rheolef version 6.6 update 15 April 2014
8.2 The fixed-point algorithm
8.2.1 Principe of the algorithm
This nonlinear problem is then reduced to a sequence of linear subproblems by using the fixed-point
algorithm. The sequence
u
(n)
n>0
is defined by recurrence as:
• n = 0: let u
(0) ∈ W
1,p
0
(Ω) be known.
• n > 0: suppose that u
(n) ∈ W
1,p
0
(Ω) is known and find u
∗ ∈ W
1,p
0
(Ω) such that:
a
u
(n)
; u
∗
, v
= l(v), ∀v ∈ W
1,p
0
(Ω)
and then set
u
(n+1) = ωu∗ + (1 − ω) ∗ u
(n)
Here ω > 0 is the relaxation parameter: when ω = 1 we obtain the usual un-relaxed fixed point
algorithm. For stiff nonlinear problems, we will consider the under-relaxed case 0 < ω < 1. Let
u
(n+1) = G
u
(n)
denotes the operator that solve the previous linear subproblem for a given u
(n)
.
Since the solution u satisfies u = G(u), it is a fixed-point of G.
Let us introduce a mesh Th of Ω and the finite dimensional space Xh of continuous piecewise polynomial
functions and Vh, the subspace of Xh containing elements that vanishes on the boundary
of Ω:
Xh = {vh ∈ C
0
0
Ω
; vh/K ∈ Pk, ∀K ∈ Th}
Vh = {vh ∈ Xh; vh = 0 on ∂Ω}
where k = 1 or 2. The approximate problem expresses: suppose that u
(n)
h ∈ Vh is known and find
u
∗
h ∈ Vh such that:
a
u
(n)
h
; u
∗
h
, vh
= l(vh), ∀vh ∈ Vh
By developing u
∗
h
on a basis of Vh, this problem reduces to a linear system.Rheolef version 6.6 update 15 April 2014 125
Example file 8.1: p_laplacian_fixed_point.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " eta . icc "
5 # include " dirichlet . icc "
6 int main (int argc , char ** argv ) {
7 environment rheolef ( argc , argv );
8 geo omega ( argv [1]);
9 Float eps = std :: numeric_limits :: epsilon ();
10 string approx = ( argc > 2) ? argv [2] : " P1 ";
11 Float p = ( argc > 3) ? atof ( argv [3]) : 1.5;
12 Float w = ( argc > 4) ? ( is_float ( argv [4]) ? atof ( argv [4]) :2/ p ) :1;
13 Float tol = ( argc > 5) ? atof ( argv [5]) : 1 e5 * eps ;
14 size_t max_it = ( argc > 6) ? atoi ( argv [6]) : 500;
15 derr << " # P - Laplacian problem by fixed - point : " << endl
16 << " # geo = " << omega . name () << endl
17 << " # approx = " << approx << endl
18 << " # p = " << p << endl
19 << " # w = " << w << endl
20 << " # tol = " << tol << endl ;
21 space Xh ( omega , approx );
22 Xh . block (" boundary ");
23 trial u ( Xh ); test v ( Xh );
24 form m = integrate ( u * v );
25 solver sm ( m . uu ());
26 quadrature_option_type qopt ;
27 qopt . set_family ( quadrature_option_type :: gauss );
28 qopt . set_order (2* Xh . degree () -1);
29 field uh ( Xh );
30 uh [" boundary "] = 0;
31 field lh = integrate ( v );
32 dirichlet ( lh , uh );
33 derr << " # n r v " << endl ;
34 Float r = 1 , r0 = 1;
35 size_t n = 0;
36 do {
37 form a = integrate ( compose ( eta ( p ) , norm2 ( grad ( uh )))* dot ( grad ( u ) , grad ( v )) ,
38 qopt );
39 field mrh = a * uh - lh ;
40 field rh ( Xh , 0);
41 rh . set_u () = sm . solve ( mrh . u ());
42 r = rh . max_abs ();
43 if ( n == 0) { r0 = r ; }
44 Float v = ( n == 0) ? 0 : log10 ( r0 /r )/ n ;
45 derr << n << " " << r << " " << v << endl ;
46 if ( r <= tol || n ++ >= max_it ) break ;
47 solver sa ( a . uu ());
48 vec u_star = sa . solve ( lh .u () - a . ub ()* uh . b ());
49 uh . set_u () = w * u_star + (1 - w )* uh . u ();
50 } while ( true );
51 dout << catchmark (" p ") << p << endl
52 << catchmark (" u ") << uh ;
53 return ( r <= tol ) ? 0 : 1;
54 }
8.2.2 Comments
The implementation with Rheolef involves a weighted forms: the tensor-valued weight
η
∇u
(n)
h
2
is inserted in the variationnal expression passed to the integrate function. The
construction of the weighted form a(.; ., .) writes:
form a = integrate ( compose ( eta ( p ) , norm2 ( grad ( uh )))* dot ( grad ( u ) , grad ( v )) ,
qopt );126 Rheolef version 6.6 update 15 April 2014
Remarks the usage of the compose, norm2 and grad libray functions. The weight η
∇u
(n)
h
2
is
represented by the compose(eta(p),norm2(grad(uh))) sub-expression. This weight is evaluated
on the fly at the quadrature nodes during the assembly process implemented by the integrate
function. Also, notice the distinction between uh, that represents the value of the solution at step
n, and the trial u and test v functions, that represents any elements of the function space Xh.
These functions appear in the dot(grad(u),grad(v)) sub-expression. As the integrals involved
by this weighted form cannot be computed exactly for a general η function, a quadrature formula
is used:
Z
K
f(x) dx =
nXK−1
q=0
f(xK,q) ωK,q + O(h
k
′+1)
where (xK,q, ωK,q)06q {
2 Float operator () ( const Float & z ) const {
3 check_macro ( z != 0 || p > 2 , " eta : division by zero ( HINT : check mesh ) ");
4 return pow (z , (p -2)/2);
5 }
6 Float derivative ( const Float & z ) const {
7 check_macro ( z != 0 || p > 4 , " eta ’: division by zero ( HINT : check mesh ) ");
8 return 0.5*( p -2)* pow (z , (p -4)/2);
9 }
10 eta ( const Float & q ) : p ( q ) {}
11 Float p ;
12 };
The η function is implemented separately, in file named eta.icc in order to easily change its
definition. The derivative member function is not yet used here: it is implemented for a
forthcoming application (the Newton method). Notice the guards that check for division by
zero and send a message related to the mesh: this will be commentated in the next paragraph.
Finally, the fixed-point algorithm is initiated with u
(0) as the solution of the linear problem
associated to p = 2, i.e. the standard Poisson problem with Dirichlet boundary conditions.Rheolef version 6.6 update 15 April 2014 127
Example file 8.3: dirichlet.icc
1 void dirichlet ( const field & lh , field & uh ) {
2 const space & Xh = lh . get_space ();
3 trial u ( Xh ); test v ( Xh );
4 form a = integrate ( dot ( grad ( u ) , grad ( v )));
5 solver sa ( a . uu ());
6 uh . set_u () = sa . solve ( lh . u () - a. ub ()* uh . b ());
7 }
8.2.3 Running the program
Compile the program, as usual:
make p_laplacian_fixed_point
and enter the commands:
mkgeo_ugrid -t 50 > square.geo
geo square.geo
The triangular mesh has a boundary domain named boundary.
./p_laplacian_fixed_point square.geo P1 1.5 > square.field
field square.field -elevation -stereo
Figure 8.1: The p-Laplacian for d = 2: elevation view for p = 1.25 (left), p = 2 (center) and
p = 2.5 (right).
Run the field visualization:
field square.field -elevation -stereo
field square.field -cut -origin 0.5 0.5 -normal 1 1
The first command shows an elevation view of the solution (see 8.1) while the second one shows
a cut along the first bisector x0 = x1. Observe that the solution becomes flat at the center
when p decreases. The p = 2 case, corresponding to the linear case, is showed for the purpose of
comparison.
There is a technical issue concerning the mesh: the computation could failed on some mesh that
presents at least one triangle with two edges on the boundary:
mkgeo_grid -t 50 > square-bedge.geo
geo square-bedge.geo
./p_laplacian_fixed_point square-bedge.geo P1 1.5 > square-bedge.field128 Rheolef version 6.6 update 15 April 2014
The computation stops and claims a division by zero: the three nodes of such a triangle, the
three nodes are on the boundary, where uh = 0 is prescribed: thus ∇uh = 0 uniformly inside
this element. Notice that this failure occurs only for linear approximations: the computation
works well on such meshes for Pk approximations with k > 2. While the mkgeo_grid generates
uniform meshes that have such triangles, the mkgeo_ugrid calls the gmsh generator that automatically
splits the triangles with two boundary edges. When using bamg, you should consider the
-splitpbedge.
8.2.4 Convergence properties of the fixed-point algorithm
The fixed-point algorithm prints also rn, the norm of the residual term, at each iteration n, and the
convergence rate vn = log10(rn/r0)/n. The residual term of the non-linear variational formulation
is defined by:
r
(n)
h ∈ Vh and m
r
(n)
h
, vh
= a
u
(n)
h
; u
(n)
h
, vh
− l(vh), ∀vh ∈ Vh
where m(., .) denotes the L
2
scalar product. Clearly, u
(n)
h
is a solution if and only if r
(n)
h = 0.
For clarity, let us drop temporarily the n index of the current iteration. The field rh ∈ Vh can be
extended as a field rh ∈ Xh with vanishing components on the boundary. The previous relation
writes, after expansion of the bilinear forms and fields on the unknown and blocked parts (see
page 17 for the notations):
m.uu*rh.u = a.uu*uh.u + a.ub*ub.b - lh.u
rh.b = 0
This relation expresses that the residual term rh is obtained by solving a linear system involving
the mass matrix.
It remains to choose a good norm for estimating this residual term. For the corresponding continuous
formulation, we have:
r = −div
η
|∇u|
2
∇u
− f ∈ W−1,p(Ω)
Thus, for the continuous formulation, the residual term may be measured with the W−1,p(Ω)
norm. It is defined, for all ϕ ∈ W−1,p(Ω), by duality:
kϕk−1,p,Ω = sup
ϕ∈W1,p
0
(Ω)
v6=0
hϕ, vi
kvk1,p,Ω
= sup
v∈W1,p
0
(Ω)
kvk1,p,Ω=1
hϕ, vi
where h., .i denotes the duality bracked between W
1,p
0
(Ω) and W−1,p(Ω).
By analogy, let us introduce the discrete W−1,p(Ω) norm, denoted as k.k−1,h, defined by duality
for all ϕh ∈ Vh by:
kϕhk−1,h = sup
vh∈Vh
kvhk1,p,Ω=1
hϕh, vhi
The dual of space of the finite element space Vh is identified to Vh and the duality bracked is the
Euclidian scalar product of R
dim(Vh)
. Then, kϕhk−1,h is the largest absolue value of components
of ϕh considered as a vector of R
dim(Vh)
. With the notations of the Rheolef library, it simply
writes:
Float r = rh.u().max_abs()
Fig 8.2.top-left shows that the residual term decreases exponentially versus n, since the slope of
the plot in semi-log scale tends to be strait. Moreover, observe that the slope is independent ofRheolef version 6.6 update 15 April 2014 129
10−15
10−10
10−5
1
0 25 50
n
r
(n)
h
−1,h
p = 3/2
h = 1/10
h = 1/20
h = 1/30
h = 1/40
h = 1/50
10−15
10−10
10−5
1
0 25 50
n
r
(n)
h
−1,h
p = 3/2
k = 1
k = 2
k = 3
k = 4
k = 5
10−15
10−10
10−5
1
0 250 500
n
r
(n)
h
−1,h
p = 2.95
p = 2.90
p = 2.50
10−15
10−10
10−5
1
0 100 200
n
r
(n)
h
−1,h
p = 1.15
p = 1.25
p = 1.50
Figure 8.2: The fixed-point algorithm on the p-Laplacian for d = 2: when p = 3/2, independence
of the convergence properties of the residue (top-left) with mesh refinement; (top-right) with
polynomial order Pk; when h = 1/50 and k = 1, convergence (bottom-left) for p > 2 and (bottomright)
for p < 2.
the mesh size h. Also, by vertue of the previous carreful definition of the residual term and its
corresponding norm, all the slopes falls into a master curve.
These invariance properties applies also to the polynomial approximation Pk : Fig 8.2.top-right
shows that all the curves tends to collapse when k increases. Thus, the convergence properties
of the algorithm are now investigated on a fixed mesh h = 1/50 and for a fixed polynomial
approximation k = 1.
Fig 8.2.bottom-left and 8.2.bottom-right show the convergence vesus the power-law index p: observe
that the convergence becomes easier when p approaches p = 2, where the problem is linear.
In that case, the convergence occurs in one iteration. Nevertheless, it appears two limitations.
From one hand, when p → 3 the convergence starts to slow down and p > 3 cannot be solved
by this algorithm (it will be solved later in this chapter). From other hand, when p → 1, the
convergence slows down too and numerical rounding effets limits the convergence: the machine
precision canot be reached. Let us introduce the convergence rate vn = log10(rn/r0)/n it tends to
a constant, denoted as v¯ and: rn ≈ r0 × 10−v n¯
. Observe on Fig 8.3.left that v¯ tends to +∞ when
p = 2, since the system becomes linear and the algorithm converge in one iteration. Observe also
that v¯ tends to zero for p = 1 and p = 3 since the algorithm diverges. Fig 8.3.right shows the
same plot in semi-log scale and shows that v¯ behaves as: v¯ ≈ − log10 |p − 2|. This study shows130 Rheolef version 6.6 update 15 April 2014
0
1
2
1 2 3
p
v¯ computation
0
1
2
10−3 10−2 10−1 100
|p − 2|
v¯ computation: p < 2
computation: p > 2
fit: − log10 |p − 2|
Figure 8.3: The fixed-point algorithm on the p-Laplacian for d = 2: (left) convergence rate versus
p; (right) convergence rate versus p in semi-log scale.
that the residual term of the fixed point algorithm behaves as:
rn ≈ r0 |p − 2|
n
8.2.5 Improvement by relaxation
The relaxation parameter can improve the fixed-point algorithm: for instance, for p = 3 and
ω = 0.5 we get a convergent sequence:
./p_laplacian_fixed_point square.geo P1 3 0.5 > square.field
Observe on Fig. 8.4 the effect on the relaxation parameter ω upon the convergence rate v¯: for
p < 2 it can improve it and for p > 2, it can converge when p > 3. For each p, there is clearly an
optimal relaxation parameter, denoted by ωopt. A simple fit shows that (see Fig. 8.4.bottom-left):
ωopt = 2/p
Let us denote v¯opt the corresponding rate of convergence. Fig. 8.4.top-right shows that the convergence
is dramatically improved when p > 2 while the gain is less prononced when p < 2.
Coveniently replacing the extra parameter ω on the command line by - leads to compute automatically
ω = ωopt: the fixed-point algorithm is always convergent with an optimal convergent
rate, e.g.:
./p_laplacian_fixed_point square.geo P1 4.0 - > square.field
There is no way to improve more the fixed point algorithm: the next paragraph shows a different
algorithm that dramatically accelerates the computation of the solution.Rheolef version 6.6 update 15 April 2014 131
0
0.1
0.2
0.3
0.4
0 0.5 1 1.5 2
ω
v¯ p = 1.2
p = 1.3
p = 1.4
p = 1.5
0
0.1
0.2
0.3
0.4
0 0.25 0.5 0.75 1
ω
v¯ p = 3
p = 4
p = 5
p = 6
0
0.5
1
1.5
2
1 2 3 4 5 6 7 8
p
ωopt
computation: ωopt
fit: ωopt(p) = 2/p
0
0.5
1
1.5
2
2.5
1 2 3 4 5 6 7 8
p
v¯opt v¯ when ω = ωopt
v¯ when ω = 1
Figure 8.4: The fixed-point algorithm on the p-Laplacian for d = 2: effect of the relaxation
parameter ω (top-left) when p < 2; (top-right) when p > 2; (bottom-left) optimal ωopt; (bottomright)
optimal v¯opt.132 Rheolef version 6.6 update 15 April 2014
8.3 The Newton algorithm
8.3.1 Principe of the algorithm
An alternative to the fixed-point algorithm is to solve the nonlinear problem (P) by using the
Newton algorithm. Let us consider the following operator:
F : W
1,p
0
(Ω) −→ W−1,p(Ω)
u 7−→ F(u) = −div
η
|∇u|
2
∇u
− f
The F operator computes simply the residual term and the problem expresses now as: find u ∈
W
1,p
0
(Ω) such that F(u) = 0.
The Newton algorithm reduces the nonlinear problem into a sequence of linear subproblems: the
sequence
u
(n)
n>0
is classically defined by recurrence as:
• n = 0: let u
(0) ∈ W
1,p
0
(Ω) be known.
• n > 0: suppose that u
(n)
is known, find δu(n)
, defined in Ω, such that:
F
′
u
(n)
δu(n) = −F
u
(n)
and then compute explicitly:
u
(n+1) := u
(n) + δu(n)
The notation F
′
(u) stands for the Fréchet derivative of F, as an operator from W−1,p(Ω) into
W
1,p
0
(Ω). For any r ∈ W−1,p(Ω), the linear tangent problem writes:
find δu ∈ W
1,p
0
(Ω) such that:
F
′
(u) δu = −r
After the computation of the Fréchet derivative, we obtain the strong form of this problem:
(LT): find δu, defined in Ω, such that
−div
η
|∇u|
2
∇(δu) + 2η
′
|∇u|
2
{∇u.∇(δu)} ∇u
= −r in Ω
δu = 0 on ∂Ω
where
η
′
(z) = 1
2
(p − 2)z
p−4
2 , ∀z > 0
This is a Poisson-like problem with homogeneous Dirichlet boundary conditions and a non-constant
tensorial coefficient. The variational form of the linear tangent problem writes:
(V LT): find δu ∈ W
1,p
0
(Ω) such that
a1(u; δu, δv) = l1(v), ∀δv ∈ W
1,p
0
(Ω)
where the a1(.; ., .) is defined for any u, δu, δv ∈ W
1,p
0
(Ω) by:
a1(u; δu, δv) = Z
Ω
η
|∇u|
2
∇(δu).∇(δv) + 2η
′
|∇u|
2
{∇u.∇(δu)} {∇u.∇(δv)}
dx
l1(v) = −
Z
Ω
r v dx
For any ξ ∈ R
d
let us denote by ν(ξ) the following d × d matrix:
ν(ξ) = η
|ξ|
2
I + 2η
′
|ξ|
2
ξ ⊗ ξRheolef version 6.6 update 15 April 2014 133
where I stands for the d-order identity matrix. Then the a1 expresses in a more compact form:
a1(u; δu, δv) = Z
Ω
(ν(∇u)∇(δu)).∇(δv) dx
Clearly a1 is linear and symmetric with respect to the two last variables.
Example file 8.4: p_laplacian_newton.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " p_laplacian . h "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega_h ( argv [1]);
8 Float eps = std :: numeric_limits :: epsilon ();
9 string approx = ( argc > 2) ? argv [2] : " P1 ";
10 Float p = ( argc > 3) ? atof ( argv [3]) : 1.5;
11 Float tol = ( argc > 4) ? atof ( argv [4]) : 1 e5 * eps ;
12 size_t max_iter = ( argc > 5) ? atoi ( argv [5]) : 500;
13 derr << " # P - Laplacian problem by Newton : " << endl
14 << " # geo = " << omega_h . name () << endl
15 << " # approx = " << approx << endl
16 << " # p = " << p << endl
17 << " # tol = " << tol << endl
18 << " # max_iter = " << max_iter << endl ;
19 p_laplacian F (p , omega_h , approx );
20 field uh = F . initial ();
21 int status = newton (F , uh , tol , max_iter , & derr );
22 dout << setprecision ( numeric_limits :: digits10 )
23 << catchmark (" p ") << p << endl
24 << catchmark (" u ") << uh ;
25 return status ;
26 }
Example file 8.5: p_laplacian.h
1 class p_laplacian {
2 public :
3 typedef field value_type ;
4 typedef Float float_type ;
5 p_laplacian ( Float p , const geo& omega , string approx );
6 field initial () const ;
7 field residue ( const field & uh ) const ;
8 void update_derivative ( const field & uh ) const ;
9 field derivative_solve ( const field & mrh ) const ;
10 field derivative_trans_mult ( const field & mrh ) const ;
11 Float space_norm ( const field & uh ) const ;
12 Float dual_space_norm ( const field & mrh ) const ;
13 Float p ;
14 space Xh ;
15 field lh ;
16 form m ;
17 solver sm ;
18 quadrature_option_type qopt ;
19 mutable form a1 ;
20 mutable solver sa1 ;
21 };
22 # include " p_laplacian1 . icc "
23 # include " p_laplacian2 . icc "
8.3.2 Comments
The Newton algorithm is implemented in a generic way, for any F function, by the newton function
from the Rheolef librarys. The reference manual for the newton generic function is available
online:134 Rheolef version 6.6 update 15 April 2014
man newton
The function F and its derivative F
′ are provided by a template class argument. Here,
the p_laplacian class describes our F function, i.e. our problem to solve: its interface
is defined in the file ‘p_laplacian.h’ and its implementation in ‘p_laplacian1.icc’
and ‘p_laplacian2.icc’. The introduction of the class p_laplacian will allow an easy exploration
of some variants of the Newton algorithm for this problem, as we will see in the next section.
Example file 8.6: p_laplacian1.icc
1 # include " eta . icc "
2 # include " nu . icc "
3 # include " dirichlet . icc "
4 p_laplacian :: p_laplacian ( Float p1 , const geo & omega , string approx )
5 : p ( p1 ) , Xh () , lh () , m () , sm () , qopt () , a1 () , sa1 () {
6 Xh = space ( omega , approx );
7 Xh . block (" boundary ");
8 qopt . set_family ( quadrature_option_type :: gauss );
9 qopt . set_order (2* Xh . degree () -1);
10 trial u ( Xh ); test v ( Xh );
11 lh = integrate ( v );
12 m = integrate ( u * v );
13 sm = solver ( m. uu ());
14 }
15 field p_laplacian :: initial () const {
16 field uh ( Xh , 0);
17 dirichlet ( lh , uh );
18 return uh ;
19 }
20 field p_laplacian :: residue ( const field & uh ) const {
21 trial u ( Xh ); test v ( Xh );
22 form a = integrate ( compose ( eta ( p ), norm2 ( grad ( uh )))* dot ( grad ( u ) , grad ( v )) ,
23 qopt );
24 field mrh = a * uh - lh ;
25 mrh . set_b () = 0;
26 return mrh ;
27 }
28 void p_laplacian :: update_derivative ( const field & uh ) const {
29 size_t d = Xh . get_geo (). dimension ();
30 trial u ( Xh ); test v ( Xh );
31 a1 = integrate ( dot ( compose ( nu < eta >( eta ( p ) , d ) , grad ( uh ))* grad ( u ) , grad ( v )) ,
32 qopt );
33 sa1 = ldlt ( a1 . uu ());
34 }
35 field p_laplacian :: derivative_solve ( const field & rh ) const {
36 field delta_uh ( Xh ,0);
37 delta_uh . set_u () = sa1 . solve ( rh . u ());
38 return delta_uh ;
39 }
The residual term F(uh) is computed by the member function residual while the resolution of
F
′
(uh)δuh = Mrh is performed by the function derivative_solve. The derivative F
′
(uh) is
computed separately by the function update_derivative:
a1 = integrate ( dot ( compose ( nu < eta >( eta (p ) , d ) , grad ( uh ))* grad ( u ) , grad ( v )) ,
qopt );
Notice that the a1(u; ., .) bilinear form is a tensorial weighted form, where ν = ν(∇u) is the
weight tensor. The tensorial weight ν is inserted as (ν∇u).∇v in the variationnal expression for
the integrate function. As the tensor ν is symmetric, the bilinear form a1(., .) is also symmetric.
As the weight is non-polynomial for general η function and a quadrature formula is used:
a1(u0; u, v) = X
K∈Th
nXK−1
q=0
(ν (∇u0(xK,q)) ∇u(xK,q).∇v(xK,q)) ωK,q (8.4)
By using exactly the same quadrature for computing both a1(., .) and a(., .) in (8.4), then we have
that F
′
is always the derivative of F at the discrete level: while, in general, the derivation andRheolef version 6.6 update 15 April 2014 135
the discretization of problems does not commute, it is the case when using the same quadrature
formulae on both problems. This is an important aspect of the Newton method at discrete level,
for conservating the optimal convergence rate of the residual terms versus n.
The linear system involving the derivative F
′
(uh) is solved by the p_laplacian member function
derivative_solve. Finally, applying the generic Newton method requires a stopping criteria
on the residual term: this is the aim of the member function dual_space_norm. The three last
member functions are not used by the Newton algorithm, but by its extension, the damped Newton
method, that will be presented later.
Example file 8.7: p_laplacian2.icc
1 field p_laplacian :: derivative_trans_mult ( const field & mrh ) const {
2 field rh ( Xh , 0);
3 rh . set_u () = sm . solve ( mrh . u ());
4 field mgh = a1 * rh ;
5 mgh . set_b () = 0;
6 return mgh ;
7 }
8 Float p_laplacian :: space_norm ( const field & uh ) const {
9 return sqrt ( m ( uh , uh ));
10 }
11 Float p_laplacian :: dual_space_norm ( const field & mrh ) const {
12 field rh ( Xh , 0);
13 rh . set_u () = sm . solve ( mrh . u ());
14 return sqrt ( dual ( mrh , rh ));
15 }
The ν function is implemented for a generic η function, as a class-function that accept as template
agument another class-function.
Example file 8.8: nu.icc
1 template < class Function >
2 struct nu : std :: unary_function {
3 tensor operator () ( const point & grad_u ) const {
4 Float x2 = norm2 ( grad_u );
5 Float a = f ( x2 );
6 Float b = 2* f . derivative ( x2 );
7 tensor value ;
8 for ( size_t i = 0; i < d ; i ++) {
9 value (i , i ) = a + b* grad_u [ i ]* grad_u [ i ];
10 for ( size_t j = 0; j < i ; j ++)
11 value (j , i ) = value (i , j ) = b * grad_u [ i ]* grad_u [j ];
12 }
13 return value ;
14 }
15 nu ( const Function & f1 , Float d1 ) : f ( f1 ) , d ( d1 ) {}
16 Function f ;
17 size_t d ;
18 };
8.3.3 Running the program
Enter:
make p_laplacian_newton
mkgeo_ugrid -t 50 > square.geo
./p_laplacian_newton square.geo P1 3 > square.field
field square.field -elevation -stereo
The program prints at each iteration n, the residual term rn in discrete L
2
(Ω) norm. Convergence
occurs in less than ten iterations: it dramatically improves the previous algorithm (see Fig. 8.5).
Observe that the slope is no more constant in semi-log scale: the convergence rate accelerates and136 Rheolef version 6.6 update 15 April 2014
10−15
10−10
10−5
1
0 5 10 15 20 25
n
r
(n)
h
−1,h
p = 3
fixed point ω = 2/3
Newton
Figure 8.5: The Newton algorithm on the p-laplacian for d = 2: comparison with the fixed-point
algorithm.
the slope tends to be vertical, the so-called super-linear convergence. This is the major advantage
of the Newton method. Figs. 8.6.top-left and. 8.6.top-bottom shows that the algorithm converge
when p > 3 and that the convergence properties are independant of the mesh size h and the
polynomial order k. There are still two limitations of the method. From one hand, the Newton
algorithm is no more independant of h and k when p 6 3/2 and to tends to diverges in that
case when h tends to zero (see Fig. 8.6.bottom-left). From other hand, when p becomes large
(see Fig. 8.6.bottom-right), an overshoot in the convergence tends to increases and distroys the
convergence, due to rounding problems. In order to circumvent these limitations, another strategy
is considered in the next section: the damped Newton algorithm.Rheolef version 6.6 update 15 April 2014 137
10−15
10−10
10−5
1
0 5 10 15 20 25
n
r
(n)
h
−1,h
p = 3
h = 1/10
h = 1/20
h = 1/30
h = 1/40
h = 1/50
10−15
10−10
10−5
1
0 5 10 15 20 25
n
r
(n)
h
−1,h
p = 3
k = 1
k = 2
k = 3
k = 4
k = 5
10−15
10−10
10−5
1
0 50 100
n
r
(n)
h
−1,h
p = 3/2
h = 1/10
h = 1/20
h = 1/30
h = 1/40
h = 1/50
10−15
10−10
10−5
100
0 25
n
r
(n)
h
−1,h
p = 2.5
p = 3.0
p = 3.5
Figure 8.6: The Newton algorithm on the p-laplacian for d = 2: (top-left) comparison with the
fixed-point algorithm; when p = 3, independence of the convergence properties of the residue (topleft)
with mesh refinement; (top-right) with polynomial order Pk; (bottom-left) mesh-dependence
convergence when p < 2; (bottom-right) overshoot when p > 2.138 Rheolef version 6.6 update 15 April 2014
8.4 The damped Newton algorithm
8.4.1 Principe of the algorithm
The Newton algorithm diverges when the initial u
(0) is too far from a solution, e.g. when p is
not at the vicinity of 2. Our aim is to modify the Newton algorithm and to obtain a globally
convergent algorithm, i.e to converge to a solution for any initial u
(0). By this way, the algorithm
should converge for any value of p ∈]1, +∞[. The basic idea is to decrease the step length while
maintaining the direction of the original Newton algorithm:
u
(n+1) := u
(n) + λn δu(n)
where λ
(n) ∈]0, 1] and δu(n)
is the direction from the Newton algorithm, given by:
F
′
u
(n)
δu(n) = −F
u
(n)
Let V a Banach space and let T : V → R defined for any v ∈ V by:
T(v) = 1
2
kC
−1F(v)k
2
V
,
where C is some non-singular operator, easy to invert, used as a non-linear preconditioner. The
simplest case, without preconditioner, is C = I. The T function furnishes a measure of the residual
term in L
2 norm. The convergence is global when for any initial u
(0), we have for any n > 0:
T
u
(n+1)
6 T
u
(n)
+ α
D
T
′
u
(n)
, u(n+1) − u
(n)
E
V ′
,V
(8.5)
where h., .iV ′
,V is the duality product between V and its dual V
′
, and α ∈]0, 1[ is a small parameter.
Notice that
T
′
(u) = {C
−1F
′
(u)}
∗C
−1F(u)
where the superscript ∗ denotes the adjoint operator, i.e. the transpose matrix the in finite
dimensional case. In practice we consider α = 10−4 and we also use a minimal step length
λmin = 1/10 in order to avoid too small steps. Let us consider a fixed step n > 0: for convenience
the n superscript is dropped in u
(n) and δu(n)
. Let g : R → R defined for any λ ∈ R by:
g(λ) = T (u + λδu)
Then :
g
′
(λ) = hT
′
(u + λδu), δuiV ′
,V
= hC
−1F(u + λδu), F′
(u + λδu)C
−1
δuiV,V ′
where the superscript ∗ denotes the adjoint operator, i.e. the transpose matrix the in finite
dimensional case. The practical algorithm for obtaining λ was introduced first in [28] and is also
presented in [43, p. 385]. The step length λ that satisfy (8.5) is computed by using a finite sequence
λk, k = 0, 1 . . . with a second order recurrence:
• k = 0 : initialization λ0 = 1. If (8.5) is satisfied with u + λ0 d then let λ := λ0 and the
sequence stop here.
• k = 1 : first order recursion. The quantities g(0) = f(u) et g
′
(0) = hf
′
(u), di are already
computed at initialization. Also, we already have computed g(1) = f(u + d) when verifying
whether (8.5) was satisfied. Thus, we consider the following approximation of g(λ) by a
second order polynomial:
g˜1(λ) = {g(1) − g(0) − g
′
(0)}λ
2 + g
′
(0)λ + g(0)Rheolef version 6.6 update 15 April 2014 139
After a short computation, we find that the minimum of this polynomial is:
λ˜
1 =
−g
′
(0)
2{g(1) − g(0) − g
′(0)}
Since the initialization at k = 0 does not satisfy (8.5), it is possible to show that, when α is
small enough, we have λ˜
1 6 1/2 and λ˜
1 ≈ 1/2. Let λ1 := max(λmin, λ˜
1). If (8.5) is satisfied
with u + λ1 d then let λ := λ1 and the sequence stop here.
• k > 2 : second order recurrence. The quantities g(0) = f(u) et g
′
(0) =if
′
(u), dh are
available, together with λk−1, g(λk−1), λk−2 and g(λk−2). Then, g(λ) is approximated by
the following third order polynomial:
g˜k(λ) = aλ3 + bλ2 + g
′
(0)λ + g(0)
where a et b are expressed by:
a
b
=
1
λk−1 − λk−2
1
λ
2
k−1
−
1
λ
2
k−2
−
λk−2
λ
2
k−1
λk−1
λ
2
k−2
g(λk−1) − g
′
(0)λk−1 − g(0)
g(λk−2) − g
′
(0)λk−2 − g(0)
The minimum of g˜k(λ) is
λ˜
k =
−b +
p
b
2 − 3ag′(0)
3a
Let λk = min(1/2 λk, max(λ˜
k/10, λ˜
k+1) in order for λk to be at the same order of magnitude
as λk−1. If (8.5) is satisfied with u + λk d then let λ := λk and the sequence stop here.
The sequence (λk)k>0 is strictly decreasing: when the stopping criteria is not satisfied until λk
reaches the machine precision εmach then the algorithm stops with an error.
Example file 8.9: p_laplacian_damped_newton.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " p_laplacian . h "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega_h ( argv [1]);
8 Float eps = numeric_limits :: epsilon ();
9 string approx = ( argc > 2) ? argv [2] : " P1 ";
10 Float p = ( argc > 3) ? atof ( argv [3]) : 1.5;
11 Float tol = ( argc > 4) ? atof ( argv [4]) : eps ;
12 size_t max_iter = ( argc > 5) ? atoi ( argv [5]) : 500;
13 derr << " # P - Laplacian problem by damped Newton :" << endl
14 << " # geo = " << omega_h . name () << endl
15 << " # approx = " << approx << endl
16 << " # p = " << p << endl ;
17 p_laplacian F (p , omega_h , approx );
18 field uh = F . initial ();
19 int status = damped_newton (F , uh , tol , max_iter , & derr );
20 dout << catchmark (" p ") << p << endl
21 << catchmark (" u ") << uh ;
22 return status ;
23 }
8.4.2 Comments
The damped_newton function implements the damped Newton algorithm for a generic T(u) function,
i.e. a generic nonlinear preconditioner. This algorithms use a backtrack strategy implemented140 Rheolef version 6.6 update 15 April 2014
in the file ‘newton-backtrack.h’ of the Rheolef library. The simplest choice of the identity preconditioner
C = I i.e. T(u) = kF(u)k
2
V ′/2 is showed in file damped-newton.h. The gradient at
λ = 0 is
T
′
(u) = F
′
(u)
∗F(u)
and the slope at λ = 0 is:
g
′
(0) = hT
′
(u), δuiV ′
,V
= hF(u), F′
(u)δuiV ′
,V ′
= −kF(u)k
2
V ′
The ‘p_laplacian_damped_newton.cc’ is the application program to the p-Laplacian problem
together with the k.kL2(Ω) discrete norm for the function T.
8.4.3 Running the program
Figure 8.7: The p-Laplacian for d = 2: elevation view for p = 1.15 (left) and p = 7 (right).
As usual, enter:
make p_laplacian_damped_newton
mkgeo_ugrid -t 50 > square.geo
./p_laplacian_damped_newton square.geo P1 1.15 | field -stereo -elevation -
./p_laplacian_damped_newton square.geo P1 7 | field -stereo -elevation -
See Fig. 8.7 for the elevation view of the solution. The algorithm is now quite robust: the
convergence occurs for quite large range of p > 1 values and extends the range previously presented
on Fig. 8.1. The only limitation is now due to machine roundoff on some architectures.
Figs. 8.8.top shows that the convergence properties seems to slightly depend on the mesh re-
finement. Nevertheless, there are quite good and support both mesh refinement and high order
polynomial degree. When p is far from p = 2, i.e. either close to one or large, Figs. 8.8.bottom
shows that the convergence becomes slower and that the first linear regime, corresponding to the
line search, becomes longer. This first regime finishes by a brutal super-linear regime, where the
residual terms fall in few iterations to the machine precision.Rheolef version 6.6 update 15 April 2014 141
8.5 Error analysis
While there is no simple explicit expression for the exact solution in the square Ω =]0, 1[2
, there
is one when considering Ω as the unit circle:
u(x) = (p − 1) 2− 1
p−1
p
1 −
x
2
0 + x
2
1
p
p−1)
Example file 8.10: p_laplacian_circle.icc
1 struct u_exact : field_functor < u_exact ,Float > {
2 Float operator () ( const point & x ) const {
3 return (1 - pow ( norm2 ( x ) , p /(2* p -2)))/(( p /(p -1))* pow (2. ,1/( p -1)));
4 }
5 u_exact ( Float q ) : p ( q ) {}
6 protected : Float p ;
7 };
8 struct grad_u : field_functor < grad_u ,point > {
9 point operator () ( const point & x ) const {
10 return - ( pow ( norm2 ( x ) , p /(2* p -2) - 1)/ pow (2. ,1/( p -1)))* x ;
11 }
12 grad_u ( Float q ) : p ( q ) {}
13 protected : Float p ;
14 };
Example file 8.11: p_laplacian_error.cc
1 # include " rheolef . h "
2 using namespace rheolef ;
3 using namespace std ;
4 # include " p_laplacian_circle . icc "
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 Float tol = ( argc > 1) ? atof ( argv [1]) : 1e -15;
8 Float p ;
9 field uh ;
10 din >> catchmark (" p ") >> p
11 >> catchmark (" u ") >> uh ;
12 const geo & omega = uh . get_geo ();
13 const space & Xh = uh . get_space ();
14 field pi_h_u = interpolate ( Xh , u_exact ( p ));
15 field eh = pi_h_u - uh ;
16 quadrature_option_type qopt ;
17 qopt . set_family ( quadrature_option_type :: gauss );
18 qopt . set_order (2* Xh . degree ());
19 Float err_lp = pow ( integrate ( omega ,
20 pow ( fabs ( uh - u_exact (p )) , p ) , qopt ) , 1./ p );
21 Float err_w1p = pow ( integrate ( omega ,
22 pow ( norm ( grad ( uh ) - grad_u ( p )) , p ) , qopt ) , 1./ p );
23 Float err_linf = eh . max_abs ();
24 dout << " err_linf = " << err_linf << endl
25 << " err_lp = " << err_lp << endl
26 << " err_w1p = " << err_w1p << endl ;
27 return ( err_linf < tol ) ? 0 : 1;
28 }
Notice, in the file ‘p_laplacian_error.cc’, the usage of the integrate function, together with
a quadrature formula specificiation, for computing the errors in L
p norm and W1,p semi-norm.
Notice also the flexibility of expressions, mixing together fields as uh and field_functors, as
u_exact. The whole expression is evaluated by the integrate function at quadrature points
inside each element of the mesh.
By this way, the error analysis investigation becomes easy:
make p_laplacian_error
mkgeo_ball -t 10 -order 2 > circle-10-P2.geo
./p_laplacian_damped_newton circle-10-P2.geo P2 1.5 | ./p_laplacian_error142 Rheolef version 6.6 update 15 April 2014
We can vary both the mesh size and the polynomial order and the error plots are showed on
Fig. 8.9 for both the L
2
, L∞ norms and the W1,p semi-norm. Observe the optimal error behavior:
the slopes in the log-log scale are the same as those obtained by a direct Lagrange interpolation
of the exact solution.Rheolef version 6.6 update 15 April 2014 143
10−15
10−10
10−5
1
0 5 10 15 20 25
n
r
(n)
h
−1,h
p = 3/2, k = 1
h = 1/10
h = 1/20
h = 1/30
h = 1/40
h = 1/50
10−15
10−10
10−5
1
0 5 10 15 20 25
n
r
(n)
h
−1,h
p = 3/2, k = 1
k = 1
k = 2
k = 3
k = 4
k = 5
10−15
10−10
10−5
100
0 25 50
n
r
(n)
h
−1,h
h = 1/50, k = 1
p = 1.5
p = 1.4
p = 1.3
p = 1.2
10−15
10−10
10−5
100
0 5 10 15 20 25
n
r
(n)
h
−1,h
h = 1/50, k = 1
p = 3
p = 4
p = 5
p = 6
p = 7
Figure 8.8: The damped Newton algorithm on the p-Laplacian for d = 2: when p = 1.5 and
h = 1/50, convergence properties of the residue (top-left) with mesh refinement; (top-right) with
polynomial order Pk; (bottom-left) convergence when p < 2; (bottom-right) when p > 2.144 Rheolef version 6.6 update 15 April 2014
10−8
10−6
10−4
10−2
10−2 10−1 1
h
ku − uhk0,p,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
10−8
10−6
10−4
10−2
10−2 10−1 1
h
ku − uhk0,∞,Ω
2 = k + 1
3
4
k = 1
k = 2
k = 3
10−6
10−4
10−2
1
10−2 10−1 1
h
|∇(u − uh)|0,p,Ω
1 = k
2
3
k = 1
k = 2
k = 3
Figure 8.9: The p-Laplacian for d = 2: error analysis.Part IV
Technical appendices
145Appendix A
How to write a variational
formulation ?
The major keypoint for using Rheolef is to put the problem in variational form. Then this
variational form can be efficiently translated into C++ language. This appendix is dedicated to
readers who are not fluent with variational formulations and some related functionnal analysis
tools.
A.1 The Green formula
Let us come back to the model problem presented in section 1.1, page 15, equations (1.1)-(1.2)
and details how this problem is transformed into (1.3).
Let H1
0
(Ω) the space of functions whose gradient square has a finite sum over Ω and that vanishes
on ∂Ω:
H1
0
(Ω) = {v ∈ L
2
(Ω); ∇v ∈ L
2
(Ω)d
and v = 0 on ∂Ω}
We start by multiplying (1.1) by an arbitrarily test-function v ∈ H1
0
(Ω) and then integrate over Ω :
−
Z
Ω
∆u v dx =
Z
Ω
f v dx, ∀v ∈ H1
0
(Ω)
The next step is to invoque an integration by part, the so-called Green formula:
Z
Ω
∆u v dx +
Z
Ω
∇u.∇v dx =
Z
∂Ω
∂u
∂n v ds, ∀u, v ∈ H1
(Ω)
Since our test-function v vanishes on the boundary, the integral over ∂Ω is zero and the problem
becomes:
Z
Ω
∇u.∇v dx =
Z
Ω
f v dx, ∀v ∈ H1
0
(Ω)
This is exactly the variational formulation (1.3), page 15.
A.2 The vectorial Green formula
In this section, we come back to the linear elasticity problem presented in section 4.1, page 51,
equations (4.1)-(4.2) and details how this problem is transformed into (4.3).
Let Γd (resp. Γn) denotes the parts of the boundary ∂Ω related to the homogeneous Dirichlet
boundary condition u = 0 (resp. the homogeneous Neumann boundary condition σ(u) n = 0).
147148 Rheolef version 6.6 update 15 April 2014
We suppose that ∂Ω = Γd ∩ Γn. Let us introduce the following functional space:
V = {v ∈ H1
(Ω)d
; v = 0 on Γd}
Then, multiplying the first equation of (4.2) by an arbitrarily test-function v ∈ V and then
integrate over Ω :
−
Z
Ω
div(σ(u)).v dx =
Z
Ω
f.v dx, ∀v ∈ V
The next step is to invoque an integration by part:
Z
Ω
div τ.v dx +
Z
Ω
τ : D(v) dx =
Z
∂Ω
τ : (v ⊗ n) ds, ∀τ ∈ L
2
(Ω)d×d
, ∀v ∈ V
Recall that div τ denotes Pd−1
j=0 ∂j τi,j
06i square.geo
This command creates a ‘square.geo’ file. Look at the mesh via the command:
geo square
This presents the mesh it in a graphical form, usually with gnuplot. You can switch to the
paraview or mayavi renders:
geo square -paraview
geo square -mayavi
A finer mesh could be generated by:
bamg -coef 0.5 -g square.bamgcad -o square-0.5.bamg
B.2 Unidimensional mesh with gmsh
The simplest unidimensional mesh is a line:
h_local = 0.1;
Point(1) = {0, 0, 0, h_local};
Point(2) = {1, 0, 0, h_local};
Line(3) = {1,2};
Physical Point("left") = {1};
Physical Point("right") = {2};
Physical Point("boundary") = {1,2};
Physical Line("interior") = {3};
The mesh generation command writes:
gmsh -1 line.mshcad -format msh -o line.msh
Then, the conversion to ‘.geo’ format and the visualization:
msh2geo line.msh > line.geo
geo lineRheolef version 6.6 update 15 April 2014 151
B.3 Bidimensional mesh with gmsh
Figure B.1: Visualization of the gmsh meshes ‘square.geo’ and ‘cube.geo’.
We first create a ‘square.mshcad’ file:
n = 10.0;
hloc = 1.0/n;
Point(1) = {0, 0, 0, hloc};
Point(2) = {1, 0, 0, hloc};
Point(3) = {1, 1, 0, hloc};
Point(4) = {0, 1, 0, hloc};
Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,1};
Line Loop(5) = {1,2,3,4};
Plane Surface(6) = {5} ;
Physical Point("left_bottom") = {1};
Physical Point("right_bottom") = {2};
Physical Point("right_top") = {3};
Physical Point("left_top") = {4};
Physical Line("boundary") = {1,2,3,4};
Physical Line("bottom") = {1};
Physical Line("right") = {2};
Physical Line("top") = {3};
Physical Line("left") = {4};
Physical Surface("interior") = {6};
This is an uniform mesh with element size h = 0.1. We refer to the gmsh documentation [21] for
the complete file format description. Next, enter the mesh generator commands:152 Rheolef version 6.6 update 15 April 2014
gmsh -2 square.mshcad -format msh -o square.msh
Then, enter the translation command:
msh2geo square.msh > square.geo
This command creates a ‘square.geo’ file. Look at the mesh via the command:
geo square
Remark that the domain names, defined in the .mshcad file, are included in the gmsh .msh input
file and are propagated in the .geo by the format conversion.
B.4 Tridimensional mesh with gmsh
First, create a ‘cube.mshcad’ file:
Mesh.Algorithm = 7; // bamg
Mesh.Algorithm3D = 7; // mmg3d
a = 0; c = 0; f = 0;
b = 1; d = 1; g = 1;
n = 10;
hloc = 1.0/n;
Point(1) = {a, c, f, hloc};
Point(2) = {b, c, f, hloc};
Point(3) = {b, d, f, hloc};
Point(4) = {a, d, f, hloc};
Point(5) = {a, c, g, hloc};
Point(6) = {b, c, g, hloc};
Point(7) = {b, d, g, hloc};
Point(8) = {a, d, g, hloc};
Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,1};
Line(5) = {5,6};
Line(6) = {6,7};
Line(7) = {7,8};
Line(8) = {8,5};
Line(9) = {1,5};
Line(10) = {2,6};
Line(11) = {3,7};
Line(12) = {4,8};
Line Loop(21) = {-1,-4,-3,-2};
Plane Surface(31) = {21} ;
Line Loop(22) = {5,6,7,8};
Plane Surface(32) = {22} ;
Line Loop(23) = {1,10,-5,-9};
Plane Surface(33) = {23} ;
Line Loop(24) = {12,-7,-11,3};
Plane Surface(34) = {24} ;
Line Loop(25) = {2,11,-6,-10};
Plane Surface(35) = {25} ;
Line Loop(26) = {9,-8,-12,4};Rheolef version 6.6 update 15 April 2014 153
Plane Surface(36) = {26} ;
Surface Loop(41) = {31,32,33,34,35,36};
Volume(51) = {41};
Physical Surface("bottom") = {31};
Physical Surface("top") = {32};
Physical Surface("left") = {33};
Physical Surface("front") = {35};
Physical Surface("right") = {34};
Physical Surface("back") = {36};
Physical Volume("internal") = {51};
Next, enter the mesh generator commands:
gmsh -3 cube.mshcad -format msh -o cube.msh
Then, enter the translation command:
msh2geo cube.msh > cube.geo
This command creates a ‘cube.geo’ file. Look at the mesh via the command:
geo cube
geo cube.geo -paraview -cut
The second command allows to see inside the mesh.154 Rheolef version 6.6 update 15 April 2014Appendix C
Migrating to Rheolef version 6.0
Due to its new distributed memory and computation support, Rheolef version 6.0 presents some
backward incompatibilities with previous versions: codes using previous versions of the library
should be slightly modified. This appendix presents some indications for migrating existing code.
C.1 What is new in Rheolef 6.0 ?
The major main features are:
• support distributed achitectures: the code looks sequential, is easy to read and write but
can be run massively parallel and distributed, based on the MPI library.
• high order polynomial approximation: Pk basis are introduced in this version, for k > 0.
This feature will be improved in the future developments.
• mesh adaptation and the charateristic method are now available for threedimensional
problems.
In order to evoluate in these directions, internal data structures inside the library are completely
rewritten in a different way, and thus this version is a completely new library.
Conversely, the library and unix command interfaces was as less as possible modified.
Nevertheless, the user will find some few backward incompatibilities: 5.93 based codes will not
directly compile with the 6.0 library version. Let us review how to move a code from 5.93 to 6.0
version.
C.2 What should I have to change in my 5.x code ?
1. Namespace
The namespace rheolef was already introduced in last 5.93 version. Recall that a code usually
starts with:
# include " rheolef . h "
using namespace rheolef ;
2. Environment
The MPI library requires initialisation and the two command line arguments. This initialisation
is performed via the boost::mpi class environment: The code entry point writes:
155156 Rheolef version 6.6 update 15 April 2014
int main (int argc , char ** argv ) {
environment rheolef ( argc , argv );
...
3. Fields and forms data accessors
The accesses to unknown and blocked data was of a field uh was direct, as uh.u and uh.b.
This access is no more possible in a distributed environment, as non-local value requests may be
optimized and thus, read and write access may be controled thought accessors. These accessors
are named uh.u() and uh.b() for read access, and uh.set_u() and uh.set_b() for write access.
Similarly, a form a has accessors as a.uu().
A typical 5.93 code writes:
ssk sa = ldlt ( a . uu );
uh . u = sa . solve ( lh . u - a . ub * uh . b );
and the corresponding 6.0 code is:
solver sa ( a . uu ());
uh . set_u () = sa . solve ( lh . u () - a. ub ()* uh . b ());
This major change in the library interface induces the most important work when porting to the
6.0 version.
Notice also that the old ssk class has been supersetted by the solver class, that manages
both direct and iterative solvers in a more effective way. For three-dimensional problems,
the iterative solver is the default while direct solvers are used otherwise. In the same spirit, a
solver_abtb has been introduced, for Stokes-like mixed problem. These features facilitate the
dimension-independent coding style provided by the Rheolef library.
4. Distributed input and output streams
Input and output sequential standard streams cin, cout and cerr may now replaced by distributed
Rheolef streams din, dout and derr as:
din >> omega ;
dout << uh ;
These new streams are available togeher with the idiststream and odiststream classes of the
Rheolef library.
5. File formats ‘.geo’ and ‘.field’ have changed
The ‘.geo’ and ‘.field’ file formats have changed. The ‘.mfield’ is now obsolete: it has been
merged into the ‘.field’ format that supports now multi-component fields. Also, the corresponding
mfield unix command is obsolete, as these features are integrated in the field unix
command.
At this early stage of the 6.0 version, it is not yet possible to read the old ‘.geo’ format, but this
backward compatibility will be assured soon.
6. Space on a domain
A space defined on a domain "boundary" of a mesh omega was defined in the 5.93 version as:
space Wh ( omega [" boundary "] , omega , " P1 ");
It writes now:
space Wh ( omega [" boundary "] , " P1 ");
as the repetition of omega is no more required.Rheolef version 6.6 update 15 April 2014 157
7. Nonlinear expressions involving fields
Non-linear operations, such as sqrt(uh) or 1/uh was directly supported in Rheolef-5.x.
space Xh ( omega , " P1 ");
field uh ( Xh , 2.);
field vh = 1/ uh ;
Notice that non-linear operations as 1/uh do not returns in general picewise polynomials while
uh*uh is piecewise quadratic. In Rheolef-5.x, the returned value was implicitly the Lagrange
interpolant of the nonlinear expression in space Xh. For more clarity, Rheolef-6.x requires an
explicit call to the interpolate function and the code should write:
field vh = interpolate (Xh , 1/ uh );
Notice that when the expression is linear, there is no need to call interpolate.
C.3 New features in Rheolef 6.4
The Rheolef-6.x code is in active developments. While backward compatibility s maintained since
6.0, some styles and idioms evoluates in order to increase the expressivity and the flexibility of the
interface library. Here is the summary of these evolutions.
1. Nonlinear expressions
Nonlinear expressions has been extended since Rheolef-6.4 to expression mixing field and functions
or field_functor. For instance, when u_exact is a field_functor, an L
2
error could be
computed using a nonlinear expression submitted to the integrate function:
Float err_l2 = sqrt ( integrate ( omega , sqr ( uh - u_exact ()) , qopt ));
2. Right-hand-side specification
For specifiying a right-hand-side involving f, previous code style, from Rheolef-6.0 to 6.3 was
using:
field lh = riesz ( Xh , f ());
Rheolef-6.4 introduces:
test v ( Xh );
field lh = integrate ( f ()* v );
This feature opens new possibilities of right-hand-side specifications, e.g. expressions involving
some derivatives of the test-function v. The riesz function is no more needed: it is maintained
for backward compatibility purpose.
3. Form specification
For specifiying a bilinear form, previous code style, from Rheolef-6.0 to 6.3 was using a specifi-
cation based on a name:
form a ( Xh , Xh , " grad_grad ");
Rheolef-6.4 introduces:
trial u ( Xh ); test v ( Xh );
form a = integrate ( dot ( grad ( u ) , grad ( v )));
This feature opens new possibilities for form specifications and more flexibility. The form specifi-
cation based on a name is no more needed: it is maintained for backward compatibility purpose.158 Rheolef version 6.6 update 15 April 2014Appendix D
GNU Free Documentation License
Version 1.1, March 2000
Copyright c 2000 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing
it is not allowed.
*
Preamble
The purpose of this License is to make a manual, textbook, or other written document “free”
in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially. Secondarily, this License
preserves for the author and publisher a way to get credit for their work, while not being considered
responsible for modifications made by others.
This License is a kind of “copyleft”, which means that derivative works of the document must
themselves be free in the same sense. It complements the GNU General Public License, which is
a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free software
needs free documentation: a free program should come with manuals providing the same freedoms
that the software does. But this License is not limited to software manuals; it can be used for
any textual work, regardless of subject matter or whether it is published as a printed book. We
recommend this License principally for works whose purpose is instruction or reference.
Applicability and Definitions
This License applies to any manual or other work that contains a notice placed by the copyright
holder saying it can be distributed under the terms of this License. The “Document”, below, refers
to any such manual or work. Any member of the public is a licensee, and is addressed as “you”.
A “Modified Version” of the Document means any work containing the Document or a portion of
it, either copied verbatim, or with modifications and/or translated into another language.
A “Secondary Section” is a named appendix or a front-matter section of the Document that deals
exclusively with the relationship of the publishers or authors of the Document to the Document’s
overall subject (or to related matters) and contains nothing that could fall directly within that
overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary
159160 Rheolef version 6.6 update 15 April 2014
Section may not explain any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal, commercial, philosophical, ethical
or political position regarding them.
The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those
of Invariant Sections, in the notice that says that the Document is released under this License.
The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or
Back-Cover Texts, in the notice that says that the Document is released under this License.
A “Transparent” copy of the Document means a machine-readable copy, represented in a format
whose specification is available to the general public, whose contents can be viewed and edited
directly and straightforwardly with generic text editors or (for images composed of pixels) generic
paint programs or (for drawings) some widely available drawing editor, and that is suitable for
input to text formatters or for automatic translation to a variety of formats suitable for input to
text formatters. A copy made in an otherwise Transparent file format whose markup has been
designed to thwart or discourage subsequent modification by readers is not Transparent. A copy
that is not “Transparent” is called “Opaque”.
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo
input format, LATEX input format, SGML or XML using a publicly available DTD, and standardconforming
simple HTML designed for human modification. Opaque formats include PostScript,
PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML
or XML for which the DTD and/or processing tools are not generally available, and the machinegenerated
HTML produced by some word processors for output purposes only.
The “Title Page” means, for a printed book, the title page itself, plus such following pages as are
needed to hold, legibly, the material this License requires to appear in the title page. For works
in formats which do not have any title page as such, “Title Page” means the text near the most
prominent appearance of the work’s title, preceding the beginning of the body of the text.
Verbatim Copying
You may copy and distribute the Document in any medium, either commercially or noncommercially,
provided that this License, the copyright notices, and the license notice saying this License
applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever
to those of this License. You may not use technical measures to obstruct or control the
reading or further copying of the copies you make or distribute. However, you may accept compensation
in exchange for copies. If you distribute a large enough number of copies you must also
follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display
copies.
Copying in Quantity
If you publish printed copies of the Document numbering more than 100, and the Document’s
license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and
legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify you as the publisher of these
copies. The front cover must present the full title with all words of the title equally prominent
and visible. You may add other material on the covers in addition. Copying with changes limited
to the covers, as long as they preserve the title of the Document and satisfy these conditions, can
be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones
listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.Rheolef version 6.6 update 15 April 2014 161
If you publish or distribute Opaque copies of the Document numbering more than 100, you must
either include a machine-readable Transparent copy along with each Opaque copy, or state in
or with each Opaque copy a publicly-accessible computer-network location containing a complete
Transparent copy of the Document, free of added material, which the general network-using public
has access to download anonymously at no charge using public-standard network protocols. If you
use the latter option, you must take reasonably prudent steps, when you begin distribution of
Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the
stated location until at least one year after the last time you distribute an Opaque copy (directly
or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before
redistributing any large number of copies, to give them a chance to provide you with an updated
version of the Document.
Modifications
You may copy and distribute a Modified Version of the Document under the conditions of sections
2 and 3 above, provided that you release the Modified Version under precisely this License, with
the Modified Version filling the role of the Document, thus licensing distribution and modification
of the Modified Version to whoever possesses a copy of it. In addition, you must do these things
in the Modified Version:
• Use in the Title Page (and on the covers, if any) a title distinct from that of the Document,
and from those of previous versions (which should, if there were any, be listed in the History
section of the Document). You may use the same title as a previous version if the original
publisher of that version gives permission.
• List on the Title Page, as authors, one or more persons or entities responsible for authorship
of the modifications in the Modified Version, together with at least five of the principal
authors of the Document (all of its principal authors, if it has less than five).
• State on the Title page the name of the publisher of the Modified Version, as the publisher.
• Preserve all the copyright notices of the Document.
• Add an appropriate copyright notice for your modifications adjacent to the other copyright
notices.
• Include, immediately after the copyright notices, a license notice giving the public permission
to use the Modified Version under the terms of this License, in the form shown in the
Addendum below.
• Preserve in that license notice the full lists of Invariant Sections and required Cover Texts
given in the Document’s license notice.
• Include an unaltered copy of this License.
• Preserve the section entitled “History”, and its title, and add to it an item stating at least
the title, year, new authors, and publisher of the Modified Version as given on the Title
Page. If there is no section entitled “History” in the Document, create one stating the title,
year, authors, and publisher of the Document as given on its Title Page, then add an item
describing the Modified Version as stated in the previous sentence.
• Preserve the network location, if any, given in the Document for public access to a Transparent
copy of the Document, and likewise the network locations given in the Document
for previous versions it was based on. These may be placed in the “History” section. You
may omit a network location for a work that was published at least four years before the
Document itself, or if the original publisher of the version it refers to gives permission.162 Rheolef version 6.6 update 15 April 2014
• In any section entitled “Acknowledgements” or “Dedications”, preserve the section’s title, and
preserve in the section all the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
• Preserve all the Invariant Sections of the Document, unaltered in their text and in their
titles. Section numbers or the equivalent are not considered part of the section titles.
• Delete any section entitled “Endorsements”. Such a section may not be included in the
Modified Version.
• Do not retitle any existing section as “Endorsements” or to conflict in title with any Invariant
Section.
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary
Sections and contain no material copied from the Document, you may at your option designate
some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections
in the Modified Version’s license notice. These titles must be distinct from any other section titles.
You may add a section entitled “Endorsements”, provided it contains nothing but endorsements
of your Modified Version by various parties – for example, statements of peer review or that the
text has been approved by an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as
a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage
of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made
by) any one entity. If the Document already includes a cover text for the same cover, previously
added by you or by arrangement made by the same entity you are acting on behalf of, you may not
add another; but you may replace the old one, on explicit permission from the previous publisher
that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use
their names for publicity for or to assert or imply endorsement of any Modified Version.
Combining Documents
You may combine the Document with other documents released under this License, under the terms
defined in section 4 above for modified versions, provided that you include in the combination all
of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant
Sections of your combined work in its license notice.
The combined work need only contain one copy of this License, and multiple identical Invariant
Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same
name but different contents, make the title of each such section unique by adding at the end of
it, in parentheses, the name of the original author or publisher of that section if known, or else a
unique number. Make the same adjustment to the section titles in the list of Invariant Sections in
the license notice of the combined work.
In the combination, you must combine any sections entitled “History” in the various original
documents, forming one section entitled “History”; likewise combine any sections entitled “Acknowledgements”,
and any sections entitled “Dedications”. You must delete all sections entitled
“Endorsements.”
Collections of Documents
You may make a collection consisting of the Document and other documents released under this
License, and replace the individual copies of this License in the various documents with a singleRheolef version 6.6 update 15 April 2014 163
copy that is included in the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under
this License, provided you insert a copy of this License into the extracted document, and follow
this License in all other respects regarding verbatim copying of that document.
Aggregation With Independent Works
A compilation of the Document or its derivatives with other separate and independent documents
or works, in or on a volume of a storage or distribution medium, does not as a whole count
as a Modified Version of the Document, provided no compilation copyright is claimed for the
compilation. Such a compilation is called an “aggregate”, and this License does not apply to
the other self-contained works thus compiled with the Document, on account of their being thus
compiled, if they are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if
the Document is less than one quarter of the entire aggregate, the Document’s Cover Texts may
be placed on covers that surround only the Document within the aggregate. Otherwise they must
appear on covers around the whole aggregate.
Translation
Translation is considered a kind of modification, so you may distribute translations of the Document
under the terms of section 4. Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include translations of some or all Invariant
Sections in addition to the original versions of these Invariant Sections. You may include a translation
of this License provided that you also include the original English version of this License.
In case of a disagreement between the translation and the original English version of this License,
the original English version will prevail.
Termination
You may not copy, modify, sublicense, or distribute the Document except as expressly provided
for under this License. Any other attempt to copy, modify, sublicense or distribute the Document
is void, and will automatically terminate your rights under this License. However, parties who
have received copies, or rights, from you under this License will not have their licenses terminated
so long as such parties remain in full compliance.
Future Revisions of This License
The Free Software Foundation may publish new, revised versions of the GNU Free Documentation
License from time to time. Such new versions will be similar in spirit to the present version, but
may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft.
Each version of the License is given a distinguishing version number. If the Document specifies
that a particular numbered version of this License "or any later version" applies to it, you have the
option of following the terms and conditions either of that specified version or of any later version
that has been published (not as a draft) by the Free Software Foundation. If the Document does
not specify a version number of this License, you may choose any version ever published (not as
a draft) by the Free Software Foundation.164 Rheolef version 6.6 update 15 April 2014
*
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of the License in the document
and put the following copyright and license notices just after the title page:
Copyright c YEAR YOUR NAME. Permission is granted to copy, distribute and/or
modify this document under the terms of the GNU Free Documentation License, Version
1.1 or any later version published by the Free Software Foundation; with the
Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being
LIST, and with the Back-Cover Texts being LIST. A copy of the license is included in
the section entitled “GNU Free Documentation License”.
If you have no Invariant Sections, write “with no Invariant Sections” instead of saying which
ones are invariant. If you have no Front-Cover Texts, write “no Front-Cover Texts” instead of
“Front-Cover Texts being LIST”; likewise for Back-Cover Texts.
If your document contains nontrivial examples of program code, we recommend releasing these
examples in parallel under your choice of free software license, such as the GNU General Public
License, to permit their use in free software.Bibliography
[1] E. M. Abdalass. Résolution performante du problème de Stokes par mini-éléments, maillages
auto-adaptatifs et méthodes multigrilles – applications. PhD thesis, Thèse de l’école centrale
de Lyon, 1987. 74
[2] L. Abouorm. Méthodes mathématiques pour les écoulements sur des surfaces. PhD thesis,
M2R Université J. Fourier, Grenoble, 2010. 115, 116
[3] P. R. Amestoy, I. S. Duff, J.-Y. L’Excellent, and J. Koster. A fully asynchronous multifrontal
solver using distributed dynamic scheduling. SIAM J. Matrix Anal. Appl., 23(1):15–41, 2001.
24
[4] P. R Amestoy, A. Guermouche, J.-Y. L’Excellent, and S. Pralet. Hybrid scheduling for the
parallel solution of linear systems. Parallel Comput., 32(2):136–156, 2006. 24
[5] D. N. Arnold, F. Brezzi, and M. Fortin. A stable finite element for the Stokes equations.
Calcolo, 21:337–344, 1984. 73
[6] C. Ashcraft and J. W. H. Liu. Robust ordering of sparse matrices using multisection. SIAM
Journal on Matrix Analysis and Applications, 19(3):816–832, 1998. 24
[7] F. Auteri, N. Parolini, and L. Quartapelle. Numerical investigation on the stability of singular
driven cavity flow. J. Comput. Phys., 183(1):1–25, 2002. 99
[8] G. K. Batchelor. An introduction to fluid dynamics. Cambridge university press, UK, sixth
edition, 1967. 79
[9] H. Borouchaki, P. L. George, F. Hecht, P. Laug, B. Mohammadi, and E. Saltel. Mailleur
bidimensionnel de Delaunay gouverné par une carte de métriques. Partie II: applications.
Technical Report RR-2760, INRIA, 1995. 59
[10] K. Boukir, Y. Maday, B. Metivet, and E. Razafindrakoto. A high-order characteristic/finite
element method for the incompressible Navier-Stokes equations. Int. J. Numer. Meth. Fluids,
25:1421–1454, 1997. 92
[11] H. Brezis. Analyse fonctionnelle. Théorie et application. Masson, Paris, 1983. 123
[12] F. Brezzi and J. Pitkäranta. On the stabilization of finite element approximation of the Stokes
equations. In Efficient solutions of elliptic systems, Kiel, Notes on numerical fluid mechanics,
volume 10, pages 11–19, 1984. 75
[13] M. J. Castro-Diaz, F. Hecht, B. Mohammadi, and O. Pironneau. Anisotropic unstructured
mesh adaption for flow simulations. Int. J. Numer. Meth. Fluids, 25(4):475–491, 1997. 59
[14] K. Deckelnick, G. Dziuk, C.M. Elliott, and C.-J. Heine. An h-narrow band finite element
method for elliptic equations on implicit surfaces. IMA Journal of Numerical Analysis, to
appear:0, 2009. 104
165166 Rheolef version 6.6 update 15 April 2014
[15] M. Dicko. Méthodes mathématiques pour les écoulements sur des surfaces. PhD thesis, M2P
Université J. Fourier, Grenoble, 2011. 115
[16] J. Donea and A. Huerta. Finite element methods for flow problems. Wiley, New-York, 2003.
98
[17] E. Erturk, T. C. Corke, and C. Gökçol. Numerical solutions of 2-D steady incompressible
driven cavity flow at high Reynolds numbers. Int. J. Numer. Meth. Fluids, 48:747–774, 2005.
99
[18] G. Fourestey and S. Piperno. A second-order time-accurate ALE Lagrange-Galerkin method
applied to wind engineering and control of bridge profiles. Comput. Methods Appl. Mech.
Engrg., 193:4117–4137, 2004. 92
[19] T. Gelhard, G. Lube, M. A. Olshanskii, and J. H. Starcke. Stabilized finite element schemes
with LBB-stable elements for incompressible flows. J. Comput. Appl. Math., 177:243–267,
2005. 99
[20] A. George. Nested dissection of a regular finite element mesh. SIAM J. Numer. Anal.,
10:345–363, 1973. 24
[21] C. Geuzaine and J.-F. Remacle. Gmsh: a three-dimensional finite element mesh generator
with built-in pre- and post-processing facilities. Int. J. Numer. Meths Engrg., 79(11):1309–
1331, 2009. 149, 151
[22] U. Ghia, K. N. Ghia, and C. T. Shin. High Re solutions for incompressible flow using the
Navier-Stokes equations and a multigrid method. J. Comput. Phys., 48:387–411, 1982. 98
[23] V. Girault and P. A. Raviart. Finite element methods for the Navier-Stokes equations. Theory
and algorithms. Springer, 1986. 39, 65, 67
[24] M. M. Gupta and J. C. Kalita. A new paradigm for solving Navier-Stokes equations:
streamfunction-velocity formulation. J. Comput. Phys., 207:52–68, 2005. 98
[25] F. Hecht. BAMG: bidimensional anisotropic mesh generator, 2006. http://www.ann.
jussieu.fr/~hecht/ftp/bamg. 59, 149
[26] A. J. Hoffman, M. S. Martin, and D. J. Rose. Complexity bounds for regular finite difference
and finite element grids. SIAM J. Numer. Anal., 10(2):364–369, 1973. 24
[27] P. Hood and C. Taylor. A numerical solution of the Navier-Stokes equations using the finite
element technique. Comp. and Fluids, 1:73–100, 1973. 63, 72, 93
[28] Jr. J. E. Dennis and R. B. Schnablel. Numerical methods for unconstraint optimization and
nonlinear equations. Prentice Hall, Englewood Cliff, N. J., 1983. 138
[29] A. Klawonn. An optimal preconditioner for a class of saddle point problems with a penalty
term. SIAM J. Sci. Comput, 19(2):540–552, 1998. 64, 72
[30] A. Laadhari, C. Misbah, and P. Saramito. On the equilibrium equation for a generalized
biological membrane energy by using a shape optimization approach. Phys. D, 239:1568–
1572, 2010. 148
[31] R. J. Labeur and G. N. Wells. A Galerkin interface stabilisation method for the advectiondiffusion
and incompressible Navier-Stokes equations. Comput. Meth. Appl. Mech. Engrg.,
196(49–52):4985–5000, 2007. 98
[32] S. Melchior, V. Legat, P. Van Dooren, and A. J. Wathen. Analysis of preconditioned iterative
solvers for incompressible flow problems. Int. J. Numer. Meth. Fluids, 2011. 99Rheolef version 6.6 update 15 April 2014 167
[33] P. D. Minev and C. R. Ethier. A characteristic/finite element algorithm for the 3-D NavierStokes
equations using unstructured grids. Comput. Meth. in Appl. Mech. and Engrg., 178(1-
2):39–50, 1998. 99
[34] D. R. Musser and A. Saini. C++ STL tutorial and reference guide. Addison Wesley, Reading,
1996. 28
[35] D. R. Musser and A. Saini. STL tutorial and reference guide. Addison-Wesley, 1996. 88
[36] M. A. Olshanskii and A. Reusken. A finite element method for surface PDEs: matrix properties.
Numer. Math., 114:491–520, 2010. 116
[37] M. A. Olshanskii, A. Reusken, and J. Grande. A finite element method for elliptic equations
on surfaces. SIAM J. Num. Anal., 47(5):3339–3358, 2009. 110, 115, 116
[38] M. L. Ould Salihi. Couplage de méthodes numériques en simulation directe d’écoulements
incompressibles. PhD thesis, Université J. Fourier, Grenoble, 1998. 99
[39] C. C. Paige and M. A. Saunders. Solution of sparse indefinite systems of linear equations.
SIAM J. Numer. Anal., 12(4):617–629, 1975. 39
[40] F. Pellegrini. PT-Scotch and libscotch 5.1 user’s guide. Université de Bordeaux and INRIA,
France, 2010. 24
[41] O. Pironneau. Méthode des éléments finis pour les fluides. Masson, Paris, 1988. 87
[42] O. Pironneau and M. Tabata. Stability and convergence of a galerkin-characteristics finite
element scheme of lumped mass type. Int. J. Numer. Meth. Fluids, 64:1240–1253, 2010. 88
[43] W. H. Press, S. A. Teulkolsky, W. T. Vetterling, and B. P. Flannery. Numerical recepies in
C. The art of scientific computing. Cambridge University Press, UK, second edition, 1997.
Version 2.08. 138
[44] P. A. Raviart and J. M. Thomas. Introduction à l’analyse numerique des équations aux
dérivées partielles. Masson, Paris, 1983. 126
[45] N. Roquet, R. Michel, and P. Saramito. Errors estimate for a viscoplastic fluid by using Pk
finite elements and adaptive meshes. C. R. Acad. Sci. Paris, ser. I, 331(7):563–568, 2000. 59
[46] H. Rui and M. Tabata. A second order characteristic finite element scheme for convection
diffusion problems. Numer. Math. (to appear), 2001. 87
[47] P. Saramito. Simulation numérique d’écoulements de fluides viscoélastiques par éléments finis
incompressibles et une méthode de directions alternées; applications. PhD thesis, Institut
National Polytechnique de Grenoble, 1990. 79
[48] P. Saramito. Rheolef home page. http://www-lmc.imag.fr/lmc-edp/Pierre.Saramito/
rheolef, 2012. 29
[49] P. Saramito. Méthodes numériques en fluides complexes : théorie et algorithmes. CNRSCCSD,
2012. http://cel.archives-ouvertes.fr/cel-00673816. 123
[50] P. Saramito. Language C++ et calcul scientifique. College Publications, London, 2013. 3, 24
[51] P. Saramito and N. Roquet. An adaptive finite element method for viscoplastic fluid flows in
pipes. Comput. Meth. Applied Mech. Engng, 190(40-41):5391–5412, 2001. 23
[52] Pierre Saramito. Are curved and high order gmsh meshes really high order ?, 2012. http:
//www.geuz.org/pipermail/gmsh/2012/006967.html. 111168 Rheolef version 6.6 update 15 April 2014
[53] J. Shen. Hopf bifurcation of the unsteady regularized driven cavity flow. J. Comp. Phys.,
95:228–245, 1991. http://www.math.purdue.edu/~shen/pub/Cavity.pdf. 99
[54] B. Stroustrup. The C++ programming language. Addison Wesley, Reading, special edition,
1997. 3
[55] B. Stroustrup. C++ programming styles and libraries. InformIt.com, 0:0, 2002. 2
[56] M.-G. Vallet. Génération de maillages anisotropes adaptés, application à la capture de couches
limites. Technical Report RR-1360, INRIA, 1990. 59
[57] Wikipedia. The Stokes stream function. Wikipedia, 2012. http://en.wikipedia.org/wiki/
Stokes_stream_function. 79
[58] N. Wirth. Algorithm + data structure = programs. Prentice Hall, NJ, USA, 1985. 2List of example files
Makefile, 16
cavity.icc, 61
convect.cc, 85
convect_error.cc, 87
cosinusprod.icc, 28
cosinusprod_error.cc, 28
cosinusprod_laplace.icc, 26
cosinusrad.icc, 30
cosinusrad_laplace.icc, 30
dirichlet-nh.cc, 26
dirichlet.cc, 14
dirichlet.icc, 125
elasticity_criterion.icc, 58
elasticity_solve.icc, 58
embankment.cc, 51
embankment.icc, 51
embankment_adapt.cc, 57
eta.icc, 124
heat.cc, 81
helmholtz_band.cc, 115
helmholtz_band_iterative.cc, 113
helmholtz_s.cc, 102
incompressible-elasticity.cc, 70
laplace_band.cc, 116
laplace_s.cc, 107
level_set_sphere.cc, 110
navier_stokes_cavity.cc, 92
navier_stokes_criterion.icc, 93
navier_stokes_solve.icc, 91
neumann-laplace.cc, 38
neumann-nh.cc, 34
nu.icc, 133
p_laplacian.h, 131
p_laplacian1.icc, 132
p_laplacian2.icc, 133
p_laplacian_circle.icc, 139
p_laplacian_damped_newton.cc, 137
p_laplacian_error.cc, 139
p_laplacian_fixed_point.cc, 122
p_laplacian_newton.cc, 131
poiseuille.h, 74
proj_band.cc, 114
robin.cc, 36
rotating-hill.h, 86
sinusprod_helmholtz.icc, 35
sphere.icc, 103
stokes_cavity.cc, 61
stokes_contraction_bubble.cc, 73
streamf_cavity.cc, 66
streamf_contraction.cc, 76
stress.cc, 53
torus.icc, 107
transmission.cc, 42
vortex_position.cc, 97
vorticity.cc, 64
cavity.icc, 93
contraction.mshcad, 74, 78
convect.cc, 92
cosinusrad_error.cc, 30
cube.mshcad, 150
dirichlet_nh_ball.cc, 30
helmholtz_s_error.cc, 105
line.mshcad, 60, 148
neumann-nh.cc, 102
square.bamgcad, 59, 95, 147
square.dmn, 59, 95, 147
square.mshcad, 149
stokes_contraction.cc, 76
streamf_cavity.cc, 95
streamf_contraction.cc, 78
stress.cc, 80
torus.mshcad, 109
169List of commands
bamg2geo, 147
bamg, 59, 95, 147
-splitpbedge, 126
branch, 86
-gnuplot, 84
-paraview, 84, 89
-umax, 84
convect, 86
ffmpeg, 84
field, 17, 154
-, 19
-bw, 18, 76, 79, 95, 114
-catchmark, 63
-comp, 53, 56, 79, 96
-cut, 79, 96, 125
-elevation, 18, 56, 114, 125
-fill, 53
-gray, 18
-max, 77, 96
-min, 96
-n-iso, 76
-n-iso-negative, 76, 79, 95
-noclean, 67
-noexecute, 67
-nofill, 18, 53, 59
-normal, 79, 96, 125
-origin, 79, 96, 125
-paraview, 18, 53, 59, 114
-proj, 55
-scale, 71, 95
-stereo, 18, 20, 53, 55, 56, 103,
114
-velocity, 63, 95
-volume, 20, 27
geo, 17
-cut, 19
-fill, 19
-full, 19
-paraview, 19
-shrink, 19
-stereo, 19, 103
-subdivide, 104
gmsh, 60, 74, 78, 103, 109, 126, 148
gnuplot, 17, 19, 44, 53, 84, 87, 148
gzip, 59
library
boost, 15, 39, 153
CGAL, computational geometry, 85
MPI, message passing interface,
153
MPI, message passing interface, 15
mumps, linear system direct solver, 22
scotch, mesh partition library, 22
STL, standard template library, 86
make, 16
man, 19
mayavi, 55, 56, 148
mkgeo_ball, 103
-e, 103
-q, 30
-s, 103
-t, 30, 103
mkgeo_grid, 17, 86, 126
-H, 20
-T, 19, 89
-a, 87
-b, 87
-c, 89
-d, 89
-e, 19
-f, 89
-g, 89
-q, 20
-region, 44
-t, 17
-zr, 77
mkgeo_ugrid, 30, 126
mpirun, 22, 39, 45
msh2geo, 74, 148, 150
-zr, 78
paraview, 18, 20, 55, 56, 67, 84, 89,
148
rheolef-config, 13
–check, 13
–docdir, 13
–exampledir, 13
sed, 30
visualization
170Rheolef version 6.6 update 15 April 2014 171
mesh, 17
deformed, 53
vlc, 84
zcat, 95Index
approximation, 14
P0, 55
P1b-P1, 71
P1d, 55
P1, 15, 51, 55, 70, 71, 90
P2-P1, Taylor-Hood, 61, 71, 72, 76
P2, 15, 19, 51, 55, 70, 90
Pk, 15, 19, 153
bubble, 71
discontinuous, 43, 54–56, 64
high-order, 15, 19, 45, 153
isoparametric, 104
mixed, 61
argc, argv, command line arguments, 15, 153
BDF2 scheme, 90
benchmark
driven cavity flow, 60, 90
Dziuk-Elliott-Heine on a sphere, 102
embankment, 49
flow in an abrupt contraction, 72, 78
Olshanskii-Reusken-Grande on a torus,
108
rotating hill, 85
boundary condition
Dirichlet, 13, 25, 43, 49, 60, 69, 90, 121,
130
mixed, 69, 72, 78
Neumann, 33, 37, 43, 49, 69
Poiseuille flow, 74
Robin, 35
class
Float, 27
adapt_option_type, 59
band, 113
branch, 82, 88
characteristic, 85
communicator, 39
csr, 39
doubledouble, 27
environment, 153
eye, 114
field_functor, 27, 155
field, 14, 154
form_option_type, 73, 78
form, 14
geo, 14
idiststream, 154
level_set_option_type, 110
odiststream, 58, 154
point, 27
quadrature_option_type, 85, 124, 139
solver_abtb, 92, 154
solver_option_type, 21
solver, 16, 21, 62, 154
space, 14, 154
vec, 39
compilation, 16
convergence
error
versus mesh, 28, 105, 139
versus polynomial degree, 28, 105, 139
residue
rate, 126, 127
super-linear, 133
coordinate system
axisymmetric, 74, 76, 77
Cartesian, 26, 44
spherical, 102
torus, 108
directory of example files, 13, 74, 76
distributed computation, 15, 22, 39, 153
element shape, 45
error analysis, 28, 88, 105, 139
file format
‘.bamgcad’ bamg geometry, 59, 147
‘.bamg’ bamg mesh, 59, 147
‘.branch’ family of fields, 83
‘.dmn’ domain names, 147
‘.field’ field, 17, 154
‘.field’ multi-component field, 53, 154
‘.geo’ mesh, 17, 74, 77, 147, 148, 150,
154
‘.gz’ gzip compressed file, 59
172Rheolef version 6.6 update 15 April 2014 173
‘.jpg’ joint photographic experts group,
84
‘.mov’ quicktime video file, 84
‘.mshcad’ gmsh geometry, 60, 74, 78,
109, 148
‘.msh’ gmsh mesh, 60, 74, 78, 148
‘.vtk’ vtk file, 67, 84
form
(η∇u).∇v, 132
2D(u) : D(v), 61, 69
2D(u) : D(v) + λdiv u div v, 51
2D(u) : D(v) + u.v, 91
η∇u.∇v, 43, 123
∇su.∇sv + uv, 102
∇u.∇v, 14
∇u.∇v + uv, 35
uv, 28
bcurl(u).ξ, 76
curl(u).ξ, 63
div(u) q, 61, 69
energy, 14, 42, 121
product, 73
weighted, 43, 123
quadrature formula, 124, 132
tensorial weight, 132
Fréchet derivative, 130
function
adapt, 57, 59
catchmark, 39, 51, 63, 82
compose, 85, 93, 123, 132
damped_newton, 137
diag, 114
dis_time, 21
field_functor, 139
grad, 123, 132
integrate, 15, 35, 73, 76, 85, 102, 123,
132, 139, 155
on a band, 114
interpolate, 27, 58, 74, 88, 155
ldlt, 39
level_set, 110
newton, 131
norm2, 58, 93, 123
riesz, 155
sqr, 58
class-function object, 26, 86, 133
geometry
axisymmetric, 74, 76
circle, 30, 103
contraction, 72, 78
cube, 19, 150
curved, 104
line, 19, 148
sphere, 102
square, 17, 149
surface, 101
curvature, 146
torus, 109
Green formula, 101, 145
Lagrange
interpolation, 26, 27, 34, 38
multiplier, 37, 62
node, 15
Lamé coefficients, 49
Makefile, 16
matrix
bloc-diagonal
inverse, 73
block structure, 16
concatenation, 39
diagonal, 114
factorization
Choleski, 16
identity, 114
indefinite, 39
singular, 39, 114
sparse, 39
mesh, 14, 147
adaptation, 153
anisotropic, 57, 93
connected components, 115
generation, 74, 78, 147
method
characteristic, 84, 90, 153
conjugate gradient algorithm, 16, 37, 61,
70
Euler implicit scheme, 81, 84
fixed-point, 122, 134
relaxation, 122, 128
level set, 101, 110
banded, 113
minres algorithm, 37, 114
Newton, 130
damped, 136
namespace
rheolef, 14, 153
std, 14
norm
in W−1,p, 126
discrete version, 126
in W1,p, 121
in W
1,p
0
, 121
operator174 Rheolef version 6.6 update 15 April 2014
adjoint, 136
curl, 63
divergence, 49
gradient, 49
symmetric part, 49
Helmholtz, 33
Helmholtz-Beltrami, 101
Laplace, 13
Laplace-Beltrami, 101
parallel computation, 15, 22, 39
polar coordinate system, 77
preconditioner, 61
Choleski incomplete factorization, 16
for nearly incompressible elasticity, 70
for Stokes problem, 61
problem
Helmholtz, 33
Navier-Stokes, 90
Poisson, 13, 25, 35, 37, 81, 121, 123
Stokes, 60, 71, 90
convection-diffusion, 84
elasticity, 49
heat, 81
linear tangent, 130
nonlinear, 90
p-Laplacian, 121
stabilized Stokes, 73
transmission, 42
projection, 55, 65
quadrature formula, 124
quadrature formulae
Gauss, 86
Gauss-Lobatto, 86
region, 42, 44
residual term, 126, 130
singular solution, 65
space
W−1,p, 121
W−1,p, dual of W
1,p
0
, 126
W1,p, 121
W
1,p
0
, 121
dual, 126
duality bracket h., .i, 126
weighted (axisymmetric), 77
speedup, 22
stabilization, 69
stream function, 65, 76, 95
axisymmetric, 77
tensor
Cauchy stress, 49, 80
field, 55
rate of deformation, 80
visualization as ellipsoid, 54
unknow and blocked components, 15
variable
derr, 154
din, 154
dout, 154
visualization
animation, 84
elevation view, 18, 125
stereoscopic anaglyph, 18, 53
vortex, 76, 79
vorticity, 63
NooJ pour l’Intelligence ´economique
Philippe Lambert
To cite this version:
Philippe Lambert. NooJ pour l’Intelligence ´economique. Ecole th´ematique. Semaine de for- ´
mation NooJ `a l’INALCO, INALCO, 2012, pp.14.
HAL Id: cel-00677782
https://cel.archives-ouvertes.fr/cel-00677782
Submitted on 9 Mar 2012
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Free Powerpoint Templates Page 1
NooJ pour l’intelligence
économique
Philippe Lambert
Institut Jean Lamour
Philippe.lambert@ijl.nancy-universite.fr
Semaine NooJ 2012Free Powerpoint Templates Page 2
PLAN
I. Contexte : l’intelligence économique
II. Cas d’études :
II. A.: Identification d’experts vietnamiens
II. B. : Traitement de questions ouvertes
d’un questionnaire
III. Perspectives de rechercheFree Powerpoint Templates Page 3
I. : L’intelligence économique
1/ L'ensemble des activités coordonnées de
collecte, de traitement et de diffusion de
l'information utile aux acteurs économiques
en vue de son exploitation
(Rapport Martre 1994)
2/ Réduction du niveau de l’incertitude dans
la prise de décision
(Nombreux auteurs)
3/ Donner la bonne information à la bonne
personne au bon momentFree Powerpoint Templates Page 4
I. : L’intelligence économique
Veille Intelligence
économique Observation
Donnée Information Connaissance
Définir les critères
de recherche
Rechercher les
données
Collecter et traiter
Valider, diffuser
l’information
Analyser l’information
et l’intégrer dans le
processus de prise de
décision
Le cycle de l’IEFree Powerpoint Templates Page 5
II. A.: Identification d’experts
Scénario : Implantation d’une entreprise au Vietnam
Trouver un point de contact localFree Powerpoint Templates Page 6
Restructuration des données
Entrepôt de données
(analyse multidimensionnelle)
II. A.: Identification d’expertsFree Powerpoint Templates Page 7
II. A.: Identification d’expertsFree Powerpoint Templates Page 8
II. B. : Questionnaire
Traitement des questions ouvertes
Questionnaire en ligne sur les nanosciences
Détermination des compétences des répondants
+
Leurs principales motivations
Répondants :
- Une centaine de chercheurs des laboratoires en recherche fondamentale (CNRS
et universités)
dans le champs des nanosciences (spintronique, photovoltaïques, optronique,
plasmas chauds, etc.
Comité de pilotage stratégiqueFree Powerpoint Templates Page 9
Préparation des données :
- Sélection des données
- Nettoyage des données
- Construction de nouvelles données
- Intégration des données
- Formatage des données
Fichier CSV
Mappage XSD
II. B. : QuestionnaireFree Powerpoint Templates Page 10
Création de
dictionnaires
II. B. : QuestionnaireFree Powerpoint Templates Page 11
II. B. : QuestionnaireFree Powerpoint Templates Page 12
Réponse ouverte : « les raisons de votre participation »
Traitement par NooJ d’un noeud XML spécifique
Extraction des syntagmes nominaux les plus
pertinents
II. B. : QuestionnaireFree Powerpoint Templates Page 13
Extraction des SN avec l’outil statistique de NooJFree Powerpoint Templates Page 14
Merci de votre attention !
Efficient C++ finite element computing with Rheolef :
volume 2: discontinuous Galerkin methods
Pierre Saramito
To cite this version:
Pierre Saramito. Efficient C++ finite element computing with Rheolef : volume 2: discontinuous
Galerkin methods. DEA. Grenoble, France, 2013, pp.51.
HAL Id: cel-00863021
https://cel.archives-ouvertes.fr/cel-00863021
Submitted on 18 Sep 2013
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Efficient C++ finite element
computing with Rheolef
volume 2:
discontinuous Galerkin methods
Pierre Saramito
version 6.6 update 17 September 2013
0
0.5
1
0 0.5 1
x
h = 1/20 φ(x)
φh(x)
Re = 10 000Copyright (c) 2003-2013 Pierre Saramito
Permission is granted to copy, distribute and/or modify this document under the terms of the
GNU Free Documentation License, Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy
of the license is included in the section entitled "GNU Free Documentation License".Contents
Notations 2
I Getting started with simple problems 5
1 A scalar first-order problem 7
1.1 The transport equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Scalar second-order problems 11
2.1 The Poisson problem with Dirichlet boundary conditions . . . . . . . . . . . . . . . 11
2.2 The Helmholtz problem with Neumann boundary conditions . . . . . . . . . . . . . 13
II Fluids and solids computations 17
3 The linear elasticity and the Stokes problems 19
3.1 The linear elasticity problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 The Stokes problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3 The stationnary Navier-Stokes problem . . . . . . . . . . . . . . . . . . . . . . . . 23
III Technical appendices 39
A GNU Free Documentation License 41
List of example files 47
List of commands 49
Index 49
12 Rheolef version 6.6 update 17 September 2013
Notations
Rheolef mathematics description
d d ∈ {1, 2, 3} dimension of the physical space
dot(u,v) u.v =
X
d−1
i=0
uivi vector scalar product
ddot(sigma,tau) σ : τ =
X
d−1
i,j=0
σi,j τi,j tensor scalar product
tr(sigma) tr(σ) = X
d−1
i=0
σi,i trace of a tensor
trans(sigma) σ
T
tensor transposition
sqr(phi)
norm2(phi) φ
2
square of a scalar
norm2(u) |u|
2 =
X
d−1
i=0
u
2
i
square of the vector norm
norm2(sigma) |σ|
2 =
X
d−1
i,j=0
σ
2
i,j square of the tensor norm
abs(phi)
norm(phi) |φ| absolute value of a scalar
norm(u) |u| =
X
d−1
i=0
u
2
i
!1/2
vector norm
norm(sigma) |σ| =
X
d−1
i,j=0
σ
2
i,j
1/2
tensor norm
grad(phi) ∇φ =
∂φ
∂xi
06i 0, f and φΓ being known. Notice that this is the steady version of the unsteady
diffusion-convection problem previously introduced in section 6.2, page 80 and when the diffusion
coefficient ν vanishes. Here, the ∂Ω− notation is the upstream boundary part, defined by
∂Ω− = {x ∈ Ω; u(x).n(x) < 0}
Let us suppose that u ∈ W1,∞(Ω)d and introduce the space:
X = {ϕ ∈ L
2
(Ω); (u.∇)ϕ ∈ L
2
(Ω)d
}
and, for all φ, ϕ ∈ X
a(φ, ϕ) = Z
Ω
(u.∇φ ϕ + σ φ ϕ) dx +
Z
∂Ω
max (0, −u.n) φ ϕ ds
l(ϕ) = Z
Ω
f ϕ dx +
Z
∂Ω
max (0, −u.n) φΓ ϕ ds
Then, the variational formulation writes:
(F V ): find φ ∈ X such that
a(φ, ϕ) = l(ϕ), ∀ϕ ∈ X
Notice that the term max(0, −u.n) = (|u.n| − u.n)/2 is positive and vanishes everywhere except
on ∂Ω−. Thus, the boundary condition φ = φΓ is weakly imposed on ∂Ω− via the integrals on the
boundary. The discontinuous finite element space is defined by:
Xh = {ϕh ∈ L
2
(Ω); ϕh|K ∈ Pk, ∀K ∈ Th}
78 Rheolef version 6.6 update 17 September 2013
where k > 0 is the polynomial degree. Notice that Xh 6⊂ X and that the ∇φh term has no more
sense for discontinous functions φh ∈ Xh. Following [6, p. 14], we introduce the broken gradient
∇h as a convenient notation:
(∇hφh)|K = ∇(φh|K), ∀K ∈ Th
Thus
Z
Ω
u.∇hφh ϕh dx =
X
K∈Th
Z
K
u.∇φh ϕh dx, ∀φh, ϕh ∈ Xh
This leads to a discrete version ah of the bilinear form a, defined for all φh, ϕh ∈ Xh by (see
e.g. [6, p. 57], eqn. (2.34)):
ah(φh, ϕh) = Z
Ω
(u.∇hφh ϕh + σφh ϕh) dx +
Z
∂Ω
max (0, −u.n) φh ϕh ds
+
X
S∈S
(i)
h
Z
S
− u.n [[φh]] {{ϕh}} +
α
2
|u.n| [[φh]] [[ϕh]]
ds
The two last terms involves a sum over S
(i)
h
, the set of internal sides of the mesh Th. Each internal
side S has two possible orientations: one is choosen definitively. In practice, this orientation
is defined in the ‘.geo’ file containing the mesh, where all sides are listed, together with teir
orientation. Let n the corresponding normal to the side: as S is an internal side, there exists
two elements K0 and K1 such that S = ∂K0 ∩ ∂K1 and n is the outward unit normal of K0
on ∂K0 ∩ S and the inward unit normal of K1 on ∂K1 ∩ S. We also denote on S the jump
[[φ]] = φ|K0 − φ|K1
and the average {{φ}} = (φ|K0 + φ|K1
)/2. The last term in the definition of ah
is ponderated by a coefficient α > 0. Choosing α = 0 correspond to the so-called centered flux
approximation, while α = 1 is the upwinding flux approximation. The case α = 1 and k = 0
(piecewise constant approximation) leads to the popular upwinding finite volume scheme. Finally,
the discrete variational formulation writes:
(F V )h: find φh ∈ Xh such that
ah(φh, ϕh) = l(ϕh), ∀ϕh ∈ Xh
The following code implement this problem in the Rheolef environment.
Example file 1.1: transport_dg.cc
1 # include " rheolef .h"
2 using namespace rheolef ;
3 using namespace std ;
4 int main (int argc , char ** argv ) {
5 environment rheolef ( argc , argv );
6 geo omega ( argv [1]);
7 space Xh ( omega , argv [2]);
8 Float alpha = ( argc > 3) ? atof ( argv [3]) : 1;
9 Float sigma = ( argc > 4) ? atof ( argv [4]) : 3;
10 point u (1 ,0 ,0);
11 trial phi ( Xh ); test psi ( Xh );
12 form ah = integrate ( dot (u , grad_h ( phi ))* psi + sigma * phi * psi )
13 + integrate (" boundary ", max (0 , - dot (u , normal ()))* phi * psi )
14 + integrate (" internal_sides ",
15 - dot (u , normal ())* jump ( phi )* average ( psi )
16 + 0.5* alpha * abs ( dot (u , normal ()))* jump ( phi )* jump ( psi ));
17 field lh = integrate (" boundary ", max (0 , - dot (u , normal ()))* psi );
18 solver sah ( ah . uu ());
19 field phi_h ( Xh );
20 phi_h . set_u () = sah . solve ( lh . u ());
21 dout << catchmark (" sigma ") << sigma << endl
22 << catchmark ("phi ") << phi_h ;
23 }Rheolef version 6.6 update 17 September 2013 9
Comments
The data are φγ = 1 and u = (1, 0, 0), and then the exact solution is known: φ(x) = exp(−σx0).
The numerical tests are running with σ = 3 by default. The one-dimensional case writes:
make transport_dg
mkgeo_grid -e 10 > line.geo
./transport_dg line P0 | field -
./transport_dg line P1d | field -
./transport_dg line P2d | field -
Observe the jumps accross elements: these jumps decreases with mesh refinement or when polynomial
approximation increases. The two-dimensional case writes:
mkgeo_grid -t 10 > square.geo
./transport_dg square P0 | field -elevation -
./transport_dg square P1d | field -elevation -
./transport_dg square P2d | field -elevation -
The elevation view shows details on inter-element jumps. Finaly, the three-dimensional case writes:
mkgeo_grid -T 5 > cube.geo
./transport_dg cube P0 | field -
./transport_dg cube P1d | field -
./transport_dg cube P2d | field -
0
0.5
1
0 0.5 1
x
h = 1/20 φ(x)
φh(x)
0
0.5
1
0 0.5 1
x
h = 1/40 φ(x)
φh(x)
Figure 1.1: The discontinuous Galerkin method for the transport problem when k = 0 and d = 1.
Fig. 1.1 plots the solution when d = 1 and k = 0: observe that the boundary condition φ = 1 at
x0 = 0 is only weakly satified. It means that the approximation φh(0) tends to 1 when h tnds to
zero. Fig. 1.2 plots the error φ − φh in L
2 and L∞ norms: these errors behave as O
h
k+1
for
all k > 0, which is optimal. A theoretical O
h
k+1/2
error bound was shown in [9]. The present
numerical results confirm that these theoretical error bounds can be improved for some families of
meshes, as pointed out by Richter [11], that showed a O
h
k+1
optimal bound for the transport
problem. This result was recently extended by Cockburn et al. [2], while Peterson [10] showed
that the estimate O
h
k+1/2
is sharp for general families of quasi-uniform meshes.10 Rheolef version 6.6 update 17 September 2013
10−15
10−10
10−5
1
10−2 10−1
h
kφ − φhkL2
1 = k + 1
5 = k + 1
k = 0
k = 1
k = 2
k = 3
k = 4
10−15
10−10
10−5
1
10−2 10−1
h
kφ − φhkL∞
1 = k + 1
5 = k + 1
k = 0
k = 1
k = 2
k = 3
k = 4
Figure 1.2: The discontinuous Galerkin method for the transport problem: convergence when
d = 2.Chapter 2
Scalar second-order problems
2.1 The Poisson problem with Dirichlet boundary conditions
The Poisson problem with non-homogeneous Dirichlet boundary conditions has been already introduced
in volume 1, section 2.1, page 23:
(P): find u, defined in Ω, such that
−∆u = f in Ω
u = g on ∂Ω
where f and g are given.
The discontinuous finite element space is defined by:
Xh = {vh ∈ L
2
(Ω); vh|K ∈ Pk, ∀K ∈ Th}
where k > 1 is the polynomial degree. As elements of Xh do not belongs to H1
(Ω), due to
discontinuities at inter-elements, we introduce the broken Sobolev space:
H1
(Th) = {v ∈ L
2
(Ω); v|K ∈ H1
(K), ∀K ∈ Th}
such that Xh ⊂ H1
(Th). We introduce the folowing bilinear form ah(., .) and linear for lh(.),
defined for all u, v ∈ H1
(Th) by (see e.g. [6, p. 125 and 127], eqn. (4.12)):
ah(u, v) = Z
Ω
∇hu.∇hv dx +
X
S∈Sh
Z
S
(ηs [[u]] [[v]] − {{∇hu.n}} [[v]] − [[u]] {{∇hv.n}}) ds (2.1)
lh(v) = Z
Ω
f u dx +
Z
∂Ω
(ηs g v − g ∇hv.n) ds (2.2)
The last term involves a sum over Sh, the set of all sides of the mesh Th, i.e. the internal sides
and the boundary sides. By convenience, the definition of the jump and average are extended to
all boundary sides as [[u]] = {{u}} = u. Notice that, as for the previous transport problem, the
Dirichlet boundary condition u = g is weakly imposed on ∂Ω via the integrals on the boundary.
Finally, ηs > 0 is a stabilization parameter on a side S. The stabilization term associated to ηs is
present in order to achieve coercivity: it penalize interface and boundary jumps. A common choice
is ηs = β h−1
s where β > 0 is a constant and hs is a local length scale associated to the current side
S. One drawnback to this choice is that it requires the end user to specify the numerical constant
β. From one hand, if the value of this parameter is not sufficiently large, the form ah(., .) is not
coercive and the approximate solution develops instabilities an do not converge [7]. From other
hand, if the value of this parameter is too large, its affect the overall efficiency of the iterative
solver of the linear system: the spectral condition number of the matrix associated to ah(., .)
1112 Rheolef version 6.6 update 17 September 2013
grows linearly with this paramater [1]. An explicit choice of penalty parameter is proposed in [12]:
ηs = β $s where β = (k + 1)(k + d)/d and
$s =
meas(∂K)
meas(K)
when S = K ∩ ∂Ω is a boundary side
max
meas(∂K0)
meas(K0)
,
meas(∂K1)
meas(K1)
when S = K0 ∩ K1 is an internal side
Notice that $s scales as h
−1
s
. Now, the computation of the penalty parameter is fully automatic
and the convergence of the method is always guaranted to converge. Moreover, this choice has
been founded to be sharp and it preserves the optimal efficiency of the iterative solvers. Finally,
the discrete variational formulation writes:
(F V )h: find uh ∈ Xh such that
ah(uh, vh) = lh(vh), ∀vh ∈ Xh
The following code implement this problem in the Rheolef environment.
Example file 2.1: dirichlet_dg.cc
1 # include " rheolef .h"
2 using namespace rheolef ;
3 using namespace std ;
4 # include " cosinusprod_laplace . icc"
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 space Xh ( omega , argv [2]);
9 size_t d = omega . dimension ();
10 size_t k = Xh . degree ();
11 Float beta = ( k +1)*( k + d )/ d;
12 trial u ( Xh ); test v ( Xh );
13 form a = integrate ( dot ( grad_h ( u ) , grad_h ( v )))
14 + integrate (" sides ", beta * penalty ()* jump ( u )* jump ( v )
15 - jump ( u )* average ( dot ( grad_h ( v ) , normal ()))
16 - jump ( v )* average ( dot ( grad_h ( u ) , normal ())));
17 field lh = integrate ( f (d )* v )
18 + integrate (" boundary ", beta * penalty ()* g ( d )* v
19 - g ( d )* dot ( grad_h ( v ), normal ()));
20 solver sa ( a . uu ());
21 field uh ( Xh );
22 uh . set_u () = sa . solve ( lh . u ());
23 dout << uh ;
24 }
Comments
The penalty() pseudo-function implements the computation of $s in Rheolef. The right-hand
side f and g are given by (2.1), volume 1, page 24. In that case, the exact solution is known.
Running the one-dimensional case writes:
make dirichlet_dg
mkgeo_grid -e 10 > line.geo
./dirichlet_dg line P1d | field -
./dirichlet_dg line P2d | field -
Fig. 2.1 plots the one-dimensional solution when k = 1 for two meshes. Observe that the jumps at
inter-element nodes decreases very fast with mesh refinement and are no more perceptible on the
plots. Recall that the Dirichlet boundary conditions at x = 0 and x = 1 is only weakly imposed:
the corresponding jump at the boundary is also not perceptible.
The two-dimensional case writes:Rheolef version 6.6 update 17 September 2013 13
-1
0
1
0 0.5 1
x
h = 1/10
u(x)
uh(x)
-1
0
1
0 0.5 1
x
h = 1/20
u(x)
uh(x)
Figure 2.1: The discontinuous Galerkin method for the Poisson problem when k = 1 and d = 1.
mkgeo_grid -t 10 > square.geo
./dirichlet_dg square P1d | field -elevation -
./dirichlet_dg square P2d | field -elevation -
and the three-dimensional one
mkgeo_grid -T 10 > cube.geo
./dirichlet_dg cube P1d | field -elevation -
./dirichlet_dg cube P2d | field -elevation -
Error analysis
The space H1
(Th) is equiped with the norm k.k1,h, defined for all v ∈ H1
(Th by [6, p. 128]:
kvk
2
1,h = k∇hvk
2
0,Ω +
X
S∈Sh
Z
S
h
−1
s
[[v]]2 ds
The code cosinusprod_error_dg.cc compute the error in these norms. This code it is not listed
here but is available in the Rheolef example directory. The computation of the error writes:
make cosinusprod_error_dg
./dirichlet_dg square P1d | cosinusprod_error_dg
Fig. 2.2 plots the error u − uh in L
2
, L∞ and the k.k1,h norms. The L
2 and L∞ error norms
behave as O
h
k+1
for all k > 0, while the k.k1,h one behaves as O
h
k
, which is optimal.
2.2 The Helmholtz problem with Neumann boundary conditions
The Poisson problem with non-homogeneous Neumann boundary conditions has been already
introduced in volume 1, section 2.2, page 31:
(P): find u, defined in Ω, such that
u − ∆u = f in Ω
∂u
∂n = g on ∂Ω14 Rheolef version 6.6 update 17 September 2013
10−15
10−10
10−5
1
10−2 10−1
h
ku − uhk0,Ω
2 = k + 1
5 = k + 1
k = 1
k = 2
k = 3
k = 4
10−15
10−10
10−5
1
10−2 10−1
h
ku − uhk∞,Ω
2 = k + 1
5 = k + 1
k = 1
k = 2
k = 3
k = 4
10−10
10−5
1
10−2 10−1
h
ku − uhk1,h
1 = k
4 = k
k = 1
k = 2
k = 3
k = 4
Figure 2.2: The discontinuous Galerkin method for the Poisson problem: convergence when d = 2.
where f and g are given. We introduce the folowing bilinear form ah(., .) and linear for lh(.),
defined for all u, v ∈ H1
(Th) by (see e.g. [6, p. 127], eqn. (4.16)):
ah(u, v) = Z
Ω
(u v + ∇hu.∇hv) dx (2.3)
+
X
S∈S
(i)
h
Z
S
(β$s [[u]] [[v]] − {{∇hu.n}} [[v]] − [[u]] {{∇hv.n}}) ds (2.4)
lh(v) = Z
Ω
f u dx +
Z
∂Ω
g v ds (2.5)
Let us comment the changes between these forms and those used for the Poisson problem with
Dirichlet boundary conditions. The Poisson operator −∆ has been replaced by the Helmholtz one
I − ∆ in order to have an unique solution. Remark also that the sum is performed in (2.1) for all
internal sides in S
(i)
h
, while, in (2.1), for Dirichlet boundary conditions, it was for all sides in Sh,
i.e. for both boundary and internal sides. Also, the right-hand-side linear form lh(.). do no more
involves any sum over sides.
Finally, the discrete variational formulation writes:
(F V )h: find uh ∈ Xh such that
ah(uh, vh) = lh(vh), ∀vh ∈ Xh
The following code implement this problem in the Rheolef environment.Rheolef version 6.6 update 17 September 2013 15
Example file 2.2: neumann_dg.cc
1 # include " rheolef .h"
2 using namespace rheolef ;
3 using namespace std ;
4 # include " sinusprod_helmholtz . icc"
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 space Xh ( omega , argv [2]);
9 size_t d = omega . dimension ();
10 size_t k = Xh . degree ();
11 Float beta = ( k +1)*( k + d )/ d;
12 trial u ( Xh ); test v ( Xh );
13 form a = integrate ( u * v + dot ( grad_h ( u ) , grad_h (v )))
14 + integrate (" internal_sides ",
15 beta * penalty ()* jump ( u )* jump ( v )
16 - jump ( u )* average ( dot ( grad_h ( v ) , normal ()))
17 - jump ( v )* average ( dot ( grad_h ( u ) , normal ())));
18 field lh = integrate ( f (d )* v ) + integrate (" boundary ", g (d )* v );
19 solver sa ( a . uu ());
20 field uh ( Xh );
21 uh . set_u () = sa . solve ( lh . u ());
22 dout << uh ;
23 }
Comments
The right-hand side f and g are given by (2.2), volume 1, page 24. In that case, the exact solution
is known. Running the program is obtained from the non-homogeneous Dirichlet case, by replacing
dirichlet_dg by neumann_dg.16 Rheolef version 6.6 update 17 September 2013Part II
Fluids and solids computations
17Chapter 3
The linear elasticity and the Stokes
problems
3.1 The linear elasticity problem
The elasticity problem (4.2) has been introduced in volume 1, section 4.1, page 47.
(P): find u such that
−div (λdiv(u).I + 2D(u)) = f in Ω
u = g on ∂Ω
where λ > −1 is a constant and f, g given. This problem is a natural extension to vector-valued
field of the Poisson problem with Dirichlet boundary conditions.
The variational formulation writes:
(F V )h: find u ∈ V(g) such that
a(u, v) = lh(v), ∀v ∈ V(0)
where
V(g) = {v ∈ H1
(Ω)d
; v = g on ∂Ω}
a(u, v) = Z
Ω
(λ div(u) div(v) + 2D(u):D(v)) dx
l(v) = Z
Ω
f.v dx
The discrete variational formulation writes:
(F V )h: find uh ∈ Xh such that
ah(uh, vh) = lh(vh), ∀vh ∈ Xh
where
Xh = {vh ∈ L
2
(Ω)d
; vh|K ∈ P
d
k
, ∀K ∈ Th}
ah(u, v) = Z
Ω
(λ divh(u) divh(v) + 2Dh(u):Dh(v)) dx
+
X
S∈Sh
Z
S
(β$s[[u]].[[v]] − [[u]].{{λdivh(v)n + 2Dh(v)n}} − [[v]].{{λdivh(u)n + 2Dh(u)n}}) ds
lh(v) = Z
Ω
f.v dx +
Z
∂Ω
g.(β$sv − λdivh(v)n − 2Dh(v)n) ds
1920 Rheolef version 6.6 update 17 September 2013
where k > 1 is the polynomial degree in Xh.
Example file 3.1: elasticity_taylor_dg.cc
1 # include " rheolef .h"
2 using namespace rheolef ;
3 using namespace std ;
4 # include " taylor .icc"
5 int main (int argc , char ** argv ) {
6 environment rheolef ( argc , argv );
7 geo omega ( argv [1]);
8 space Xh ( omega , argv [2] , " vector ");
9 Float lambda = ( argc > 3) ? atof ( argv [3]) : 1;
10 size_t d = omega . dimension ();
11 size_t k = Xh . degree ();
12 Float beta = ( k +1)*( k + d )/ d;
13 trial u ( Xh ); test v ( Xh );
14 form a = integrate ( lambda * div_h ( u )* div_h ( v ) + 2* ddot ( Dh ( u ) , Dh ( v )))
15 + integrate ( omega . sides () ,
16 beta * penalty ()* dot ( jump ( u ) , jump ( v ))
17 - lambda * dot ( jump ( u ), average ( div_h ( v )* normal ()))
18 - lambda * dot ( jump ( v ), average ( div_h ( u )* normal ()))
19 - 2* dot ( jump ( u ) , average ( Dh ( v )* normal ()))
20 - 2* dot ( jump ( v ) , average ( Dh ( u )* normal ())));
21 field lh = integrate ( dot ( f () , v ))
22 + integrate ( omega . boundary () ,
23 beta * penalty ()* dot ( g () , jump ( v ))
24 - lambda * dot ( g () , average ( div_h ( v )* normal ()))
25 - 2* dot ( g () , average ( Dh ( v )* normal ())));
26 solver sa ( a . uu ());
27 field uh ( Xh );
28 uh . set_u () = sa . solve ( lh . u ());
29 dout << uh ;
30 }
Comments
The data are given when d = 2 by:
g(x) =
− cos(πx0) sin(πx1)
sin(πx0) cos(πx1)
and f = 2π
2g (3.1)
This choice is convenient since the exact solution is known u = g. This benmark solution was
proposed in 1923 by Taylor [13] in the context of the Stokes problem. Notice that the solution is
independent of λ since div(u) = 0.
Example file 3.2: taylor.icc
1 struct g : field_functor {
2 point operator () ( const point & x ) const {
3 return point ( - cos ( pi * x [0])* sin ( pi * x [1]) ,
4 sin ( pi * x [0])* cos ( pi * x [1])); }
5 g () : pi ( acos ( Float ( -1.0))) {}
6 const Float pi ;
7 };
8 struct f : field_functor {
9 point operator () ( const point & x ) const { return 2* sqr ( pi )* _g ( x ); }
10 f () : pi ( acos ( Float ( -1.0))) , _g () {}
11 const Float pi ; g _g ;
12 };
As the exact solution is known, the error can be computed. The code code
elasticity_taylor_error_dg.cc compute the error in L
2
, L∞ and energy norms. This code
it is not listed here but is available in the Rheolef example directory. The computation writes:
make elasticity_taylor_dg elasticity_taylor_error_dgRheolef version 6.6 update 17 September 2013 21
mkgeo_grid -t 10 > square.geo
./elasticity_taylor_dg square P1d | ./elasticity_taylor_error_dg
./elasticity_taylor_dg square P2d | ./elasticity_taylor_error_dg
3.2 The Stokes problem
Let us consider the Stokes problem for the driven cavity in Ω =]0, 1[d
, d = 2, 3. The problem has
been introduced in volume 1, section 4.4, page 57.
(P): find u and p, defined in Ω, such that
− div(2D(u)) + ∇p = f in Ω,
− div u = 0 in Ω,
u = g on ∂Ω
where f and g are given. This problem is the extension to divergence free vector fields of the
elasticity problem. The variational formulation writes:
(V F)h find u ∈ V(g) and p ∈ L
2
(Ω) such that:
a(u, v) + b(v, p) = l(v), ∀v ∈ V(0),
b(u, q) = 0, ∀q ∈ L
2
(Ω) (3.2)
where
V(g) = {v ∈ H1
(Ω)d
; v = g on ∂Ω}
a(u, v) = Z
Ω
2D(u):D(v) dx
b(u, q) = −
Z
Ω
div(u) q dx
l(v) = Z
Ω
f.v dx
The discrete variational formulation writes:
(V F)h find uh ∈ Xh and ph ∈ Qh such that:
ah(uh, vh) + bh(vh, ph) = lh(vh), ∀vh ∈ Xh,
bh(uh, qh) − ch(ph, qh) = kh(q), ∀qh ∈ Qh.
(3.3)
The discontinuous finite element spaces are defined by:
Xh = {vh ∈ L
2
(Ω)d
; vh|K ∈ P
d
k
, ∀K ∈ Th}
Qh = {qh ∈ L
2
(Ω)d
; qh|K ∈ P
d
k
, ∀K ∈ Th}
where k > 1 is the polynomial degree. Notice that velocity and presure are approximated by the
same polynomial order. This method was introduced by [4] and some recent theoretical results
can be founded in [5]. The forms are defined for all u, v ∈ H1
(Th)
d and q ∈ L
2
(Ω) by (see22 Rheolef version 6.6 update 17 September 2013
e.g. [6, p. 249]):
ah(u, v) = Z
Ω
2Dh(u):Dh(v) dx
+
X
S∈Sh
Z
S
(β$s[[u]].[[v]] − [[u]].{{2Dh(v)n}} − [[v]].{{2Dh(u)n}}) ds
bh(u, q) = Z
Ω
u.∇hq dx −
X
S∈S
(i)
h
Z
S
{{u}}.n [[q]] ds
ch(p, q) = X
S∈S
(i)
h
Z
S
hs [[p]] [[q]] ds
lh(v) = Z
Ω
f.v ds +
Z
∂Ω
g.(β$s v − 2Dh(v) n) ds
kh(q) = Z
∂Ω
g.n q ds
The stabilization form ch controls the pressure jump accross internal sides. This stabilization
term is necessary when using equal order polynomial approximation for velocity and pressure.
The definition of the forms is grouped in a subroutine: it will be reused later for the Navier-Stokes
problem.
Example file 3.3: stokes_dirichlet_dg.icc
1 void stokes_dirichlet_dg ( const space & Xh , const space & Qh ,
2 form & a , form & b , form & c , form & mp , field & lh , field & kh ,
3 quadrature_option_type qopt = quadrature_option_type ())
4 {
5 size_t k = Xh . degree ();
6 size_t d = Xh . get_geo (). dimension ();
7 Float beta = ( k +1)*( k + d )/ d;
8 trial u ( Xh ) , p ( Qh );
9 test v ( Xh ) , q ( Qh );
10 a = integrate (2* ddot ( Dh ( u ) , Dh ( v )) , qopt )
11 + integrate (" sides ", beta * penalty ()* dot ( jump ( u ) , jump ( v ))
12 - 2* dot ( jump ( u ) , average ( Dh ( v )* normal ()))
13 - 2* dot ( jump ( v ) , average ( Dh ( u )* normal ())) , qopt );
14 lh = integrate ( dot ( f () , v ) , qopt )
15 + integrate (" boundary ", beta * penalty ()* dot ( g () , v )
16 - 2* dot ( g () , Dh ( v )* normal ()) , qopt );
17 b = integrate ( dot (u , grad_h ( q )) , qopt )
18 + integrate (" internal_sides ", - dot ( average ( u ) , normal ())* jump ( q) , qopt );
19 kh = integrate (" boundary ", dot (g () , normal ())* q , qopt );
20 c = integrate (" internal_sides ", h_local ()* jump ( p )* jump ( q ) , qopt );
21 mp = integrate ( p *q , qopt );
22 }
A simple test program writes:Rheolef version 6.6 update 17 September 2013 23
Example file 3.4: stokes_taylor_dg.cc
1 # include " rheolef .h"
2 using namespace rheolef ;
3 using namespace std ;
4 # include " taylor .icc"
5 # include " stokes_dirichlet_dg . icc"
6 int main (int argc , char ** argv ) {
7 environment rheolef ( argc , argv );
8 geo omega ( argv [1]);
9 space Xh ( omega , argv [2] , " vector ");
10 space Qh ( omega , argv [2]);
11 form a , b , c , mp ;
12 field lh , kh ;
13 stokes_dirichlet_dg ( Xh , Qh , a , b , c , mp , lh , kh );
14 field uh ( Xh , 0) , ph (Qh , 0);
15 solver_abtb stokes ( a . uu () , b . uu () , c . uu () , mp . uu ());
16 stokes . solve ( lh . u () , kh . u () , uh . set_u () , ph . set_u ());
17 dout << catchmark ("u") << uh
18 << catchmark ("p") << ph ;
19 }
Comments
The data are given when d = 2 by (3.1). This choice is convenient since the exact solution is
known u = g and p = 0. The code stokes_taylor_error_dg.cc compute the error in L
2
, L∞
and energy norms. This code it is not listed here but is available in the Rheolef example directory.
The computation writes:
make stokes_taylor_dg stokes_taylor_error_dg
mkgeo_grid -t 10 > square.geo
./stokes_taylor_dg square P1d | ./stokes_taylor_error_dg
./stokes_taylor_dg square P2d | ./stokes_taylor_error_dg
3.3 The stationnary Navier-Stokes problem
3.3.1 Problem statemment
The Navier-Stokes problem has been already introduced in volume 1, section 3.3 page 23. Here
we consider the stationnary version of this problem. Let Re > 0 be the Reynolds number. The
problem writes:
(P): find u and p, defined in Ω, such that
Re (u.∇)u − div(2D(u)) + ∇p = f in Ω,
− div u = 0 in Ω,
u = g on ∂Ω
Notice that, when Re > 0, the problem is nonlinear, due to the inertia term u.∇u. When Re = 0
the problem reduces to the linear Stokes problem, presented in the previous section/
The variationnal formulation of this nonlinear problem writes:
(F V ): find u ∈ V(g) and p ∈ L
2
(Ω) such that
Re t(u; u, v) + a(u, v) + b(v, p) = l(v), ∀v ∈ V(0),
b(u, q) = 0, ∀q ∈ L
2
(Ω)
where the space V(g) and forms a, b and l are given as in the previous section 3.2 for the Stokes
problem and the trilinear form t(.; ., .) is given by:
t(w; u, v) = Z
Ω
((w.∇)u).v dx24 Rheolef version 6.6 update 17 September 2013
3.3.2 The discrete problem
Let
t(w; u, u) = Z
Ω
(w.∇u).u dx
Observe that, for all u, w ∈ H1
(Ω)d we have
Z
Ω
(w.∇u).u dx =
X
d−1
i,j=0
Z
Ω
ui wj ∂j (ui) dx
=
X
d−1
i,j=0
−
Z
Ω
ui ∂j (ui wj ) dx +
Z
∂Ω
u
2
i wj nj dx
=
X
d−1
i,j=0
−
Z
Ω
ui ∂j (ui) wj dx −
Z
Ω
u
2
i ∂j (wj ) dx +
Z
∂Ω
u
2
i wj nj dx
= −
Z
Ω
(w.∇u).u dx −
Z
Ω
div(w)|u|
2 dx +
Z
∂Ω
w.n |u|
2 ds (3.4)
Thus
t(w; u, u) = Z
Ω
(w.∇u).u dx = −
1
2
Z
Ω
div(w)|u|
2 dx +
1
2
Z
∂Ω
w.n |u|
2 ds
When div(w) = 0, the trilinear form t(.; ., .) reduces to a boundary term: it is formaly skewsymmetric.
The skew-symmetry of t is an important property: let (v, q) = (u, p) as test functions
in (F V ). We obtain:
a(u, u) = l(u)
In other words, we obtain the same energy balance as for the Stokes flow and inertia do not
contribute to the energy balance. This is an important property and we aim at obtaining the
same one at the discrete level. As the discrete solution uh is not exactly divergence free, following
Temam, we introduce the following modified trilinear form:
t
∗
(w; u, v) = Z
Ω
(w.∇u).v +
1
2
div(w) u.v
dx −
1
2
Z
∂Ω
(w.n) u.v ds, ∀u, v, w ∈ H1
(Ω)d
This form integrates the non-vanishing terms and we have:
t
∗
(w; u, u) = 0, ∀u, w ∈ H1
(Ω)d
When the discrete solution is not exactly divergence free, it is better to use t
∗
than t.
The discontinuous finite element spaces Xh and Qh and forms ah, bh, ch, lh and kh are defined as
in the previous section. Let us introduce t
∗
h
, the following discrete trilinear form, defined for all
uh, vh, wh ∈ Xh:
t
∗
h
(wh; uh, vh) = Z
Ω
(wh.∇huh).vh +
1
2
divh(wh) uh.vh
dx −
1
2
Z
∂Ω
(wh.n) uh.vh ds
Notice that t
∗
h
is similar to t
∗
: the gradient and divergence has been replaced by their broken
counterpart in the first term. As Xh 6⊂ H1
(Ω)d
, the skew-symmetry property is not expected to
be true at the discrete level. Then
t
∗
h
(wh; uh, uh) = X
K∈Th
Z
K
(wh.∇uh).uh +
1
2
div(wh)|uh|
2
dx −
1
2
Z
∂Ω
(wh.n)|uh|
2 dsRheolef version 6.6 update 17 September 2013 25
As the restriction of uh and wh to each K ∈ Th belongs to H1
(K)
d
, we have, using a similar
integration by part:
Z
K
(wh.∇uh).uh dx = −
1
2
Z
K
div(wh)|uh|
2 dx +
1
2
Z
∂K
(wh.n)|uh|
2 ds
Thus
t
∗
h
(wh; uh, uh) = 1
2
X
K∈Th
Z
∂K
(wh.n)|uh|
2 ds −
1
2
Z
∂Ω
(wh.n)|uh|
2 ds
The terms on boundary sides vanish while those on internal sides can be grouped:
t
∗
h
(wh; uh, uh) = 1
2
X
S∈S
(i)
h
Z
S
[[|uh|
2wh]].n ds
The jump term [[(uh.vh) wh]].n is not easily manageable and could be developed. A short computation
shows that, for all scalar fields φ, ϕ we have on any internal side:
[[φϕ]] = [[φ]]{{ϕ}} + {{φ}}[[ϕ]] (3.5)
{{φϕ}} = {{φ}}{{ϕ}} +
1
4
[[φ]][[ϕ]] (3.6)
Then
t
∗
h
(wh; uh, uh) = 1
2
X
S∈S
(i)
h
Z
S
{{wh}}.n [[|uh|
2
]] + [[wh]].n {{|uh|
2
}}
ds
=
X
S∈S
(i)
h
Z
S
{{wh}}.n ([[uh]].{{uh}}) + 1
2
[[wh]].n {{|uh|
2
}}
ds
Thus, as expected, the skew-symmetry property is no more satisfied at the discrete level, due to
the jumps of the fields at the inter-element boundaries. Following the previous idea, we introduce
the following modified discrete trilinear form:
th(wh; uh, vh) = t
∗
h
(wh; uh, vh) −
X
S∈S
(i)
h
Z
S
{{wh}}.n ([[uh]].{{vh}}) + 1
2
[[wh]].n {{uh.vh}}
ds
=
Z
Ω
(wh.∇huh).vh +
1
2
divh(wh) uh.vh
dx −
1
2
Z
∂Ω
(wh.n) uh.vh ds
−
X
S∈S
(i)
h
Z
S
{{wh}}.n ([[uh]].{{vh}}) + 1
2
[[wh]].n {{uh.vh}}
ds (3.7)
This expression has been proposed by Pietro and Ern [5, p. 22], eqn (72) (see also [6, p. 272], eqn
(6.57)). The boundary term introduced in th may be compensated in the right-hand side:
l
∗
h
(v) := lh(v) −
Re
2
Z
∂Ω
(g.n) g.vh ds
Notice that the boundary term introduced in th is compensated in the right-hand side l
∗
h
.26 Rheolef version 6.6 update 17 September 2013
Example file 3.5: inertia.icc
1 template < class W , class U , class V >
2 form inertia ( W w , U u , V v ,
3 quadrature_option_type qopt = quadrature_option_type ())
4 {
5 return
6 integrate ( dot ( grad_h ( u )* w , v ) + 0.5* div_h ( w )* dot (u , v ) , qopt )
7 + integrate (" boundary ", - 0.5* dot (w , normal ())* dot (u , v ) , qopt )
8 + integrate (" internal_sides ",
9 - dot ( average ( w ) , normal ())* dot ( jump ( u ) , average ( v ))
10 - 0.5* dot ( jump ( w ) , normal ())
11 *( dot ( average ( u ) , average ( v )) + 0.25* dot ( jump ( u ) , jump ( v ))) , qopt );
12 }
13 field inertia_fix_rhs ( test v ,
14 quadrature_option_type qopt = quadrature_option_type ())
15 {
16 return integrate (" boundary ", - 0.5* dot ( g () , normal ())* dot ( g () , v ) , qopt );
17 }
The discrete problem is
(F V )h: find uh ∈ Xh and p ∈ Qh such that
Re th(uh; uh, vh) + ah(uh, vh) + bh(vh, ph) = l
∗
h
(vh), ∀vh ∈ Xh,
bh(uh, qh) − ch(ph, qh) = kh(q), ∀qh ∈ Qh
(3.8)
The simplest approach for solving the discrete problem is to consider a fixed-point algorithm. The
sequence
u
(k)
h
k>0
is defined by reccurence as:
• k = 0: let u
(0)
h ∈ Xh being known.
• k > 0: let u
(k−1)
h ∈ Xh given. Find u
(k)
h ∈ Xh and p
(k)
h ∈ Qh such that
Re th
u
(k−1)
h
; u
(k)
h
, vh
+ ah
u
(k)
h
, vh
+ bh
vh, p
(k)
h
= l
∗
h
(vh), ∀vh ∈ Xh,
bh
u
(k)
h
, qh
− ch
p
(k)
h
, qh
= kh(q), ∀qh ∈ Qh.
At each step k > 0, this algorithm involves a linear subproblem of Stokes-type.Rheolef version 6.6 update 17 September 2013 27
Example file 3.6: navier_stokes_taylor_dg.cc
1 # include " rheolef .h"
2 using namespace rheolef ;
3 using namespace std ;
4 # include " taylor .icc"
5 # include " stokes_dirichlet_dg . icc"
6 # include " inertia .icc"
7 int main (int argc , char ** argv ) {
8 environment rheolef ( argc , argv );
9 geo omega ( argv [1]);
10 space Xh ( omega , argv [2] , " vector ");
11 space Qh ( omega , argv [2]);
12 Float Re = ( argc > 3) ? atof ( argv [3]) : 1;
13 size_t max_iter = ( argc > 4) ? atoi ( argv [4]) : 1;
14 form a , b , c , mp ;
15 field lh , kh ;
16 stokes_dirichlet_dg ( Xh , Qh , a , b , c , mp , lh , kh );
17 field uh ( Xh , 0) , ph (Qh , 0);
18 solver_abtb stokes ( a . uu () , b . uu () , c . uu () , mp . uu ());
19 stokes . solve ( lh . u () , kh . u () , uh . set_u () , ph . set_u ());
20 trial u ( Xh ); test v ( Xh );
21 form a1 = a + Re * inertia ( uh , u , v );
22 lh += Re * inertia_fix_rhs ( v );
23 derr << "#k r as" << endl ;
24 for ( size_t k = 0; k < max_iter ; ++ k ) {
25 solver_abtb stokes ( a1 . uu () , b. uu () , c . uu () , mp . uu ());
26 stokes . solve ( lh . u () , kh . u () , uh . set_u () , ph . set_u ());
27 form th = inertia ( uh , u , v );
28 a1 = a + Re * th ;
29 field rh = a1 * uh + b . trans_mult ( ph ) - lh ;
30 derr << k << " " << rh . max_abs () << " " << th ( uh , uh ) << endl ;
31 }
32 dout << catchmark ("Re") << Re << endl
33 << catchmark ("u") << uh
34 << catchmark ("p") << ph ;
35 }
Comments
The data are given when d = 2 by (3.1). This choice is convenient since the exact solution is known
u = g and p = −(Re/4)(cos(2πx0) + cos(2πx1)). The code navier_stokes_taylor_error_dg.cc
compute the error in L
2
, L∞ and energy norms. This code it is not listed here but is available in
the Rheolef example directory. The computation writes:
make navier_stokes_taylor_dg navier_stokes_taylor_error_dg
./navier_stokes_taylor_dg square P1d 10 10 | ./navier_stokes_taylor_error_dg
./navier_stokes_taylor_dg square P2d 10 10 | ./navier_stokes_taylor_error_dg
3.3.3 A conservative variant
Remark the identity
div(u ⊗ u) = (u.∇)u + div(u) u
The momentum conservation can be rewritten in conservative form and the problem writes:
(P˜): find u and p, defined in Ω, such that
div(Re u ⊗ u − 2D(u)) + ∇p = f in Ω,
− div u = 0 in Ω,
u = g on ∂Ω28 Rheolef version 6.6 update 17 September 2013
Notice the Green formulae (see volume 1, appendix A.2, page 141):
Z
Ω
div(u ⊗ u).v dx = −
Z
Ω
(u ⊗ u):∇v dx +
Z
∂Ω
(u.n) (u.v) ds
The variationnal formulation is:
(F Vg): find u ∈ V(g) and p ∈ L
2
(Ω) such that
Re t˜(u; u, v) + a(u, v) + b(v, p) = ˜l(v), ∀v ∈ V(0),
b(u, q) = 0, ∀q ∈ L
2
(Ω)
where the forms t˜ and ˜lh are given by:
t˜(w; u, v) = −
Z
Ω
(w ⊗ u):∇v dx
˜l(v) = l(v) − Re Z
∂Ω
(g.n) (g.v) ds
Notice that the right-hand side ˜l contains an additional term that compensates those comming
from the integration by parts. Then, with v = u:
t˜(w; u, u) = −
Z
Ω
(w ⊗ u):∇u dx
=
Z
Ω
div(w ⊗ u).u dx −
Z
∂Ω
(w ⊗ u) : (u ⊗ n) dx
=
Z
Ω
(((u.∇)w).u + div(u) (u.w)) dx −
Z
∂Ω
(u.n) (u.w) dx
From an integration by part similar to (3.4):
Z
Ω
(u.∇w).u dx = −
Z
Ω
(u.∇u).w dx −
Z
Ω
div(u) (u.w) dx +
Z
∂Ω
(u.n) (u.w) ds
The term (u.∇w).u do not reapper after the integration by parts: instead, it appears (u.∇u).w.
Thus, the structure of the t˜ trilinear form do not permit a general skew-symmetry property as it
was the case for t. It requires the three arguments to be the same:
t˜(u; u, u) = Z
Ω
((u.∇)u).u + div(u)|u|
2
dx −
Z
∂Ω
(u.n)|u|
2 dx
Using (3.4) with w = u leads to:
Z
Ω
((u.∇)u).u dx = −
1
2
Z
Ω
div(u)|u|
2 dx +
1
2
Z
∂Ω
(u.n)|u|
2 ds (3.9)
Then
t˜(u; u, u) = 1
2
Z
Ω
div(u)|u|
2 dx −
1
2
Z
∂Ω
(u.n)|u|
2 ds
When working with velocities that are not divergence-free, a possible modification of the trilinear
form t˜ is to consider
t˜∗
(w; u, v) = t˜(w; u, v) −
1
2
Z
Ω
div(v) (u.w) dx +
1
2
Z
∂Ω
(v.n) (u.w) ds
= −
Z
Ω
(w ⊗ u):D(v) + 1
2
div(v) (u.w)
dx +
1
2
Z
∂Ω
(v.n) (u.w) dsRheolef version 6.6 update 17 September 2013 29
Then we have
t˜∗
(u; u, u) = 0, ∀u ∈ H1
(Ω)d
The new variationnal formulation is:
(F Vg)
∗
: find u ∈ V(g) and p˜ ∈ L
2
(Ω) such that
Re t˜∗
(u; u, v) + a(u, v) + b(v, p˜) = ˜l(v), ∀v ∈ V(0),
b(u, q) = 0, ∀q ∈ L
2
(Ω)
One can easily check that when (u, p˜) is a solution of (F Vg)
∗
, then (u, p) is a solution of (F Vg)
with p = ˜p + Re|u|/2. The apparition of the kinetic energy term Re|u|/2 in the modified pressure
field p˜ is due to the introduction of the div(v) (u.w) term in the trilinear form t˜∗
.
At the discrete level, let us define for all uh, vh, wh ∈ Xh:
t˜∗
h
(wh; uh, vh) = −
Z
Ω
(wh ⊗ uh):∇hvh +
1
2
divh(vh) (uh.wh)
dx
+
1
2
Z
∂Ω
(vh.n) (uh.wh) ds
Notice that t˜∗
h
is similar to t˜∗
: the gradient and divergence has been replaced by their broken
counterpart in the first term. As Xh 6⊂ H1
(Ω)d
, the skew-symmetry property is not expected to
be true at the discrete level. Then
t˜∗
h
(uh; uh, uh) = −
Z
Ω
(uh ⊗ uh):∇huh +
1
2
divh(uh)|uh|
2
dx +
1
2
Z
∂Ω
(uh.n)|uh|
2 ds
Next, using (3.9) in each K, and then developing thanks to (3.5)-(3.6), we get
t˜∗
h
(uh; uh, uh) = 1
2
Z
∂Ω
(uh.n)|uh|
2 ds −
1
2
X
K∈Th
Z
∂K
(uh.n)|uh|
2 ds
= −
1
2
X
S∈S
(i)
h
Z
S
[[(uh.n)|uh|
2
]] ds
= −
1
2
X
S∈S
(i)
h
Z
S
({{uh}}.n) [[|uh|
2
]] + ([[uh]].n) {{|uh|
2
}}
ds
= −
X
S∈S
(i)
h
Z
S
({{uh}}.n) ({{uh}}.[[uh]]) + 1
2
([[uh]].n) {{|uh|
2
}}
ds
The idea is to integrate this term in the definition of a discrete t˜h. One of the possibilities is
t˜h(wh; uh, vh) = t˜∗
h
(wh; uh, vh) + X
S∈S
(i)
h
Z
S
({{uh}}.n) ({{wh}}.[[vh]]) + 1
2
{{uh.wh}} ([[vh]].n)
ds
= −
Z
Ω
(wh ⊗ uh):∇hvh +
1
2
divh(vh) (uh.wh)
dx
+
1
2
Z
∂Ω
(vh.n) (uh.wh) ds
+
X
S∈S
(i)
h
Z
S
({{uh}}.n) ({{wh}}.[[vh]]) + 1
2
{{uh.wh}} ([[vh]].n)
ds (3.10)
This expression was proposed by [5, p. 21], eqn (73) (see also [6, p. 282]) folling and original idea
introduced in [3].30 Rheolef version 6.6 update 17 September 2013
Example file 3.7: inertia_cks.icc
1 form inertia ( field w , trial u , test v ,
2 quadrature_option_type qopt = quadrature_option_type ())
3 {
4 return
5 integrate ( - dot ( trans ( grad_h ( v ))* w , u ) - 0.5* div_h ( v )* dot (u , w ) , qopt )
6 + integrate (" internal_sides ",
7 dot ( average ( u ) , normal ())* dot ( jump ( v ) , average ( w ))
8 + 0.5* dot ( jump ( v ) , normal ())
9 *( dot ( average ( u ) , average ( w )) + 0.25* dot ( jump ( u ) , jump ( w ))) , qopt )
10 + integrate (" boundary ", 0.5* dot (v , normal ())* dot (u , w ) , qopt );
11 }
12 field inertia_fix_rhs ( test v ,
13 quadrature_option_type qopt = quadrature_option_type ())
14 {
15 return integrate (" boundary ", - dot ( g () , normal ())* dot ( g () , v ), qopt );
16 }
The discrete problem is
(F Vg)h: find uh ∈ Xh and p˜ ∈ Qh such that
Re t˜h(uh; uh, vh) + ah(uh, vh) + bh(vh, p˜h) = ˜l
∗
h
(vh), ∀vh ∈ Xh,
bh(uh, qh) − ch(ph, qh) = kh(q), ∀qh ∈ Qh
A simple test program is obtained by replacing in navier_stokes_taylor_dg.cc the include
inertia.icc by inertia_cks.icc. The compilation and run are similar.
3.3.4 A Newton solver
The discrete problems (F V )h can be put in a compact form:
F(uh, ph) = 0
where F is defined in variationnal form:
hF(uh, ph), (vh, qh)i =
Re th(uh; uh, vh) + ah(uh, vh) + bh(vh, ph) − l
∗
h
(vh)
bh(uh, qh) − ch(ph, qh) − kh(q)
for all (vh, qh) ∈ Xh × Qh. Notices that, after some minor modifications in the definition of
F, this method could also applies for the locally conservative formulation (F Vg)h. The previous
formulation is simply the variationnal expression of F(uh, ph) = 0. The Newton method defines
the sequence
u
(k)
h
k>0
by reccurence as:
• k = 0: let u
(0)
h ∈ Xh being known.
• k > 0: let u
(k−1)
h ∈ Xh given. Find δuh ∈ Xh and δph ∈ Qh such that
F
0
u
(k−1)
h
, p
(k−1)
h
.(δuh, δph) = −F
u
(k−1)
h
, p
(k−1)
h
and then defines
u
(k)
h = u
(k−1)
h + δuh and p
(k)
h = p
(k−1)
h + δph
At each step k > 0, this algorithm involves a linear subproblem involving the jacobian F
0
that is
definied by its variationnal form:
hF
0
u
(k−1)
h
, p
(k−1)
h
.(δuh, δph), (vh, qh)i
=
Re (th(δuh; uh, vh) + th(uh; δuh, vh)) + ah(δuh, vh) + bh(vh, δph)
bh(δuh, qh) − ch(δph, qh)
Rheolef version 6.6 update 17 September 2013 31
Example file 3.8: navier_stokes_taylor_newton_dg.cc
1 # include " rheolef .h"
2 using namespace rheolef ;
3 using namespace std ;
4 # include " taylor .icc"
5 # include " stokes_dirichlet_dg . icc"
6 # include " inertia .icc"
7 # include " navier_stokes_dg .h"
8 int main (int argc , char ** argv ) {
9 environment rheolef ( argc , argv );
10 Float eps = numeric_limits :: epsilon ();
11 geo omega ( argv [1]);
12 string approx = ( argc > 2) ? argv [2] : " P1d";
13 Float Re = ( argc > 3) ? atof ( argv [3]) : 100;
14 Float tol = ( argc > 4) ? atof ( argv [4]) : eps ;
15 size_t max_iter = ( argc > 5) ? atoi ( argv [5]) : 100;
16 string restart = ( argc > 6) ? argv [6] : "";
17 navier_stokes_dg F ( Re , omega , approx );
18 navier_stokes_dg :: value_type xh = F . initial ( restart );
19 int status = damped_newton (F , xh , tol , max_iter , & derr );
20 dout << catchmark ("Re") << Re << endl
21 << catchmark ("u") << xh [0]
22 << catchmark ("p") << xh [1];
23 return status ;
24 }
Comments
The implementation of the Newton method follows the generic approach introduced in volume 1,
section 8.3, page 126. For that purpose we define a class navier_stokes_dg.
Example file 3.9: navier_stokes_dg.h
1 struct navier_stokes_dg {
2 typedef valarray value_type ;
3 typedef Float float_type ;
4 navier_stokes_dg ( Float Re , const geo& omega , string approx );
5 value_type initial ( string restart ) const ;
6 value_type residue ( const value_type & uh ) const ;
7 void update_derivative ( const value_type & uh ) const ;
8 value_type derivative_solve ( const value_type & mrh ) const ;
9 value_type derivative_trans_mult ( const value_type & mrh ) const ;
10 Float space_norm ( const value_type & uh ) const ;
11 Float dual_space_norm ( const value_type & mrh ) const ;
12 Float duality_product ( const value_type & mrh , const value_type & msh ) const ;
13 Float Re ;
14 space Xh , Qh ;
15 quadrature_option_type qopt ;
16 form a0 , b , c , mu , mp ;
17 field lh0 , lh , kh ;
18 solver smu , smp ;
19 mutable form a1 ;
20 mutable solver_abtb stokes1 ;
21 };
22 # include " navier_stokes_dg1 .icc"
23 # include " navier_stokes_dg2 .icc"
The member functions of the class are defined in two separate files.32 Rheolef version 6.6 update 17 September 2013
Example file 3.10: navier_stokes_dg1.icc
1 navier_stokes_dg :: navier_stokes_dg (
2 Float Re1 , const geo& omega , string approx )
3 : Re ( Re1 ), Xh () , Qh () , qopt () , a0 () , b () , c () , mu () , mp () , lh0 () , lh () , kh () ,
4 smu () , smp () , a1 () , stokes1 ()
5 {
6 Xh = space ( omega , approx , " vector ");
7 Qh = space ( omega , approx );
8 qopt . set_family ( quadrature_option_type :: gauss );
9 qopt . set_order (2* Xh . degree ()+1);
10 stokes_dirichlet_dg ( Xh , Qh , a0 , b , c , mp , lh0 , kh , qopt );
11 trial u ( Xh ); test v ( Xh );
12 lh = lh0 + Re * inertia_fix_rhs (v , qopt );
13 mu = integrate ( dot (u , v ) , qopt );
14 smu = solver ( mu . uu ());
15 smp = solver ( mp . uu ());
16 }
17 navier_stokes_dg :: value_type
18 navier_stokes_dg :: initial ( string restart ) const {
19 value_type xh (2);
20 xh [0] = field ( Xh , 0);
21 xh [1] = field ( Qh , 0);
22 Float Re0 = 0;
23 if ( restart == "") {
24 solver_abtb stokes0 ( a0 . uu () , b . uu () , c . uu () , mp . uu ());
25 stokes0 . solve ( lh0 . u () , kh . u () , xh [0]. set_u () , xh [1]. set_u ());
26 } else {
27 idiststream in ( restart );
28 in >> catchmark ("Re") >> Re0
29 >> catchmark ("u") >> xh [0]
30 >> catchmark ("p") >> xh [1];
31 check_macro ( xh [1]. get_space () == Qh , " unexpected " << xh [0]. get_space (). stamp ()
32 << " approximation in file \"" << restart << "\" (" << Xh . stamp () << " expected )");
33 }
34 derr << "# continuation : from Re=" << Re0 << " to " << Re << endl ;
35 return xh ;
36 }
37 navier_stokes_dg :: value_type
38 navier_stokes_dg :: residue ( const value_type & xh ) const {
39 trial u ( Xh ); test v ( Xh );
40 form a = a0 + Re * inertia ( xh [0] , u , v , qopt );
41 value_type mrh (2);
42 mrh [0] = a * xh [0] + b . trans_mult ( xh [1]) - lh ;
43 mrh [1] = b * xh [0] - c * xh [1] - kh ;
44 return mrh ;
45 }
46 void navier_stokes_dg :: update_derivative ( const value_type & xh ) const {
47 trial u ( Xh ); test v ( Xh );
48 a1 = a0 + Re *( inertia ( xh [0] , u , v , qopt ) + inertia (u , xh [0] , v , qopt ));
49 stokes1 = solver_abtb ( a1 . uu () , b . uu () , c . uu () , mp . uu ());
50 }
51 navier_stokes_dg :: value_type
52 navier_stokes_dg :: derivative_solve ( const value_type & mrh ) const {
53 value_type delta_xh (2);
54 delta_xh [0] = field ( Xh , 0);
55 delta_xh [1] = field ( Qh , 0);
56 stokes1 . solve ( mrh [0]. u () , mrh [1]. u () ,
57 delta_xh [0]. set_u () , delta_xh [1]. set_u ());
58 return delta_xh ;
59 }
60 navier_stokes_dg :: value_type
61 navier_stokes_dg :: derivative_trans_mult ( const value_type & mrh ) const {
62 value_type rh (2);
63 rh [0] = field ( Xh );
64 rh [1] = field ( Qh );
65 rh [0]. set_u () = smu . solve ( mrh [0]. u ());
66 rh [1]. set_u () = smp . solve ( mrh [1]. u ());
67 value_type mgh (2);
68 mgh [0] = a1 . trans_mult ( rh [0]) + b . trans_mult ( rh [1]);
69 mgh [1] = b * rh [0] - c * rh [1];
70 return mgh ;
71 }Rheolef version 6.6 update 17 September 2013 33
Example file 3.11: navier_stokes_dg2.icc
1 Float navier_stokes_dg :: dual_space_norm ( const value_type & mrh ) const {
2 value_type rh (2);
3 rh [0] = field ( Xh );
4 rh [1] = field ( Qh );
5 rh [0]. set_u () = smu . solve ( mrh [0]. u ());
6 rh [1]. set_u () = smp . solve ( mrh [1]. u ());
7 return std :: max ( rh [0]. max_abs () , rh [1]. max_abs ());
8 }
9 Float navier_stokes_dg :: space_norm ( const value_type & xh ) const {
10 return sqrt ( mu ( xh [0] , xh [0]) + mp ( xh [1] , xh [1]));
11 }
12 Float navier_stokes_dg :: duality_product (
13 const value_type & mrh , const value_type & msh ) const
14 {
15 value_type rh (2);
16 rh [0] = field ( Xh );
17 rh [1] = field ( Qh );
18 rh [0]. set_u () = smu . solve ( mrh [0]. u ());
19 rh [1]. set_u () = smp . solve ( mrh [1]. u ());
20 return dual ( rh [0] , msh [0]) + dual ( rh [1] , msh [1]);
21 }
make navier_stokes_taylor_newton_dg navier_stokes_taylor_error_dg
./navier_stokes_taylor_newton_dg square P2d 1000 | ./navier_stokes_taylor_error_dg
3.3.5 Application to the driven cavity benchmark
Example file 3.12: cavity_dg.icc
1 struct g : field_functor {
2 point operator () ( const point & x ) const {
3 return point (( abs (1 - x [1]) < 1e -7) ? 1 : 0 , 0 , 0); }
4 };
5 struct f : field_functor {
6 point operator () ( const point & x ) const { return point (0 ,0 ,0); }
7 };
The program navier_stokes_cavity_newton_dg.cc is obtained by replacing in
navier_stokes_taylor_newton_dg.cc the include taylor.icc by cavity_dg.icc that
defines the boundary conditions. The compilation and run are similar.
make navier_stokes_cavity_newton_dg stream_cavity
./navier_stokes_cavity_newton_dg square P1d 500 > square.field
field -proj square.field -field | ./streamf_cavity | \
field -bw -n-iso-negative 10 -mayavi -
3.3.6 Upwinding
The skew symmetry property is generalized to the requirement that th be non-dissipative (see [6,
p. 282], eqn (6.68)):
th(wh; uh, uh) > 0, ∀wh, uh ∈ Xh
A way to satisfy this property is to add an upwinding term in th:
t˘h(wh; uh, vh) := th(wh; uh, vh) + sh(wh; uh, vh)
with
sh(wh; uh, vh) = 1
2
X
S∈S
(i)
h
Z
S
|{{wh}}.n| ([[uh]].[[vh]]) ds34 Rheolef version 6.6 update 17 September 2013
10−10
10−5
100
0 5 10 15 20 25
n
r
(n)
h
L∞
h = 1/40, k = 1
Re = 100
500
1000
Figure 3.1: The discontinuous Galerkin method for the Navier-Stokes problem on the driven cavity
benchmark when k = 1 and d = 2: convergence of the damped Newton algorithm.
We aim at using a Newton method. We replace th by its extension t˘h containing the upwind
terms in the definition of F, and then we compute its jacobian F
0
. As the absolute value is
not differentiable, the functions sh, t˘h and then F are also not differentiable with respect to
wh. Nevertheless, the absolute value is convex and we can use some concets of the sudifferential
calculus. Let us introduce the multi-valued sign function:
sgn(x) =
{1} when x > 0
[−1, 1] when x = 0
{−1} when x < 0
Then, the subdifferential of the absolute value function is sgn(x) and for all δwh, wh, uh, vh ∈ Xh,
we define a generalization of the partial derivative as
∂sh
∂wh
(wh; uh, vh).(δwh) = 1
2
X
S∈S
(i)
h
Z
S
sgn({{wh}}.n) ({{δwh}}.n) ([[uh]].[[vh]]) ds
Example file 3.13: inertia_upw.icc
1 # include " sgn.icc"
2 form inertia_upw ( field w , trial u , test v ,
3 quadrature_option_type qopt = quadrature_option_type ())
4 {
5 return integrate (" internal_sides ",
6 0.5* abs ( dot ( average ( w ), normal ()))* dot ( jump (u ) , jump ( v )));
7 }
8 form d_inertia_upw ( field w , trial dw , field u , test v ,
9 quadrature_option_type qopt = quadrature_option_type ())
10 {
11 return integrate (" internal_sides ",
12 0.5* compose ( sgn , dot ( average ( w ) , normal ()))
13 * dot ( average ( dw ) , normal ())* dot ( jump ( u ) , jump ( v )));
14 }Rheolef version 6.6 update 17 September 2013 35
A multi-valued jacobian F
0
is then defined:
hF
0
u
(k−1)
h
, p
(k−1)
h
.(δuh, δph), (vh, qh)i
= Re
th(δuh; uh, vh) + th(uh; δuh, vh) + ∂sh
∂wh
(uh; uh, vh).(δuh) + sh(uh; δuh, vh)
0
+
ah(δuh, vh) + bh(vh, δph)
bh(δuh, qh) − ch(δph, qh)
We are abble to extend the Newton method to the F function that allows a multi-valued subdifferential
F
0
. During iterations, we can choose any of the available directions in the subdifferential.
One the possibilities is then to replace the multi-valued sign function by a single-value one:
sgn( g x) =
1 when x > 0
−1 when x < 0
Example file 3.14: sgn.icc
1 Float sgn ( Float x ) { return ( x >= 0) ? 1 : -1; }
Example file 3.15: navier_stokes_upw_dg.h
1 # include " navier_stokes_dg .h"
2 struct navier_stokes_upw_dg : navier_stokes_dg {
3 typedef valarray value_type ;
4 typedef Float float_type ;
5 navier_stokes_upw_dg ( Float Re , const geo& omega , string approx );
6 value_type residue ( const value_type & uh ) const ;
7 void update_derivative ( const value_type & uh ) const ;
8 };
9 # include " navier_stokes_upw_dg . icc"
Example file 3.16: navier_stokes_upw_dg.icc
1 # include " inertia_upw .icc "
2 navier_stokes_upw_dg :: navier_stokes_upw_dg (
3 Float Re1 , const geo& omega , string approx )
4 : navier_stokes_dg ( Re1 , omega , approx ) {}
5
6 navier_stokes_upw_dg :: value_type
7 navier_stokes_upw_dg :: residue ( const value_type & xh ) const {
8 trial u ( Xh ); test v ( Xh );
9 form a = a0 + Re *( inertia ( xh [0] , u , v , qopt )
10 + inertia_upw ( xh [0] , u , v , qopt ));
11 value_type mrh (2);
12 mrh [0] = a * xh [0] + b . trans_mult ( xh [1]) - lh ;
13 mrh [1] = b * xh [0] - c * xh [1] - kh ;
14 return mrh ;
15 }
16 void navier_stokes_upw_dg :: update_derivative ( const value_type & xh ) const {
17 trial du ( Xh ); test v ( Xh );
18 a1 = a0 + Re *( inertia ( xh [0] , du , v , qopt )
19 + inertia_upw ( xh [0] , du , v , qopt )
20 + inertia ( du , xh [0] , v , qopt )
21 + d_inertia_upw ( xh [0] , du , xh [0] , v , qopt ));
22 stokes1 = solver_abtb ( a1 . uu () , b . uu () , c . uu () , mp . uu ());
23 }
The program navier_stokes_cavity_newton_upw_dg.cc is obtained by replacing in
navier_stokes_taylor_newton_dg.cc the string navier_stokes_dg by navier_stokes_upw_dg
(two occurences: in the includes and then in the definition of F). Also replace the include
taylor.icc by cavity_dg.icc that defines the boundary conditions. The compilation and run
are similar.36 Rheolef version 6.6 update 17 September 2013
make navier_stokes_cavity_newton_upw_dg stream_cavity
mkgeo_grid -t 80 > square.geo
./navier_stokes_cavity_newton_upw_dg square P1d 500 1e-15 100 > square-500.field
field -proj square-500.field -field | ./streamf_cavity | \
field -bw -n-iso 30 -n-iso-negative 20 -mayavi -
Computations for higher Renolds numbers are performed by continuation, starting from a previous
computation at lower Re:
./navier_stokes_cavity_newton_upw_dg square P1d 1000 1e-15 100 square-500.field > square-1000.field
./navier_stokes_cavity_newton_upw_dg square P1d 1500 1e-15 100 square-1000.field > square-1500.field
Re = 0 Re = 400
Re = 1000 Re = 2000
Figure 3.2: The discontinuous Galerkin method for the Navier-Stokes problem on the driven cavity
benchmark when k = 1 (80 × 80 grid): stream function isovalues for various Re.Rheolef version 6.6 update 17 September 2013 37
Re = 3200 Re = 5000
Re = 7500 Re = 10000
Figure 3.3: The discontinuous Galerkin method for the Navier-Stokes problem on the driven cavity
benchmark when k = 1 (80 × 80 grid): stream function isovalues for various Re (cont.).38 Rheolef version 6.6 update 17 September 2013
Re = 15000 Re = 20000
Re = 25000
Figure 3.4: The discontinuous Galerkin method for the Navier-Stokes problem on the driven cavity
benchmark when k = 1 (80 × 80 grid): stream function isovalues for various Re (cont.).Part III
Technical appendices
39Appendix A
GNU Free Documentation License
Version 1.1, March 2000
Copyright c 2000 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing
it is not allowed.
*
Preamble
The purpose of this License is to make a manual, textbook, or other written document “free”
in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially. Secondarily, this License
preserves for the author and publisher a way to get credit for their work, while not being considered
responsible for modifications made by others.
This License is a kind of “copyleft”, which means that derivative works of the document must
themselves be free in the same sense. It complements the GNU General Public License, which is
a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free software
needs free documentation: a free program should come with manuals providing the same freedoms
that the software does. But this License is not limited to software manuals; it can be used for
any textual work, regardless of subject matter or whether it is published as a printed book. We
recommend this License principally for works whose purpose is instruction or reference.
Applicability and Definitions
This License applies to any manual or other work that contains a notice placed by the copyright
holder saying it can be distributed under the terms of this License. The “Document”, below, refers
to any such manual or work. Any member of the public is a licensee, and is addressed as “you”.
A “Modified Version” of the Document means any work containing the Document or a portion of
it, either copied verbatim, or with modifications and/or translated into another language.
A “Secondary Section” is a named appendix or a front-matter section of the Document that deals
exclusively with the relationship of the publishers or authors of the Document to the Document’s
overall subject (or to related matters) and contains nothing that could fall directly within that
overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary
4142 Rheolef version 6.6 update 17 September 2013
Section may not explain any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal, commercial, philosophical, ethical
or political position regarding them.
The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those
of Invariant Sections, in the notice that says that the Document is released under this License.
The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or
Back-Cover Texts, in the notice that says that the Document is released under this License.
A “Transparent” copy of the Document means a machine-readable copy, represented in a format
whose specification is available to the general public, whose contents can be viewed and edited
directly and straightforwardly with generic text editors or (for images composed of pixels) generic
paint programs or (for drawings) some widely available drawing editor, and that is suitable for
input to text formatters or for automatic translation to a variety of formats suitable for input to
text formatters. A copy made in an otherwise Transparent file format whose markup has been
designed to thwart or discourage subsequent modification by readers is not Transparent. A copy
that is not “Transparent” is called “Opaque”.
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo
input format, LATEX input format, SGML or XML using a publicly available DTD, and standardconforming
simple HTML designed for human modification. Opaque formats include PostScript,
PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML
or XML for which the DTD and/or processing tools are not generally available, and the machinegenerated
HTML produced by some word processors for output purposes only.
The “Title Page” means, for a printed book, the title page itself, plus such following pages as are
needed to hold, legibly, the material this License requires to appear in the title page. For works
in formats which do not have any title page as such, “Title Page” means the text near the most
prominent appearance of the work’s title, preceding the beginning of the body of the text.
Verbatim Copying
You may copy and distribute the Document in any medium, either commercially or noncommercially,
provided that this License, the copyright notices, and the license notice saying this License
applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever
to those of this License. You may not use technical measures to obstruct or control the
reading or further copying of the copies you make or distribute. However, you may accept compensation
in exchange for copies. If you distribute a large enough number of copies you must also
follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display
copies.
Copying in Quantity
If you publish printed copies of the Document numbering more than 100, and the Document’s
license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and
legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify you as the publisher of these
copies. The front cover must present the full title with all words of the title equally prominent
and visible. You may add other material on the covers in addition. Copying with changes limited
to the covers, as long as they preserve the title of the Document and satisfy these conditions, can
be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones
listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.Rheolef version 6.6 update 17 September 2013 43
If you publish or distribute Opaque copies of the Document numbering more than 100, you must
either include a machine-readable Transparent copy along with each Opaque copy, or state in
or with each Opaque copy a publicly-accessible computer-network location containing a complete
Transparent copy of the Document, free of added material, which the general network-using public
has access to download anonymously at no charge using public-standard network protocols. If you
use the latter option, you must take reasonably prudent steps, when you begin distribution of
Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the
stated location until at least one year after the last time you distribute an Opaque copy (directly
or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before
redistributing any large number of copies, to give them a chance to provide you with an updated
version of the Document.
Modifications
You may copy and distribute a Modified Version of the Document under the conditions of sections
2 and 3 above, provided that you release the Modified Version under precisely this License, with
the Modified Version filling the role of the Document, thus licensing distribution and modification
of the Modified Version to whoever possesses a copy of it. In addition, you must do these things
in the Modified Version:
• Use in the Title Page (and on the covers, if any) a title distinct from that of the Document,
and from those of previous versions (which should, if there were any, be listed in the History
section of the Document). You may use the same title as a previous version if the original
publisher of that version gives permission.
• List on the Title Page, as authors, one or more persons or entities responsible for authorship
of the modifications in the Modified Version, together with at least five of the principal
authors of the Document (all of its principal authors, if it has less than five).
• State on the Title page the name of the publisher of the Modified Version, as the publisher.
• Preserve all the copyright notices of the Document.
• Add an appropriate copyright notice for your modifications adjacent to the other copyright
notices.
• Include, immediately after the copyright notices, a license notice giving the public permission
to use the Modified Version under the terms of this License, in the form shown in the
Addendum below.
• Preserve in that license notice the full lists of Invariant Sections and required Cover Texts
given in the Document’s license notice.
• Include an unaltered copy of this License.
• Preserve the section entitled “History”, and its title, and add to it an item stating at least
the title, year, new authors, and publisher of the Modified Version as given on the Title
Page. If there is no section entitled “History” in the Document, create one stating the title,
year, authors, and publisher of the Document as given on its Title Page, then add an item
describing the Modified Version as stated in the previous sentence.
• Preserve the network location, if any, given in the Document for public access to a Transparent
copy of the Document, and likewise the network locations given in the Document
for previous versions it was based on. These may be placed in the “History” section. You
may omit a network location for a work that was published at least four years before the
Document itself, or if the original publisher of the version it refers to gives permission.44 Rheolef version 6.6 update 17 September 2013
• In any section entitled “Acknowledgements” or “Dedications”, preserve the section’s title, and
preserve in the section all the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
• Preserve all the Invariant Sections of the Document, unaltered in their text and in their
titles. Section numbers or the equivalent are not considered part of the section titles.
• Delete any section entitled “Endorsements”. Such a section may not be included in the
Modified Version.
• Do not retitle any existing section as “Endorsements” or to conflict in title with any Invariant
Section.
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary
Sections and contain no material copied from the Document, you may at your option designate
some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections
in the Modified Version’s license notice. These titles must be distinct from any other section titles.
You may add a section entitled “Endorsements”, provided it contains nothing but endorsements
of your Modified Version by various parties – for example, statements of peer review or that the
text has been approved by an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as
a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage
of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made
by) any one entity. If the Document already includes a cover text for the same cover, previously
added by you or by arrangement made by the same entity you are acting on behalf of, you may not
add another; but you may replace the old one, on explicit permission from the previous publisher
that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use
their names for publicity for or to assert or imply endorsement of any Modified Version.
Combining Documents
You may combine the Document with other documents released under this License, under the terms
defined in section 4 above for modified versions, provided that you include in the combination all
of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant
Sections of your combined work in its license notice.
The combined work need only contain one copy of this License, and multiple identical Invariant
Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same
name but different contents, make the title of each such section unique by adding at the end of
it, in parentheses, the name of the original author or publisher of that section if known, or else a
unique number. Make the same adjustment to the section titles in the list of Invariant Sections in
the license notice of the combined work.
In the combination, you must combine any sections entitled “History” in the various original
documents, forming one section entitled “History”; likewise combine any sections entitled “Acknowledgements”,
and any sections entitled “Dedications”. You must delete all sections entitled
“Endorsements.”
Collections of Documents
You may make a collection consisting of the Document and other documents released under this
License, and replace the individual copies of this License in the various documents with a singleRheolef version 6.6 update 17 September 2013 45
copy that is included in the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under
this License, provided you insert a copy of this License into the extracted document, and follow
this License in all other respects regarding verbatim copying of that document.
Aggregation With Independent Works
A compilation of the Document or its derivatives with other separate and independent documents
or works, in or on a volume of a storage or distribution medium, does not as a whole count
as a Modified Version of the Document, provided no compilation copyright is claimed for the
compilation. Such a compilation is called an “aggregate”, and this License does not apply to
the other self-contained works thus compiled with the Document, on account of their being thus
compiled, if they are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if
the Document is less than one quarter of the entire aggregate, the Document’s Cover Texts may
be placed on covers that surround only the Document within the aggregate. Otherwise they must
appear on covers around the whole aggregate.
Translation
Translation is considered a kind of modification, so you may distribute translations of the Document
under the terms of section 4. Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include translations of some or all Invariant
Sections in addition to the original versions of these Invariant Sections. You may include a translation
of this License provided that you also include the original English version of this License.
In case of a disagreement between the translation and the original English version of this License,
the original English version will prevail.
Termination
You may not copy, modify, sublicense, or distribute the Document except as expressly provided
for under this License. Any other attempt to copy, modify, sublicense or distribute the Document
is void, and will automatically terminate your rights under this License. However, parties who
have received copies, or rights, from you under this License will not have their licenses terminated
so long as such parties remain in full compliance.
Future Revisions of This License
The Free Software Foundation may publish new, revised versions of the GNU Free Documentation
License from time to time. Such new versions will be similar in spirit to the present version, but
may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft.
Each version of the License is given a distinguishing version number. If the Document specifies
that a particular numbered version of this License "or any later version" applies to it, you have the
option of following the terms and conditions either of that specified version or of any later version
that has been published (not as a draft) by the Free Software Foundation. If the Document does
not specify a version number of this License, you may choose any version ever published (not as
a draft) by the Free Software Foundation.46 Rheolef version 6.6 update 17 September 2013
*
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of the License in the document
and put the following copyright and license notices just after the title page:
Copyright c YEAR YOUR NAME. Permission is granted to copy, distribute and/or
modify this document under the terms of the GNU Free Documentation License, Version
1.1 or any later version published by the Free Software Foundation; with the
Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being
LIST, and with the Back-Cover Texts being LIST. A copy of the license is included in
the section entitled “GNU Free Documentation License”.
If you have no Invariant Sections, write “with no Invariant Sections” instead of saying which
ones are invariant. If you have no Front-Cover Texts, write “no Front-Cover Texts” instead of
“Front-Cover Texts being LIST”; likewise for Back-Cover Texts.
If your document contains nontrivial examples of program code, we recommend releasing these
examples in parallel under your choice of free software license, such as the GNU General Public
License, to permit their use in free software.Bibliography
[1] P. Castillo. Performance of discontinuous Galerkin methods for elliptic PDEs. SIAM J. Sci.
Comput., 24(2):524–547, 2002. 12
[2] B. Cockburn, B. Dong, J. Guzmán, and J. Qian. Optimal convergence of the original DG
method on special meshes for variable transport velocity. SIAM J. Numer. Anal., 48(1):133–
146, 2010. 9
[3] B. Cockburn, G. Kanschat, and D. Schötzau. A locally conservative LDG method for the
incompressible Navier-Stokes equations. Math. Comput., 74(251):1067–1095, 2005. 29
[4] B. Cockburn, G. Kanschat, D. Schötzau, and C. Schwab. Local discontinuous Galerkin
methods for the Stokes system. SIAM J. Numer. Anal., 40(1):319–343, 2002. 21
[5] D. A. di Pietro and A. Ern. Discrete functional analysis tools for discontinuous Galerkin methods
with application to the incompressible Navier-Stokes equations. Math. Comp., 79:1303–
1330, 2010. 21, 25, 29
[6] D. A. di Pietro and A. Ern. Mathematical aspects of discontinuous Galerkin methods. Springer,
2012. 7, 8, 11, 13, 14, 22, 25, 29, 33
[7] Y. Epshteyn and B. Rivière. Estimation of penalty parameters for symmetric interior penalty
Galerkin methods. J. Comput. Appl. Math., 206(2):843–872, 2007. 11
[8] J. S. Hesthaven and T. Warburton. Nodal discontinuous Galerkin methods. Algorithms, analysis
and applications. Springer, 2008. 7
[9] C. Johnson and J. Pitkäranta. An analysis of the discontinuous Galerkin method for a scalar
hyperbolic equation. Math. Comp., 46(173):1–26, 1986. 9
[10] T. E. Peterson. A note on the convergence of the discontinuous Galerkin method for a scalar
hyperbolic equation. SIAM J. Numer. Anal., 28(1):133–140, 1991. 9
[11] G. R. Richter. An optimal-order error estimate for the discontinuous galerkin method. Math.
Comput., 50(181):75–88, 1988. 9
[12] K. Shahbazi. An explicit expression for the penalty parameter of the interior penalty method.
J. Comput. Phys., 205(2):401–407, 2005. 12
[13] G. I. Taylor. On the decay of vortices in a viscous fluid. Philos. Mag., 46:671–674, 1923. 20
47List of example files
cavity_dg.icc, 33
dirichlet_dg.cc, 12
elasticity_taylor_dg.cc, 20
inertia.icc, 25
inertia_cks.icc, 29
inertia_upw.icc, 34
navier_stokes_dg.h, 31
navier_stokes_dg1.icc, 31
navier_stokes_dg2.icc, 33
navier_stokes_taylor_dg.cc, 26
navier_stokes_taylor_newton_dg.cc, 31
navier_stokes_upw_dg.h, 35
navier_stokes_upw_dg.icc, 35
neumann_dg.cc, 14
sgn.icc, 35
stokes_dirichlet_dg.icc, 22
stokes_taylor_dg.cc, 22
taylor.icc, 20
transport_dg.cc, 8
cosinusprod_error_dg.cc, 13
elasticity_taylor_error_dg.cc, 20
navier_stokes_taylor_error_dg.cc, 27
stokes_taylor_error_dg.cc, 23
taylor.icc, 23, 27
48Index
approximation
P0, 8
P1, 23
P2, 23
discontinuous, 7
benchmark
driven cavity flow, 21, 23
embankment, 19
boundary condition
Dirichlet, 11, 13, 21, 23
weakly imposed, 7, 11
broken Sobolev space H1
(Th), 11
convergence
error
versus mesh, 9, 13
form
[[u]]{{∇hv.n}}, 11, 14
[[u]]{{v}}, 8
[[u]][[v]], 8, 11, 14
internal sides of a mesh, 8
operator
average, accross sides, 8, 11
jump, accross sides, 8, 11
penalty parameter, 12
problem
Navier-Stokes, 23
Poisson, 11, 13
Stokes, 21, 23
elasticity, 19
nonlinear, 23
upstream boundary, 7
upwind scheme, 33
upwinding, 8
49
Une introduction aux (semi-)groupes d’automate
Ines Klimann
To cite this version:
Ines Klimann. Une introduction aux (semi-)groupes d’automate. Master. Une introduction
aux (semi-)groupes d’automate, MPRI, 2013, pp.21.
HAL Id: cel-01058503
https://cel.archives-ouvertes.fr/cel-01058503
Submitted on 27 Aug 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Une introduction aux (semi-)groupes d’automate
Ines Klimann klimann@liafa.univ-paris-diderot.fr
MPRI 2012/2013 - filière “Modélisation par automates finis”
1 Introduction
Les groupes d’automate ont été introduits dans les années 1960-1970 par des mathématiciens spécialistes
de la théorie des groupes. Ils ont permis dans les années qui ont suivi de répondre à des conjectures
importantes de théorie des groupes, notamment le problème de Burnside (exemples d’automates très
simples engendrant des groupes de torsion infinis finiment engendrés, c’est-à-dire des groupes infinis
finiment engendrés dont tous les éléments sont d’ordres finis [stage proposé sur cette thématique, encadré
par Matthieu Picantin]) et le problème de Milnor (existence de groupes à croissance intermédiaire).
Les (semi-)groupes d’automate sont un objet d’étude en soi et, comme pour toute famille de (semi-)groupes,
on peut se poser des questions de décidabilité concernant les (semi-)groupes d’automate. Le but de ce
cours est d’explorer une partie de l’existant sur la décidabilité de la finitude de tels (semi-)groupes. Nous
nous centrerons en particulier sur les résultats liés à la structure de l’automate. Il existe d’autres critères
provenant de la théorie géométrique des groupes, que nous n’aborderons pas ici.
Pierre Gillibert a montré très récemment que le problème de finitude des semi-groupes d’automate est
indécidable [5], tandis que le problème de finitude des groupes sur des automates inversibles-réversibles
sur 2 lettres est décidable [7].
Il y a donc deux directions de recherche concernant la finitude des (semi-)groupes d’automates :
– trouver la frontière entre décidable et indécidable [stage proposé sur ce sujet],
– trouver des semi-algorithmes efficaces en moyenne pour tester la finitude ou l’infinitude.
Dans ce cours, nous allons nous concentrer sur le deuxième point : je donnerai des conditions nécessaires
ou suffisantes de finitude et nous verrons comment accélérer les calculs pour les semi-algorithmes existant
déjà [2, 1, 8].
Pour illustrer la difficulté de l’étude de la finitude des (semi-)groupes d’automates, regardons la figure 1 :
ce petit automate engendre un groupe d’ordre 1 494 186 269 970 473 680 896 = 264
· 3
4 ≈ 1.5 × 1021
.
1 2 3
1|3
2|2
3|1
3|1
1|3
2|2
1|2
2|3
3|1
Figure 1 – Automate de Mealy engendrant un groupe d’ordre 1 494 186 269 970 473 680 896.
12 Premiers éléments
2.1 Automates de Mealy
Soit S un ensemble fini non vide. On note TS l’ensemble des applications de S dans S et SS l’ensemble
des permutations de S.
automate Définition 1. En oubliant les états initiaux et finaux, un automate (fini, déterministe et complet) est la
donnée d’un triplet
A, Σ, δ = (δi
: A → A)i∈Σ
,
où
– l’ensemble des états A est un ensemble fini non vide,
– l’alphabet Σ est un ensemble fini non vide,
– les fonctions de transition δi sont des applicationss : δi ∈ TA.
On identifie cet automate à un élément de T
Σ
A.
automate de Définition 2. Un automate de Mealy est un quadruple
Mealy
A, Σ, δ = (δi
: A → A)i∈Σ, ρ = (ρx : Σ → Σ)x∈A
,
tel que (A, Σ, δ) et (Σ, A, ρ) sont des automates.
Les applications ρx sont les fonctions de production de l’automate.
La terminologie standard vue jusqu’à présent est transducteur lettre-à-lettre séquentiel et complet (avec
même alphabet d’entrée et de sortie).
Un automate de Mealy est identifié à un élément de T
Σ
A × T
A
Σ.
Les transitions d’un automate de Mealy sont les
x
i | ρx(i)
−−−−−→ δi(x).
Un automate de Mealy est identifié à son ensemble de transitions.
On utilise la notation graphique usuelle des automates : un graphe dont les sommets sont les états et les
arcs correspondent aux transitions de l’automate, voir figure 2.
0 1
0|0
1|1
1|0
0|1
Figure 2 – Un automate de Mealy.
2.2 (Semi-)groupe engendré par un automate de Mealy et propriétés structurelles
de certains automates
Soit A = (A, Σ, δ, ρ) un automate de Mealy. Cet automate peut être vu comme un automate à deux
bandes définissant une application de Σ
∗
vers Σ
∗
.
Plus formellement, on construit les fonctions de production étendues ρx : Σ∗ → Σ
∗
à partir des fonctions fcts prod.
étendues
2de production ρx : Σ → Σ. Pour cela, on écrit
x
u|v
−−→ y avec u = u1 · · · un et v = v1 · · · vn
pour décrire l’existence d’un chemin
x
u1|v1 −−−→ x1
u2|v2 −−−→ x2 −→ · · · −→ xn−1
un|vn −−−−→ y
dans A.
Par convention, l’image du mot vide est lui-même. L’application ρx préserve la longueur et les préfixes et
satisfait
∀u ∈ Σ, ∀v ∈ Σ
∗
, ρx(uv) = ρx(u)ρδu(x)(v) . (1)
On peut aussi définir les fonctions de production étendues ρx : Σ∗ → Σ
∗ par récurrence à l’aide de la
formule (1).
Par ailleurs, on peut aussi étendre ces fonctions sur A∗ par composition :
ρu = ρu1···un = ρun ◦ · · · ◦ ρu1
.
On peut bien entendu faire de même avec les applications δi
: A∗ → A∗
.
semi-groupe Définition 3. Le semi-groupe hAi+ engendré par A = (A, Σ, δ, ρ) est le semi-groupe des applications
engendré Σ
∗ → Σ
∗
engendré par les fonctions de production étendues ρx, x ∈ A.
Un semi-groupe est un semi-groupe d’automate s’il existe un automate qui l’engendre.
Exemple 1. L’automate de la figure 2 engendre le semi-groupe N. Soit un mot u ∈ {0, 1}
∗
. On interprète
u comme le miroir de l’écriture en base 2 d’un entier, notons u¯ cet entier. Alors : ρ0(u) = u et ρ1(u) = v,
où v¯ = ¯u + 1. L’application associée à l’état 0 est donc l’identité et l’application associée à l’état 1 est
l’incrémentation. Le semi-groupe engendré est donc isomorphe à N.
Si les fonctions de production sont des permutations de Σ, alors les fonctions de production étendues
sont des permutations de Σ
∗
. Elles sont donc inversibles et on peut envisager d’engendrer un groupe.
automate Définition 4. Un automate de Mealy est inversible si ses fonctions de production sont des permutations.
inversible Un automate inversible est identifié à un élément de T
Σ
A × S
A
Σ.
groupe Définition 5. Le groupe hAi engendré par un automate de Mealy inversible A = (A, Σ, δ, ρ) est le
engendré groupe des permutations de Σ
∗
engendré par les fonctions de production étendues ρx, x ∈ A.
Un groupe est un groupe d’automate s’il existe un automate qui l’engendre.
Exemple 2. L’automate de la figure 2 engendre le groupe Z.
automate Définition 6. Un automate de Mealy est réversible si ses fonctions de transition sont des permutations.
réversible
Un automate réversible est identifié à un élément de S
Σ
A × T
A
Σ. Le terme employé habituellement en
théorie des automates est automate à groupe.
Un automate inversible-réversible est identifié à un élément de S
Σ
A × S
A
Σ.
32.3 Opérations sur les automates et liens entre les (semi-)groupes engendrés
2.3.1 Automate inverse
Définition 7. Soit un automate de Mealy inversible A ∈ T
Σ
A × S
A
Σ. Soit A−1 = {x
−1 automate , x ∈ A} une copie
inverse disjointe de l’ensemble A des états. L’automate (de Mealy) inverse A−1 de A est défini par l’ensemble de
transitions
x
−1
j|i
−→ y
−1 ∈ A−1 ⇐⇒ x
i|j
−→ y ∈ A . (2)
La fonction de production ρx associée à l’état x de A est une bijection de Σ
∗
sur Σ
∗
, on peut donc
considérer son inverse ρ
−1
x
: Σ∗ → Σ
∗
associée à l’état x
−1 de A−1
. On a alors
hAi+ = {ρu, u ∈ A
∗
}, hAi = {ρu, u ∈ (A ⊔ A
−1
)
∗
} .
A noter qu’on peut toujours, à partir d’un automate de Mealy, considérer l’ensemble des transitions
inverses de ses transitions (telles que définies par (2)). On note i cette opération. Par i, on obtient toujours
un transducteur lettre-à-lettre avec même alphabet d’entrée et de sortie, mais ce n’est pas nécessairement
un automate de Mealy : c’est un automate de Mealy si et seulement l’automate de départ est inversible,
dans ce cas bien entendu : i(A) = A−1
.
automate Définition 8. Un automate de Mealy inversible est biréversible si lui et son inverse sont réversibles.
biréversible
En particulier, et de façon immédiate, un automate biréversible est inversible-réversible.
Proposition 1. Soit A un automate inversible-réversible. On a
hAi = hA−1
i = hA ⊔ A−1
i = hA ⊔ A−1
i+,
où A ⊔ A−1
est l’automate de Mealy dont l’ensemble des transitions est l’union des ensembles de
transitions de A et A−1
.
De plus, si hAi ou hAi+ est fini, on a
hAi = hAi+.
Démonstration. Le premier point découle directement des définitions.
Supposons que le semi-groupe hAi+ soit fini et soit x un de ses éléments : il existe deux entiers k et
n tels que x
k+n = x
k
. On a donc x
n = 1 dans le groupe hAi. L’inverse x
n−1 de x appartient donc au
semi-groupe hAi+ et on a égalité entre groupe et semi-groupe.
(À noter que cette démonstration est valable pour tout semi-groupe qui est sous-semi-groupe d’un groupe :
un tel semi-groupe fini est toujours un groupe.)
2.3.2 Automate dual
La définition d’un automate de Mealy introduit une symétrie forte entre l’ensemble des états et l’alphabet
de l’automate. De fait on peut inverser leurs rôles.
automate Définition 9. L’automate dual de A = (A, Σ, δ, ρ) est l’automate de Mealy d(A) dont les transitions
dual sont décrites par
i
x|y
−−→ j ∈ d(A) ⇐⇒ x
i|j
−→ y ∈ A . (3)
4Cette définition est consistante : le dual d’un automate de Mealy est bien toujours un automate de Mealy
(c’est-à-dire un transducteur lettre-à-lettre séquentiel et complet).
Un automate est réversible si et seulement si son dual est inversible.
Les propositions 2 et 3 suivantes sont complémentaires l’une de l’autre et nous donnent nos premières
propriétés liées à la finitude sur les (semi-)groupes d’automate.
Proposition 2 ([1]). Soit deux semi-groupes finis G et H. Il existe un automate de Mealy A tel que
hAi+ = G et hd(A)i+ = H.
On a un énoncé similaire sur les groupes.
Démonstration. La preuve est faite dans le cadre des groupes. Elle est similaire pour les semi-groupes.
Commençons par une preuve avec les mains pour comprendre ce qui se passe.
On construit en parallèle l’automate A qui engendre G et l’automate d(A) qui engendre H. On procède
par étape en s’assurant à chaque instant que A et d(A) sont duaux, que A est bien un automate de
Mealy inversible et bien entendu en s’assurant que A engendre G et d(A) engendre H.
Le groupe G étant fini, il est isomorphe à un sous-groupe de Sm pour un certain m. De même, le groupe
H est isomorphe à un sous-groupe de Sn pour un certain n.
A
ρg ∈ Sm g
d(A)
δh ∈ Sn h
Par dualisation on obtient :
A
ρg ∈ Sm g
i δh(i)
idH
d(A)
δh ∈ Sn h
i ρg(i)
idG
Les états de A agissent tous sur les éléments de H et de même les états de d(A) sur les éléments de G,
donc :
A
g
ρg ∈ Sm
idH
i δh(i)
idH
d(A)
h
δh ∈ Sn
idG
i ρg(i)
idG
Les états de A agissent tous sur les éléments de {1, . . . , m} et de même du côté du dual, donc :
5A
g
ρg ∈ Sm
idH
i δh(i)
id
d(A)
h
δh ∈ Sn
idG
i ρg(i)
id
Formalisons la preuve précédente.
Tout groupe fini est un sous-groupe d’un groupe de permutations. Soit Σ1 et A2 deux ensembles finis tels
que G est un sous-groupe de SΣ1
et H est un sous-groupe de SA2
. Soit A1 ⊆ SΣ1 un ensemble de
générateurs de G et Σ2 ⊆ SA2 un ensemble de générateurs de H.
On pose A = A1 × A2 et Σ = Σ1 × Σ2 et on considère l’automate de Mealy d’ensemble d’états A sur
l’alphabet Σ dont les transitions sont données par
(a, b)
(i,j)|(a(i),j)
−−−−−−−−→ (a, j(b)).
On note δ et ρ les fonctions de transition et de production correspondantes. Clairement pour (a, b) ∈
A1 × A2 et (a, b′
) ∈ A1 × A2, on a ρ(a,b) = ρ(a,b′) et on peut noter cette fonction ρa : Σ∗ → Σ
∗
. On a
alors pour tout a ∈ A1 et tout (i1, j1), . . . ,(in, jn) ∈ Σ
∗
:
ρa
(i1, j1)· · ·(in, jn)
= (a(i1), j1) (a(i2), j2) · · · (a(in), jn) .
Ainsi le groupe engendré par (ρa : Σ∗ → Σ
∗
)a∈A1
est isomorphe au groupe engendré par (a : Σ1 →
Σ1)a∈A1
, c’est-à-dire hAi = G. De la même façon hd(A)i = H.
Proposition 3 ([10, 12, 1]). Le (semi-)groupe engendré par A est fini si et seulement si le (semi-)groupe
engendré par son dual d(A) est fini.
Démonstration. La preuve est faite pour les semi-groupes, elle s’étend aux groupes directement par la
proposition 1.
Soit un automate de Mealy A = (A, Σ, δ, ρ). On suppose que le semi-groupe engendré par son dual est
fini.
Fixons un mot w ∈ A∗
, on a :
ρw(u1u2 · · · un) := ρw(u1)ρδu1
(w)(u2)ρδu1u2
(w)(u3)· · · ρδu1u2···un−1
(w)(un) ,
pour tout u1u2 · · · un ∈ Σ
∗
. La fonction de production ρw peut donc être vue comme la fonction de
production d’un transducteur lettre-à-lettre sur le graphe de Cayley de hd(A)i+ par rapport aux lettres
de Σ :
δu δui δu δui
i i|ρδu(w)(i)
Or il n’y a qu’un nombre fini de tels transducteurs, égal au nombre d’applications de hd(A)i+ vers TΣ.
On en conclut
#hAi+ ≤
#Σ(#Σ) (#hd(A)i+)
.
62.3.3 Automates étendus
Soit A un automate inversible-réversible. On a vu en proposition 1 que hAi = hA ⊔ A−1
i, c’est-à-dire
qu’on ne modifie pas le groupe engendré en considérant les états et leurs inverses.
On peut de même considérer les lettres et leurs inverses.
automate Définition 10. Soit A un automate inversible-réversible. L’automate étendu A˜ de A est son extension à
étendu l’ensemble d’états A ⊔ A−1
et à l’alphabet Σ ⊔ Σ
−1
:
A˜ = A
′ ⊔ (A
′
)
−1
où A
′ = d(d(A) ⊔ d(A)
−1
).
Le corollaire suivant est une conséquence des propositions 1 et 3.
Corollaire 1. Soit A un automate inversible-réversible. Les groupes hAi et hAi˜ sont tous deux finis ou
tous deux infinis.
À noter que ces deux groupes ne sont pas nécessairement isomorphes. Par exemple si on considère
l’automate de la figure 3, il engendre un groupe d’ordre 16 et son automate étendu engendre un groupe
d’ordre 64.
a b
0|1
2|3
0|3
2|1
1|0
3|2
1|0
3|2
Figure 3 – Automate inversible-réversible engendrant le groupe K4 ⋊ Z2 d’ordre 16.
2.3.4 Automates d’ordres supérieurs
Définition 11. Soit un automate de Mealy A = (A, Σ, δ, ρ) ∈ T
Σ
A × T
A aut. d’ordre Σ et deux entiers n, k > 0.
supérieur L’automate de Mealy
An,k =
A
n
, Σ
k
,(δx : A
n → A
n
)x∈Σk ,(ρu : Σk → Σ
k
)u∈An
(4)
est l’automate de Mealy d’ordre (n, k) associé à A.
Il s’identifie à un élément de T
Σ
k
An × T
A
n
Σk .
Dans l’équation (4), ρu : An → An est la restriction de ρu : A∗ → A∗
à An, et de même pour δx. On a
en particulier A1,1 = A.
Graphiquement, An,k est un automate dont les états sont des mots de longueur n sur A dans le semigroupe
engendré par A et les actions de ces états correspondent aux actions des éléments du semi-groupe
sur des mots de longueur k sur Σ.
Le semi-groupe engendré par l’automate d’ordre (n, 1) associé à A est un sous-semi-groupe de hAi+. Le
semi-groupe engendré par l’automate d’ordre (1, k) associé à A est isomorphe à hAi+. Le semi-groupe
engendré par l’automate d’ordre (n, k) associé à A est donc isomorphe à un sous-semi-groupe de hAi+.
L’automate An,1 est parfois noté An et appelé puissance n-ème de A.
puissance
d’un aut.
73 Problème du mot
Le premier problème de décision qu’on aborde avec les (semi-)groupes est le problème du mot : peuton
décider si deux mots représentent le même élément du (semi-)groupe ? Ce problème est en général
indécidable [11].
Ce problème est décidable dans le cadre des semi-groupes d’automate, comme montré en proposition 4,
ce qui rend le problème de finitude semi-décidable par énumération.
Lemme 1. Étant donné un automate de Mealy, on peut décider si les fonctions de production étendues
de deux de ses états sont égales.
Je ne détaille pas la preuve ici, mais il suffit de regarder la procédure de minimisation introduite en
section 4 pour s’en convaincre.
Proposition 4. Le problème du mot est décidable pour les (semi-)groupes d’automate.
Démonstration. Soit un automate de Mealy A = (A, Σ, δ, ρ). Si l’identité de Σ
∗ n’est pas une des fonctions
de production étendues des états de A, on peut ajouter un état qui boucle sur lui-même et dont la fonction
de production est l’identité de Σ. Sans perte de généralité on peut donc supposer qu’un des générateurs
du groupe est l’identité, ce qui permet de considérer le problème du mot sur des mots de même longueur.
Soit les générateurs u1, u2, . . . , un, v1, v2, . . . , vn ∈ A pour lesquels on se demande si
u1u2 · · · un
?= v1v2 · · · vn.
On se place dans l’automate puissance An : u1u2 · · · un et v1v2 · · · vn sont des états de cet automate. On
applique donc le lemme 1 pour obtenir le résultat.
Cependant, même pour de petits automates, les (semi-)groupes engendrés peuvent être grands, comme
montré dans l’introduction avec l’automate de la figure 1.
Dans la suite, on s’intéresse à des constructions permettant de décider de la finitude ou de l’infinitude
d’un (semi-)groupe engendré par automate.
4 Critère de finitude : la md-réduction
On construit ici un critère reposant sur la notion de minimisation d’un automate.
congruence Définition 12. Soit un automate de Mealy A = (A, Σ, δ, ρ). Une équivalence ≡ sur A est une congruence
pour A si
∀x, y ∈ A,
[x ≡ y] =⇒ [∀i ∈ Σ, ρx(i) = ρy(i) et δi(x) ≡ δi(y)]
.
L’équivalence de Nérode sur A est la congruence la plus fine pour A.
équivalence
de Nérode
L’équivalence de Nérode est la limite de la suite d’équivalences de plus en plus fines (≡k) définie par
∀x, y ∈ A, x ≡0 y ⇐⇒ ∀i ∈ Σ, ρx(i) = ρy(i),
∀k > 0, x ≡k+1 y ⇐⇒ x ≡k y et ∀i ∈ Σ, δi(x) ≡k δi(y).
L’ensemble des états A étant fini, cette suite est ultimement constante ; de plus, elle est constante dès que
deux termes consécutifs sont égaux. Sa limite est donc calculable.
On note [x] la classe d’équivalence d’un état x ∈ A pour l’équivalence de Nérode.
8automate Définition 13. Soit un automate de Mealy A = (A, Σ, δ, ρ) et ≡ l’équivalence de Nérode associée à A.
minimisé Le minimisé de A est l’automate de Mealy A/≡ = (A/≡, Σ,
˜δ, ρ˜), où, pour tout état x ∈ A et toute lettre
i ∈ Σ, on a :
˜δi([x]) = [δi(x)] et ρ˜[x](i) = ρx(i).
Un automate est minimal s’il est équivalent à son minimisé.
La définition est consistante avec la définition classique de minimisation sur les automates booléens : la
partition initiale a lieu ici en fonction des fonctions de production ; pour rappel, dans le cas des automates
booléens elle se fait sur le critère états finaux / états non finaux.
Proposition 5. Un automate de Mealy et son minimisé engendrent le même semi-groupe.
Démonstration. On montre par récurrence sur n que ρx et ρ˜[x] sont égaux sur Σ
n.
Laissé en exercice.
On remarque que le dual d’un minimisé n’est pas nécessairement minimal. On introduit ici une notion de
minimalité symétrique entre un automate et son dual.
Définition 14. Une paire d’automates duaux est md-réduite si chacun des deux automates de la paire est
paire / aut.
md-réduit(e)
minimal. Par extension, on dira qu’un automate est md-réduit si la paire qu’il forme avec son dual est
md-réduite.
La md-réduction d’une paire d’automates duaux consiste à réduire alternativement chacun des deux auto- md-réduction
mates jusqu’à ce que la paire soit md-réduite.
Exemple 3. Un exemple de md-réduction est donné en figure 4.
Même si elle ne le semble pas au premier abord, la md-réduction est confluente [1]. Ce fait n’est pas crucial
pour la suite, mais facilitera les tournures de phrase en nous permettant de donner la définition suivante.
Définition 15. La paire d’automates de Mealy obtenue par md-réduction d’un couple d’automates duaux
md-réduit est appelée son md-réduit.
Théorème 1 ([1]). Une paire d’automates duaux engendre des (semi-)groupes finis si et seulement si son
md-réduit engendre des (semi-)groupes finis.
Démonstration. Laissée en exercice.
On note par ailleurs que dmd(A) est un quotient de A. Donc si le groupe engendré par A est fini, celui
engendré par dmd(A) est plus petit.
Le théorème 1 n’est pas en lui-même un critère de finitude puisqu’il faut savoir si le md-réduit obtenu
engendre des groupes finis. Néanmoins il peut être efficacement combiné à d’autres critères de finitude.
On déduit de ce théorème une condition suffisante de finitude effective donnée par le corollaire 2, en
remarquant que l’automate trivial engendre le groupe trivial.
Corollaire 2 ([1]). Si la md-réduction d’une paire d’automates de Mealy duaux aboutit à une paire d’automates
triviaux, les automates de départ engendrent des (semi-)groupes finis.
La démonstration de la proposition 6 ci-dessous est une application directe de ce critère.
Il existe des paires md-réduites non triviales d’automates duaux qui engendrent des (semi-)groupes finis.
Un exemple est donné en figure 5.
9a b
0|1
2|3
0|3
2|1
1|0
3|2
1|0
3|2
d
0 1
3 2
a|a
b | b
a| b
a|a
b | b
a| b
b |a
b |a
m
13 02
a|a
b | b
a| b
b |a
d
a b
02|13
02|13
13|02 13|02
m
ab
13|02
02|13
d
13 02
ab |ab
ab |ab
m
0123
ab |ab
d
ab
0123|0123
Figure 4 – La md-réduction d’une paire d’automates de Mealy duaux.
a b
1|0
0|1
1|1
0|1
Figure 5 – Automate md-réduit (non trivial) qui engendre un semi-groupe de taille 6.
5 Critère structurel de finitude : branchement limité
Antonenko [2] s’est intéressé au problème suivant : quels sont les automates de Mealy tels que pour toutes
les fonctions de production possibles, le semi-groupe engendré est fini ?
Les critères développés dans [2] reposent sur la structure de l’automate. La proposition 7 donne le résultat
général. Il est cependant plus intuitif d’étudier en premier la proposition 6.
état sans Définition 16. Dans un automate de Mealy A = (A, Σ, δ, ρ), l’état x ∈ A est sans branchement si son
branchement image par une fonction de transition ne dépend pas de la lettre lue, c’est-à-dire :
∀i, j ∈ Σ, δi(x) = δj(x).
Graphiquement cela signifie qu’une seule transition part de l’état x, étiquetée par toutes les lettres de
l’alphabet Σ.
10aut. sans Définition 17. Un automate de Mealy A = (A, Σ, δ, ρ) est sans branchement si tous ses états sont sans
branchement branchement.
On pourra alors en abusant légèrement noter δ(x) l’image d’un état x ∈ A par une des fonctions de
transition δi
.
Proposition 6 ([2]). Un automate de Mealy sans branchement engendre un (semi-)groupe fini.
Démonstration. Soit un automate de Mealy sans branchement. Tous les états de son dual sont équivalents,
le md-réduit de la paire est donc une paire d’automates triviaux et on peut conclure par le corollaire 2.
[Ce n’est pas la démonstration donnée dans [2].]
Le résultat de la proposition 6 s’étend aux automates dont aucun branchement n’est suivi d’un cycle.
aut. à branch Définition 18. Un automate de Mealy A = (A, Σ, δ, ρ) est à branchement limité si tous ses états t
limité atteignables à partir d’un cycle sont sans branchement.
Proposition 7 ([2]). Un automate de Mealy à branchement limité engendre un (semi-)groupe fini.
Démonstration. avec les mains
Quitte à dérouler un peu les cycles, on peut supposer que toutes les branches qui précèdent l’entrée dans
un cycle ont même longueur b. En s’autorisant à agrandir ces mêmes cycles (en les parcourant un certain
nombre de fois), on peut également supposer que tous les cycles ont même longueur ℓ.
On découpe alors un mot en ses b premières lettres, puis en paquets de ℓ lettres consécutives. Sur les b
premières lettres, il n’y a qu’un nombre fini d’actions possibles. Sur la suite du mot : sur chaque paquet de
ℓ lettres, il n’y a qu’un nombre fini d’actions possibles et au bout d’un moment on a forcément vu toutes
les actions qui devaient apparaître.
Formalisation laissée en exercice.
Bien entendu ce critère ne couvre pas tous les automates engendrant des (semi-)groupes finis. Par exemple,
l’automate de la figure 1 n’est pas à branchement limité et engendre un semi-groupe fini.
Ce critère est maximal dans le sens où pour tout automate qui n’est pas à branchement limité, il existe
une fonction de production telle que le groupe engendré est infini.
La démonstration se fait en traitant séparément les trois cas suivants :
(i) il existe un cycle C étiqueté uniquement par des 0 et tel qu’un des états de ce cycle branche vers un
état extérieur à C ;
(ii) il existe un cycle C étiqueté uniquement par des 0 et tel qu’un des états de ce cycle branche vers un
état de C ;
(iii) les cycles qui possèdent des états qui branchent ne sont pas uniquement étiquetés par des 0.
Montrons le cas (i) pour donner une idée :
x1
x2
x0
xn−1
xn−2
x
′
0|0
0|0
0|0
0|0
0|0
0|0
i|1 1|0
0|0
11Soit deux entiers k et ℓ tels que k + ℓ soit divisible par n. Alors ρxk
(0ℓ1v) = 0ℓ+11v
′
.
On montre que l’élément suivant du groupe engendré par l’automate est d’ordre infini :
ρ¯ = ρx1 ◦ ρx2 ◦ · · · ◦ ρxn−1 ◦ ρx0
.
En effet pour un entier k quelconque, on a
ρ¯(0kn1 · · ·) = ρx1 ◦ ρx2 ◦ · · · ◦ ρxn−1 ◦ ρx0
(0kn1 · · ·)
= ρx1 ◦ ρx2 ◦ · · · ◦ ρxn−1
(0kn+11 · · ·)
= . . .
= 0(k+1)n
1 · · ·
Donc au final :
ρ¯
k
(1ω
) = 0kn1 · · · .
6 Critère d’infinitude : graphe en hélice
Dans cette partie nous travaillons exclusivement sur des automates inversibles-réversibles. Nous introduisons
de nouvelles représentations d’automates de Mealy permettant de considérer un automate et son dual
simultanément.
graphe en Définition 19. On appelle graphe en hélice d’un automate de Mealy A = (A, Σ, δ, ρ) le graphe de
hélice sommets A × Σ et d’arcs les (x, i) → (δi(x), ρx(i)).
On remarque qu’on peut définir un graphe en hélice pour tout transducteur lettre-à-lettre ayant même
alphabet d’entrée et de sortie. Un tel transducteur est un automate de Mealy si et seulement si de tout
sommet part un unique arc.
Proposition 8. Si le groupe engendré par un automate inversible-réversible est fini, alors son graphe en
hélice est une union de cycles disjoints.
Pour montrer ce résultat, nous avons besoin d’une autre représentation d’une paire d’automates duaux.
La transition x
i | ρx(i)
−−−−−→ δi(x) est notée
i
x δi(x)
ρx(i)
.
Cette notation est appelée transition en croix. Un automate de Mealy est identifié à l’ensemble de ses transition en
croix transitions en croix (de cardinalité |A| × |Σ|).
Un chemin dans un automate de Mealy A (resp. dans son dual d(A)) peut être représenté par un
diagramme en croix horizontal (resp. vertical). On peut également considérer des diagrammes en croix diagramme
en croix rectangulaires de dimension n × k sur lesquels on peut lire les fonctions de production de l’automate
associé An,k d’ordre (n, k) et de son dual.
Par exemple, le diagramme en croix suivant :
i1 ik
x1 . . . y1
.
.
.
.
.
.
xn . . . yn
j1 jk
correspond dans An,k à
ρx1···xn
(i1 · · ·ik) = j1 · · · jk,
δi1···ik
(x1 · · · xn) = y1 · · · yn .
12Démonstration de la proposition 8. Soit A = (A, Σ, δ, ρ) un automate inversible-réversible qui engendre
un groupe fini. La proposition 3 nous permet d’affirmer que l’automate dual d(A) engendre également un
groupe fini.
Si on considère l’application qui va de l’ensemble fini des sommets d’un graphe en hélice dans lui-même
et qui à un sommet associe son unique successeur dans ce graphe, le graphe en hélice est une union de
cycles disjoints si et seulement si cette application est bijective, donc si et seulement si elle est surjective,
c’est-à-dire qu’un graphe en hélice est une union de cycles disjoints si et seulement si chaque sommet de
ce graphe possède un prédécesseur.
Soit un état x ∈ A et une lettre i ∈ Σ. Montrons que le sommet (x, i) du graphe en hélice possède un
prédécesseur. Il existe deux entiers m, n > 0 tels que ρ
m
x = ρxm = idhAi et δ
n
i = δin = idhd(A)i
. Cela
implique l’existence d’une transition x
m i
n|i
n
−−−→ x
m dans l’automate associé d’ordre (m, n). Le diagramme
en croix correspondant s’écrit :
n
i i
x . . . x
m
.
.
.
.
.
.
x . . . x
i i
.
Le coin sud-est donne un prédécesseur à (x, i).
La condition de la proposition 8 n’est pas suffisante : il existe des automates dont le graphe en hélice est
une union de cycles disjoints et dont on sait par ailleurs qu’ils engendrent un groupe infini, comme par
exemple l’automate d’Alešin donné en figure 6.
a
b
c
0|1
1|0
0|1
1|0
0|0
1|1
Figure 6 – L’automate d’Alešin engendre un groupe infini. Son graphe en hélice est un cycle.
De fait, la proposition 9 caractérise de façon très simple l’ensemble des automates inversibles-réversibles
dont le graphe en hélice est une union de cycles disjoints.
Proposition 9. Soit A un automate inversible-réversible. Les propriétés suivantes sont équivalents :
(i) A est biréversible,
(ii) didi(A) est un automate de Mealy,
(iii) le graphe en hélice de A est une union de cycles disjoints.
Démonstration.
(i) ⇒ (ii) A est biréversible, cela signifie qu’il est inversible et i(A) est réversible, ce qui entraîne que
di(A) est inversible. A nouveau, on peut donc prendre l’inverse puis le dual et on obtient que
didi(A) est un automate de Mealy.
13(ii) ⇒ (i) L’automate A étant supposé inversible-réversible, di(A) est bien un automate de Mealy.
Par ailleurs, didi(A) étant un automate de Mealy, idi(A) est également un automate de Mealy.
Comme c’est l’inverse de di(A), on en déduit que di(A) est inversible, donc i(A) réversible. Ce qui
entraîne que A est biréversible.
(ii) ⇔ (iii) Dans le graphe en hélice d’un automate de Mealy, il part exactement un arc de chaque
sommet. Le graphe en hélice d’un automate de Mealy est donc une union de cycles disjoints si et
seulement s’il arrive au plus un arc par sommet.
On définit le graphe G d’ensemble de sommets A−1 × Σ
−1
et d’arcs (y
−1
, j−1
) → (x
−1
, i−1
) si
(x, i) → (y, j) appartient au graphe en hélice H de A.
Le graphe G est le graphe en hélice de didi(A) :
– si didi(A) est un automate de Mealy, chaque sommet de G possède un successeur, donc chaque
sommet de H possède un prédecesseur et H est une union de cycles disjoints,
– si H est une union de cycles disjoints, il en est de même pour G et on déduit de la remarque
qui suit la définition 19 que didi(A) est un automate de Mealy.
On en déduit un critère d’infinitude structurel, très simple à vérifier :
Corollaire 3. Tout automate inversible-réversible qui n’est pas biréversible engendre un groupe infini.
7 Condition nécessaire et suffisante de finitude (non effective)
Dans cette partie nous travaillons exclusivement sur des automates inversibles-réversibles. Le critère pré-
senté ici n’est à ce jour pas effectif, cette section sert donc quelque peu du cadre général de ce cours,
mais les techniques utilisées dans les preuves peuvent s’avérer intéressantes dans d’autres occasions.
graphes en Définition 20. Soit un automate de Mealy A et deux entiers n, k > 0. Le graphe en hélice d’ordre (n, k)
hélice de A est le graphe en hélice de l’automate de Mealy d’ordre (n, k) associé à A.
On parle des graphes en hélice de A pour désigner l’ensemble de ses graphes en hélice d’ordre quelconque.
On peut noter que le graphe en hélice de A tel que défini à la définition 19 est le graphe en hélice
d’ordre (1, 1) de A.
Théorème 2. Le groupe engendré par un automate inversible-réversible est fini si et seulement si les
graphes en hélice de son automate étendu sont des unions de cycles disjoints uniformément bornés.
Pour montrer le théorème 2, nous allons utiliser des résultats intermédiaires.
Lemme 2. Les graphes en hélice d’un automate de Mealy sont des unions de cycles disjoints si et
seulement si son graphe en hélice d’ordre (1, 1) est une union de cycles disjoints.
La démonstration de ce lemme repose sur le même type d’argument que celle de la proposition 8 et est
laissée en exercice.
Proposition 10. Si un automate inversible-réversible engendre un groupe fini, alors les cycles des graphes
en hélices de son automate étendu sont uniformément bornés.
Démonstration. Soit A un automate inversible-réversible engendrant un groupe fini et A˜ son automate
étendu. D’après le corollaire 1, le groupe engendré par A˜ est fini et d’après le lemme 2, ses graphes en
hélices sont des unions de cycles disjoints.
D’après la proposition 3, le groupe hd(A˜)i est également fini.
14Soit C, un cycle d’un graphe en hélice de A˜ et (u, v) ∈ (A ⊔ A−1
)
∗ × (Σ ⊔ Σ
−1
)
∗ un sommet de
ce cycle. Chaque sommet de C est de la forme (h(u), g(v)), où g (resp. h) est un élément de hAi˜
(resp. hd(A˜)i). Comme les sommets sont deux à deux distincts, la longueur du cycle C est bornée par
#hAi × ˜ #hd(A˜)i.
Proposition 11. Si les cycles des graphes en hélice de l’automate étendu d’un automate inversible-réversible
sont uniformément bornés, alors le groupe engendré par cet automate est fini.
Démonstration. La démonstration de cette proposition repose sur un résultat poussé de théorie des groupes
qui permet d’affirmer qu’un groupe d’automate dont les ordres des éléments sont bornés1
est fini.
On dit qu’un mot sur les générateurs d’un groupe est unitaire s’il représente l’identité dans le groupe. mot unitaire
Le groupe hAi˜ étant infini, les ordres de ses éléments ne sont pas bornés : soit il existe un mot x ∈
(A ⊔ A−1
)
∗
tel que ρx est d’ordre infini, soit il existe une suite de mots (xn)n∈N ⊆ (A ⊔ A−1
)
∗
telle
que la suite des ordres des (ρxn
)n∈N est strictement croissante. Nous allons traiter le deuxième cas (le
premier est analogue).
On note kn l’ordre de l’élément ρxn
: pour tout k, 1 ≤ k < kn, il existe un mot uk ∈ (Σ ⊔ Σ
−1
)
∗
tel que
ρ
k
xn
(uk) = u
′
k
6= uk.
Comme hd(A˜)i est un groupe, le mot uk peut être étendu en un mot unitaire ukvk. On pose alors
wn = u1v1 · · · ukn−1vkn−1.
Par construction ρxn
(wn) = u
′
1
· · · 6= wn.
Par ailleurs u1v1 étant unitaire, on a également
ρ
2
xn
(wn) = ρ
2
xn
(u1v1)ρ
2
xn
(u2v2 · · · ukn−1vkn−1)
= ρ
2
xn
(u1v1)u
′
2
· · · 6= wn .
De la même façon, on montre que pour tout k < kn, on a ρ
k
xn
(wn) 6= wn.
Dans le graphe en hélice de A˜ d’ordre (|xn|, |wn|), on considère le cycle contenant le nœud (xn, wn). Le
mot wn étant unitaire, les successeurs de (xn, wn) dans ce cycle sont : (xn, ρxn
(wn)), (xn, ρ2
xn
(wn)),
. . . Ce cycle est donc de longueur kn. Comme (kn)n diverge vers l’infini, les longueurs des cycles des
graphes en hélice de A˜ ne sont pas uniformément bornées.
Le théorème 2 est alors un corollaire des propositions 10 et 11.
8 Accélération des semi-algorithmes existants
Cette section décrit comment la minimisation permet d’accélérer substantiellement les procédures existantes
servant à tester la finitude et à caluler la croissance ou l’ordre d’un (semi-)groupe fini [8].
Notre point de départ sont les deux paquets GAP [4] suivants : FR développé par Bartholdi [3] et automgrp
développé par Muntyan et Savchuk [9].
8.1 Croissance d’un (semi-)groupe d’automate
La croissance d’un (semi-)groupe correspond à la vitesse à laquelle celui-ci va grossir lorsqu’on compose
les éléments au fur et à mesure. Donnons une définition plus formelle. Soient un automate de Mealy
15A = (A, Σ, δ, ρ) et un mot x ∈ A∗
. La longueur de ρx, notée |ρx|, est la longueur minimale d’un mot longueur
équivalent à x :
|ρx| = min{n | ∃y ∈ A
n
, ρx = ρy} .
La fonction de croissance de l’automate A est la série formelle qui énumère les éléments du semigroupe fonction de
croissance en fonction de leur longueur :
X
g∈hAi+
t
|g| =
X
n∈N
#{g ∈ hAi+ ; |g| = n} t
n
.
On s’intéresse au calcul des termes de cette série. Les paquets FR et automgrp utilisent l’énumération ; cette
technique fonctionne pour n’importe quel (semi-)groupe dans lequel le problème du mot est résoluble : on
part des générateurs et on engendre de nouveaux éléments étape par étape, jusqu’à ne plus en obtenir. Le
fait que le groupe soit engendré par un automate ne sert qu’à apporter une solution au problème du mot.
On peut en fait utiliser complètement et en permanence la structure d’automate et la puissance de la
minimisation pour obtenir de manière globale tous les éléments de longueur n à partir des éléments de
longueur n − 1. A chaque entier n, on associe un automate de Mealy An dont les états sont exactement
les éléments de longueur au plus n :
An = m(An−1 × m(A
′
)) et A1 = m(A) ,
où A′ = A si l’identité est un générateur de A, et l’union de A et de l’automate trivial sinon.
AutomatonGrowth := function ( arg )
local aut , radius , growth , sph , curr , next , r;
aut := arg [1]; # automate de Mealy
if Length ( arg ) >1 then radius := arg [2];
else radius := infinity ;
fi;
r := 0;
curr := TrivialMealyMachine ([1]);
next := Minimized ( aut );
aut := Minimized ( next + TrivialMealyMachine ( Alphabet ( aut )));
sph := aut !. nrstates - 1; # nombre d ’ etats non triviaux
growth := [ next !. nrstates - sph ];
while sph >0 and r < radius
do Add ( growth , sph );
r := r +1;
curr := next ;
next := Minimized ( next * aut );
sph := next !. nrstates - curr !. nrstates ;
od;
return growth ;
end;
L’appel AutomatonGrowth(aut) permet de calculer la croissance du semi-groupe hauti+, tandis que l’appel
AutomatonGrowth(aut+aut^-1) calcule la croissance du groupe hauti.
Résultats expérimentaux. Nous commençons par faire tourner AutomatonGrowth et WordGrowth (paquet
FR) sur l’automate de Grigorchuk. Pour un rayon de 10, AutomatonGrowth est nettement plus rapide, 76 ms
contre 9 912 ms 2
. La raison en est simple : WordGrowth appelle la procédure de minimisation 57 577 fois
tandis que AutomatonGrowth ne l’appelle que 12 fois :
1. Il existe des groupes d’automate infinis dont les éléments sont tous d’ordre fini, par exemple le groupe engendré par l’automate
de Grigorchuk [6].
2. Programmes exécutés sur un processeur Intel Core 2 Duo 3,06 GHz.
16gap > aut := GrigorchukMachine ;; f := sgp ( aut );; radius := 10;;
gap > ProfileFunctions ([ Minimized ]);
gap > WordGrowth (f , radius ); time ;
[ 1, 4, 6, 12 , 17 , 28 , 40 , 68 , 95 , 156 , 216 ]
9912
gap > DisplayProfile ();
count self / ms chld / ms function
57577 7712 0 Minimized
7712 TOTAL
gap > ProfileFunctions ([ Minimized ]);
gap > AutomatonGrowth ( aut , radius ); time ;
[ 1, 4, 6, 12 , 17 , 28 , 40 , 68 , 95 , 156 , 216 ]
76
gap > DisplayProfile ();
count self / ms chld / ms function
12 72 0 Minimized
72 TOTAL
Comparons maintenant les temps d’exécution des diverses implémentations pour les premiers termes de
la fonction de croissance des 335 automates de Mealy biréversibles à 3 lettres et 3 états (à isomorphisme
près). Certains résultats n’apparaissent pas dans la table 1 faute d’avoir pu les obtenir en temps raisonnable.
Table 1 – Temps moyen (en ms)
rayon 1 2 3 4 5 6 7
WordGrowth – FR 3,4 29,0 555,0 8 616,5 131 091,4 2 530 170,3 ?
Growth – automgrp 0,7 2,8 16,9 158,9 1 909,0 22 952,8 ?
AutomatonGrowth 0,6 1,8 5,9 28,9 187,3 1 005,9 7 131,4
8.2 Ordre d’un (semi-)groupe
FR et automgrp implémentent des procédures de calcul de l’ordre d’un (semi-)groupe d’automate fini. Ces
deux paquets utilisent des approches tout à fait orthogonales. L’implémentation décrite ici affine l’approche
de FR and reste orthogonale à celle de automgrp.
L’implémentation de automgrp. Le paquet GAP automgrp définit la function LevelOfFaithfulAction
qui permet de calculer—parfois de façon extrêmement efficace—l’ordre du groupe engendré. Le principe
est le suivant : soient A un automate de Mealy inversible sur l’alphabet Σ et Gk le groupe engendré
par les restrictions à Σ
k des fonctions de productions étendues. Si #Gk = #Gk+1 pour un certain k,
alors hAi est fini, d’ordre #Gk. Cette fonction peut être facilement adaptée à un automate de Mealy non
inversible.
LevelOfFaithfulAction n’est pas utilisable pour calculer la fonction de croissance : à chaque étape on
calcule un quotient du semi-groupe. Mais c’est une bonne stratégie pour calculer l’ordre du semi-groupe.
De plus cette méthode profite du fait que GAP a en quelque sorte été écrit pour manipuler des permutations
de groupes finis.
L’implémentation de FR et la nouvelle implémentation. Tout algorithme qui permet de calculer la
fonction de croissance peut être utilisé pour calculer l’ordre d’un (semi-)groupe fini. Il suffit de calculer la
fonction de croissance jusqu’à trouver un coefficient nul. C’est l’approche utilisée dans FR. Comme nous
avons proposé, dans la section précédente, une nouvelle implémentation pour la fonction de croissance,
nous obtenons directement une nouvelle procédure pour calculer l’ordre. Appelons-la AutomSGrOrder.
17Résultats expérimentaux. L’orthogonalité des deux approches précédentes peut être illustrée par l’automate
de la figure 1. Ni la fonction Order de FR, ni AutomSGrOrder ne sont capables de calculer
l’ordre du groupe, alors que automgrp, via LevelOfFaithfulAction, permet d’obtenir le résultat en seulement
14 338 ms. D’un autre côté, AutomSGrOrder calcule l’ordre du semi-groupe engendré par le dual
en 17 ms, alors qu’une adaptation de LevelOfFaithfulAction (aux automates de Mealy non inversibles)
met 2 193 ms (ce semi-groupe est d’ordre 234).
8.3 Finitude
Toute procédure qui calcule l’ordre d’un (semi-)groupe d’automate produit une procédure de semi-décision
pour le problème de finitude. Les deux paquets FR and automgrp appliquent un certain nombre de critères
de finitude ou d’infinitude puis essayent en dernier recours de calculer l’ordre du groupe.
On peut saupoudrer ces procédures de minimisation : on remplace le (semi-)groupe dont on veut dé-
cider s’il est fini ou non successivement par d’autres (semi-)groupes qui sont finis si et seulement si le
(semi-)groupe d’origine l’était. Il est possible d’incorporer cette astuce pour obtenir deux nouvelles implé-
mentations, l’une dans l’esprit de FR et l’autre dans l’esprit de automgrp. Ces nouvelles implémetations
sont plus efficaces que les précédentes, de plusieurs ordres de grandeur. Les deux approches restent utiles
car selon le cas l’une ou l’autre sera la plus rapide.
Les nouvelles impleméntations La conception de la procédure IsFinite1 est consistente avec celle
de AutomatonGrowth. Ainsi IsFinite1 est beaucoup plus proche de FR que de automgrp. La version écrite
ici fonctionne en parallèle sur l’automate et son dual.
IsFinite1 := function ( aut , limit )
local radius , dual , curr1 , next1 , curr2 , next2 ;
radius := 0;
aut := MDReduced ( Prune ( aut )); # automate elague puis md - reduit
dual := DualMachine ( aut );
curr1 := MealyMachine ([[1]] ,[()]);
curr2 := curr1 ;
next1 := aut ;
next2 := dual ;
while curr2 !. nrstates <> next2 !. nrstates and radius < limit
do radius := radius + 1;
curr1 := next1 ;
next1 := Minimized ( next1 * aut );
if curr1 !. nrstates <> next1 !. nrstates
then curr2 := next2 ;
next2 := Minimized ( next2 * dual );
else return true ;
fi;
od;
if curr2 !. nrstates = next2 !. nrstates then return true ; fi;
return fail ;
end;
La procédure IsFinite2 est une amélioration de LevelOfFaithfulAction (automgrp) : la minimisation
est faite sur le dual. Cette procédure peut être améliorée en parallélisant son exécution sur l’automate et
son dual.
IsFinite2 := function ( aut , limit )
local Fonc1 , Fonc2 , next , cs , ns , lev ;
aut := MDReduced ( Prune ( aut ));
if IsInvertible ( aut ) then Fonc1 := Group ;
Fonc2 := PermList ;
18else Fonc1 := Semigroup ;
Fonc2 := Transformation ; fi;
lev := 0;
cs := 1;
ns := Order ( Fonc1 ( List ( aut !. output , Fonc2 )));
aut := DualMachine ( aut );
next := aut ;
while cs < ns and lev < limit
do
lev := lev +1;
cs := ns ;
next := Minimized ( next * aut );
ns := Order ( Fonc1 ( List ( DualMachine ( next )!. output , Fonc2 )));
od;
if cs = ns then return true ; else return fail ; fi;
end;
Table 2 – Temps moyen (en ms) pour détecter la finitude de (semi-)groupes
2 lettres 3 états 2 lettres 4 états 3 lettres 3 états
IsFinite – FR 0,68 36,36 1 342,12
IsFinite – automgrp 0,81 1,79 3,78
IsFinite1 0,49 0,52 0,61
IsFinite2 0,49 0,62 0,70
Résultats expérimentaux. La table 2 présente le temps moyen pour détecter la finitude de (semi-)groupes
engendrés par des automates de Mealy inversibles ou réversibles sur p lettres et q états, avec p+q ∈ {5, 6}.
Pour que ces comparaisons soient équitables, ce qui est donné est le temps minimal pour un automate et
son dual.
9 Cas à deux états
Si on fixe le nombre d’états et la taille de l’alphabet, le nombre d’automates de Mealy correspondant
est potentiellement très grand : il y a q
qp(p!)q
automates de Mealy inversibles à q états et p lettres. Si
on regarde à isomorphisme de structure près, il y a 76 automates de Mealy à 2 états et 2 lettres et
10 766 772 automates de Mealy à 3 états et 3 lettres. Engendrer ces automates est un défi en soi.
L’accélération des calculs permet de faire des tests systématiques sur de grandes familles d’automates. Ces
tests permettent de vérifier et/ou d’élaborer des conjectures. Voici deux conjectures établies par calculs
dans [8] :
Conjecture 1. Tout groupe fini engendré par un automate biréversible sur p lettres et q états est d’ordre
au plus #hBp,qi = p!
q
, où :
y
x
ρx = (1, 2, . . . , p)
ρy = (1, 3, . . . , p)
∀z 6∈ {x, y}, ρz = ( )
Bp,q :
Si cette conjecture se révèle vraie, la problème de finitude serait décidable pour les automates biréversibles.
Une autre conjecture (devenue depuis un résultat) obtenue par expérimentation :
19Théorème 3. Un automate de Mealy réversible à deux états engendre un semi-groupe fini ou libre.
Nous allons montrer ici une partie de ce résultat.
Analysons la structure des composantes connexes des puissances successives de l’automate de Mealy A.
Pour m > 0, u, v ∈ Am et x, y ∈ A, s’il existe un chemin de ux vers vy dans Am+1, alors il existe un
chemin de u vers v dans Am. Donc si An n’est pas connexe, il en est de même de toutes les puissances
suivantes de A. Il existe donc au plus un entier n tel que An est connexe et An+1 ne l’est pas. Appelons-le
degré de connexion de A. Par convention, si A n’est pas connexe, son degré de connexion est nul et il a degré de
connexion un degré de connexion infini si toutes ses puissances sont connexes.
On peut remarquer que l’automate Baby Aleshin (voir figure 7) est réversible, possède trois états et a un
degré de connexion égal à 2 ; il engendre le semi-groupe infini non libre Z
∗3
2 = Z2 ∗ Z2 ∗ Z2 [10]. Ainsi le
théorème 3 ne s’étend pas à des ensembles d’états plus grands.
a
b
c
0|1
1|0
0|0
1|1
0|0
1|1
Figure 7 – L’automate Baby Aleshin engendre le groupe Z
∗3
2 = Z2 ∗ Z2 ∗ Z2 [10].
Proposition 12. Le degré de connexion d’un automate de Mealy réversible à deux états est fini si et
seulement s’il engendre un semi-groupe fini.
Ce résultat se montre par une série de petits résultats.
Lemme 3. Soit un automate de Mealy réversible A ayant au moins deux états. Si A engendre un semigroupe
possédant des éléments de torsion, alors son degré de connexion est fini.
Idée. Notons A l’ensemble des états de A. Si hAi+ possède des éléments de torsion, alors il existe un
mot u ∈ A+ et deux entiers n ≥ 0 et k > 0 tels que u
n et u
n+k
sont équivalents.
On montre que les états de la composante connexe contenant u
n+2k
sont tous de la forme vw2
, où
|v| = |u|
n et |w| = |u|
k
, ce qui entraîne que A(n+2k)|u| n’est pas connexe.
Dans la suite de cette sous-section, A = (A, Σ, δ, ρ) est un automate de Mealy réversible à deux
états (A = {x, y}), de degré de connexion fini n.
Lemme 4. Soit C une composante connexe de Am, pour un certain m et soit u ∈ Am un état de C. La
composante connexe de ux est de taille #C si elle ne contient pas uy et 2#C si elle contient uy.
Démonstration. Soit D la composante connexe contenant ux : v ∈ Am appartient à C si et seulement s’il
existe z ∈ A tel que vz appartienne à D, d’où : N ≤ #D ≤ 2N.
Soient v appartenant à C et z, z¯ ∈ A, z 6= ¯z : ux et vz appartiennent à la même composante connexe si
et seulement si uy et vz¯ appartiennent à la même composante connexe. D’où le résultat.
Lemme 5. Soit un automate de Mealy réversible A, de degré de connexion n. Pour m ≥ n, les composantes
connexes de Am sont toutes de taille 2
n.
20Idée. Par récurrence sur m ≥ n.
Pour m ∈ {n, n + 1}, la propriété est vraie (en utilisant le lemme 4 pour m = n + 1).
Soit m > n + 1. On suppose que les composantes connexes de Am−1
et Am sont de taille 2
n. Si C
est une composante connexe de Am+1, le lemme 4 et l’hypothèse de récurrence permettent de conclure
que C est de taille 2
n ou 2
n+1. On montre ensuite par l’absurde que C n’est pas de taille 2
n+1, car cela
entraînerait, par le lemme 4, l’existence d’une composante connexe de Am−1 de taille 2
n−1
.
Preuve de la proposition 12. Soit A un automate de Mealy réversible à deux états.
Si le degré de connexion de A est nul, hd(A)i+ est le semi-groupe trivial et hAi+ est fini d’après la
proposition 3.
Sinon, soit n ≥ 1 le degré de connexion de A : pour un m ≥ n, les composantes connexes de Am
sont toutes de taille 2
n. A numérotation des états prêt, il ne peut donc y avoir qu’un nombre fini de
composantes connexes distinctes. On en déduit que hAi+ est fini.
La réciproque est un cas particulier du lemme 3.
Références
[1] A. Akhavi, I. Klimann, S. Lombardy, J. Mairesse, and M. Picantin. On the finiteness problem
for automaton (semi)groups. International Journal of Algebra and Computation, (accepted), 2011.
http://arxiv.org/abs/1105.4725.
[2] A. S. Antonenko. On transition functions of Mealy automata of finite growth. Matematychni Studii.,
29(1) :3–17, 2008.
[3] L. Bartholdi. FR Functionally recursive groups, Self-similar groups — a GAP package, Version 1.2.3, 2011.
[4] The GAP Group. GAP – Groups, Algorithms, and Programming, Version 4.4.12, 2008.
[5] P. Gillibert. communication personnelle, 2012.
[6] R. I. Grigorchuk. On Burnside’s problem on periodic groups. Funktsional. Anal. i Prilozhen., 14(1) :53–54,
1980.
[7] I. Klimann. The finiteness of a group generated by a 2-letter invertible-reversible Mealy automaton is
decidable. In STACS, 2013. http ://arxiv.org/abs/1208.6324.
[8] I. Klimann, J. Mairesse, and M. Picantin. Implementing computatioons in automaton (semi)groups. In
N. Moreira and R. Reis, editors, CIAA, number 7381 in LNCS, pages 240–252, 2012.
[9] Y. Muntyan and D. Savchuk. automgrp Automata Groups — a GAP package, Version 1.1.4.1, 2008.
[10] V. Nekrashevych. Self-similar groups, volume 117 of Mathematical Surveys and Monographs. American
Mathematical Society, Providence, RI, 2005.
[11] P.S. Novikov. On the algorithmic unsolvability of the word problem in group theory. Trudy Mat. Inst.
Steklov, 44 :1–143, 1955. in Russian.
[12] D. M Savchuk and Y. Vorobets. Automata generating free produtcs of groups of order 2. J. Algebra,
336(1) :53–66, 2011.
21
Le syst`eme d’information de l’entreprise
Badr Benmammar
To cite this version:
Badr Benmammar. Le syst`eme d’information de l’entreprise. Ecole d’ing´enieur. 2007. ´
HAL Id: cel-00662726
https://cel.archives-ouvertes.fr/cel-00662726
Submitted on 24 Jan 2012
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Le système d’information
de l’entreprise
Badr Benmammar
benmamma@enst.frPlan
Introduction à l’informatique
Domaines d’application de l’informatique
L’informatique industrielle
L’informatique scientifique
L’informatique de gestion
L’informatique communicante
Internet
L’histoire d’Internet
Les services sur Internet
Protocoles et logiciels
Structure de l’ordinateur
Système d’exploitation
Le système d’information de l’entrepriseFormation
En Algérie :
USTO - ORAN
1999
Ingénieur en Informatique - Option Génie Logiciel
Mention : Très bien (Major de la promotion)
2001
Ingénieur Etude et Développement Tlemcen
1994 Tlemcen Baccalauréat Série Sciences Exactes
Mention : Bien
En France :
LaBRI
ENSEIRB
LIPN
2003
2005
2006
Attaché temporaire d’enseignement et de recherche
(demi-service)
Ingénieur de recherche
Doctorat de l’Université Bordeaux 1
Mention : Très honorable
2001
2002
LIPN Master Recherche en Intelligence Artificielle
et Optimisation Combinatoire
Post-Doc : Chargé d’études à l’ENST
2007 ENST
Le routage externe BGP4
Luc Saccavini
To cite this version:
Luc Saccavini. Le routage externe BGP4. 2006.
HAL Id: inria-00108171
https://cel.archives-ouvertes.fr/inria-00108171
Submitted on 19 Oct 2006
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.1
LE ROUTAGE BGP4(+) / septembre 2006 1/56 V2.0
LE ROUTAGE BGP4(+)
Luc.Saccavini@inria.fr
septembre 20062
LE ROUTAGE BGP4(+) / septembre 2006 2/56 V2.0
Classification des protocoles de routage
R Il existe 2 grandes familles de protocoles de routage
R Les protocoles intérieurs (IGP)
R Distance-vecteur : RIP, IGRP
R État des liens : OSPF, IS-IS
R Taille <100 routeurs, 1 autorité d’administration
R Échange de routes, granularité = routeur
R Les protocoles extérieurs (EGP)
R EGP, BGP, IDRP
R Taille = Internet, coopération d’entités indépendantes
R Échange d’informations de routage, granularité = AS
Rappel sommaire sur les types de protocoles de routage :
- distance vecteur : la distance est le nombre de routeurs pour joindre une destination, chaque routeur ne connaît
que son voisinage et propage les routes qu'il connaît à ses voisins (ex. RIP).
- états des liens : chaque routeur connaît la topologie et l'état de l'ensemble des liens du réseau, puis en déduit les
chemins optimaux. À chaque interaction les routeurs s'envoient toute leur table de routage (ex. OSPF).
Le protocole BGP peut être considéré comme à mi-chemin entre les deux types de protocoles précédents. En
effet, l’échange de chemins d’AS permet à chaque routeur de reconstruire une grande partie de la topologie du
réseau, ce qui est caractéristique des protocoles de type «état des liens», mais deux routeurs voisins n’échangent
que les routes qu’ils connaissent, ce qui est caractéristique d’un protocole de type «distance-vecteur».
Références sur les autres protocoles de routage :
IPv4 IPv6 --------------------------------------------------------------------------------------------------------------
RIP (Routing Information Protocol) RFC 2453, 11/98 «RIPv2» RFC2080, 01/97 «RIPng»
IGRP voir manuel IOS de Cisco
EIGRP voir manuel IOS de Cisco
OSPF (Open Shortest Path First) RFC 2328, 04/98 «OSPv2» RFC 2740, 12/99 «OSPv3»
IS-IS (Intermediate System to Intermediate System ISO/IEC 10589, (ou RFC1142, 02/90)
EGP (Exterior Gateway Protoco) RFC 904 04/84 --------
IDRP (Inter Domain Routing Protocol) ISO/IEC IS10747 10/93
BGP (Border Gateway Protocol) RFC 4271, 01/06 «BGP4» RFC 2545, 03/99 «BGP4+»3
LE ROUTAGE BGP4(+) / septembre 2006 3/56 V2.0
Notion de système autonome (AS)
R Ensemble de routeurs sous une même entité administrative
SYSTÈME AUTONOME
R1
R2
R4 R5
Routeurs internes
Routeur de bord
annonceur BGP
R3
Au sein d’un AS plusieurs IGP (et/ou un routage statique) peuvent être utilisés.
Fonctionnellement, on distingue 2 types de Systèmes Autonomes :
- les AS clients : ils sont les producteurs ou les consommateurs de paquets IP
- les AS de transit : ils ne font que transporter les paquets IP qui leurs sont confiés
Un AS n’est à priori pas lié à la localisation géographique des différents routeurs qui le
constituent.4
LE ROUTAGE BGP4(+) / septembre 2006 4/56 V2.0
Objectifs généraux du protocole BGP
R Échanger des routes (du trafic) entre organismes indépendants
R Opérateurs
R Gros sites mono ou multi connectés
R Implémenter la politique de routage de chaque organisme
R Respect des contrats passés entre organismes
R Sûreté de fonctionnement
R Être indépendant des IGP utilisés en interne à un organisme
R Supporter un passage à l’échelle (de l’Internet)
R Minimiser le trafic induit sur les liens
R Donner une bonne stabilité au routage
BGP élimine les boucles de routage en examinant le chemin d’AS associé à une route.
Les RFC1265 et RFC1774 contiennent une étude des propriétés de mise à l’échelle du protocole BGP.
Dans cette étude, si on appelle N le nombre total de préfixes annoncés dans l’Internet, M la distance
moyenne entre les AS (exprimée en nombre d’AS), et A le nombre total d’AS de l’Internet, alors, le
volume d’information échangé lors du premier échange entre deux voisins BGP est proportionnel à :
O(N+M*A). Le volume de mémoire nécessaire dans chaque routeur étant proportionnel à :
O((N+M*A)*K), avec K=nombre moyen de voisins BGP par routeur.
Nombre de Distance moy. Nombre moy. Nombre moy. Volume initial Volume mém.
préfixes (N) inter-AS (M) d’AS (A) de voisins (K) échangé utilisé
--------------------------------------------------------------------------------------------------------------
2100 5 59 3 9000 27000
4000 10 100 6 18000 108000
10000 15 300 10 49000 490000
20000 8 400 86000
40000 15 400 172000
100000 20 3000 20 520000 1040000
La première ligne de ce tableau correspond à la situation de début 1991, la quatrième à celle de fin
1994, la dernière au 1er semestre 2001.5
LE ROUTAGE BGP4(+) / septembre 2006 5/56 V2.0
Principes généraux du protocole BGP
R Protocole de type PATH-vecteur
R Chaque entité est identifiée par un numéro d’AS
R La granularité du routage est le Système Autonome (AS)
R Le support de la session BGP est TCP (port 179)
R Les sessions BGP sont établies entre les routeurs de bord d’AS
R Protocole point à point entre routeurs de bord d’AS
R Protocole symétrique
R (un annonceur BGP n’est pas forcément un routeur)
Le choix de TCP comme support du protocole est important car il le libère du problème de
garantir une bonne transmission des informations.
C'est ce choix qui a permis aux architectes du protocole de ne plus procéder que par mise à jour
des informations modifiées après l'envoi initial de la table complète lors de l'ouverture de la
session entre deux routeurs. Cela permet de minimiser le trafic induit.
La politique de routage se traduit par le filtrage des routes apprises et annoncées (ne jamais
oublier qu’annoncer une route vers un réseau c’est accepter du trafic à destination de ce réseau).
Le filtrage (au sens BGP) peut agir en «tout ou rien» sur la route (annonce, prise en compte), mais
aussi par modification des attributs de la route pour modifier la préférence accordée à la route
comme on le verra plus loin.6
LE ROUTAGE BGP4(+) / septembre 2006 6/56 V2.0
Exemple de connexion BGP (1)
R2
AS 200
AS 100
R1
BGP
R Client connecté à un seul Fournisseur d’Accès Internet (FAI).
Seuls les routeurs de bord de l’AS sont figurés.
Client
Session BGP
AS officiels (enregistrés) : de 1 à 64511
AS privés (non-enregistrés) : de 64512 à 65535
FAI
Lien physique
Les routeurs qui échangent leurs informations en BGP doivent être directement connectés (liaison
point à point ou LAN partagé).
C'est la conséquence logique de la frontière administrative qui les sépare et qui empêche que le
routage à travers un réseau de routeurs puisse être assuré par un IGP.
Exceptionnellement, des routeurs de bord peuvent ne pas être en vis-à-vis (ex. le routeur où arrive
le lien externe à l’AS ne connaît pas le protocole BGP).
L’utilisation de numéros d’AS privés est à éviter pour des AS terminaux (clients) car une
connexion à un deuxième AS de transit (FAI) peut conduire à une configuration illégale.
Les numéros d’AS officiels sont attribués par les mêmes organismes qui sont en charge de
distribuer les réseaux IP :
- RIPE-NCC : zone Europe
- APNIC : zone Asie et Pacifique
- ARIN : zone Amérique du Nord
- AFRINIC : zone Afrique
- LACNIC : zone Amérique Latine et îles Caraïbes
C ’est le même numéro d’AS qui est utilisé pour les échanges de préfixes IPv4 et IPv6 (car BGP
est multi-protocole)..7
LE ROUTAGE BGP4(+) / septembre 2006 7/56 V2.0
Exemple de connexion BGP (2)
R3
AS 300
R2
AS 200
BGP
BGP
R Client connecté à deux fournisseurs :
AS 100
R1
Client
FAI 1
FAI 2
R1 à deux voisins : R2 et R3
L’AS client peut choisir de faire passer tout son trafic par FAI1 (AS 200) et garder sa liaison vers
FAI2 (AS 300) en secours, ou équilibrer son trafic entre FAI1 et FAI2. C’est le cas typique qui
amène à utiliser le protocole de routage BGP pour réagir dynamiquement en cas de défaillance
d’un lien.
Dans le cas précédent, le seul intérêt d ’avoir un protocole de routage dynamique (par rapport à
une simple route par défaut) est de pouvoir avoir une alerte (en provenance de la session BGP) en
cas de défaillance du FAI.8
LE ROUTAGE BGP4(+) / septembre 2006 8/56 V2.0
Exemple de connexion BGP (3)
R3
AS 300
R2
AS 200
R4
AS 100
R1
R Client connecté à 2 fournisseurs par 2 routeurs différents :
E-BGP
E-BGP
I-BGP
FAI 2
FAI 1
BGP Externe
BGP Interne
Client
Ce schéma correspond au cas classique d'un client qui se connecte à deux fournisseurs pour
s'assurer une protection contre la défaillance de l'un d'entre eux ou de l’un de ses routeurs de bord
R1 ou R4.
On notera la présence d’une connexion BGP entre les routeurs de bord de l’AS 100. Cette
connexion BGP «interne» (notée I-BGP) est nécessaire pour maintenir la cohérence entre ces 2
routeurs qui doivent posséder les mêmes informations de routage (se souvenir qu’en BGP la
granularité du routage est l’AS).
L’un des principaux intérêts de l’I-BGP est de permettre la redondance des routeurs de bord d’un
AS.9
LE ROUTAGE BGP4(+) / septembre 2006 9/56 V2.0
Exemple de connexion BGP (4)
R3
AS 300
R2
AS 200
R Client connecté à 3 fournisseurs avec redondance sur l’un :
E-BGP
E-BGP
FAI2
FAI1
BGP Externe
BGP Interne
R7
AS 400
R8
E-BGP
E-BGP
R4
AS 100
R1
I-BGP
R6
R5
FAI3
Client
Noter le maillage complet de sessions I-BGP entre R1, R4, R6, R5 dans l’AS 100. Pour les autres
AS, les 4 routeurs de bord de l’AS 100 sont vus, du point de vue fonctionnel comme un seul
routeur (avec 4 interfaces).
Cet exemple montre aussi une des limitations d'avoir à faire un maillage complet de sessions IBGP
entre les routeurs de bord d'un même AS (nombre de sessions = N*(N+1)/2). On verra à la
fin de l'exposé qu’il existe des solutions (réflecteurs de routes) qui permettent de diminuer le
nombre de sessions I-BGP.
Sauf mention explicite, tout ce qui est exposé dans la suite concerne les sessions BGP externes.
Dans le cas de deux AS multiplement connectés comme AS400 et AS100 et si l’ensemble des
routeurs de bord des deux AS partagent un même LAN, les routeurs de bord ne sont pas
forcément des annonceurs BGP, et vice-versa.10
LE ROUTAGE BGP4(+) / septembre 2006 10/56 V2.0
Règles pour les AS multi-connectés
R Les routeurs de bord d’un même AS échangent leurs informations
de routage en I-BGP
R Les connexions en I-BGP forment un maillage complet sur les
routeurs de bord d’un AS
R Ce sont les IGP internes à l’AS qui assurent et maintiennent la
connectivité entre les routeurs de bord qui échangent des
informations de routage en I-BGP
R Le numéro d’AS est un numéro officiel (si connexions vers 2 AS
différents)
Attention, dans un même AS, c'est bien l'IGP (ou le routage statique) qui est responsable de la
connectivité interne de l'AS. Si un routeur de bord ne peut pas atteindre une route de son AS (qui
lui a été annoncée par un voisin interne par exemple), il ne la propagera pas à ses voisins BGP
(externes ou internes).11
LE ROUTAGE BGP4(+) / septembre 2006 11/56 V2.0
Les composants d’un annonceur BGP
R Une description des politiques de routage (entrée et sortie)
R Des tables où sont stockées les informations de routage
R En entrée : Adj-RIB-in (informations reçues et non traitées)
R En sortie : Adj-RIB-out (informations à annoncer)
R En interne : Loc-RIB (informations locales au routeur)
R Un automate implémentant le processus de décision
R Des sessions avec ses voisins pour échanger les informations de
routage
L’expression ‘routeur BGP’ est très souvent utilisée à la place de ‘annonceur BGP’ car il est peu
fréquent qu’un annonceur ne soit pas aussi un routeur. Le cas pouvant cependant se produire (ex.
serveurs de routes), le standard (RFC4271) utilise systématiquement l’expression ‘annonceur
BGP’.
Concernant les 3 tables où sont stockées les informations de routage, le standard ne spécifie pas
qu'elles doivent être physiquement séparées, ce qui impliquerait un gaspillage de mémoire qui est
une ressource critique sur les routeurs qui doivent connaître toutes les routes de l'Internet (environ
180 000 en septembre 2006).
La spécification de l’expression de la politique de routage dans BGP n'est pas standardisée, elle
dépend donc des implémentations du protocole. Une telle standardisation n’est suggérée que dans
RFC1786 (status Informational) pour les bases des organismes d’allocation (RIPE-NCC, ARIN,
APNIC, LACNIC, AFRINIC).12
LE ROUTAGE BGP4(+) / septembre 2006 12/56 V2.0
Schéma fonctionnel du processus BGP
Politique de
filtrage d‘annonces en entrée
Politique de
filtrage d‘annonces sortie
Adj-RIB-in Loc-RIB Adj-RIB-out
Annonceur BGP
Annonces reçues Annonces émises
Table de
routage locale
Configuration
locale routeur (+IGP)
Processus de décision
Noter la flèche à double sens entre la table Loc-RIB et le processus de décision en bas du schéma.
En effet, si c'est bien la table Loc-RIB qui permet au final de bâtir la table de routage, elle reçoit
aussi des informations sur les routes locales de l'AS à travers des directives du fichier de
configuration (annonces statiques ou redistribution des routes apprises par l'IGP dans BGP).
Ce schéma ne concerne que les annonces reçues et faites en E-BGP. En I-BGP, le schéma est plus
simple (voir fin d’exposé).
Quand l’annonceur BGP est aussi un routeur, sa table de routage locale est construite à partir des
informations de routage produites par le processus BGP, les autres protocoles de routage, et sa
configuration. S’il existe plusieurs routes vers le même réseau, une métrique nouvelle est
introduite (la ‘distance administrative’ dans l’implémentation de Cisco) pour régler le choix de la
route à installer dans la table de routage.13
LE ROUTAGE BGP4(+) / septembre 2006 13/56 V2.0
La vie du processus BGP
R Automate à 6 états, qui réagit sur 13 événements
R Il interagit avec les autres processus BGP par échange de 4 types de
messages :
R OPEN
R KEEPALIVE
R NOTIFICATION
R UPDATE
R Taille des messages de 19 à 4096 octets
R Éventuellement sécurisés par MD5
Les messages étant de longueur variable, ils sont marqués dans le flot d'octets du canal TCP par
une séquence spéciale de trois octets qui repère leur début.14
LE ROUTAGE BGP4(+) / septembre 2006 14/56 V2.0
Le message OPEN
R 1er message envoyé après l’ouverture de la session TCP
R Informe son voisin de :
R Sa version de BGP
R Son numéro d’AS
R D’un numéro identifiant le processus BGP
R Propose une valeur de temps de maintien de la session
R Valeur suggérée : 90 secondes
R Si 0 : maintien sans limite de durée
R Met le processus en attente d’un KEEPALIVE
En cas de démarrage simultané de deux sessions BGP par deux voisins, il faut choisir de ne
conserver que l'une des deux connexions. Pour cela on ne conserve que celle ouverte par le
processus de numéro identifiant le plus petit. Pour déterminer ce numéro identifiant, les
implémentations de Cisco et Zebra choisissent par défaut le plus petit numéro IP de interfaces
connues.15
LE ROUTAGE BGP4(+) / septembre 2006 15/56 V2.0
Le message KEEPALIVE
R Confirme un OPEN
R Réarme le minuteur contrôlant le temps de maintien de la session
R Si temps de maintien non égal à 0
R Est ré-émis toutes les 30 secondes (suggéré)
R Message de taille minimum (19 octets)
En cas d'absence de modification de leur table de routage, les routeurs ne s'échangent plus que des
messages KEEPALIVE toutes les 30 secondes, ce qui génère un trafic limité à environ 5bits/s au
niveau BGP.
L'implémentation BGP de Cisco porte par défaut à 60 secondes l'intervalle entre 2 messages
KEEPALIVE, celle de Zebra à 30 secondes.16
LE ROUTAGE BGP4(+) / septembre 2006 16/56 V2.0
Le message NOTIFICATION
R Ferme la session BGP
R Fournit un code et un sous code renseignants sur l’erreur
R Ferme aussi la session TCP
R Annule toutes les routes apprises par BGP
R Émis sur incidents :
R Pas de KEEPALIVE pendant 90s ()
R Message incorrect
R Problème dans le processus BGP
R ….
Le message NOTIFICATION est envoyé au moindre incident lors du déroulement du processus
BGP. Le fait de supprimer lors de son arrivée toutes les routes apprises par BGP peut provoquer
des instabilités de routage injustifiées (un incident ne veut pas forcément dire que toutes les routes
apprises précédemment sont devenues fausses).
Dans son implémentation de BGP, Cisco donne la possibilité de supprimer cette fonctionnalité,
en conservant telle quelle la table de routage en cas de réception d’un message NOTIFICATION.17
LE ROUTAGE BGP4(+) / septembre 2006 17/56 V2.0
Le message UPDATE
R Sert à échanger les informations de routage
R Routes à éliminer (éventuellement)
R Ensemble des attributs de la route
R Ensemble des réseaux accessibles (NLRI)
R Chaque réseau est défini par (préfixe, longueur)
R Envoyé uniquement si changement
R Active le processus BGP
R Modification des RIB f(Update, politique de routage, conf.)
R Émission d’un message UPDATE vers les autres voisins
C'est le message principal du protocole.
Lors du paramétrage d'un processus BGP il faut aussi faire un choix entre synchroniser ou pas les
annonces de l'IGP et les annonces BGP.18
LE ROUTAGE BGP4(+) / septembre 2006 18/56 V2.0
Le processus BGP
R L’automate à états finis du processus BGP (simplifié au chemin
principal, sans la gestion des incidents)
LIBRE EN
CONNEXION OPEN ENVOYÉ Session TCP ouverte
Envoi OPEN
Envoi KEEPALIVE
Démarrage BGP
Ouverture session
TCP
Réception OPEN
Traitement,
envoi UPDATE SESSION ÉTABLIE OPEN CONFIRMÉ Réception KEEPALIVE
Fin initialisation
Réception UPDATE
Réception
KEEPALIVE
Réception NOTIFICATION,
problème dans UPDATE, etc..
Fermeture session TCP
L’état supplémentaire non figuré (ACTIF) sur le schéma se rapporte à la phase d'initialisation de
la session BGP et concerne la gestion des incidents au niveau TCP pendant cette phase.
La liste complète des événements pouvant arriver est la suivante :
1 : Démarrage BGP
2 : Fin BGP
3 : Session TCP ouverte
4 : Session TCP fermée
5 : Ouverture session TCP échouée
6 : Erreur fatale dans session TCP
7 : Minuteur ConnectRetry expiré
8 : Minuteur Hold Time expiré
9 : Minuteur KeepAlive expiré
10 : Réception d’un message OPEN
11 : Réception d’un message KEEPALIVE
12 : Réception d’un message UPDATE
13 : Réception d’un message NOTIFICATION19
LE ROUTAGE BGP4(+) / septembre 2006 19/56 V2.0
Le message UPDATE : attributs de la route
R Classés en 4 catégories :
R Reconnus, obligatoires
R ORIGIN, AS_PATH, NEXT_HOP
R Reconnus, non-obligatoires
R LOCAL_PREF, ATOMIC_AGGREGATE
R Optionnels, annonçables (transitifs ou non)
R MULTI_EXIT_DISC (MED), AGGREGATOR
R Optionnels, non-annonçables
R WEIGHT (spécifique à Cisco)
Tout ces attributs de route concernent le cas principal qui est l’E-BGP. Un seul est spécifique de
l’I-BGP, c’est le LOCAL_PREF qui n’est annoncé qu’à l'intérieur de l'AS dans les sessions IBGP.
Pour un attribut de route, le fait d’appartenir à la catégorie «reconnu» impose au processus BGP
de savoir le traiter s’il est présent dans une annonce.
Inversement, s’il appartient à la catégorie «optionnel» un processus BGP n’est pas dans
l’obligation de savoir le prendre en compte pour le traiter.
Le caractère «transitif» d’un attribut lui donne une portée illimitée.
Le caractère «non-transitif» d’un attribut limite sa portée à l’AS (ex. LOCAL_PREF) ou à l’AS
voisin (ex. MED).20
LE ROUTAGE BGP4(+) / septembre 2006 20/56 V2.0
Les attributs de route obligatoires (1)
R ORIGIN
R Donne l’origine de la route, peut prendre 3 valeurs :
R IGP : la route est intérieure à l’AS d’origine
R EGP : la route a été apprise par le protocole EGP
R Incomplète : l’origine de la route est inconnue ou apprise par
un autre moyen (redistribution des routes statiques ou
connectées dans BGP par exemple)
On ne voit dans la pratique que les valeurs "IGP" ou "Incomplete" qui sont positionnées. (même
sur des routeurs de points d'échange qui connaissent environ 130 000 routes), le protocole EGP
n’étant plus utilisé.
Dans les implémentations de Cisco ou de Zebra, les valeurs «IGP», «EGP» ou «incomplete», sont
respectivement représentées par les lettres «i», «e» ou «?» dans les représentations des tables
d’informations de routage.
Exemple (Cisco ou Zebra) :
cs7206>sh ip bgp
BGP table version is 28403, local router ID is 194.199.17.59
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 129.88.0.0 193.54.188.1 19 0 64515 i
*> 129.88.1.250/32 193.54.188.1 19 0 64515 ?
*> 129.88.1.254/32 193.54.188.1 11 0 64515 ?
*> 129.88.3.0/24 193.54.188.1 18 0 64515 ?
*> 129.88.100.0/24 194.199.17.35 0 32768 i
*> 129.88.103.0/24 193.54.188.1 20 0 64515 ?
*> 129.88.253.0/24 193.54.188.1 20 0 64515 ?
*> 132.168.0.0 193.54.188.5 0 0 2063 i21
LE ROUTAGE BGP4(+) / septembre 2006 21/56 V2.0
Les attributs de route obligatoires (2)
R AS_PATH
R Donne la route sous forme d’une liste de segments d’AS
R Les segments sont ordonnés ou non (AS_SET)
R Chaque routeur rajoute son numéro d’AS aux AS_PATH des
routes qu’il a apprises avant de les ré-annoncer
R NEXT_HOP
R Donne l’adresse IP du prochain routeur qui devrait être utilisé
(peut éviter un rebond si plusieurs routeurs BGP sont sur un
même réseau local)
Les segments d’AS non ordonnés sont formés par un routeur qui a fait une opération d'agrégation.
Ce dernier regroupe dans cet ensemble non ordonné tous les AS associés aux routes qu'il a
agrégées. Cela permet aux autres routeurs de continuer à détecter d'éventuelles boucles
concernant ces routes.
Dans l’implémentation de Cisco, les segments d’AS dans un AS_PATH sont encadrés par des
accolades {}.22
LE ROUTAGE BGP4(+) / septembre 2006 22/56 V2.0
Exemple 1 : tables Adj-RIB-in
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
2001:660:114:9:1::1
2001:660:114:9:1::2
NLRI
2001:660:114:0:2::/64
ORIGIN
i
AS_PATH
200
NEXT_HOP
2001:660:114:9:1::2
NLRI
2001:660:114:0:1::/64
ORIGIN
i
AS_PATH
100
NEXT_HOP
2001:660:114:9:1::123
LE ROUTAGE BGP4(+) / septembre 2006 23/56 V2.0
Exemple 1 : configuration sur ZEBRA(*)
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
2001:660:114:9:1::1
2001:660:114:9:1::2 router bgp 200
bgp router-id 0.0.0.200
neighbor 2001:660:114:9:1::1 remote-as 100
address-family ipv6 unicast
neighbor 2001:660:114:9:1::1 activate
network 2001:660:114:0:2::/64
exit-address-family
router bgp 100
bgp router-id 0.0.0.100
neighbor 2001:660:114:9:1::2 remote-as 200
address-family ipv6 unicast
neighbor 2001:660:114:9:1::2 activate
network 2001:660:114:0:1::/64
exit-address-family
(*) version 0.96a
Noter que l'annonce des réseaux internes de l'AS se fait par une directive "network" qui
positionne aussi l'attribut ORIGIN à la valeur "IGP" (cf. planche précédente).
Attention, cette directive n’a pas du tout le même sens qu’avec certains IGP (ex. OSPF), de plus
les implémentations de Cisco et Zebra diffèrent sensiblement quand à l’effet d’une directive
"network" :
Pour Cisco, cette directive ne fait que positionner l’attribut ORIGIN à IGP, mais ne force pas
l’annonce de la route concernant ce réseau en BGP. Cette annonce est conditionnée au fait que le
routeur sache bien router ce réseau. Ce comportement est normal pour un routeur, mais une
instabilité de l’IGP interne à l’AS se propage hors de l’AS et peut s’avérer pénalisant).
Pour Zebra, cette directive positionne l’attribut ORIGIN à IGP, et provoque l’annonce de la route
concernant ce réseau en BGP. Ce comportement évite les instabilité d’annonces de route, mais
peut provoquer un trafic inutile sur le lien inter-AS.
Noter aussi que la première directive neighbor (ex neighbor 2001:660:114:9:1::2
remote-as 200) identifie le voisin et le protocole IP de transport (IPv6 dans cet exemple). La
deuxième directive neighbor (ex neighbor 2001:660:114:9:1::2 activate) qui est
positionnée dans la séquence spécifique au protocole IPv6 (ex address-family ipv6
unicast) active spécifiquement des échanges d’informations de routage concernant le protocole
IPv6.24
LE ROUTAGE BGP4(+) / septembre 2006 24/56 V2.0
Exemple 2 : tables Adj-RIB-in
AS 300
R3
2001:660:114:0:3::/64
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
AS_PATH
100
100, 300
NLRI
2001:660:114:0:1::/64
2001:660:114:0:3::/64
ORIGIN
i
i
NEXT_HOP
2001:660:114:9:1::1
2001:660:114:9:1::1
2001:660:114:9:1::1
2001:660:114:9:1::2
2001:660:114:9:2::1 2001:660:114:9:2::3
AS_PATH
200
300
NLRI
2001:660:114:0:2::/64
2001:660:114:0:3::/64
ORIGIN
i
i
NEXT_HOP
2001:660:114:9:1::2
2001:660:114:9:2::325
LE ROUTAGE BGP4(+) / septembre 2006 25/56 V2.0
Exemple 2 : configuration sur ZEBRA(*)
AS 300
R3
2001:660:114:0:3::/64
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
2001:660:114:9:1::1
2001:660:114:9:1::2
2001:660:114:9:2::1 2001:660:114:9:2::3
router bgp 100
bgp router-id 0.0.0.100
neighbor 2001:660:114:9:1::2 remote-as 200
neighbor 2001:660:114:9:2::3 remote-as 300
address-family ipv6 unicast
neighbor 2001:660:114:9:1::2 activate
neighbor 2001:660:114:9:2::3 activate
network 2001:660:114:0:1::/64
exit-address-family
(*) version 0.96a
La configuration de R3 est symétrique de celle de R2.
L’AS 100 qui sert d’AS de transit pour les AS 200 et 300 doit synchroniser les annonces entre
BGP et l’IGP interne à l’AS. Sinon un effet de «trou noir» peut se produire.26
LE ROUTAGE BGP4(+) / septembre 2006 26/56 V2.0
2001:660:114:9:3::2
2001:660:114:9:3::3
Exemple 3 : tables Adj-RIB-in
AS 300
R3
2001:660:114:0:3::/64
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
AS_PATH
100
100, 300
300
300, 100
NLRI
2001:660:114:0:1::/64
2001:660:114:0:3::/64
2001:660:114:0:3::/64
2001:660:114:0:1::/64
ORIGIN
i
i
i
i
NEXT_HOP
2001:660:114:9:1::1
2001:660:114:9:1::1
2001:660:114:9:3::3
2001:660:114:9:3::3
2001:660:114:9:1::1
2001:660:114:9:1::2
2001:660:114:9:2::1 2001:660:114:9:2::3
AS_PATH
200
300
200, 300
300, 200
NLRI
2001:660:114:0:2::/64
2001:660:114:0:3::/64
2001:660:114:0:3::/64
2001:660:114:0:2::/64
ORIGIN
i
i
i
i
NEXT_HOP
2001:660:114:9:1::2
2001:660:114:9:2::3
2001:660:114:9:1::2
2001:660:114:9:2::3
Noter la présence de plusieurs routes pour le même réseau dans les tables des routeurs R1, R2 (et
R3 par symétrie).27
LE ROUTAGE BGP4(+) / septembre 2006 27/56 V2.0
Exemple 3 : configuration sur ZEBRA(*)
AS 300
R3
2001:660:114:0:3::/64
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
2001:660:114:9:1::1
2001:660:114:9:1::2
2001:660:114:9:2::1 2001:660:114:9:2::3
router bgp 200
bgp router-id 0.0.0.200
neighbor 2001:660:114:9:1::1 remote-as 100
neighbor 2001:660:114:9:3::3 remote-as 300
address-family ipv6 unicast
neighbor 2001:660:114:9:1::1 activate
neighbor 2001:660:114:9:3::3 activate
network 2001:660:114:0:2::/64
exit-address-family
2001:660:114:9:3::2
2001:660:114:9:3::3
(*) version 0.96a28
LE ROUTAGE BGP4(+) / septembre 2006 28/56 V2.0
Les attributs de route optionnels (1)
R LOCAL_PREF (non transitif, discretionary)
R Pondère la priorité donnée aux routes en interne à l’AS
R Jamais annoncé en E-BGP
R ATOMIC_AGGREGATE (transitif, discretionary)
R Indicateur d’agrégation
R Quand des routes plus précises ne sont pas annoncées
R AGGREGATOR (transitif)
R Donne l’AS qui a formé la route agrégée
R L'adresse IP du routeur qui a fait l’agrégation
L’attribut LOCAL_PREF est un puissant outil d’expression de la politique de routage à l’intérieur
d’un AS car il est pris en compte avant la longueur de l’AS_PATH dans le choix entres des routes
concurrentes.
Noter le caractère non-transitif de l’attribut de route LOCAL_PREF qui n’est donc pas transmis
hors de l’AS.29
LE ROUTAGE BGP4(+) / septembre 2006 29/56 V2.0
Les attributs de route optionnels (2)
R MULTI_EXT_DISC ou MED (non transitif)
R Permet de discriminer les différents points de connexion d’un
AS multi-connecté (plus faible valeur préférée)
R WEIGHT (non transitif, spécifique Cisco)
R Pondère localement (au routeur) la priorité des routes BGP
R COMMUNITY (transitif)
R Pour un ensemble de routeurs ayant une même propriété
RTrois valeurs reconnues
R no-export : pas annoncé aux voisins de la confédération
R no-advertise : pas annoncé aux voisins BGP
R no-export-subconfed : pas annoncé en E-BGP
Dans la version 3 de BGP, l’attribut MED était appelé Inter-AS_Metric, l’implémentation Cisco
de BGP-4 a gardé le terme de Metric pour certaines commandes manipulant le MED. Cette
implémentation permet aussi de comparer des MED d’AS différents (bgp always-compare-med
sur IOS Cisco).
On pourra aussi consulter le RFC4451 ‘BGP MULTI_EXT_DISC (MED) Considerations’ sur
l’usage et la pratique de l’attribut MED.
Pour l’attribut COMMUNITY, le standard (RFC1997) recommande de coder le numéro d’AS
dans les deux premiers octets, les 2 suivants étant laissés à disposition des administrateurs de
l’AS. Une communauté de routeurs peut s’étendre sur plusieurs AS. L’implémentation de Cisco
connaît une valeur prédéfinie égale à «internet».
L’attribut WEIGHT peut varier de 0 à 32768, les plus grandes valeurs sont préférées. Par défaut,
il prend les valeurs suivantes :
- 32768 si la route est initiée par le routeur
- 0 pour les autres routes30
LE ROUTAGE BGP4(+) / septembre 2006 30/56 V2.0
La portée de quelques attributs de route
R1
AS 100
AS 300
R3
AS 200
R2
ORIGIN
(AS_PATH)
NEXT_HOP
LOCAL_PREF
MULTI_EXT_DISC
WEIGHT
ORIGIN
(100, AS_PATH)
NEXT_HOP{R1}
MULTI_EXT_DISC
ORIGIN
(200, 100, AS_PATH)
NEXT_HOP {R2}
ORIGIN
(AS_PATH)
NEXT_HOP
LOCAL_PREF
R1’
L'attribut MED n'est pas annoncé dans l'AS du routeur de bord R1 mais à son voisin extérieur (qui
ne le propage pas).
L'attribut LOCAL_PREF n'est annoncé que dans l'AS du routeur de bord.
L'attribut NEXT_HOP est modifié par chaque traversée d’AS.
L'attribut AS_PATH est préfixé du numéro d’AS à chaque traversée d’AS.
L'attribut ORIGIN n’est jamais modifié.31
LE ROUTAGE BGP4(+) / septembre 2006 31/56 V2.0
Le processus de décision (1)
R Il est enclenché par une annonce de route
R Il se déroule en trois phases
R Calcul du degré de préférence de chaque route apprise
R Choix des meilleures routes à installer dans RIB-Loc
R Choix des routes qui vont être annoncées
R Il applique aux informations de routage un traitement basé sur
RCritères techniques : suppression boucles, optimisations, …
RCritères administratifs : application de la politique de routage de
l’AS.
Pour être prise en compte une annonce de route doit avoir son NEXT_HOP routable.
Une route interne n’est annoncée par un routeur que s’il sait la joindre.
Une route externe n’est annoncée par un routeur que s’il sait joindre le NEXT_HOP.
Une route dont l’attribut NEXT_HOP est l’adresse IP du voisin n’est pas annoncée à ce voisin
(qui la connaît déjà !).32
LE ROUTAGE BGP4(+) / septembre 2006 32/56 V2.0
Le processus de décision (2)
R Critères de choix entre 2 routes (priorités décroissantes) :
RWEIGHT (propriétaire Cisco, plus grand préféré)
RLOCAL_PREF le plus grand
RRoute initiée par le processus BGP local
RAS_PATH minimum
RORIGIN minimum (IGP -> EGP -> Incomplete)
RMULTI_EXT_DISC minimum
RRoute externe préférée à une route interne (à l’AS)
RRoute vers le plus proche voisin local (au sens de l’IGP)
RRoute vers le routeur BGP de plus petite adresse IP
L’installation d’une route dans la table de routage doit prendre en compte le fait qu’une route peut
être apprise par plusieurs protocoles de routage différents. L’implémentation de Cisco utilise la
notion de distance administrative pour cela. Le choix entre 2 routes se fait en prenant celle qui a la
distance administrative la plus faible. Les valeurs par défaut des distances administratives
associées aux origines des routes sont :
Route directement connectée 0
Route statique 1
Route apprise en E-BGP 20
Route apprise en EIGRP (interne) 90
Route apprise en IGRP 100
Route apprise en OSPF 110
Route apprise en ISIS 115
Route apprise en RIP 120
Route apprise en EGP 140
Route apprise en EIGRP (externe) 170
Route apprise en I-BGP 200
Route apprise en BGP (local) 200
Route d’origine inconnue 25533
LE ROUTAGE BGP4(+) / septembre 2006 33/56 V2.0
Différences entre E-BGP et I-BGP
R Une annonce reçue en I-BGP n’est pas ré-annoncée en I-BGP
R L’attribut LOCAL_PREF n’est annoncé qu’en I-BGP
R Seuls les voisins E-BGP doivent être directement connectés
R Les annonces I-BGP ne modifient pas l’AS_PATH
R Les annonces I-BGP ne modifient pas le NEXT_HOP
R Le MED n’est pas annoncé en I-BGP
Le traitement différent appliqué aux attributs de route suivant que le voisin BGP est externe ou interne est
résumé dans le tableau suivant :
ATTRIBUT E-BGP I-BGP
-----------------------------------------------------------------------------------------------------------------
AS_PATH =(local AS+AS_PATH) non modifié si reçu en E-BGP
NEXT_HOP =@IP annonceur non modifié
MED =métrique non annoncé
LOCAL_PREF pas annoncé annoncé
ATOMIC_AGGREGATE
AGGREGATOR
Certains minuteurs (vus plus loin) sont aussi traités différemment :
MINUTEUR E-BGP I-BGP
------------------------------------------------------------------------------------------------------------------
MinRouteAdvertisement pris en compte pas pris en compte (pour accélérer
la convergence dans l’AS)34
LE ROUTAGE BGP4(+) / septembre 2006 34/56 V2.0
L’annonce des routes internes d’un AS
R Statique
R Pas d’instabilité de routage, mais trous noirs possibles
R Exemples en IOS
R redistribute [static|connected] -> ORIGIN: Incomplete
R network -> ORIGIN: IGP
R Dynamique
R Suit au mieux l’état du réseau, nécessite du filtrage
R Exemples en IOS
R redistribute -> ORIGIN: IGP
La redistribution de routes apprises dynamiquement est difficile à contrôler. Il est nécessaire de
faire attention à ne pas faire boucler la redistribution de routes entre l’IGP et BGP (notamment la
route par défaut !).
L’annonce statique est à préférer à priori pour annoncer les routes internes de l’AS par BGP.35
LE ROUTAGE BGP4(+) / septembre 2006 35/56 V2.0
La politique de routage
R Elle peut influencer :
R Le traitement des routes reçues
R Le traitement des routes annoncées
R L'interaction avec les IGP de l’AS
R En pratique elle s’exprime par :
R Du filtrage de réseaux
R Du filtrage de routes (AS_PATH)
R De la manipulation d’attributs de routes36
LE ROUTAGE BGP4(+) / septembre 2006 36/56 V2.0
Politique de routage :
exemple de filtrage de réseaux sur ZEBRA
R Filtrage des réseaux annoncés : AS100 ne veut pas servir d’AS de
transit pour le réseau 2001:660:114:0:3::/64 de l’AS300
AS 300
R3
2001:660:114:0:3::/64
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
2001:660:114:9:1::1
2001:660:114:9:1::2
2001:660:114:9:2::1 2001:660:114:9:2::3
router bgp 100
bgp router-id 0.0.0.100
neighbor 2001:660:114:9:1::2 remote-as 200
[…..]
neighbor 2001:660:114:9:1::2 distribute-list 1 out
access-list 1 deny 2001:660:114:0:3::/64 le 128
access-list 1 permit ::/0 le 128
Le filtrage BGP s’appuie sur le même mécanisme des access-list qui est utilisé pour le filtrage des
paquets IP. L’application de l’access-list à une session BGP (au lieu d’une interface dans le cas de
filtrage de paquets IP) permet d’éliminer certains réseaux d’une annonce reçue (paramètre ‘in’)
ou faite (paramètre ‘out’).
Dans le cas ci-dessus, l’access-list est à appliquer à toutes les autres sessions BGP que pourrait
avoir le routeur R1.37
LE ROUTAGE BGP4(+) / septembre 2006 37/56 V2.0
Politique de routage :
exemple de filtrage de réseaux sur ZEBRA
R Filtrage des réseaux annoncés : AS100 ne veut pas servir d’AS de
transit pour le réseau 2001:660:114:0:3::/64 de l’AS300 (variante)
AS 300
R3
2001:660:114:0:3::/64
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
2001:660:114:9:1::1
2001:660:114:9:1::2
2001:660:114:9:2::1 2001:660:114:9:2::3
router bgp 100
bgp router-id 0.0.0.100
neighbor 2001:660:114:9:2::3 remote-as 300
[…..]
neighbor 2001:660:114:9:2::3 distribute-list 1 in
access-list 1 deny 2001:660:114:0:3::/64 le 128
access-list 1 permit ::/0 le 128
Dans cette variante, l’élimination de l’annonce du réseau 2001:660:114:0:3::/64/24 empêche bien
le transit car ce réseau ne sera pas réannoncé, mais en plus, l’AS 100 ne sera pas capable de router
ce réseau.38
LE ROUTAGE BGP4(+) / septembre 2006 38/56 V2.0
Politique de routage :
exemple de filtrage de routes sur ZEBRA
R Filtrage des AS_PATH annoncés : AS100 ne veut pas servir d’AS
de transit pour tous les réseaux internes d’AS300
AS 300
R3
2001:660:114:0:3::/64
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
2001:660:114:9:1::1
2001:660:114:9:1::2
2001:660:114:9:2::1 2001:660:114:9:2::3
router bgp 100
bgp router-id 0.0.0.100
neighbor 2001:660:114:9:1::2 remote-as 200
[….]
neighbor 2001:660:114:9:1::2 filter-list 1 out
ip as-path access-list 1 deny ^300$
ip as-path access-list 1 permit .*
Les AS_PATH étant des chaînes de caractères, l’identification et la localisation d’un AS ou d’un
ensemble d’AS se fait par des expressions régulières, en utilisant le sous ensemble suivant de
caractères spéciaux :
Caractère Symbole Signification
---------------------------------------------------------------------------------------------------
Point . Représente n’importe quel caractère
Astérisque * Représente 0 ou N fois le caractère précédent
Plus + Représente 1 ou N fois le caractère précédent
Interrogation ? Représente 0 ou 1 fois le caractère précédent
Circonflexe ^ Représente le début de la chaîne de caractères
Dollar $ Représente la fin de la chaîne de caractères
Souligné _ Représente l’un des 5 caractères servant à délimiter
les N° d ’AS soit: ,{}() le début ou fin de chaîne
Crochet ouvrant [ Début d’un intervalle
Crochet fermant ] Fin d’un intervalle
Tiret - Sépare les 2 caractères définissant l’intervalle
Les 3 derniers caractères spéciaux s’utilisent conjointement, par exemple l’intervalle noté [1-6]
représente un chiffre compris entre 1 et 6 inclus.39
LE ROUTAGE BGP4(+) / septembre 2006 39/56 V2.0
Politique de routage :
exemple de manipulation sur ZEBRA
R Filtrage par route map : AS100 veut privilégier la route par défaut
annoncée par AS300
AS 300
R3
2001:660:114:0:3::/64
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
2001:660:114:9:1::1
2001:660:114:9:1::2
2001:660:114:9:2::1 2001:660:114:9:2::3
router bgp 100
bgp router-id 0.0.0.100
neighbor 2001:660:114:9:2::3 remote-as 300
[…..]
neighbor 194.9.2.3 route MAP_300 in
neighbor 194.9.1.2 route MAP_200 in
Nota : confédération de routeurs dans AS10040
LE ROUTAGE BGP4(+) / septembre 2006 40/56 V2.0
Politique de routage :
exemple de manipulation sur ZEBRA (suite)
R Filtrage par route map : AS100 veut savoir router uniquement
2001:660:114:0:3::/64, mais sans servir d’AS de transit pour AS300
AS 300
R3
2001:660:114:0:3::/64
AS 200 R2
2001:660:114:0:2::/64
AS 100
R1
2001:660:114:0:1::/64
2001:660:114:9:1::1
2001:660:114:9:1::2
2001:660:114:9:2::1 2001:660:114:9:2::3
route map MAP_300 permit 10
match ip address 1
set LOCAL_PREF 150
route map MAP_300 permit 20
set LOCAL_PREF 100
access-list 1 permit 0.0.0.0 0.0.0.0
route map MAP_200 permit 10
match ip address 1
set LOCAL_PREF 100
route map MAP_200 permit 20
set LOCAL_PREF 15041
LE ROUTAGE BGP4(+) / septembre 2006 41/56 V2.0
Optimisations : stabilité du routage (1)
R Les routes instables sont pénalisées
RÀ chaque instabilité => X points de pénalité
RSi Pénalité > limite L1 => route supprimée
RSi Pénalité < limite L2 => route rétablie
RSi : pas de nouvelle pénalité pendant T1 => Pénalité/2
RSi Pénalité < limite L3 => on oublie tout
R Ne concerne que les annonces E-BGP42
LE ROUTAGE BGP4(+) / septembre 2006 42/56 V2.0
Optimisations : stabilité du routage (2)
R Allure du facteur de mérite associé à une route instable
Facteur de mérite (RFC2439)
0,000
0,500
1,000
1,500
2,000
2,500
3,000
3,500
4,000
4,500
5,000
0,00 0,40 0,80 1,20 1,60 2,00 2,40 2,80 3,20
Temps
Valeur
Fréquence 1/2
Fréquence 1/3
Fréquence 1/4
Fréquence 1/8
Dans l’implémentation IOS de Cisco, on a :
- Pénalité pour une instabilité (X) = 1000 points
- Limite de suppression d’une route (L1) = 2000 points
- Limite de réutilisation d’une route (L2) = 750 points
- Valeur d’oubli des informations de pénalisation (L3) = 350 points
- Demie vie de la pénalisation (T1) = 120 secondes
Cette technique de pénalisation des routes instables est justifiée et standardisée dans le RFC2439.43
LE ROUTAGE BGP4(+) / septembre 2006 43/56 V2.0
Optimisations : contrôle du trafic BGP
R On peut agir sur différents minuteurs
R MinRouteAdvertisementInterval
R MinASOriginationInterval
RLa gigue dans la fréquence des annonces
R On peut réduire le volume des informations annoncées
RNLRI agrégés
RAS_PATH condensés
MinRouteAdvertisementInterval est le temps minimum entre 2 annonces de routes vers des
voisins externes (uniquement).
MinASOriginationInterval est le temps minimum entre 2 annonces résultant d’une mise à jour des
routes internes de l’AS (en provenance de l’IGP par exemple).
Le facteur de gigue est un paramètre global au routeur. C’est un nombre aléatoire à valeur dans
l’intervalle [0,75-1] qui pondère l’ensemble des 5 minuteurs du processus BGP.
Rappel des valeurs (en secondes) des minuteurs d’un processus BGP :
Minuteur Valeur suggérée implémentation implémentation
par le RFC1771 Cisco Zebra ----------------------------------------------------------------------------------------------------
ConnectRetry 120
Hold Time 90 180 180
KeepAlive 30 60 60
MinRouteAdvertisementInterval 30 30 0
MinASOriginationInterval 1544
LE ROUTAGE BGP4(+) / septembre 2006 44/56 V2.0
Optimisation : sécurisation des échanges BGP
R Mesures natives au protocole
RSession BGP = {@IP1,numéro AS1},{@IP2,numéro AS2}
RSignature MD5 de chaque message
R Compléments : mesures standard au niveau TCP ou IP
RFiltrage du port 179
R MAIS : a toutes les vulnérabilités de TCP ou IP
RDéni de service45
LE ROUTAGE BGP4(+) / septembre 2006 45/56 V2.0
Optimisations : les réflecteurs de routes
R Permet d’éviter une croissance en N2 des sessions I-BGP
R Mais rajoute un point de panne singulier
R On met donc plusieurs réflecteurs de route par AS
R4
AS 100
R1
I-BGP
R6
R5
Schéma sans réflecteur de routes Schéma avec 2 réflecteurs de routes (R4 et R5)
R4
AS 100
R1
I-BGP
R6
R5
Introduit à titre expérimental en 1996 par le RFC1966, modifié en 2000 par le RFC2756,
actuellement défini comme standard par le RFC4456 (d’avril 2006).
Si l’on considère un AS avec N routeurs de bord, il aura un nombre de sessions I-BGP qui sera égal à
: N(N-1)/2 sans réflecteur de route. Si certains de ces routeurs de bord sont aussi réflecteurs de route,
le nombre de sessions I-BGP sera plus faible, mais pourra varier entre 2 valeurs suivant le niveau de
redondance que l’on souhaite (noter que tous les réflecteurs de route doivent être complètement
maillés en sessions I-BGP).
Ainsi le nombre de sessions I-BGP sera compris entre :
N-1 et 2N-3 avec 2 réflecteurs de route
N et 3(N-2) avec 3 réflecteurs de route
N-R + R(R-1)/2 et NR - R(R+1)/2 avec R réflecteurs de route
La fonction Fmin(N,R)=N-R + R(R-1)/2 a une valeur minimale pour R=3/2 quel que soit N. Les
valeurs entières de R qui la minimisent sont donc 1 et 2.
La fonction Fmax(N,R)=NR-R(R+1)/2 a une valeur maximale pour R=N-1/2 donc plus R est petit
plus la valeur de Fmax sera faible.
Du point de vue de la minimisation du nombre de sessions I-BGP, la valeur optimale de R est donc
égale à 2 quel que soit N, si l’on veut assurer une redondance des réflecteurs de route. Dans ce cas
on a 2N-3 sessions I-BGP.46
LE ROUTAGE BGP4(+) / septembre 2006 46/56 V2.0
Extensions : les confédérations d’AS
R Permet de réduire le nombre de sessions I-BGP
R En divisant l’AS en mini-AS (ou sous AS)
R Les routeurs de bord d’un mini-AS établissent des sessions
RI-BGP entre eux (maillage complet)
RE-BGP avec leurs voisins d’autres AS
RPseudo E-BGP avec leurs voisins d’autres minis-AS
R Vu de l’extérieur, la confédération d’AS apparaît comme un seul et
unique AS
Pour bien apparaître comme faisant partie d’un même AS vis-à-vis de l’extérieur, les routeurs de
bord de deux mini-AS différents échangent des sessions E-BGP (car leurs numéros d’AS sont
différents), mais ces sessions suivent les mêmes règles de modification des attributs de route que
les sessions I-BGP. Lors de ces sessions, les attributs NEXT_HOP, MED, et LOCAL_PREF ne
sont donc pas modifiés.
Les confédérations d’AS ont été introduites en 1996 à titre expérimental par le RFC1965, puis
standardisées en 2001 par le RFC3065.47
LE ROUTAGE BGP4(+) / septembre 2006 47/56 V2.0
Extensions : les groupements de routeurs
R Les routeurs BGP d’un groupement partagent la même politique de
routage (ex. routes maps, filtres d’annonces, …)
R Cette politique est définie sur l’un des routeurs du groupement
R Elle est propagée automatiquement sur les autres routeurs
R Un routeur du groupement peut modifier localement sa politique de
routage (mais ne la propage pas aux autres)48
LE ROUTAGE BGP4(+) / septembre 2006 48/56 V2.0
Extensions : les serveurs de route
R Sur un grand point d’échange on peut avoir :
R100 fournisseurs d’accès Internet
RPlus de 180 000 routes annoncées (en 2006)
R Ce qui pourrait impliquer :
RJusqu'à 10 000 sessions TCP !
R Solution : les serveurs de route
RRéduit le nombre de sessions (quelques unes par fournisseur
d’accès)
Introduit à titre expérimental en 1995 par le RFC1863, et classé en historique en 2005 par le
RFC4223.49
LE ROUTAGE BGP4(+) / septembre 2006 49/56 V2.0
Extensions : le routage multi-protocole (IPv6)
R Dans BGP, seuls 3 attributs de route de dépendent d’IPv4
RNLRI, NEXT_HOP, (AGGREGATOR)
R Pour rendre BGP multi-protocole, on introduit 2 attributs de route
supplémentaires
R MP_REACH_NLRI (optionnel, non-transitif)
R MP_UNREACH_NLRI (optionnel, non-transitif)
R L’attribut de route MP_REACH_NLRI contient des triplets
RAdress_family (ex. IPv4, IPv6, IPX), NEXT_HOP, NLRI
R Un message UPDATE contient MP_REACH_NLRI et les autres
attributs de route déjà vus (ORIGIN, LOCAL_PREF...)
Introduit comme standard par le RFC2858. Les seules modifications de configurations
correspondent aux format des adresses IPv6.
Exemple de configuration d’une session BGP en IPv6 sous Zebra :
router bgp 65400
bgp router-id 192.108.119.167
ipv6 bgp neighbor 2001:660:281:8::1 remote-as 1938
Exemple d’affichage des informations BGP en IPv6 sous Zebra :
bgpd# sh ipv6 bgp
BGP table version is 0, local router ID is 192.108.119.167
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Metric LocPrf Weight Path
*> ::194.182.135.0/120 0 1938 2200 1103 766 278 6435 i
2001:660:281:8::1(fe80::83fe:c80a)
*> 2001:200::/35 0 1938 2200 3425 2500 i
2001:660:281:8::1(fe80::83fe:c80a)
*> 2001:200:12a::/48 0 1938 2200 5511 3549 ?
2001:660:281:8::1(fe80::83fe:c80a)
[….]50
LE ROUTAGE BGP4(+) / septembre 2006 50/56 V2.0
Exemple de configuration BGP en IPv6 (Zebra)
router bgp 65400
bgp router-id 192.108.119.167
ipv6 bgp neighbor 2001:660:281:8::1 remote-as 1938
ipv6 bgp neighbor 2001:660:281:8::1 prefix-list filtre_nlri in
ipv6 bgp neighbor 2001:660:281:8::1 filter-list filtre_as in
!
ipv6 prefix-list filtre_nlri description Refus des annonces de son préfixe et du 2002::/16
ipv6 prefix-list filtre_nlri seq 5 deny 3ffe:305:1014::/48 le 128
ipv6 prefix-list filtre_nlri seq 10 deny 2002::/16 le 128
ipv6 prefix-list filtre_nlri seq 15 permit any
!
ip as-path access-list filtre_as deny 1938 2200 5511 *
ip as-path access-list filtre_as permit .*
Résultat sous Zebra de la configuration ci-dessus (commande ‘sh ipv6 bgp neighbors’)
BGP neighbor is 2001:660:281:8::1, remote AS 1938, external link
BGP version 4, remote router ID 131.254.200.10
BGP state = Established, up for 00:04:16
Last read 00:00:16, hold time is 180, keepalive interval is 60 seconds
Neighbor capabilities:
Route refresh: advertised and received(old and new)
[…..]
For address family: IPv6 Unicast
Community attribute sent to this neighbor
Inbound path policy configured
Incoming update prefix filter list is *filtre_nlri
Incoming update AS path filter list is *filtre_as
225 accepted prefixes
Connections established 1; dropped 0
Local host: 2001:660:281:8::2, Local port: 1190
Foreign host: 2001:660:281:8::1, Foreign port: 179
Nexthop: 192.108.119.167
Nexthop global: 2001:660:281:8::2
Nexthop local: ::
BGP connection: non shared network
Read thread: on Write thread: off51
LE ROUTAGE BGP4(+) / septembre 2006 51/56 V2.0
Extensions : le routage multicast (MBGP)
R Vu comme un cas particulier du routage multi-protocole
R Utilisation de la notion de sous famille d’adresse
R Implémentations récentes (IOS, ….)
Introduit comme standard par le RFC2858 en juin 2000.52
LE ROUTAGE BGP4(+) / septembre 2006 52/56 V2.0
Extensions : annonce de capacité
R Standardisé initialement en mai 2000 par le RFC2842 (statut PS)
R Standardisé définitivement en novembre 2002 par le RFC3392 (DS)
R Introduit un paramètre optionnel : capabilities
R Annonce les capacités fonctionnelles d’un routeur lors de l’OPEN
R Permet une mise à niveau automatique des fonctionnalités utilisées
dans cette session BGP
R Permettra des mises à niveau des implémentations de BGP non
synchrones
Exemple sous Ios/Cisco du résultat de la commande ‘sh ipv6 bgp neighbors’ :
BGP neighbor is 2001:660:281:1::1, remote AS 1938, external link
BGP version 4, remote router ID 131.254.200.10
BGP state = Established, up for 16:42:08
Last read 00:00:08, hold time is 180, keepalive interval is 60 seconds
Neighbor capabilities:
Route refresh: advertised and received
Address family IPv6 Unicast: advertised and received
Received 5601 messages, 0 notifications, 0 in queue
Sent 3785 messages, 0 notifications, 0 in queue
Route refresh request: received 0, sent 0
Minimum time between advertisement runs is 30 seconds
For address family: IPv6 Unicast
BGP table version 3272, neighbor version 3272
Index 1, Offset 0, Mask 0x2
264 accepted prefixes consume 16896 bytes
Prefix advertised 4, suppressed 0, withdrawn 053
LE ROUTAGE BGP4(+) / septembre 2006 53/56 V2.0
Bibliographie : principaux RFC sur BGP
R RFC1772 Application of the Border Gateway Protocol in the Internet. Y
Rekhter, P. Gross. 03/1995. (DS)
R RFC1773 Experience with the BGP-4 protocol. P. Traina. 03/1995. (INFO)
R RFC1774 BGP-4 Protocol Analysis. P. Traina, Editor. 03/1995. (INFO)
R RFC1997 BGP Communities Attribute. R. Chandra, P. Traina & T. Li. 06/1996.
(PS)
R RFC1998 An Application of the BGP Community Attribute in Multi-home Routing.
E. Chen & T. Bates. 06/1996. (INFO)
R RFC2042 Registering New BGP Attribute Types. B. Manning. 01/1997. (INFO)
R RFC2385 Protection of BGP Sessions via the TCP MD5 Signature Option. A.
Heffernan. 08/1998. (PS)
R RFC2439 BGP Route Flap Damping. C.Villamizar, R.Chandra, R.Govindan. 11/1998.
(PS)
R RFC2457 Definitions of Managed Objects for Extended Border Node. B. Clouston,
B. Moore. 11/1998. (PS)
R RFC2545 Use of BGP-4 Multiprotocol Extensions for IPv6 Inter-Domain Routing.
P. Marques, F. Dupont. 03/1999. (PS)
R RFC2858 Multiprotocol Extensions for BGP-4. T. Bates, Y. Rekhter, R. Chandra,
D. Katz. 06/2000. (PS)
Bref historique de l’évolution du protocole BGP (voir RFC1773)
BGP-1 : RFC1105, juin 1989
BGP-2 : RFC1163, juin 1990
La hiérarchisation des AS est supprimée (notion de liens inter-AS haut/bas/horizontaux),
introduction des attributs de routes, beaucoup de changements dans les formats des
messages.
BGP-3 : RFC1267, octobre 1991
Détection et gestion des collisions d’ouvertures de sessions BGP, introduction d ’un
identifiant de routeur, le NEXT_HOP peut être situé dans un autre AS que celui du
routeur qui fait l’annonce.
BGP-4 : RFC1771, mars 1995
Ajout des adresses CIDR, introduction des ensembles d’AS (non ordonnés) dans les
AS_PATH, et ajout des attributs de route MED (remplace INTER-AS METRIC),
LOCAL-PRFERENCE, AGGREGATOR.
BGP-4+ : RFC2283 en février 1998, RFC2545 en mars 1999, RFC2858 en juin 2000
Extensions multiprotocoles (RFC2283, remplacé par le RFC2858)
Support d’IPv6 (RFC2545)
Routage multicast
Réflecteurs de routes, RFC2796 en avril 2000
Annonces de capacités, RFC2842 en mai 2000, puis RFC3302 en novembre 2002
Confédérations d’AS RFC3065 en février 2001
Ré-écriture complète du RFC1771 par le RFC4271 en janvier 2006
BGP/MPLS, RFC4364 février 2006
Interaction entre OSPF et BGP/MPLS, RFC4577, juin 200654
LE ROUTAGE BGP4(+) / septembre 2006 54/56 V2.0
Bibliographie : principaux RFC sur BGP
R RFC2918 Route Refresh Capability for BGP-4. E. Chen, 09/2000. (PS)
R RFC3065 Autonomous System Confederations for BGP. P. Traina, D. McPherson, J.
Scudder. 02/2001. (PS)
R RFC3107 Carrying Label Information in BGP-4. Y.Rekhter, E.Rosen. 02/2001.(PS)
R RFC3345 Border Gateway Protocol (BGP) Persistent Route Oscillation Condition.
D. McPherson, V. Gill, D. Walton, A. Retana, 08/2002. (INFO)
R RFC3392 Capabilities Advertisement with BGP-4. R. Chandra, J. Scudder.
11/2002. (DS)
R RFC4271 A Border Gateway Protocol 4 (BGP-4). Y. Rekhter, T. Li., S. Hares.
01/2006. (DS)
R RFC4272 BGP Security Vulnerabilities Analysis. S. Murphy. 01/2006 (INFO)
R RFC4273 Definitions of Managed Objects for BGP-4. J. Haas, Ed., S. Hares,
Ed.. 01/2006. (PS)
R RFC4274 BGP-4 Protocol Analysis. D. Meyer, K. Patel. 01/2006. (INFO)
R RFC4276 BGP-4 Implementation Report. S. Hares, A. Retana. 01/2006. (INFO)
R RFC4364 BGP/MPLS IP Virtual Private Networks (VPNs). E. Rosen, Y. Rekhter.
02/2006. (PS)
R RFC4456 BGP Route Reflection: An Alternative to Full Mesh Internal BGP
(IBGP). T. Bates, E. Chen, R. Chandra. 04/2006. (DS)55
LE ROUTAGE BGP4(+) / septembre 2006 55/56 V2.0
Bibliographie : livres
R Le routage dans l’Internet, C. Huitema, Eyrolles, 1994
R Interconnections with bridges and routers, R, Perlman,
Addison-Wesley, 1996
R Internet Routing Architectures, B.Halabi, Cisco Press,
1997
R BGP4 Inter-Domain Routing in the Internet, J. W. Stewart
III, Addison-Wesley, 199956
LE ROUTAGE BGP4(+) / septembre 2006 56/56 V2.0
Bibliographie : Sites web
R www.rsng.net : Route Server Next generation Project
R www.merit.net : Nombreuses informations sur les points d’échange de trafic entre
opérateurs des USA.
R www.gated.org : Site de distribution du logiciel gated (payant) qui implemente la
plupart des logiciels de routage (dont BGP4)
R www.zebra.org : Site de distribution du logiciel zebra (licence GPL) qui implemente la
plupart des logiciels de routage (dont BGP4)
R www.caida.org : Propose des outils de métrologie réseau, beaucoup de données sur le
trafic.
R www.merit.edu/~ipma/ : outils de mesure de performances, beaucoup d’informations sur
les tables BGP de certains routeurs des points d’échange
R www.ep.net : Liste des points déchange
R www.ra.net : Routing Arbiter Project
R telnet://route-server.cerf.net : Accès en ligne a un routeur BGP
R http://www.cisco.com/univercd/cc/td/doc/cisintwk/ics/icsbgp4.htm : Manuel de référence
des commandes BGP sur IOS de Cisco.
R www.mcvax.org/~jhma/routing/ : nombreuses statistiques sur les tables de routage BGP
Pr´esentation de la radio cognitive
Badr Benmammar
To cite this version:
Badr Benmammar. Pr´esentation de la radio cognitive. 3`eme cycle. 2012.
HAL Id: cel-00680189
https://cel.archives-ouvertes.fr/cel-00680189v2
Submitted on 25 Mar 2012
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Présentation de la radio
cognitive
Badr Benmammar
badr.benmammar@gmail.com2
Plan
Radio logicielle (software radio)
Radio logicielle restreinte (SDR)
Radio cognitive (RC)
Historique
Définition
Relation entre RC et SDR
Architecture
Cycle de cognition
Composantes
Fonctions
Détection du spectre (Spectrum sensing)
Gestion du spectre (Spectrum management)
Mobilité du spectre (Spectrum mobility)3
Radio logicielle (software radio)
Travaux de Joseph Mitola (1991): définir une classe de radio
reprogrammable et reconfigurable.
Définition : La radio logicielle est une radio dans laquelle les fonctions
typiques de l’interface radio généralement réalisées en matériel, telles que la
fréquence porteuse, la largeur de bande du signal, la modulation et l’accès au
réseau sont réalisés sous forme logicielle. La radio logicielle moderne intègre
également l’implantation logicielle des procédés de cryptographie, codage
correcteur d’erreur, codage source de la voix, de la vidéo ou des données.
Le concept de radio logicielle doit également être considéré comme une
manière de rendre les usagers, les fournisseurs de services et les fabricants
plus indépendants des normes. Ainsi, avec cette solution, les interfaces radio
peuvent, en principe, être adaptées aux besoins d’un service particulier pour
un usager particulier dans un environnement donné à un instant donné.4
Radio logicielle restreinte (SDR)
On distingue plusieurs niveaux d’avancement dans le domaine : la radio
logicielle est le but ultime intégrant toute les fonctionnalités en logiciel, mais
elle impose des phases intermédiaires combinant anciennes et nouvelles
techniques, on parle alors de radio logicielle restreinte (software defined
radio). Les contraintes de puissance de calcul, de consommation électrique, de
coûts, etc. imposent actuellement de passer par cette phase intermédiaire.
La radio logicielle restreinte est un système de communication radio qui
peut s’adapter à n’importe quelle bande de fréquence et recevoir n’importe
quelle modulation en utilisant le même matériel.
Les opportunités qu’offre le SDR lui permettent de résoudre des problèmes
de la gestion dynamique du spectre. Les équipements SDR peuvent
fonctionner dans des réseaux sans fil hétérogènes c’est-à-dire qu’un SDR idéal
peut s’adapter automatiquement aux nouvelles fréquences et aux nouvelles
modulations. 5
Radio cognitive
L’idée de la radio cognitive a été présentée officiellement par Joseph Mitola
III à un séminaire à KTH, l'Institut royal de technologie, en 1998, publié plus
tard dans un article de Mitola et Gerald Q. Maguire, Jr en 1999.
Mitola combine son expérience de la radio logicielle ainsi que sa passion pour
l'apprentissage automatique et l'intelligence artificielle pour mettre en place la
technologie de la radio cognitive. D’après lui : Une radio cognitive peut
connaître, percevoir et apprendre de son environnement puis agir pour
simplifier la vie de l'utilisateur.
• Le terme radio cognitive (CR) est utilisé pour décrire un système ayant la
capacité de détecter et de reconnaître son cadre d'utilisation, ceci afin de lui
permettre d’ajuster ses paramètres de fonctionnement radio de façon
dynamique et autonome et d'apprendre des résultats de ses actions et de son
cadre environnemental d'exploitation. 6
Radio cognitive
La radio cognitive est une forme de communication sans fil dans laquelle un
émetteur/récepteur peut détecter intelligemment les canaux de
communication qui sont en cours d'utilisation et ceux qui ne le sont pas, et
peut se déplacer dans les canaux inutilisés. Ceci permet d'optimiser l'utilisation
des fréquences radio disponibles (RF) du spectre tout en minimisant les
interférences avec d'autres utilisateurs.
Cette capacité permet d'adapter chaque appareil aux conditions spectrales du
moment et offre donc aux utilisateurs un accès plus souple, efficace et
complet à cette ressource. Cette approche peut améliorer considérablement le
débit des données et la portée des liaisons sans augmenter la bande passante
ni la puissance de transmissions. La radio cognitive offre également une
solution équilibrée au problème de l'encombrement du spectre en accordant
d'abord l'usage prioritaire au propriétaire du spectre, puis en permettant à
d'autres de se servir des portions inutilisées du spectre.7
Radio cognitive
Le principe de la radio cognitive, repris dans la norme IEEE 802.22, nécessite une
gestion alternative du spectre qui est la suivante : un mobile dit secondaire pourra à
tout moment accéder à des bandes de fréquence qu’il juge libre, c’est-à-dire, non
occupées par l’utilisateur dit primaire possédant une licence sur cette bande.
L’utilisateur secondaire devra les céder une fois le service terminé ou une fois qu’un
utilisateur primaire aura montré des velléités de connexion.
On entreprend actuellement de modifier la norme IEEE 802.16 (WiMAX) par le biais
de la norme IEEE 802.16h afin de prendre en charge la coexistence et la collaboration
dans le même canal. La norme IEEE 802.22, qui vise la coexistence avec les
microphones et les systèmes de télévision, présente des caractéristiques semblables.
Les deux normes mettent en application les techniques de la radio cognitive.
Un Réseau Cognitif coordonne les transmissions suivant différentes bandes de
fréquences et différentes technologies en exploitant les bandes disponibles à un instant
donné et à un endroit donné. Il a besoin d’une station de base capable de travailler sur
une large gamme de fréquences afin de reconnaître différents signaux présents dans le
réseau et se reconfigurer intelligemment.8
Relation entre RC et SDR
L’une des principales caractéristiques de la radio cognitive est la capacité
d’adaptation où les paramètres de la radio (fréquence porteuse, puissance,
modulation, bande passante) peuvent être modifiés en fonction de :
L’environnement radio
La situation
Les besoins de l’utilisateur
L’état du réseau
La géo localisation
…
La radio logicielle est capable d’offrir les fonctionnalités de flexibilité, de
reconfigurabilité et de portabilité inhérentes à l’aspect d’adaptation de la radio
cognitive. Par conséquent, cette dernière doit être mise en œuvre autour d’une
radio logicielle. En d’autres termes, la radio logicielle est une "technologie
habilitante" pour la radio cognitive.9
Relation entre RC et SDR
Chargé de l’optimisation ou du
contrôle du module SDR en se basant
sur quelques paramètres d’entrée tels
que les informations issues de la
perception sensorielle ou de
l’apprentissage de l’environnement
radio, du contexte utilisateur, et de
l’état du réseau.
Figure 1 : Relation entre la radio cognitive et la radio logicielle restreinte10
Architecture de la RC
Mitola a défini l’architecture d’une radio cognitive par un ensemble cohérent
de règles de conception par lequel un ensemble spécifique de composants
réalise une série de fonctions de produits et de services.
Figure 2 : Architecture de la radio cognitive11
Architecture de la RC
Les six composantes fonctionnelles de l’architecture d’une radio cognitive sont:
La perception sensorielle (Sensory Perception : SP) de l'utilisateur qui inclut
l'interface haptique (du toucher), acoustique, la vidéo et les fonctions de détection et
de la perception.
Les capteurs de l'environnement local (emplacement, température, accéléromètre,
etc.).
Les applications système (les services médias indépendants comme un jeu en réseau).
Les fonctions SDR (qui incluent la détection RF et les applications radio de la SDR).
Les fonctions de la cognition (pour les systèmes de contrôle, de planification,
d'apprentissage).
Les fonctions locales effectrices (synthèse de la parole, du texte, des graphiques et
des affiches multimédias). 12
Protocoles utilisés par la radio cognitive
Figure 3 : Protocoles utilisés par la radio cognitive13
Protocoles utilisés par la radio cognitive
Dans la couche physique, le RF est mis en œuvre à base de radio définie par
logiciel. Les protocoles d'adaptation de la couche MAC, réseau, transport, et
applications doivent être conscients des variations de l'environnement radio
cognitif. En particulier, les protocoles d'adaptation devraient envisager
l'activité du trafic des principaux utilisateurs, les exigences de transmission
d'utilisateurs secondaires, et les variations de qualité du canal…
Pour relier tous les modules, un contrôle radio cognitif est utilisé pour établir
des interfaces entre l'émetteur/récepteur SDR et les applications et services
sans fil. Ce module radio cognitif utilise des algorithmes intelligents pour
traiter le signal mesuré à partir de la couche physique, et de recevoir des
informations sur les conditions de transmission à partir des applications pour
contrôler les paramètres de protocole dans les différentes couches. 14
Cycle de cognition
La composante cognitive de l’architecture de la radio cognitive comprend une
organisation temporelle, des flux d'inférences et des états de contrôle.
Ce cycle synthétise cette composante de manière évidente. Les stimuli entrent
dans la radio cognitive comme des interruptions sensorielles envoyées sur le
cycle de la cognition pour une réponse. Une telle radio cognitive observe
l'environnement, s’oriente, crée des plans, décide, et puis agit.
Figure 4 : Cycle de cognition de Mitola Figure 5 : Cycle de cognition simplifié15
Cycle de cognition
Phase d’observation (détecter et percevoir)
La RC observe son environnement par l'analyse du flux de stimuli entrant. Dans la
phase d'observation, la RC associe l’emplacement, la température, le niveau de
lumière des capteurs, et ainsi de suite pour en déduire le contexte de
communication. Cette phase lie ces stimuli à des expériences antérieures pour
discerner les modèles au fil du temps. La radio cognitive rassemble les expériences
en se souvenant de tout.
Phase d’orientation
La phase d'orientation détermine l'importance d'une observation en liant à celle-ci
une série connue de stimuli. Cette phase fonctionne à l'intérieur des structures de
données qui sont analogues à la mémoire à court terme (STM), que les gens
emploient pour s’engager dans un dialogue sans forcément se souvenir de tout à la
même mesure que dans la mémoire à long terme (LTM). Le milieu naturel fournit
la redondance nécessaire pour lancer le transfert de la STM à la LTM. La
correspondance entre les stimuli courants et les expériences stockées se fait par
reconnaissance des stimuli ou par reliure.16
Cycle de cognition
Phase de planification
La plupart des stimuli sont traités avec délibérative plutôt qu’avec réactivité. Un
message entrant du réseau serait normalement traité par la génération d'un plan
(dans la phase de plan, la voie normale). Le plan devrait également inclure la phase
de raisonnement dans le temps. Généralement, les réponses réactives sont
préprogrammées ou apprises en étant dit, tandis que d'autres réactions de
délibération sont prévues.
Phase de décision
La phase de décision sélectionne un plan parmi les plans candidats. La radio peut
alerter l'utilisateur d’un message entrant ou reporter l'interruption à plus tard en
fonction des niveaux de QoI (Quality of Information) statués dans cette phase.
Phase d’action
Cette phase lance les processus sélectionnés qui utilisent les effecteurs
sélectionnés qui accèdent au monde extérieur ou aux états internes de la radio
cognitive. L'accès au monde extérieur consiste principalement à composer des
messages qui doivent être envoyés dans l'environnement en audio ou exprimés
dans différents langages appropriés. 17
Cycle de cognition
Phase d’apprentissage
L’apprentissage dépend de la perception, des observations, des décisions
et des actions. L'apprentissage initial est réalisé à travers la phase
d’observation dans laquelle toutes les perceptions sensorielles sont
continuellement comparées à l'ensemble de l'expérience antérieure pour
continuellement compter les événements et se souvenir du temps écoulé
depuis le dernier événement.
L'apprentissage peut se produire quand un nouveau modèle est créé en
réponse à une action. Par exemple, les états internes antérieurs et courants
peuvent être comparés avec les attentes pour en apprendre davantage sur
l'efficacité d'un mode de communication.18
Composantes de la radio cognitive
Les différentes composantes d'un émetteur/récepteur radio cognitive qui mettent en
œuvre ces fonctionnalités sont présentées dans la figure ci-dessous.
Figure 6 : Composante de la radio cognitive19
Composantes de la radio cognitive
Emetteur / Récepteur: un émetteur/récepteur SDR sans fil est le composant
majeur avec les fonctions du signal de transmission de données et de réception. En
outre, un récepteur sans fil est également utilisé pour observer l'activité sur le spectre
de fréquence (spectre de détection).
Les paramètres émetteur/récepteur dans le nœud de la radio cognitive peuvent
être modifiés dynamiquement comme dicté par les protocoles de couche
supérieure.
Analyseur de spectre (Spectrum analyser): L'analyseur de spectre utilise les signaux
mesurés pour analyser l'utilisation du spectre (par exemple pour détecter la signature
d'un signal provenant d'un utilisateur primaire et trouver les espaces blancs du spectre
pour les utilisateurs secondaires).
L'analyseur de spectre doit s'assurer que la transmission d'un utilisateur primaire
n'est pas perturbée si un utilisateur secondaire décide d'accéder au spectre. Dans
ce cas, diverses techniques de traitement du signal peuvent être utilisées pour
obtenir des informations sur l'utilisation du spectre.20
Composantes de la radio cognitive
Extraction de connaissances et apprentissage (Knowledge
extraction/learning): L'apprentissage et l'extraction de connaissances utilisent les
informations sur l'utilisation du spectre pour comprendre l'environnement ambiant RF
(par exemple le comportement des utilisateurs sous licence). Une base de
connaissances de l'environnement d'accès au spectre est construite et entretenue, qui
est ensuite utilisée pour optimiser et adapter les paramètres de transmission pour
atteindre l'objectif désiré sous diverses contraintes. Les algorithmes d'apprentissage
peuvent être appliqués pour l'apprentissage et l'extraction de connaissances.
Prise de décision (Decision making): Après que la connaissance de l'utilisation du
spectre soit disponible, la décision sur l'accès au spectre doit être faite. La décision
optimale dépend du milieu ambiant, elle dépend du comportement coopératif ou
compétitif des utilisateurs secondaires. Différentes techniques peuvent être utilisées
pour obtenir une solution optimale.21
Fonctions de la radio cognitive
Les principales fonctions de la radio cognitive sont les suivantes:
Détection du spectre (Spectrum sensing)
Détecter le spectre non utilisé et le partager sans interférence avec d'autres
utilisateurs. La détection des utilisateurs primaires est la façon la plus efficace pour
détecter les espaces blancs du spectre.
L'un des objectifs de la détection du spectre, en particulier pour la détection des
interférences, est d'obtenir le statut du spectre (libre /occupé), de sorte que le
spectre peut être consulté par un utilisateur secondaires en vertu de la contrainte
d'interférence. Le défi réside dans le fait de mesurer l'interférence au niveau du
récepteur primaire causée par les transmissions d'utilisateurs secondaires.
Gestion du spectre (Spectrum management)
Capter les meilleures fréquences disponibles pour répondre aux besoins de
communication des utilisateurs.
Les radios cognitives devraient décider de la meilleure bande de spectre pour
répondre aux exigences de qualité de service sur toutes les bandes de fréquences
disponibles, donc les fonctions de gestion du spectre sont nécessaires pour les
radios cognitives. Ces fonctions de gestion peuvent être classées comme suit:22
Fonctions de la radio cognitive
Analyse du spectre :
Les résultats obtenus de la détection du spectre sont analysés pour estimer la qualité
du spectre. Une des questions ici est de savoir comment mesurer la qualité du
spectre qui peut être accédée par un utilisateur secondaire.
Cette qualité peut être caractérisée par le rapport signal/bruit, la durée moyenne et
la corrélation de la disponibilité des espaces blancs du spectre. Les informations sur
cette qualité de spectre disponible à un utilisateur par radio cognitive peuvent être
imprécises et bruyantes.
Des algorithmes d’apprentissage de l’intelligence artificielle sont des techniques qui
peuvent être employées par les utilisateurs de la radio cognitive pour l'analyse du
spectre.
Décision sur le spectre :
Modèle de décision: un modèle de décision est nécessaire pour l'accès au spectre. La
complexité de ce modèle dépend des paramètres considérés lors de l'analyse du spectre.
Le modèle de décision devient plus complexe quand un utilisateur secondaire a des objectifs
multiples. Par exemple, un utilisateur secondaire peut avoir l'intention de maximiser son
rendement tout en minimisant les perturbations causées à l'usager primaire. Les méthodes
d'optimisation stochastique (le processus de décision de Markov) seront un outil intéressant
pour modéliser et résoudre le problème d’accès au spectre dans un environnement radio
cognitif.23
Fonctions de la radio cognitive
Compétition / coopération dans un environnement multi utilisateurs : Lorsque
plusieurs utilisateurs (à la fois primaires et secondaires) sont dans le système, leur préférence
va influer sur la décision du spectre d’accès. Ces utilisateurs peuvent être coopératifs ou non
coopératifs dans l'accès au spectre.
Dans un environnement non-coopératif, chaque utilisateur a son propre objectif, tandis
que dans un environnement coopératif, tous les utilisateurs peuvent collaborer pour atteindre
un seul objectif. Par exemple, plusieurs utilisateurs secondaires peuvent entrer en
compétition les uns avec les autres pour accéder au spectre radio (par exemple, O1, O2, O3,
O4 dans la figure ci-dessous) de sorte que leur débit individuel soit maximisé. Au cours de
cette concurrence entre les utilisateurs secondaires, tous veillent à ce que l’interférence causée
à l'utilisateur primaire est maintenue en dessous de la limite de température de brouillage
correspondante. La théorie des jeux est l'outil le plus approprié pour obtenir la solution
d'équilibre pour le problème du spectre dans un tel scénario.
Dans un environnement coopératif, les radios cognitives coopèrent les unes avec les
autres pour prendre une décision pour accéder au spectre et de maximiser une fonction
objectif commune en tenant compte des contraintes. Dans un tel scénario, un contrôleur
central peut coordonner le spectre de gestion. 24
Fonctions de la radio cognitive
Figure 7 : Accès au spectre Coopératif et non-coopératif 25
Fonctions de la radio cognitive
Mise en œuvre distribuée du contrôle d’accès au spectre : Dans un environnement
multi utilisateur distribué, pour un accès non-coopératif au spectre, chaque utilisateur peut
parvenir à une décision optimale de façon indépendante en observant le comportement
(historique / action) des autres utilisateurs du système. Par conséquent, un algorithme
distribué est nécessaire pour un utilisateur secondaire pour prendre la décision sur l'accès au
spectre de manière autonome.
Mobilité du spectre (Spectrum mobility)
C’est le processus qui permet à l’utilisateur de la RC de changer sa fréquence de
fonctionnement. Les réseaux radio cognitifs essayent d’utiliser le spectre de manière
dynamique en permettant à des terminaux radio de fonctionner dans la meilleure
bande de fréquence disponible, de maintenir les exigences de communication
transparentes au cours de la transition à une meilleure fréquence.
Recherche des meilleures bandes de fréquence : La RC doit garder une trace des bandes
de fréquence disponibles de sorte que si nécessaire (par exemple, un utilisateur autorisé est
détecté), il peut passer immédiatement à d'autres bandes de fréquences. Lors de la
transmission par un utilisateur secondaire, l'état de la bande de fréquences doit être respecté.
Auto-coexistence et synchronisation : Quand un utilisateur secondaire effectue un
transfert du spectre, deux questions doivent être prises en compte. Le canal cible ne doit pas
être actuellement utilisé par un autre utilisateur secondaire (l'exigence d'auto-coexistence), et
le récepteur de la liaison secondaire correspondant doit être informé de la non-intervention
du spectre (la demande de synchronisation). 26
Nos publications dans le domaine de la RC
Asma Amraoui, Fatima zohra Benidris, Badr Benmammar, Francine Krief and Fethi Tarik
Bendimerad. "Toward cognitive radio resource management based on multi-agent systems for
improvement of real-time application performance". Proceedings of the Fifth IFIP International
Conference on New Technologies, Mobility and Security (NTMS'2012). Istanbul, Turkey.7-10
May 2012.
B. Benmammar, A. Amraoui and W. Baghli. "Performance improvement of wireless link
reliability in the context of cognitive radio". IJCSNS International Journal of Computer Science
and Network Security. VOL.12 No.01, January, 2012, pp. 15-22. ISSN : 1738-7906.
A. Amraoui, W. Baghli and B. Benmammar, "Improving video conferencing application quality
for a mobile terminal through cognitive radio", Proceedings of the 14th IEEE International
Conference on Communication Technology (ICCT 2012). Chengdu, China, November 9th-11th,
2012.
A. Amraoui, W. Baghli et B. Benmammar, "Amélioration de la fiabilité du lien sans fil pour un
terminal radio cognitive mobile". Dans les actes du 12 ème Journées Doctorales en Informatique
et Réseau (JDIR'11). Belfort, France, 23-25 Novembre 2011. Pages : 1-6. 27
Publications relatives à nos travaux
Zeina Jrad, Badr Benmammar, Joseph Corréa, Francine Krief, Nader Mbarek. "A User
Assistant for QoS Negotiation in a Dynamic Environment Using Agent Technology".
Proceedings of the Second IEEE and IFIP International Conference on Wireless and Optical
Communications Networks WOCN 2005. March 6 - 8, 2005, Hyatt Regency Hotel, Dubai,
United Arab Emirates UAE, Print ISBN: 0-7803-9019-9.
B. Benmammar and F. Krief. “Resource Management for End-to-End QoS in a Mobile
Environment”. 2nd IEEE INTERNATIONAL CONFERENCE ON Wireless and Mobile
Computing, Networking and Communications (WiMob 2006). Montréal, Canada. June 19-21,
2006.
N. Samaan, B. Benmammar, F. Krief and A. Karmouch. "Prediction-based Advanced
Resource Reservation in a Mobile Environment". 18th IEEE Annual Canadian Conference on
Electrical and Computer Engineering, CCECE05, May 1-4, 2005, Saskatoon Inn, Saskatoon,
Saskatchewan Canada.28
Publications relatives à nos travaux
B. Benmammar and F. Krief. "MQoS NSLP: a mobility profile management based approach
for advance resource reservation in a mobile environment". Proceedings of the 7th IFIP
IEEE International Conference on Mobile and Wireless Communications Networks (MWCN
2005). Marrakech, Morocco. September 19-21, 2005.
Z. Jrad, F. Krief and B. Benmammar. "An Intelligent User Interface for the Dynamic
Negotiation of QoS". Proceedings of the 10th IEEE International Conference on
Telecommunications.ICT'2003. Papeete, Tahiti. February 2003, Print ISBN: 0-7803-7661-7.
B. Benmammar et F. Krief. “La Technologie Agent et les Réseaux Sans Fil”. Congrès Des
Nouvelles Architectures pour les Communications. DNAC’2003. Paris, France. Octobre 2003.
Analyse num´erique
Catherine Bolley
To cite this version:
Catherine Bolley. Analyse num´erique. Ecole d’ing´enieur. Ecole Centrale de Nantes, 2012, ´
pp.97.
HAL Id: cel-01066570
https://cel.archives-ouvertes.fr/cel-01066570
Submitted on 21 Sep 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Catherine Bolley
Analyse numériqueÉcole Centrale de Nantes — 2012
Ce document est sous licence Creative Commons BY-NC-SA 4.0 France :
— attribution ;
— pas d’utilisation commerciale ;
— partage dans les mêmes conditions.
http://creativecommons.org/licenses/by-nc-sa/4.0/deed.frTable des matières
1 Généralités sur les matrices
1.1 Normes matricielles 9
1.2 Suites dans Kn;n 10
2 Résolution numérique de systèmes linéaires
2.1 Méthodes directes 13
2.1.1 Système triangulaire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.2 Méthodes de Gauss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.1.3 Méthode LU ou algorithme de Crout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.4 Méthode de Cholesky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2 Méthodes itératives 18
2.2.1 Résultats généraux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2.2 Principales méthodes itératives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.3 Convergence et comparaison des méthodes itératives 21
2.3.1 Matrices à diagonale strictement dominante . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3.2 Matrices hermitiennes définies positives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3 Calcul de valeurs et vecteurs propres
3.1 Vecteurs propres d’une matrice triangulaire 23
3.2 Méthodes de la puissance itérée 24
3.2.1 Itérations simples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2.2 Méthode d’accélération de convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.2.3 Méthode de la puissance itérée inverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3 Méthodes issues de transformations matricielles 26
3.3.1 Méthode de Rutishauser ou du LU
LR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3.2 Matrices réelles symétriques : méthode de Jacobi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4 Interpolation polynomiale
4.1 Polynôme d’interpolation de Lagrange 31
4.1.1 Existence et unicité du polynôme d’interpolation de Lagrange . . . . . . . . . . . . . . . . . . . . . . 31
4.1.2 Erreur d’interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.1.3 Choix des points d’interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2 Construction du polynôme d’interpolation 33
4.2.1 Différences divisées . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.2.2 Différences finies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.3 Schéma de Hörner 35
5 Approximation de fonctions
5.1 Approximation hilbertienne 375.2 Approximation au sens des moindres carrés 38
5.2.1 Données dans L
2
w .a I b/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.2.2 Données dans R
n
: approximation au sens des moindres carrés discret . . . . . . . . . . . . . . . . 39
5.2.3 Convergence des approximations au sens des moindres carrés . . . . . . . . . . . . . . . . . . . . . . 39
5.3 Polynômes orthonormés 40
6 Intégration numérique
6.1 Étude générale 43
6.1.1 Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
6.1.2 Erreur d’intégration numérique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
6.1.3 Convergence des méthodes d’intégration numérique . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
6.2 Formules d’intégration numérique 44
6.2.1 Formules élémentaires de Newton-Côtes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
6.2.2 Méthodes d’intégration numérique composées . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.2.3 Formules de Gauss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.3 Intégration numérique en deux dimensions 48
7 Équations différentielles du premier ordre à condition initiale
7.1 Problème de Cauchy 51
7.1.1 Condition de Cauchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
7.1.2 Théorème d’existence et d’unicité . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
7.2 Méthodes de résolution numériques à un pas 52
7.2.1 Méthode d’Euler-Cauchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
7.2.2 Étude générale des méthodes à un pas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7.3 Méthodes de résolution numérique à pas multiples 56
7.3.1 Méthodes d’Adams-Bashforth à k C 1 pas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7.3.2 Méthodes d’Adams-Moulton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7.3.3 Formulation générale des méthodes à pas multiples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
8 Systèmes d’équations non linéaires
8.1 Principe de résolution par itérations 61
8.2 Principales méthodes en une dimension 62
8.2.1 Méthode des approximations successives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
8.2.2 Méthode de Newton-Raphson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8.2.3 Méthode de dichotomie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.3 Principales méthodes dans R
n 64
8.3.1 Méthode des approximations successives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.3.2 Méthode de Newton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.4 Application aux racines de polynômes : méthode de Bairstow 65
8.4.1 Principe de la méthode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.4.2 Algorithme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 Exercices
A Méthode des éléments finis en dimension 1
A.1 Étude de l’erreur d’approximation 79
A.1.1 Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
A.1.2 Majoration de jju
uhjj0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
A.1.3 Majoration de ju
uhj0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
A.1.4 Majoration de ju
uhj1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
A.2 Problème approché avec intégration numérique 81
A.2.1 Majoration de jju
Quhjj0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
A.2.2 Majoration de ju
Quhj0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
A.2.3 Erreur d’intégration numérique par la méthode des trapèzes . . . . . . . . . . . . . . . . . . . . . . . 83
A.2.4 Majoration de Rh si on utilise la méthode des trapèzes . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
A.3 Tests numériques de résolution de problèmes approchés 84
B Méthode de la puissance itérée pour le calcul de valeurs propres
B.1 Itérations simples 85
B.1.1 Résultats généraux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
B.1.2 Approximation d’un vecteur propre associé à 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
B.1.3 Approximation de la valeur propre 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
B.1.4 Cas où l’itéré initial est orthogonal à l’espace propre à gauche associé à 1 . . . . . . . . . . . . . 86
B.1.5 Amélioration de la méthode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
B.1.6 Calcul d’autres éléments propres : méthode de déflation . . . . . . . . . . . . . . . . . . . . . . . . . . 88
B.2 Méthode d’accélération de convergence 88
B.3 Méthode de la puissance itérée inverse 89
C Prérequis d’analyse numérique
C.1 Analyse matricielle 91
C.2 Algèbre linéaire 91
C.3 Valeurs propres 92
C.4 Résolution numérique de systèmes linéaires 93
C.5 Analyse 961
Généralités sur les matrices
Notations et rappels
Dans ce document, l’ensemble K est un corps commutatif, R ou C. Kn
est l’espace vectoriel des
vecteurs (colonnes) à n lignes à coefficients dans K. Si u 2 Kn
, on notera u D .ui/iD1;:::;n où les
ui sont les coefficients de u. Kn;m est l’espace vectoriel des matrices à n lignes et m colonnes à
coefficients dans K. Si A 2 Kn;m a pour coefficients aij , on notera :
A D .aij /
i;j ; i D 1; : : : ; n; j D 1; : : : ; m (1.1)
où i désigne l’indice de ligne et j , l’indice de colonne. La matrice A
> 2 Km;n désigne la
transposée de la matrice A et ses coefficients vérifient :
a
>
ij D aj i; i D 1; : : : ; n; j D 1; : : : ; m (1.2)
La matrice A
2 Kn;m est l’adjointe de la matrice A :
A
D AN> (1.3)
Matrices carrées On s’intéresse au cas m D n et A 2 C
n;n. On note i
, i D 1; : : : ; n les n
valeurs propres dans C de A.
B Définition 1.1 — Rayon spectral. On appelle rayon spectral de A, le réel noté .A/ défini par :
.A/ D max
iD1;:::;n
ji
j (1.4)
B Définition 1.2 — Trace. La trace de la matrice A est donnée par :
tr.A/ D
Xn
iD1
ai i (1.5)
On a en particulier :
tr.A/ D
Xn
iD1
i (1.6)
B Définition 1.3 — Matrice diagonale. Une matrice carrée A 2 Kn;n est dite diagonale lorsque
aij D 0 pour i ¤ j .
CRYPTANALYSE DE RSA
Abderrahmane Nitaj
To cite this version:
Abderrahmane Nitaj. CRYPTANALYSE DE RSA. 3`eme cycle. Oujda (Maroc), 2009, pp.56.
HAL Id: cel-00420490
https://cel.archives-ouvertes.fr/cel-00420490v2
Submitted on 12 Jan 2010
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.CRYPTANALYSE DE RSA
Abderrahmane Nitaj
Laboratoire de Math´ematiques Nicolas Oresme
Universit´e de Caen, France
http://www.math.unicaen.fr/~nitaj
nitaj@math.unicaen.fr
c Version du 28 juin 2009Table des mati`eres
Contenu i
Pr´eface 1
1 Introduction au cryptosyst`eme RSA 3
1.1 Principe de RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 Le module RSA . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2 Les cl´es publiques et priv´ees . . . . . . . . . . . . . . . . . . . 5
1.1.3 Envoi d’un message . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1.4 D´echiffrement d’un message . . . . . . . . . . . . . . . . . . . 8
1.1.5 Signature d’un message . . . . . . . . . . . . . . . . . . . . . . 9
1.1.6 Preuve de RSA . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.2 Un exemple d’utilisation de RSA . . . . . . . . . . . . . . . . . . . . 12
1.2.1 Transformation d’un texte en nombres . . . . . . . . . . . . . 12
1.2.2 L’exemple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3 Cryptanalyses ´el´ementaires de RSA . . . . . . . . . . . . . . . . . . 15
1.3.1 Cryptanalyse de RSA connaissant ϕ(N) . . . . . . . . . . . . 15
1.3.2 Utilisation du mˆeme module et deux exposants diff´erents . . . 16
1.3.3 Utilisation de modules diff´erents pour le mˆeme message. . . . 18
1.3.4 Cryptanalyse de RSA si |p − q| < cN1/4
: M´ethode de Fermat 21
2 Cryptanalyse de RSA par les fractions continues 25
2.1 Les fractions continues . . . . . . . . . . . . . . . . . . . . . . . . . . 25
iii TABLE DES MATIERES `
2.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.1.2 D´efinitions et propri´et´es . . . . . . . . . . . . . . . . . . . . . 26
2.2 Cryptanalyse de RSA par les fractions continues . . . . . . . . . . . . 37
2.2.1 L’attaque de Wiener . . . . . . . . . . . . . . . . . . . . . . . 38
3 Cryptanalyse de RSA par l’algorithme LLL 43
3.1 L’algorithme LLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.1.1 Introduction aux r´eseaux . . . . . . . . . . . . . . . . . . . . . 43
3.1.2 L’algorithme LLL . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.2 Cryptanalyse de RSA par la r´eduction des r´eseaux . . . . . . . . . . . 59
3.2.1 La m´ethode de Coppersmith : polynˆomes `a une variable . . . 59
3.2.2 Factorisation de N . . . . . . . . . . . . . . . . . . . . . . . . 69
Bibliographie 73Pr´eface
Si vous enseignez `a un homme, vous n’enseignez qu’`a une
personne. Si vous enseignez `a une femme, vous enseignez `a toute
une famille.
.
éÊ
K
A
«
IÒ
Ê« Y
®
¯
è
@QÓ@
IÒ
Ê« @
X@
A
Ó
@ , @
XQ
¯
IÒ
Ê« Y
®
¯ C
g.
P
IÒ
Ê« @
X@
La cryptographie moderne est bas´ee sur les math´ematiques pour s´ecuriser l’information.
On distingue deux types de protocoles cryptographiques : la cryptographie
`a cl´e priv´ee et la cryptographie `a cl´e publique. La cryptographie `a cl´e publique `a ´et´e
introduite par Whitfield Diffie et Martin Hellman en 1976, marquant ainsi la naissance
de la cryptographie moderne. Le principe de la cryptographie `a cl´e publique
repose sur deux types de cl´es : une cl´e publique et une cl´e priv´ee. Pour chiffrer un
message, on utilise la cl´e publique de son destinataire. Alors, seul le destinataire peut
d´echiffrer le message re¸cu avec sa propre cl´e priv´ee. En 1978, Ronald Rivest, Adi
Shamir et Leonard Adleman ont propos´e le premier cryptosyst`eme `a cl´e publique,
appel´e RSA. Ce cryptosyst`eme est devenu le plus r´epandu dans le monde car il est
facile `a r´ealiser mais tr`es difficile `a casser. En effet, sa s´ecurit´e repose sur l’un des
probl`emes les plus difficiles en math´ematiques : la factorisation des grand nombres.
Dans ce travail, nous introduisons les principes g´en´eraux du cryptosyst`eme RSA
ainsi que certaines attaques permettant de le casser, si les param`etres de s´ecurit´e sont
mal choisis ou s’il v´erifient des relations permettant `a un attaquant d’en tirer profit.
Dans le chapitre 1, nous donnons les principes g´en´eraux du cryptosyst`eme RSA et
nous pr´esentons quelques attaques ´el´ementaires permettant de le casser. Dans le
chapitre 2, nous pr´esentons une introduction `a la th´eorie des fractions continues
et leur utilisation pour attaquer le cryptosyst`eme RSA dans certains cas. Dans
le chapitre 3, nous pr´esentons quelques aspects de la r´eduction des r´eseaux, plus
pr´ecis´ement l’algorithme LLL et son utilisation pour attaquer le cryptosyst`eme RSA
grˆace `a la m´ethode de Coppersmith.
Dans ce travail, la plupart des r´esultats sont illustr´es par des algorithmes programm´es
`a l’aide des syst`emes de calcul Maple 12 et Magama dont un calculateur
12 TABLE DES MATIERES `
en ligne est `a l’adresse http://magma.maths.usyd.edu.au/calc/.Chapitre 1
Introduction au cryptosyst`eme
RSA
Celui qui n’aime pas gravir les montagnes, vivra toute sa vie dans
les trous.
Abou Al Qasim Achabi
. Q
®
m
Ì'@
á
K
.
Q
ë
YË@
Y
K
.
@
ª
K
È
A
J
.
m
.
Ì'@
Xñ
ª
I
.
m
B
á
Ó
ð
ú
G
.
A
Ë@ Õæ
A
®Ë@ ñ
K
.
@
1.1 Principe de RSA
Toutes les op´eration du cryptosyst`eme RSA se passe dans un ensemble de nombre
entiers. Soient p et q deux nombres premiers assez grands. On note N = pq. Le
nombre N est appel´e module RSA. Supposons que deux personnes A et B veulent
communiquer de fa¸con sˆure en utilisant le cryptosyst`eme RSA. Pour cela, ils doivent,
chacun de son cot´e pr´eparer un module RSA, deux cl´es e et d, ex´ecuter une proc´edure
de chiffrement et de signature et une proc´edure de d´echiffrement et de v´erification
de la signature.
1.1.1 Le module RSA
Avant tout, pour utiliser le cryptosyst`eme RSA, chacun des intervenants A et B doit
fabriquer son propre module RSA. L’algorithme 1 peut ˆetre alors utilis´e.
3
Cours Interconnexion et conception de r´eseaux
(informatiques)
Jean-Luc Archimbaud
To cite this version:
Jean-Luc Archimbaud. Cours Interconnexion et conception de r´eseaux (informatiques). Ecole ´
d’ing´enieur. A Grenoble `a l’ENSIMAG (cours donn´e 2 fois), 2002, pp.322.
HAL Id: cel-00561873
https://cel.archives-ouvertes.fr/cel-00561873
Submitted on 2 Feb 2011
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.1
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 1
Interconnexion et conception de
réseaux
Cours de 24 h pour 3ième année
Ecole d’ingénieurs réseaux
2002
Jean-Luc Archimbaud CNRS/UREC
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 2
Interconnexion et conception de réseaux
• Réseau :
– Qu’est-ce ?
– Plusieurs réseaux interconnectés ? réseau
– Dans le cours : réseau informatique d’entreprise – de
campus
• Concevoir un réseau c’est actuellement :
– Faire évoluer l’existant
– Réfléchir à toutes les couches
• Tranchées ? Applications
– Utiliser les services des opérateurs – sous-traitance
– Travail de puzzle : assemblage de briques
• Matériel - logiciel2
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 3
Concevoir un réseau c’est définir
• L’architecture physique (réseau = câble)
– Carte des sites – bâtiments – salles à connecter
– Les supports physiques
– Les équipements actifs
• L’architecture logique (réseau = réseau IP)
– Les protocoles
– Plan adressage – Routage
• L’administration des équipements - surveillance
• Les services réseaux
– DNS (nommage), Messagerie, Web, …
• Les outils de sécurité
• Les connexions avec l’extérieur : Internet, …
Adaptée aux équipements - besoins des utilisateurs
Stations – Serveurs – Applications
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 4
Plan du cours
• Réseaux locaux - LAN
– Liens physiques - câblage : Coax - TP – FO – sans fil
– Câblage de bâtiment
– Protocoles niveau 1-2 : Ethernets – FDDI
• Rappels : caractéristiques du protocole IP
• Eléments actifs d’interconnexion Eth-IP
– Répéteurs – hubs (Ethernet)
– Ponts (Ethernet)
– Commutateurs Ethernet
– Routeurs (IP)
– Commutateurs-routeurs (Ethernet-IP)3
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 5
Plan du cours
• Liaisons longues distances
– Liaisons physiques
• Commutées RTC, RNIS, ADSL, X25, louées LS
– Modems
• ATM
– Objectifs
– QoS : Qualité de Service
– Couches 1 et 2
– Commutateurs et routage
– Architectures LS et LANE
– Bilan
• Exemples d’architecture
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 6
Plan du cours
• Architecture logique IP
– Adresses IP
– Plan adressage IP
– Routage IP
– Exemples de répartition d’utilisateurs et de services
– Architecture ATM : classical IP
• MPLS
• Intégration voix-données (téléphonie – informatique)
– Pourquoi ?
– Différents niveaux d’intégration
– Téléphonie sur IP
• Services rendus
• H323
• SIP
– Bilan aujourd’hui4
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 7
Plan du cours
• Réseaux virtuels
– Pourquoi ?
– VLAN
– Avec ATM
– VPN (PPTP, L2TP, IPsec)
• Services d’interconnexion de France Télécom
– Interconnexion niveau 2 moyen débit
– Interconnexion niveau 2 haut-débit
– Services (entreprises)
• Services à assurer – couche 7
– Noms
– Messagerie
– Annuaire
– Services Web
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 8
Plan de cours
• Qualité de service IP –rappels
– RSVP
– DiffServ
• Fonctions « annexes » de certains équipements actifs
– Rappels
– NAT
– Filtrage
– Multicast
– Gestion des files d’attente
• Administration de réseau
• Quoi ?
– Equipes, standards
– Configuration, surveillance, dépannage
– Stations d’administration
– Métrologie5
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 9
Plan du cours
• Quelques éléments de sécurité
• Accès à l’Internet
• Accès depuis l’Internet
– A l’Intranet
– Aux serveurs Internet
• Construction d’un réseau « solide »
• Etudes de cas
– Réseau de petit laboratoire éclaté
– Réseau de campus
• Gros site d’une entreprise
– Réseau Renater (national)
• Entreprise multi-sites
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 10
Bibliographie
• Computer Networks 3rd edition (Tanenbaum)
• TCP/IP Illustrated, Vol 1 - W. Richard Stevens
• Constructeurs (white papers)
– CISCO : http://www.cisco.com
– …
• Elements d’interconnexion Ethernet
– http://www.unige.ch/dinf/jfl/elem/index.htm
• Pointeurs cours, mémoires
– http://reseau.plisson.org/
• Cours UREC
– http://www.urec.cnrs.fr/cours/
• Moteurs de recherche6
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 11
LAN : dimension
• LAN : Local Area Network
– Un étage
– Un bâtiment
– Diamètre < 2 km
– Un site géographique : domaine privé
– Plusieurs bâtiments (site-campus)
• Interconnexion de LAN
• MAN : Metropolitan Area Network
– Dimension d’une ville
– Diamètre < 10 km
– Domaine public : service d’opérateurs locaux
• WAN : Wide Area Network
– Très longues distances : opérateurs (inter)nationaux
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 12
LAN : Liens physiques : critères choix
• En théorie : propriétés physiques
• En pratique :
– Coût
• Câble (media)
• Connecteurs (connectique)
• Emetteurs et récepteurs
• Installation : pose (tirer des câbles)
– Immunité aux perturbations
• Foudre, électromagnétiques, …
– Longueur maximum possible entre deux équipements
actifs (? minimiser le nb)
• Coût équipement
• Besoin alimentation électrique, …
– Débits possibles (surtout débit max) : bps7
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 13
LAN : liens physiques : câble coaxial
• Bande de base : Baseband
– 50 ohm – transmissions numériques – quelques kms
– Ex : Ethernet câble jaune – bus - prises vampires - 10base5 (500
m)
• Large bande : Broadband (LAN, MAN, WAN)
– 75 ohm – transmissions analogiques – 100 kms
– Plusieurs bandes de fréquences ? plusieurs flux
– Ex : câble télévision
• Bons débits (Gbits/s) et distances, bonne immunité
• Problème : cher
– Equipements - encombrement (Ø = 1 cm)– difficulté de la pose
• N’est plus utilisé pour le LAN informatique
– Il peut rester quelques câbles coaxiaux jaunes Ethernet et
Ethernet fin (Bande de base) : 10base2 (185 m) - Prises en T
• Utilisé dans le réseau câble des villes
– Connexion ordinateur : Carte 10BaseT – Modem – Câble (TV)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 14
LAN : câble coaxial fin et prise en T8
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 15
LAN : Liens physiques : TP
• TP : Twisted Pair : Paire torsadée
• Fil de cuivre isolé de diamètre 1 mm
• Utilisé depuis très longtemps pour le téléphone
• TP catégorie (type de TP mais aussi composants)
– 3 : jusqu’à 16 Mhz : très répandu aux USA
– 4 : jusqu’à 20 Mhz : peu utilisé
– 5 : jusqu’à 125 Mhz : le plus répandu actuellement
• Câbles 4 paires avec des pas de torsades différents
– 5E : amélioration du câblage 5 (Gigabit Ethernet)
– 6 : jusqu’à 250 Mhz
– 7 : jusqu’à 600 Mhz
• Blindage des câbles :
– UTP : Unshielded : pas de blindage
– STP : Shielded : blindage avec tresse métallique
– FTP : Foiled : entourée d’un feuillard d’aluminium
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 16
LAN : Liens physiques : TP
• Nombre de paires utilisées : 2 à 4 suivant l’utilisation
• Connexions point à point : architecture en étoile
• Connecteurs RJ45 : 4 paires
• Avantages :
– Câblage universel : informatique et téléphone
– Débit : plusieurs Mbits/s et Gbits/s sur 100 m (jusqu’à quelques
centaines)
– Câble et pose peu chers
• Désavantages :
– Très sensibles aux perturbations (électromagnétiques, …)
– Courtes distances
– Beaucoup de câbles : pose par professionnels
• C’est le media le plus utilisé à l’intérieur des bâtiments9
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 17
LAN : photos TP et RJ45
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 18
LAN : Liens physiques : FO
• FO : Fiber Optic : Fibre Optique
• 2 types : multimode - monomode
– Multimode : rayons lumineux avec réflexions : dispersion
• Cœur optique : diamètre 50 ou 62.5 microns
• Gaine optique : 125 microns
• Multimode 50 ou 62.5 (le plus courant aujourd’hui)
– Monomode (single mode) : rayons lumineux « en ligne droite »
• Cœur optique avec un diamètre plus petit : 9 microns
• Gaine optique : 125 microns
– Monomode pour de plus longues distances et plus haut débits
• Plusieurs fenêtres de longueurs d’onde possibles pour le
faisceau lumineux émis
– Fenêtres d’émission centrées sur : 850, 1300 et 1550 nm10
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 19
LAN : Liens physiques : FO
• Connectique :
– Epissures (définitif) ~ soudures
– Connecteurs : les plus répandus :
SC (encliquetage) et ST (baionnette)
• Emetteurs :
– Photodiodes (LED) : multimode, débits moyens,
distances courtes-moyennes, peu chers
– Lasers : multi ou monomode , très hauts débits,
longues distances, plus chers
– Plus faciles à installer sur de la fibre multimode
• Unidirectionnel : 2 FO pour une liaison
• Câbles généralement de 2 à 40 fibres
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 20
LAN : Liens physiques : FO
• Budget optique :
– Emetteur-récepteur : quelle « atténuation optique » maximale
possible peut-on avoir ?
• Ex 12 dB
– Affaiblissements dans chaque liaison
• Distance : lg de fibre : 3.5 dB/km pour FO 62.5 - 850 nm
• Connectique : épissure : 0.2 dB, connecteur : 2 dB, …
• Détérioration des éléments
– Affaiblissement total de la liaison < budget optique
• Multiplexage optique
– Multiples longueurs d’ondes sur une même fibre
– Protocole DWDM (Dense Wavelengh Division Multiplexing)
– Mutiplexeurs, démultiplexeurs, commutateurs optiques
– Choix n fibres ou multiplexage optique : coût11
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 21
LAN : Liens physiques : FO
• Avantages-inconvénients
– Débits possibles très élevés (potentiellement
immenses)
– Longues distances (dizaines voir centaines de km)
– Insensible aux perturbations électromagnétiques
– … confidentialité
• Utilisation
– C’est le support maintenant le plus utilisé en
interconnexion de bâtiments, en MAN et WAN
– Quelques fois en câblage de stations : cher
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 22
LAN : photos de FO et connecteurs
Connecteur SC Connecteur ST12
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 23
LAN : sans fil
Liaisons radio LAN (R-LAN - WIFI) : 2.4 GHz
• Architecture étoile
– Carte sur stations (PC, …) avec antenne
– Concentrateur avec antenne : borne
• Connecté au réseau câblé : borne
• Normes IEEE 802.11
• Même rôle que 802.3 pour Ethernet
• Distance max station-borne : entre 50 et 200 m
• Débits max
• 11 Mbits/s partagés (802.11b) : 10 M à 10 m, 1 M à 50 m
• Evolutions : Jusqu’à 54 Mbps (802.11a), 20 Mbps et + (802.11g)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 24
LAN : R-LAN
• Utilisation : intérieur de bâtiment (en R-LAN)
– Liaisons provisoires : portables, conférences, …
– Locaux anciens et protégés (impossible d’effectuer un
câblage)
• Problèmes
– Débit limité
– Sécurité : diffusion
• Contrôle de l’espace de diffusion
• WEP (Wired Equivalent Privacy)
• Fixe les adresses Ethernet
• Considère comme « externe » : ajout IPSec, …
• Se déploie très fortement actuellement
• MAN aussi : boucle locale radio (BLR 8M)13
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 25
LAN : sans fil
Liaisons laser
• Depuis de nombreuses années
• Point à point : interconnexion de réseaux
• Distance : 1 ou 2 km sans obstacle
• Débits : plusieurs Mbits/s
• Utilisation :
– Quand coût tranchées trop élevé ou domaine public
– Liaison provisoire
• Problème : réglage de la direction du faisceau
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 26
LAN-MAN : sans fil
• Faisceaux hertziens : de 2.4 à 40 GHz
– Pas les mêmes fréquences que R-LAN
– Demande une licence à l’ART et une redevance
– Maxima de débit : de l’ordre de
• 2 - 34 voir 155 Mbits/s jusqu’à plusieurs km
– Interconnexion de réseaux (et téléphone)
– Utilisation :
• Plutôt en MAN
• Demande une solide étude préalable (obstacles …)
• Interconnexion de sites distants sans besoin d’opérateur
• Utilisé par les opérateurs (France Télécom …)
• Satellite : pas en LAN !
– Service d’opérateur
– Quand FO non disponible14
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 27
LAN : câblage de bâtiment (TP)
(vocabulaire)
• Construction d’un bâtiment : pré -câblage
• TP : câblage courants faibles : informatique et téléphone
• Répartiteur : local technique
– Nœud de concentration et de brassage
– Arrivées-départ des liaisons, équipements actifs
• Dans un grand bâtiment
– 1 répartiteur général : RG
– n sous-répartiteurs : SR
– Entre RG et SR : câblage primaire : rocades ou colonnes
– Entre SR et prises stations : câblage horizontal
– Structure étoilée
• Câbles - connecteurs – cordons - jarretières – baies de
brassage
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 28
LAN : câblage de bâtiment (TP)
• Chemins de câbles :
– gaines techniques
– faux plafond
– goulottes, …
• Bureaux :
– Prises murales
– Recommandation CNRS : 3 prises (tél + info) par personne
• Tests après installation : cahier de recette
– Certification (classe d’installation : classe D)
– Réflectométrie
– Etiquetage – plans : obligatoire
• Base de données pour le système de câblage ?
• Travail de spécialistes
Sans bon câblage, pas de bons services
Câblage : fondations du réseau15
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 29
LAN : Photo baie de brassage optique
–
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 30
LAN : tous les Ethernets
• Protocoles pour LAN (au départ)
– Gigabit Eth : protocole différent (sauf trame) ? MAN
• Trame
– Adresse destination (MAC address) : 6 octets 08:00:20:06:D4:E8
– Adresse origine (MAC address) : 6 octets
– Type (IP = 0800) ou longueur (IEEE 802.3) : 2 octets
– Données : taille variable < 1500 octets
• Adresses (6 bytes) – MAC address
– Station : unique
• 3 premiers octets : constructeur
– CISCO 00:00:0C
– Sun 08:00:20
– HP 08:00:09
• 3 octets suivants : coupleur
– Broadcast : FF:FF:FF:FF:FF:FF
– Multicast : 1er octet impair16
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 31
LAN : Ethernet 10 M - 10Base5
• Protocole : Ethernet – IEEE802.3
• Début 1980
• Conçu pour 10Base5 : bus : coaxial : diffusion
• Méthode d’accès : CSMA-CD
– Carrier Sense Multiple Access-Collision Detection
– Accès multiple et écoute de porteuse – Détection de
collision
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 32
LAN : Ethernet 10 M - 10Base5
• 10 Mbits/s (partagés)
• CSMA-CD :
– Emet quand le media est libre
– Si autre signal sur le media durant émission : arrête l’émission
• RTD : round trip delay < 51.2 µs ? lg max réseau
• Taille minimum trame envoyée (correcte) : 64 bytes
• Quand trame taille < 64 bytes : collision
• 10Base5 : 5 câbles 500 m avec répéteurs : 2.5 km
• Problèmes 10Base5
– Coût : câble et connectique
– Sensibilité aux perturbations électromagnétiques
– Besoin d’une même terre
• Solution bas prix : 10Base2
– Thin Ethernet - 185 m - stations en coupure
• 10Base5 et 10Base2 ? 10BaseT17
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 33
LAN : Ethernet 10 M - 10BaseT
• CSMA-CD, 10 Mbits/s, RTD < 51.2 µs
• Câble : paire torsadée : UTP 5 – RJ45
• Architecture étoile : centre : hub (multirépéteur)
• Distance max hub-station ou hub-hub : 100 m
• 4 hubs max entre 2 stations : 500 m lg max
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 34
LAN : Ethernet 10 M : 10BaseF
• Pbs 10BaseT : perturbations – distance
– ? 10BaseF
• CSMA-CD, 10 Mbps, RTD < 51.2 µs
• Liaison : 2 FO multimode 50 ou 62.5
• Connecteurs SC ou ST
• Station – Répéteur : 1 km
• Répéteur – Répéteur : 2 km18
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 35
LAN : Ethernet 10 M
• Réseau au sens Ethernet : domaine de broadcast
• Avantage : protocole simple
• Problèmes :
– Débit limité (10 M partagé)
– Distances limitées
– Dépendance vis a vis de son voisin (collisions, charge)
– Broadcast : charge
– Pas de confidentialité (diffusion)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 36
LAN : Ethernet 100 M – 1000 M
• 100BaseT (IEEE802.3U) – Fast Ethernet 1995
– Idem 10BaseT (CSMA/CD, RJ45, …)
avec débit x 10 et taille réseau / 10
– TP (100BaseT) ou FO (100BaseF)
– Distance max : Hub – Station : 100 m (TP) - 412 m (FO)
– Lg max réseau 100BaseTX : 250 m
– Utilisation : serveurs ? stations
– Auto-négociation débit : 10 ou 100
• 1000Base – Gigabit Ethernet
– Idem 100Base avec débit x 10 – Taille min trame : 512 bytes
– Câblage FO ou TP de très bonne qualité
– Point à point, pas de diffusion
– Full duplex possible
– Utilisation : Serveurs - Backbone Campus – MAN
ATTENTION : toutes les distances max Ethernet citées :
réseau uniquement avec répéteurs-hubs19
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 37
LAN : Ethernets
• 10Base5
– 10 Mbits/s - Coax jaune - Lg max rép – station : 500 m
• 10Base2
– 10 Mbits/s – Coax fin – Lg max rép– station : 185 m
• 10BaseT (IEEE802.3 – 1990)
– 10 Mbits/s – 2 paires UTP – Lg max hub-station : 100 m
– 1 paire pour chaque sens de transmission
• 10BaseFL
– 10 Mbits/s – 2 FO (1 pour chaque sens)
– Lg max répet/ou stations : 2 km avec multimode 62.5
• 100BaseTX
– 100Mbits/s - 2 paires UTP catégorie 5
– Lg max hub-station : 100 m (réseau 250 m)
• 100BaseT4 (peu utilisé)
– 100Mbits/s - 4 paires UTP Catégorie 3 ou 4
– Lg max hub-station : 100 m (réseau 250 m)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 38
LAN : Ethernets
• 100 BaseFX
– 100 Mbits/s – 2 FO
– 412 m (HD) ou 2 km (FD) multimode 62.5
– 20 km monomode
• 1000BaseSX (IEEE802.3z)
– Sur 2 FO avec longueurs d’onde 850 nm
– Lg max : multimode 50 550 m – 62.5 220 m
• 1000BaseLX (IEEE802.3z)
– Sur 2 FO avec longueurs d’onde 1300 nm
– Lg max : multimode 50 550 m - monomode 5 km et plus
• 1000BaseT (IEEE802.3ab – 1999)
– Sur 4 paires UTP Cat 5E
– Longueur max 100 m20
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 39
LAN : schéma réseau campus de Jussieu
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 40
LAN : FDDI
• FDDI : Fiber Distributed Data Interface
• Protocole pour réseau local informatique
• Débit 100 Mbits/s (partagé)
• Anneau 2 FO multimode
• Nœud : station (SA/ DA)-concentrateur-routeur
• Réseau max : taille 100 km, 500 stations
C
S S S
S R
S S S S
Ethernet
S
S21
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 41
LAN : FDDI
• Accès au support par jeton (3 octets)
• Un jeton circule sur l’anneau
• Une station qui veut émettre
– Capture le jeton
– Envoie les trames de données
– Libère le jeton
– Retire ses trames au passage suivant
• Une station réceptrice
– Lit les trames qui lui sont adressées
– Modifie un champ des trames (FS) pour indiquer
qu’elle a lu la trame
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 42
LAN : FDDI
• Trame
– Adresse destination (6 octets idem Ethernet)
– Adresse source
– FS (Frame Status)
• Erreur
• Adresse reconnue
• Trame lue
– …
– Données : lg max 4500 octets
• Pb : station FDDI ? station Ethernet
– Taille des trames FDDI jusqu’à 4500 bytes alors que
max Ethernet est 1500
– Solution pour IP : fragmentation IP22
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 43
LAN : FDDI
• Circulation normale : anneau primaire
• Coupure anneau
– Rebouclage de l’anneau
– Mise en fonction : anneau secondaire
C
S S S
S R
S S S S
Ethernet
S
S Anneau primaire
Anneau secondaire
Fonctionnement normal
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 44
LAN : FDDI
C
S S S
S R
S S S S
Ethernet
S
S Anneau primaire
Anneau secondaire
C
S S S
S R
S S S S
Ethernet
S
S Anneau primaire
Anneau secondaire
Coupure de lien
Arrêt de station23
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 45
LAN : FDDI
Possibilité d’avoir des stations prioritaires
CDDI : FDDI sur paire torsadée
Bilan :
FDDI trop cher – pas assez de débit
Maintenant remplacé par Ethernet 100 ou Giga
Bon example de réseau anneau à jeton
C
S S S
S R
S S S S
Ethernet
S
S Anneau primaire
Anneau secondaire
Coupure lien station simple attachement
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 46
Rappels : caractéristiques IPv4
• Protocole réseau : couche 3
• Mode non connecté
• Eléments d’un réseau IP :
– Stations, réseaux (sens niv2), routeurs
• Informations : datagrammes (paquets)
• Entête datagramme :
– Version (4)
– TOS Type of Service : qualité de service
– TTL Time To Live : 60 ? 0 (-1 à chaque routeur)
– Identification protocole de transport (TCP, UDP, ICMP, …)
– Adresse IP de la station origine
– Adresse IP de la station destinataire
– …
• Taille datagramme < 64 Koctets
Souvent de taille d’environ 512 ou 576 bytes24
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 47
IPv4 : couche 4
• Couche 4 :protocole entre stations (pas entre routeurs)
• TCP : Transmission Control Protocol
– Paquet TCP = segment
– Mode connecté
– Transport fiable (contrôle d’erreurs, accusés de réception,
retransmission, …)
– Spécification des applications : numéros de port (origine,
destination) dans le segment
– Fenêtrage – Slow start: s’adapte à tous les débits
• UDP : UserDatagramm Protocol
– Pas de contrôle
– Mode non connecté
– Spécification de l’application : numéros de port (orig, dest)
– Protocole léger, permet multicast-broadcast facilement
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 48
IPv4 : ICMP
• ICMP : Internet Control Message Protocol
• RFC792
• Messages ’de contrôle’ émis par les stations ou
les routeurs
• Messages :
– Ralentir le débit d’émission
– Destination inaccessible
– Demande d’echo
– Réponse echo
– « Time To Live » exceeded
– Redirection
– ….25
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 49
IPv4 : couche 2
• IP / couche 2 : les datagrammes IP peuvent être
transportés par tous les types de réseaux :
– Ethernet RFC894 et RFC1042
– Liaison série : point à point (PPP RFC1331-1332)
– ATM (RFC1577)
– FDDI
– X25
– …
• @ IP ? @ couche 2 ?
– Ethernet, FDDI : broadcast : ARP, RARP
– ATM : serveur ARP
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 50
IPv4 : exemple trame Ethernet (TCP)
Une trame Ethernet avec un segment TCP a la forme :
• Entête Ethernet
– @ Ethernet destination
– @ Ethernet origine
– Type = 800
• Entête IP
– …
– Indication TCP
– @ IP origine
– @ IP destination
– …
• Entête TCP
– Numéro de port source
– Numéro de port destination
– …
• Données26
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 51
IPv4 : adresses
• 4 bytes 194.220.156.3
• Chaque coupleur de station ou de routeur a une
adresse
• Partie réseau (IP) : 194.220.156
• Partie station (IP) : 3
• Routeur : sépare (interconnecte) 2 réseaux IP
• Adresses (IP) de broadcast et de multicast
– 194.220.157.255 : broadcast sur réseau IP
194.220.157.0
• Détails dans les cours suivants
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 52
Eléments d’interconnexion
Ethernet - IP
• Pourquoi ? – Problèmes
• Répéteurs – Hubs (Ethernet)
• Ponts (Ethernet)
• Commutateurs Ethernet
• Routeurs (IP)
• Commutateurs-Routeurs (Ethernet-IP)27
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 53
Eléments d’interconnexion : pourquoi ?
• Ré-amplifier les signaux
– Electriques - optiques
– ? Augmenter la distance maximale entre 2 stations
• Connecter des réseaux différents
– Supports : Coax, TP, FO, Radio, Hertzien, …
– Protocoles niveau 2 : Ethernet, FDDI, ATM, … rieur
• « Limiter » la diffusion (Ethernet)
– Diminuer la charge globale
• Limiter les broadcast-multicast Ethernet (inutiles)
– Diminuer la charge entre stations
• Limiter la dépendance / charge des voisins
• Objectif in fine : garantir une bande passante disponible (une qualité de
service) entre 2 stations
– Limiter les problèmes de sécurité
• Diffusion ? écoute possible : pas de confidentialité
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 54
Eléments d’interconnexion : pourquoi ?
• Restreindre le périmètre de la connectivité désirée
– Extérieur ? Intérieur : protection contre attaques (sécurité)
– Intérieur ? Extérieur : droits de connexion limités
• Segmenter le réseau :
– Un sous-réseau / groupe d’utilisateurs : entreprises, directions,
services, …)
– Séparer l’administration de chaque réseau
– Créer des réseaux réseaux virtuels
• S’affranchir de la contrainte géographique
• Pouvoir choisir des chemins différents dans le transport
des données entre 2 points
– Autoriser ou interdire d’emprunter certains réseaux ou liaisons à
certains trafic28
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 55
Eléments d’interconnexion : problèmes
• Eléments conçus pour répondre a des besoins :
– Qui ont évolué au cours du temps
• Durée de vie courte des équipements
• Toujours mieux et moins cher
– Rapidement à moindre coût : pragmatique
• Chaque élément offre certaines fonctions
les « prioritaires » du marché de l’époque
• ? Problèmes :
– Classification, frontières sont un peu complexes
– Terminologie imprécise (dépend du contexte)
• Commerciaux rarement techniciens
• Attention : le choix est un compromis entre les
fonctions désirées et le coût
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 56
Eléments d’interconnexion : répéteur
• Répéteur (Ethernet)
– Boite noire dédiée
– Remise en forme, ré -amplification des signaux
(électroniques ou optiques)
– But augmenter la taille du réseau (au sens Ethernet)
• Exemple : distance maxentre stations A - C : 500 m ? 1000 m
Repeteur
Station A Station B
Station C
Coax 1
Coax 229
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 57
Eléments d’interconnexion : répéteur
• Travaille au niveau de la couche 1
• Ne regarde pas le contenu de la trame
• Il n'a pas d'adresse Ethernet
– Transparent pour les stations Ethernet
• Entre supports coaxiaux, TP et FO
• Avantages
– débit 10 Mb/s
– pas (ou très peu) d'administration
• Désavantages
– Ne diminue pas la charge
– Ne filtre pas les collisions
– N’augmente pas la bande passante
– Pas de possibilité de réseau virtuel (VLAN)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 58
Eléments d’interconnexion : hub
• Hub : muti-répéteur : étoile (obligatoire TP)
• Idem répéteur pour :
– Fonctions, avantages, désavantages
• Pour Eth 10 et 100
• Ex : Hub 8 ports TP
HUB Station
Station
Station
Station
Station Station
Station
d < 100 m
HUB Station
Station
10 M
10 M 10 M
10 M
10 M
10 M
10 M 10 M
10 M30
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 59
Eléments d’interconnexion : hub
• Fonction annexes :
– Affectation d’une @ MAC (@ Eth) à chaque brin : sécurité
– « Auto-negotiation » débit hub 10-100 (IEEE 802.3u)
– Surveillance SNMP
• Nombre maximum sur réseau Ethernet
– 10Base5 : 4 répéteurs
– 10BaseT : 4 hubs
• Distance max entre 2 stations : 500 m
– 100BaseT : 4 hubs
• Mais distance maxentre 2 stations : 250 m
– 1000BaseX : utilise des commutateurs
• Utilisation actuelle
– En « extrémité » de réseau (stations utilisateurs)
– Remplacés par des commutateurs Ethernet
• En cœur de réseau, pour serveurs, et même pour stations
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 60
Eléments d’interconnexion :hub
• Remarque : borne sans fil 802.11b = hub
• Face arrière hub stackable
– 3 x 24 ports TP (prises RJ45)
– 1 port FO (2 FO)31
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 61
• Aussi appelé répéteur filtrant ou "bridge"
• Niveau de la couche 2
– Traitement : valeur @ MAC destinataire ? transmet
ou non : trafic A-D ne va pas sur coax 2
– Localisation des @ MAC des stations par écoute
(auto-learning) ou fixée
– Ignoré des stations (transparent)
Elts d’interconnexion : pont (Ethernet)
Station A Station D
Station C
Coax 1
Coax 2
PONT
Station B
500 m
500 m
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 62
Elts d’interconnexion : pont
• Avantages
– Augmente la distance max entre 2 stations Ethernet
– Diminue la charge des réseaux et limite les collisions
• Le trafic entre A et D ne va pas sur Coax 2
• Remplacés en LAN par les commutateurs
• Fonctions supplémentaires : cf commutateurs
• Ponts distants
– Ethernet – Liaison spécialisée (cuivre ou hertzienne
ou laser)
– Encore utilisés32
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 63
Elts d’interconnexion : commutateur
• Commutateur – Switch Ethernet de niveau 2
– 10, 100, 1000 Mb/s TP ou FO
• Fonction : multi-ponts, cœur d’étoile
• Commute les trames Ethernet sur un port ou un
autre
– Matrice de commutation
COMM Station
Station Station
Station
Station Station
Station
d < 100 m
HUB Station
Station
1 G
10 M
100 M
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 64
Elts d’interconnexion : commutateur
• Mêmes fonctions et avantages que le pont +
augmentation de la bande passante disponible
• Matériels - logiciel
– Chassis ou boitier
– Cartes : 2 ports FO, 8 ports TP … avec débits 10, 100, 1000 Mb/s
– Système d’exploitation
– Configuration : telnet, client Web
– Surveillance : SNMP
• Quelques critères de choix techniques (performances)
– Bus interne avec un débit max : 10 Gb/s
– Vitesse de commutation nb de trames / s
– Bande passante « annoncée » : 24 Gb/s
– Nb d’adresses MAC mémorisable / interface33
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 65
Elts d’interconnexion : commutateur
• Permet : Ethernet Full duplex (TP ou FO)
– Emission et réception en même temps : 2x10 ou 2x100
– « Auto-negotiation» possible (IEEE 802.3u)
• Fonctions supplémentaires
– Auto-sensing débit (IEEE 802.3u)
– Affectation statique d’@ MAC et filtrage au niveau 2
– Spanning Tree : évite les boucles
• Construction d’un arbre
• A un instant : un seul chemin utilisé
– Réseaux virtuels : VLAN
– Port d’écoute qui reçoit tout le trafic des autres ports
• Analyseur
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 66
Elts d’interconnexion : commutateur
• Limitations d’un réseau de commutateurs
– Théoriquement pas de distance maximum
– Broadcast et multicast diffusés partout
– 1 seul réseau IP possible
• Très répandu :
– Local : workgroup switch
– Campus : complété par le routeur (plus « lent » et
plus cher)
– Remplacé par le commutateur-routeur (plus cher)
quand besoin34
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 67
Elts interconnexion :
commutateur et hubs
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 68
Elts interconnexion : routeur (IP)
• Niveau 3 : aussi appelé commutateur niveau 3
– Il y a des routeurs multi-protocoles
• On ne parlera que de IP
– Interconnecte 2 ou plus réseaux (ou sous-réseaux) IP
Station
Station
Station
hub
Routeur
Ethernet
192.88.32.0
COMM
Eth Station
Station
Station
Station
Ethernet
192.99.40.0
COMM
ATM Station
Station
ATM
129.88.0.035
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 69
Elts interconnexion : routeur (IP)
• Table de routage / @ IP destination
• N’est pas transparent pour les stations
– Chaque station doit connaître l’@ IP du coupleur du
routeur pour « le traverser »
• Pour le protocole Ethernet
– C’est une station Ethernet
– Chaque port possède une adresse Ethernet
• Matériels
– Chassis ou boitier
– Cartes : 2 ports FO, 8/16/24/32/48/64 ports TP … avec
débits 10, 100, 1000 Mb/s, LS, ATM, FDDI …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 70
Elts interconnexion : routeur (IP)
• Logiciel – performances
– Système d’exploitation
• IOS CISCO
– Configuration : avec telnet ou navigateur
– Surveillance : SNMP
– Performances :
• Nb de paquets routés/s
• Routage : ASIC
– Un PC Linux avec 2 cartes Ethernet peut faire
fonction de routeur
• Fonctions annexes : chapitre ultérieur du cours 36
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 71
Elts interconnexion :
Commutateur-routeur (IP)
• Multilayers switch
• Réunion des fonctions commutateur et routeur
dans une seule « boite »
• On peut configurer certains ports en
commutation, d’autres en routage
• L’équipement à tout faire
– Mais pour le configurer il est nécessaire d’avoir défini
l’architecture que l’on veut mettre en place
• Maintenant très performant avec des prix très
compétitifs
– Remplace les routeurs et les commutateurs
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 72
Elts interconnexion : commut-routeur
• Exemple de réseau de laboratoire
COMMUTATEUR-ROUTEUR
CAMPUS
FO
1G
FO
Serveur 1
Serveur 2 100 M TP
1 G
100 M TP
S1 S2 S3 S4 Mail WWW 10 M TP 10 M TP 10 M TP 10 M TP 10 M TP37
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 73
Elts interconnexion : commut-routeur
• Peut-être équivalent à :
ROUTEUR
CAMPUS
Serveur 1 Serveur 2
S1
S2 S3
S4
Mail WWW
COMMUT
COMMUT
COMMUT
3 (sous-)réseaux IP :
Serveur 1, Serveur2 – S1, S2, S3, S4 – Mail, WWW
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 74
Elts interconnexion : action /trame
Trame Ethernet contenant un datagramme TCP
• Entête Ethernet
– @ Ethernet destination ? Pont - Commutateur
– …
• Entête IP
– …
– @ IP destination ? Routeur
– …
• Entête TCP
– …
– Numéro de port destination ? Station (choix du service)
– …
• Données ? Application38
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 75
Elts interco : Architecture Eth - IP
Dans une entreprise
• Entre stations utilisateurs d’un service
– Hubs ou commutateurs
• Entre serveurs ou stations demandant du débit
(graphiques, …) d’un service
– Commutateurs
• Entre services
– Commutateurs ou routeurs
• Entre l’entreprise et l’extérieur (Internet)
– Routeurs
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 76
Ex interconnexion de réseaux Ethernet
Station M
Station L
Station K
hub
Routeur
COMM
Eth Station F
Station G
Station H
COMM
Eth Station J
Station I
Station E
Station D
hub
Station C
Station A
hub Station B
Pont
Station N
Station O
hub
Pont Station P
Station R Station Q
10 M
10 M
10 M 10 M
10 M
100 M
100 M
100 M
100 M
10 M
10 M
100 M
2 M
100 M
10 M
10 M
10 M
10 M 10 M
10 M
10 M
10 M
10 M
10 M
100 M39
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 77
Ex interconnexion de réseaux Ethernet
• Trame Eth A ? C. Arrive -t- elle à B ? E ? F ?
• Trame Eth P ? O. Arrive -t-elle à N ? M ?
• Trame Eth R ? Q. Arrive -t-elle à I ? J ?
• Trame Eth A ? L. Arrive -t-elle à K ?
• A -> Broadcast Eth. Arrive -t-il à B ? D ? G ? R ?
• L ? Broadcast Eth. Arrive -t-il à K ? O ? D ?
• Collision possible entre les 2 trames :
– A ? B et D ? E ? O ? N et M ? L ?
– G ? H et E ? F ?
• B a un coupleur défectueux (envoie des trames sans écoute ?
collisions). Cette station perturbe –t-elle A ? E ? G ? R ?
• F dans le même cas. G est-elle perturbée ?
• O dans le même cas. M est-elle perturbée ?
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 78
Ex interconnexion de réseaux Ethernet
• B émet un flot de données de 5 M b/s vers A en continu. Quelle
bande passante (théorique) reste-t-il à A ? C ? E ? F ? R ?
• G émet un flot de données de 5 M b/s vers H en continu. Quelle
bande passante (théorique) reste-t-il à F ? E ?
• G émet un flot continu de broadcast à 20 Mbps. Quelle bande
passante (théorique) reste-t-il à H ? E ? B ? R ?
• O émet un flot de broadcast à 2 Mbps. Quelle bande passante reste-til
entre N et M ?
• Les flots de données en parallèle suivants sont ils possibles ?
– 10 Mb/s A-B et 10 Mbps D-E ?
– 100 Mb/s R-Q et 10 Mbps I-J ?
– 10 Mb/s O-N et 10 Mb/s L-M ?
– 10 Mb/s F-G et 10 Mb/s F-H ?40
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 79
Liaisons longues distances - opérateurs
• Liaisons
– Commutées = temporaires ? partagées
• Pb : phase (+ ou - longue) d’établissement de connexion et de
déconnexion ? difficile pour un serveur
– Permanentes : entre 2 points fixes
• LS : Liaisons Spécialisées – Lignes Louées
• Opérateurs
– Opérateurs Telecom traditionnels : FT, Cegetel, …
Mais aussi SNCF, sociétés d’autoroutes, …
– Liaisons : FO, câbles cuivre, liaisons hertziennes, …
– Equipements : (dé)multiplexeur, commutateurs (en tous genres),
…
– Offres « sur mesure » - contrats spécifiques
– Offres « catalogue » : étudiées ici
– Les services « à valeur ajoutée » (d’interconnexion) seront
étudiés dans un chapitre ultérieur
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 80
Liaisons longues distances : utilisations
• Entreprises :
– Liaisons inter-sites
– Louent des liaisons spécialisées aux opérateurs
– Coût d’installation + coût de location
• Particuliers ou petites agences :
– Particulier - domicile ? entreprise
– Agence ? siège
– Utilisent les réseaux commutés
– Généralement : coût d’installation + location +
utilisation41
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 81
Liaisons commutées : RTC
Réseau Téléphonique Commuté
• Equipement : modem V90 56.6 Kb/s (réception)
– Emission à 33.6 Kb/s
• Modem micro : interne, externe sur port série …
• Particulier/agence ? LAN Entreprise
– Micro - Modem – RTC – Serveur d’accès RTC (pool
de modems – Concentrateur - Routeur) – LAN
(Ethernet) entreprise
• Fonction de ré-appel : coût et sécurité
• Authentification des utilisateurs : protocole – serveur RADIUS
– Micro – Modem – RTC – Fournisseur d’accès
Internet – Connexion Internet –Routeur – (Garde -
barrière) - LAN entreprise
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 82
Liaisons commutées : RTC
• IP
– Protocole niveau 2
SLIP ? PPP (Point to Point Protocol)
– Micro : @ IP statique ou dynamique (DHCP)
• Liaison non permanente
– Le micro ne peut pas être serveur
• Toujours très utilisé
– Réseau RTC partout
– Toujours plus de débit possible sur la paire torsadée42
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 83
Liaisons commutées : RNIS
Réseau Numérique à Intégration de Service
• ISDN (surtout Europe et Japon)
• Réseau national de FT : Numéris
• Accès de base (particulier-agence) : 144 Kb/s
– 2 canaux B à 64 Kb/s : téléphone + Internet par exemple
– 1 canal D à 14 Kb/s : signalisation
– Utilisation liaison téléphonique classique
– 25,5 E / mois en oct 02 (Numeris Itoo)
• Accès primaire (Entreprise : PABX) : ~ 2 Mb/s
– 30 canaux B à 64 Kb/s + 1 canal D à 64 Kb/s
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 84
Liaisons commutées : RNIS
• Connexion micro (particulier-agence)
– « Modem » RNIS : carte micro ou « modem» externe
sur port série
– Modem RTC - BoitierRNIS avec 2 prises
téléphoniques
– Chemin : Micro – Modem RNIS – Réseau Numéris –
(Modem RNIS) – Serveur d’accès RTC ou PABX -
Entreprise
• Interconnexion de sites : routeurs RNIS (2B + D)
• IP : idem RTC : PPP
• L’utilisation n’a jamais vraiment décollé
– Européen, surtout français : pas USA - Cher
– Encore utilisé en back-up ou pour liaisons provisoires43
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 85
Liaisons longues distance : ADSL
• ADSL : Asymmetric Digital Subscriber Line
• xDSL : technologie pour transmission à haut
débit sur le RTC
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 86
Liaisons longues distances : ADSL
• Modems :
– 512 Kb/s réception - 128 Kb/s émission
– 1 M b/s réception – 256 Kb/s émission (ADSL Pro)
• La liaison reste libre pour le téléphone
– Bande de fréquences utilisée # fréquences vocales
– Filtres : chez particulier et au répartiteur FT
• Contraintes :
– Poste téléphonique < 5 km d’un répartiteur FT
• Le cas de 80 % des foyers français
– Que le répartiteur FT soit connecté à un réseau ADSL
– Abonnement
• ADSL chez FT ou ailleurs
• Chez un fournisseur accès Internet
• Pack qui inclut les 244
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 87
Liaisons longues distances : ADSL
• Liaison particulier – entreprise :
– Micro – coupleur Ethernet ou port USB – Modem ADSL – RTC
– FAI ADSL – Internet – Routeur – LAN Entreprise
• IP : idem Ethernet
• Connexion permanente :
– Coût installation et mensuel (pas à la consommation)
– Possibilité de connecter un routeur côté particulier ou agence
mais fournisseur d’accès obligatoire
• Offre FT :
– Sans Internet : 30 E / mois ou 107 E / mois (ADSL Pro) en oct 02
• De plus en plus utilisé
– Pbs : monopole de FT, disponibilité selon le lieu
– Devrait devenir l’accès standard
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 88
Liaisons longues distances : X25
• Réseau à commutation de paquets :
– Couches 2-3
– Circuits virtuels
– Adresses X25
• Opérateur historique : Transpac
• Accès jusqu’à 64 Kb/s (ou guère plus)
• Les serveurs vidéotex (minitel) ont une
connexion X25
• Remplacé par IP sous toutes ses formes45
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 89
Liaisons spécialisées FT
• Transfix (nationales)
– 2.4 K b/s à 34 Mb/s
– STAS : Spécifications Techniques d’Accès au Service
– 2.4 K à 19.2 K : interfaces : V24, V28
– 64 K à 34 M : interfaces : X24/V11 ou G703-G704
– Modems fournis par opérateur
– Liaisons internationales : idem nationales mais plus difficiles à
mettre en place de bout en bout : sur-mesure
• Connexions :
– Routeurs
– Ponts (distants)
– Commutateurs ATM
– PABX Téléphoniques
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 90
Liaisons longues distances : modems
• MOdulateur DEModulateur
– Convertisseur digital/analogique ou adaptateur
digital/digital destiné à transporter des données sur
des lignes point à point
• Plusieurs types de modems :
– RTC : Liaisons commutées : asynchrones
historiquement
– LS : Liaisons permanentes : synchrones
– RNIS
– Câble
– ADSL
– TV
– …46
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 91
Modems RTC
• Programmation :
– Commandes AT (origine Hayes)
• Fonctions :
– Contrôle de flux XON/XOFF ou RTS-CTS
– Correction d’erreur (MNP 34, V42, ARQ)
– Compression (MNP5, MNP7, V42Bis)
– Adaptation automatique débits et fonctions
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 92
ATM : plan
• Objectifs
• QoS : Qualité de Service
• Couches 1 et 2
• Commutateurs
• Routage
• Architectures LS et LANE
• Bilan
• Exemple47
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 93
ATM : objectifs
• ATM : Asynchronous Transfert Mode
• Origine : CNET (FT R&D)
– Opérateur téléphone à l’origine
• Supporter tout type de communication
Voix – Vidéo - Données informatiques
• Mieux utiliser la bande passante
– Téléphonie longue distance
• Fonctionner à très hauts débits : Gbits/s
• Garantir une qualité de service (QoS) à chaque
utilisateur (application) de bout en bout
• Démarche très théorique
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 94
ATM : objectifs
• Mêmes protocoles et technologies en LAN, MAN
et WAN
• Caractéristiques des réseaux / services attendus
– Bande passante (bps) partagée : garantie si possible
– Temps de latence (délai de transmission) :
minimum et constant si possible
• Dépend distance, éléments actifs, charge (files d’attente)
– Jitter (variation temps de latence) : min si possible
– Taux de pertes : min si possible
– …
ATM veut fournir ces services
? Protocoles et technologies complexes48
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 95
ATM : Exemple de QoS : Téléphonie
• Entendre tous les mots
– Faible taux de pertes
• Contrainte : bit error rate < 10-2
– Débit constant garanti
• Contrainte : 64 Kbits/s sans compression ---> 5 Kbits/s avec
• Recevoir au même rythme que l'émission
– Temps de latence fixe : contrainte :jitter < 400 ms
• Dialogue possible
– Temps de latence faible
– Poste avec annulation d'echo
• Retransmissions : inutiles
• Mode connecté bien adapté
• Exemple d'incompatibilité (théorique)
Téléphone et Ethernet
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 96
ATM QoS : classes de service
• Problème : pour supporter toutes les qualités de
service sur tous les réseaux ATM il faudrait surdimensionner
:
– Les liaisons : bande passante et caractéristiques
– Les équipements : performances et fonctionnalités
• Solution ATM :
– On regroupe les applications qui demandent des
qualités de service similaires ? 4 groupes
– On définit 4 classes de services que peuvent offrir les
réseaux (liens et équipements) ATM qui
correspondent aux 4 groupes : UBR, ABR, CBR, VBR 49
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 97
ATM QoS : classes de services
• UBR – Unspecified Bit Rate
– Les applications peuvent émettre un flux variable
jusqu’à un débit maximum
– Réseau : aucune garantie – pas de contrôle de flux
– Service très dégradé
• ABR – Available Bit Rate
– Pour supporter des applications qui peuvent utiliser
toute la bande passante disponible, avec un service
« Best Effort » de type IP
– Exemples : applications qui utilisent TCP (FTP,
HTTP, …), interconnexion d’Ethernets
– Services réseau
• Aucune garantie (bande passante, temps de latence, …)
• Mais mécanisme de contrôle de flux
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 98
ATM QoS : classes de services
• CBR – Constant Bit Rate
– Pour supporter les flux à débit constant de données
– Exemple d’application : téléphone
– Services réseau : bande passante réservée, temps de latence fixe
• VBR – Variable Bit Rate
– Pour supporter les applications à débit variable mais qui
demandent certaines garanties (par exemple une bande passante
minimum garantie à tous les instants)
– Exemple : multimédia : vidéo compressée à débit variable …
– Services réseau :
• Bande passante minimum garantie
• Bande passante maximum garantie pendant un temps maximum fixé
• Temps de latence
• ….
– ? Très complexe à réaliser50
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 99
ATM 1-2 : mode connecté
• Problème : quand demande-t-on une (des)
qualité(s) de service au réseau ?
• Statiquement : à l’abonnement
– (Ou lors de la conception du réseau)
• A chaque session : mode connecté
– Ouverture d’une connexion de bout en bout
• En indiquant ce dont on a besoin
– Transfert d’informations
– Fermeture d’une connexion
• Appel destinataire (ouverture connexion)
– Adresse destinataire ? Numéro de VP et de VC
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 100
ATM 1-2 : les cellules
• Données dans des cellules
• Taille fixe : 53 octets
– Compromis
• Petite (avantage : faible temps de propagation, …)
• Grande (avantage : moins de traitements, …)
– Facilite les implémentations hardware
– Facilite l'allocation de bande passante
• Ni détection, ni récupération d'erreur
En Tête Information (Payload)
53 Octets
5 Octets 48 Octets51
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 101
ATM 1-2 : structure de la cellule
Champ Information
48 octets
GFC VPI
VPI VCI
VCI
VCI PT CLP
8 bits
HEC
GFC Generic Flow Control
VPI Virtual Path Identifier (8 bits : 256)
VCI Virtual Channel Identifier
(16 bits : 64000 possibilités)
PT Payload Type
Message d’administration ou
d’information
Etat de congestion
(MAJ par commutateur)
CLP Cell Loss Priority
"priorité" à la destruction si 1
HEC Header Error Check
sur l'en-tête de la cellule
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 102
ATM 1-2 : UNI (standard)
• UNI : User to Network Interface
– Comment établir une connexion
– Comment la rompre
– Format des paramètres de qualité de service
• Débit, taux d’erreur, temps de latence, …
– Format d’adresse : 20 octets
Emetteur Réseau Récepteur
Début de
l'appel
Setup
Call proceeding
Connect
Connect Ack, facultatif
Setup
Connect
Connect Ack
Call proceeding
Appel
terminé
Appel
accepté
Appel reçu
Etablissement connexion52
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 103
ATM 1-2 : adresses : 3 types
AFI : Identificateur de l'autorité et du format
HO-DSP : High Order Domain Specific Part, utilisé pour supporter des protocoles de routages hiérarchiques.
ESI : End System Identifier, en fait la MAC adresse (idem Ethernet)
1 2 10 6 1
1 2 10 6 1
DCC ATM Format
ICD ATM Format
AFI
39
AFI
47
DCC
ICD
HO-DSP
HO-DSP ESI SEL
ESI SEL
1 8 4 6 1
E.164 ATM Format
AFI
45
E.164 HO-DSP ESI SEL
Data
Country
Code
Code
organisation
IDI
IDP
IDI
IDP
IDI
IDP
Initial domain identifier
Initial Domain Part
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 104
ATM 1-2 : liaisons
• Point à point
• Liaisons spécialisées câble cuivre (longues distances)
– E1 (2 Mbits/s), E2 (34 Mbits/s)
– T1 (1.5 Mbits/s), T3 (45 Mbits/s)
– ….
• Liaisons FO
– FO multimode 155 Mbits/s (OC 3)
– FO multimode ou monomode 622 Mbits/s (OC12)
– ….
• Liaisons TP
– 155 Mbps UTP cat5
– 52 Mbps UTP cat3
– ….53
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 105
ATM : commutateurs ATM
• Eléments d’interconnexion de niveau 2
• Commutateur ATM
– Interconnecte des liaisons ATM (point à point)
– Commute les cellules sur une liaison ou une autre /
table de routage
• Cellule contient les numéros de VP et de VC
– Etablissement des VP et VC
• Statiquement
• Dynamiquement lors de l’ouverture de la connexion
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 106
ATM : commutateurs ATM
• Structure d’un réseau ATM
COMM
ATM
Station
Station
Station
Station
Station
Station
COMM
ATM Station
Station
hub
Routeur
Eth
COMM
ATM54
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 107
ATM : commutateurs
• VP et VC
Chemin de transmission
VP
VP
VP
VC
VC
VC
VC
VC
VC
VC VC
VC
VC
VC
VC
VC
VC
VP
VP
VP
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 108
ATM : commutateurs
• Commutateur de VP et de VC
VC Switch
VP Switch
VP 1
VP 6 VP 2
VP 7
VP 5
VC 1
VC 2
VC 1
VC 2
VC 3
VC 4
VC 1
VC 255
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 109
ATM : routage
Switch
1
2
3
Link 1 Routing Table
VCI-in Link out VCI-out
1 2 2
2 2 4
3 3 3
4 3 6
Link 2 Routing Table
VCI-in Link out VCI-out
2 1 1
4 1 2
Link 3 Routing Table
VCI-in Link out VCI-out
3 1 3
6 1 4
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 110
ATM : routage
Switch
1
2
3
Link 1 Routing Table
VCI-in Link out VCI-out
1 2 2
2 2 4
3 3 3
4 3 6
Link 2 Routing Table
VCI-in Link out VCI-out
2 1 1
4 1 2
Link 3 Routing Table
VCI-in Link out VCI-out
3 1 3
6 1 4
VCI = 456
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 111
ATM : routage
Switch
1
2
3
Link 1 Routing Table
VCI-in Link out VCI-out
1 2 2
2 2 4
3 3 3
4 3 6
Link 2 Routing Table
VCI-in Link out VCI-out
2 1 1
4 1 2
Link 3 Routing Table
VCI-in Link out VCI-out
3 1 3
6 1 4
VCI = 4 VCI = 4
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 112
ATM : routage
Switch
1
2
3
Link 1 Routing Table
VCI-in Link out VCI-out
1 2 2
2 2 4
3 3 3
4 3 6
Link 2 Routing Table
VCI-in Link out VCI-out
2 1 1
4 1 2
Link 3 Routing Table
VCI-in Link out VCI-out
3 1 3
6 1 4
VCI = 4 VCI = 4
VCI = 657
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 113
ATM : routage
Switch
1
2
3
Link 1 Routing Table
VCI-in Link out VCI-out
1 2 2
2 2 4
3 3 3
4 3 6
Link 2 Routing Table
VCI-in Link out VCI-out
2 1 1
4 1 2
Link 3 Routing Table
VCI-in Link out VCI-out
3 1 3
6 1 4
VCI = 4
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 114
ATM : routage
Switch
1
2
3
Link 1 Routing Table
VCI-in Link out VCI-out
1 2 2
2 2 4
3 3 3
4 3 6
Link 2 Routing Table
VCI-in Link out VCI-out
2 1 1
4 1 2
Link 3 Routing Table
VCI-in Link out VCI-out
3 1 3
6 1 4
VCI = 4
VCI = 458
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 115
ATM : routage
Switch
1
2
3
Link 1 Routing Table
VCI-in Link out VCI-out
1 2 2
2 2 4
3 3 3
4 3 6
Link 2 Routing Table
VCI-in Link out VCI-out
2 1 1
4 1 2
Link 3 Routing Table
VCI-in Link out VCI-out
3 1 3
6 1 4
VCI = 2 VCI = 4
VCI = 4
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 116
Tables de routage ATM
Commutateur
port 1
Table de routage
Station VCI
B 2
C 3
Station A
Table de routage port 1
VCI-in Port- out VCI-out
2 2 2
3 3 6
Table de routage
Station VCI
A 2
C 4
Table de routage
Station VCI
A 6
B 8
Station B Station C
port 2
port 3
Table de routage port 2
VCI-in Port- out VCI-out
2 1 2
4 3 8
Table de routage port 3
VCI-in Port- out VCI-out
6 1 3
8 2 459
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 117
Architectures ATM
• On peut bâtir plusieurs types d’architecture sur
un réseau ATM
– Liaisons spécialisées point à point
– Des réseaux LANE : émulation de LAN
– Des réseaux classical IP : architecture IP
• Traité dans la partie « Architecture IP »
• Et on peut mixer l’ensemble
– Ce que font les opérateurs
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 118
Architecture ATM : Liaison spécialisée
• Utilisation courante : location de VC ou de VP entre 2
sites à un opérateur qui possède un réseau ATM
– WAN
– Débit demandé pour la liaison
– Certaines qualités de service assurées : ABR, CBR, …
• Connexion des sites aux extrémités :
– Commutateur ATM
• S’il y a un réseau ATM sur le site, permet de garantir certaines qualités
de service jusqu’à l’intérieur du site.
– Routeur IP (fourni par le site) avec une carte ATM
• Sur le site : réseaux Ethernets par exemple
• Routeur fourni ou non par l’opérateur
– Commutateur ou routeur Ethernet
• L’opérateur fournit l’équipement ATM ?? Ethernet
• ATM est « invisible » pour le site60
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 119
Architecture ATM : LANE : buts
• LANE : LAN Emulation
– ELAN : EmulatedLAN
• Objectifs :
– Interconnexions (niveau 2) de réseaux locaux comme
Ethernet à travers un réseau ATM
– Intégration de stations ATM comme « stations
Ethernet »
– But : rendre « invisible » les commutateurs ATM aux
réseaux Ethernet ? LAN emulation
• En LAN mais aussi en MAN
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 120
Architecture ATM : LANE : schéma
Commutateur
ATM
Commutateur
ATM
Commutateur
ATM
Réseau ATM
Station A
ATM
A
T Routeur IP
M
Commutateur
ATM - Eth
Commutateur
ATM - Eth
Commutateur
ATM - Eth
hub Station Eth
Station Eth
Station Eth
hub Station ETH
Station ETH
Station ETH
hub Station Eth
Station Eth
Station Eth
hub Station Eth
Station Eth Station Eth
Station B
ATM
hub
Station Eth
Station Eth
Serveur LANE61
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 121
Architecture ATM : LANE
• Emule un réseau Ethernet (de commutateurs) :
– Stations Eth + Stations ATM A et B
– Stations ETH ne font pas partie de ce réseau
• Sur LANE : interconnexion de niveau 2
– On peut utiliser d’autres protocoles que IP
• Logiciels :
– Stations Eth : pas de logiciel spécifique
• ATM « transparent »
– Stations ATM, routeur IP, Commut ATM-Eth : LEC
• LAN Emulation Client
– Sur réseau ATM : « serveur » LANE
• LECS (Configuration Server)
• LES (LAN Emulation Server)
• BUS (Broadcast and Unknown Server)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 122
Architecture LANE : pbs à résoudre
Transformation @ Eth ? ? @ ATM
• Lorsqu’une station ATM se connecte sur le réseau
(A, B, commutateur ATM-Eth, routeur ATM IP)
– Elle connaît l’adresse ATM du Serveur LANE (config manuelle)
– Elle s’enregistre auprès du Serveur LANE :
• J’ai telle @ ATM
• J’ai, ou je connais les @ Ethernet suivantes …
• Lorsqu’une station ATM veut envoyer une trame
Ethernet à une station X
– Interroge le Serveur LANE : qu’elle est l’adresse ATM de la
station Ethernet X ?
– Le Serveur lui indique l’adresse ATM
– La station ouvre une connexion ATM avec la station ATM
– ….62
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 123
Architecture LANE : pbs à résoudre
Broadcast Eth ? Réseau mode connecté ATM
• Lorsqu’une station ATM veut envoyer un
broadcastEthernet
– Elle envoie la trame vers le Serveur LANE
– Celui-ci ouvre autant de connexions que de stations
ATM sur le LANE
– Il envoie la trame à toutes les stations ATM
• Ouverture-fermeture de connexion ATM
– Mécanismes de time -out pour ne pas trop ouvrir ou
fermer de connexions ATM
• On peut avoir plusieurs ELAN sur un réseau
ATM
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 124
ATM : bilan
• Très complexe :
– Cher
– Très délicat à faire fonctionner
• Utilisé en MAN et WAN par opérateur :
– Location de VC statiques entre 2 points (équivalent de LS)
• Reconfiguration lorsque location de nouvelles liaisons
• Garantit de bande passante
– Création de réseaux virtuels ELAN
• Utilisation en LAN
– Années 1995-2000
– Remplacé par Gigabit Ethernet maintenant
– Avantage restant : peut intégrer le téléphone (PABX)
• Utilisation en MAN et WAN
– Encore très utilisé
– Remplacé par DWDM, IP directement sur FO, …
• Bon exemple de réseau multiservices en mode connecté63
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 125
ATM exemple : réseau MAN (C3I2)
VPs C3I2 à
10 M, 20, 30, 35, …
selon les sites
VPs SAFIR
à 2, 4 ou 10 M
SAFIR
France
C3I2
Grenoble
INRIA
Montbonnot
Domaine
universitaire
INPG
Felix Viallet
CNET
Meylan
CEA
Polygone
CNRS
Paris
Jussieu
Lyon
La Doua
Rouen
Crihan
Toulouse
CICT
CEA
Saclay
Sophia
INRIA
EDF
Clamart
Liaison interne
au site à 155 M
Prise C3I2 à 155 M
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 126
Ex d’architecture : dorsale Jussieu64
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 127
Ex d’architecture : tour
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 128
Ex d’archi : interco 2 bâtiments distants65
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 129
Ex d’archi : interco 2 bâtiments distants
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 130
Ex d’archi : RAP : MAN
• Réseau Académique Parisien
• Universités, CNRS, INSERM, …
– 300 000 étudiants – 40 000 personnels
– 99 sites Paris intra-muros
• Réseau privé : ART …
• 5 POP (Point Of Presence)
– Jussieu (27 sites)
– Odéon (34 sites)
– Auteuil (15 sites)
– Malesherbes (10 sites)
– CNAM (13 sites)
• Ouverture: été 200266
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 131
Ex d’archi : RAP : câbles
• Fibre noire : Single Mode G652
– 69 sites
– Lg totale (liaison) : 356.1 km
– Métro : 312 km
– Egouts : 33 km
– Génie civil : 0.3 km
– Plus petite liaison : 1 km, plus grande : 9.6 km
• BLR (Boucle locale radio)/ S-HDSL (« ADSL »
particulier)
– 23 sites à 2 Mbits/s
• Faisceaux hertziens
– 2 sites proches de Paris
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 132
DWDM
Infrastructure
de transport optique
Ex d’archi : RAP : services réseau
Data, voice, vidéo, multimédia, VPN …
ATM
SDH/SONET
Ethernet
IP
DWDM
Infrastructure
de services
Services67
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 133
Ex d’archi : RAP : Architecture
Odéon
W
W
E
E
Auteuil
Jussieu E
dwdm
dwdm
dwdm
cr
cr
cr
s-atm
s-atm
Site F Eth 100
Gigabit Ethernet
ATM OC12
GigaEthernet
8410 m
3100 m
W W E
E
Malesherbes
dwdm
s-atm
cr
dwdm
cr
s-atm
Site A
Site D
Site C
c
c
NRD
ATM
IP
5082 m
8672 m
5120 m
ATM OC3
Eth 100
10 longueurs d’onde
20 réseaux optiques virtuelsSP SP
Site B
s-atm
s-atm
gw-rap
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 134
Architecture logique IP : plan
Dans ce chapitre : réseau = réseau IP
• Adresses IP
• Affectation statique ou dynamique (DHCP)
• Plan adressage IP
• Routage IP
• Exemple de répartition d’utilisateurs et de
services
• Architecture ATM : classical IP68
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 135
Architecture IP : réseaux IP
Station M
Routeur
COMM
Eth
Station G
Station H
COMM
Eth Station J
Routeur
Station C
Station A
hub Station B
Station N hub Station O
Routeur Station P
Station Q
Station R
LS 1 M
256 Kb/s
Station L
hub
Fournisseur d’accès
Internet
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 136
Architecture IP : adresses
• Une adresse IP par coupleur (machine, routeur)
• Format : 4 octets notation décimale A.B.C.D
– Ex : 130.190.5.3 193.32.30.150
• Une adresse doit être unique au monde
– Pour l’accès depuis l’Internet
• ? Surtout pour les serveurs
– Pas obligatoire pour les stations clientes Internet
• ? Intervalles d’adresses locales
• 2 ou 3 parties dans une adresse IP :
– @ de réseau – (@ sous-réseau) - @ machine
• Elément qui sépare 2 (ou +) réseaux ou sousréseaux
IP : routeur (ou commut-routeur)69
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 137
Archi IP : @ (ancienne classification)
• Classe A : A.B.C.D avec A ? 127
– 1er octet : @ de réseau : 126 réseaux possibles
– Reste : 254 x 254 x 254 (16 M) machines adressables
– Ex : DEC : 16.0.0.0 MIT : 18.0.0.0
• Classe B : 128 ? A ? 191
– 2 premiers octets : @ de réseau
• 64 x 254 : 16 000 réseaux possibles
– Reste : 254 x 254 (64 000) machines adressables
– Ex : IMAG : 129.88.0.0 Jussieu : 134.157.0.0
• Classe C : 192 ? A ? 223
– 3 premiers octets : @ de réseau
• 31x 254 x 254 (2 M) de réseaux possibles )
– Dernier octet : 254 adresses de machines
• IBP : 192.33.181.0 CITI2 : 192.70.89.0
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 138
Archi IP : sous-réseaux (subnets)
• Sous-réseaux : découpage d’un réseau IP (classe A, B, C)
• Les sous-réseaux d’un même réseau (subnetté) devaient
avoir une taille identique (contrainte routeurs) :
– Masque de subnetspécifiait le découpage
– Bits qui désignent la partie réseau + sous-réseau = 1
– 192.33.181.0 découpé en 4 sous-réseaux
• Masque 255.255.255.192
• 192.33.181.0-192.33.181.63
• 192.33.181.64-192.33.181.127
• 192.33.181.128-192.33.181.191
• 192.33.181.192-192.33.181.255
• Les routeurs permettent maintenant de créer des sousréseaux
de tailles différentes
• Les sous-réseaux sont connexes
– Non séparés par un autre réseau IP
– Découpage en sous-réseaux n’est connu que du propriétaire du
réseau (site, entreprise, provider, …), pas de l’Internet70
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 139
Archi IP : classless
• Pour obtenir une adresse de réseau (unique)
– Auprès de son fournisseur d’accès à l’Internet
– AFNIC (France) – RIPE (Europe)
– Classe A : impossible
– Classe B : presque impossible (épuisé)
– Classe C ou partie de Classe C : OK
• Nouvelle notation et découpage : classless
– Réseau 129.88.0.0 ? Réseau 129.88/16
– Réseau 192.33.181.0 ? Réseau 192.33.181/24
– Réseaux (sous-réseaux avant)
• 192.33.181.0/26 : 192.33.181.0-192.33.181.63
• 192.33.181.64/26 : 192.33.181.64-192.33.181.127
• 192.33.181.128/26 : 192.33.181.128-192.33.181.191
• 192.33.181.192/27 : 192.33.181.192-192.33.181.223
• 192.33.181.224/27 : 192.33.181.224-192.33.181.255
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 140
Archi IP : @ particulières
• Classe D : 224? A ? 239 : multicast
– 224.10.15.3 : ? groupe de stations sur l’Internet (n’importe où)
• Classe E : 240 ? A ? 254 : utilisation ultérieure
• Adresses locales (ne doivent pas sortir sur l’Internet)
– 10.0.0.0 à 10.255.255.255 : 10/8
– 172.16.0.0 à 172.31.255.255 : 172.16/12
– 192.168.0.0 à 192.168.255.255 : 192.168/16
• Loopback (soi-même) : 127.0.0.1
• 0.0.0.0 : quand station ne connaît pas son adresse
• 130.190.0.0 : le réseau 130.190/16
• 130.190.255.255 : broadcast
– Toutes les machines du réseau 130.190/1671
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 141
Archi IP : Affection @ IP à une station
• Configuration statique
– Unix : commande ifconfig
– Windows (2000 pro) : panneau de conf – connexion réseau –
TCP/IP
• Configuration dynamique : DHCP
– Serveur DHCP (Dynamic Host Configuration Protocol) dans un
réseau IP avec une plage d’adresses à attribuer
– Station sans adresse IP fait une demande DHCPDISCOVER
• @ IP source 0000 @IP dest 255.255.255.255
• Contient @ Ethernet et nom de la station
– Serveur DHCP répond :
• Adresse IP - Masque de sous-réseau – informations de routage
• Adresses DNS – Nom de domaine
• Durée du bail
– Explication simplifiée (plusieurs serveurs DHCP possibles, …)
– Avantage : pas de conf sur stations, portables, économie d’@
– Désavantage : qui est qui ?
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 142
Archi IP : pbs adresses IP
• Adressage ni hiérarchique, ni géographique
– Tables de routages énormes au cœur de l’Internet
– Distribution des adresses
• Au compte-goutte (maintenant bataille commerciale)
• Uniquement 4 bytes (et certaines plages vides)
? Pénurie d’adresses
– FAI : adresses dynamiques aux clients
– Entreprises – FAI :
• Adresses locales sur réseau privé
• NAT : Network Address Translation
– Et PAT : Port Address Translation
– IPv672
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 143
Archi IP : plan d’adressage
• Un routeur sépare 2 (ou plus) réseaux ou sous-réseaux IP
• Il faut construire un plan d’adressage
– Découper l’espace d’adressage dont on dispose en sous-réseaux
et le répartir entre les stations
• Eléments à prendre en compte :
– Les routeurs séparent les sous-réseaux
• Proximité géographique des stations
• Ou non si VLAN
– Dans un sous-réseau on est dépendant de son voisin
• Broadcast Ethernet par exemple
– On regroupe dans un même sous-réseau les stations qui
travaillent entre elles (d’un service par exemple)
• La majorité du trafic reste local au sous-réseau (évite de charger les
autres sous-réseaux
• Profils de connexion et de sécurité identiques
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 144
Archi IP : plan adressage 192.33.181/24
192.33.181.129
Routeur 3
COMM
Eth
192.33.181.141
192.33.181.142
COMM
Eth 192.33.181.200
Routeur 2
192.33.181.67
192.33.181.65 (B)
hub
192.33.181.66 (A)
192.33.181.2 hub 192.33.181.3
Routeur 1
192.33.181.5
192.33.181.201
192.33.181.202 (C)
LS 1 M
256 Kb/s
192.33.181.130
hub
Fournisseur d’accès
Internet
192.33.181.0/26
192.33.181.64/26
192.33.181.128/26
192.33.181.192/27
192.33.181.224/27
Quelles @ manquent ils ?73
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 145
Archi IP : plan adressage 192.33.181/24
192.33.181.129
Routeur 3
COMM
Eth
192.33.181.141
192.33.181.142
COMM
Eth 192.33.181.200
Routeur 2
192.33.181.67
192.33.181.65 (B)
hub
192.33.181.66 (A)
192.33.181.2 hub 192.33.181.3
Routeur 1
192.33.181.5
192.33.181.201
192.33.181.202 (C)
LS 1 M
256 Kb/s
192.33.181.130
hub
Fournisseur d’accès
Internet
192.33.181.0/26
192.33.181.64/26
192.33.181.128/26
192.33.181.192/27
192.33.181.224/27
192.33.181.203
192.33.181.231
192.33.181.10
192.33.181.230
192.33.181.80
192.33.181.150
192.33.181.145
X
Pour l’administration des équipements, il en manque d’autres …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 146
Archi IP : routage IP
• A (192.33.181.66) veut envoyer un datagramme IP à B
(192.33.181.65)
– Pb : A doit envoyer une trame Ethernet mais ne connaît l’@ Eth
B
– Elle envoie un broadcast Ethernet sur le réseau qui demande :
quelle est l’@ eth de B ? (l’@ Eth de A est spécifiée dans la trame
Ethernet : @ Eth origine)
– B répond à l’@ Eth A en disant : je suis 192.33.181.65 et mon
adresse Ethernet est @ Eth B
– A peut alors envoyer alors les datagrammes IP dans des trames
Ethernet (elle connaît l’@ Eth de B)
– Mécanisme : ARP – RARP
• A (192.33.181.66) veut envoyer un datagramme à C
(192.33.181.202)
– Elle doit envoyer une trame Eth au routeur 2 : 192.33.181.80
– Il lui manque cette information ? Information de routage74
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 147
Archi IP : routage IP
• Chaque station doit être configurée pour spécifier
– Son adresse IP (Commande Unix ifconfig)
– L’adresse du sous-réseau sur laquelle elle est (Commande Unix
ifconfig)
– Une table (de routage) qui indique comment atteindre les autres
réseaux (Commande Unix route add)
• Exemple A
– @ IP : 192.33.181.66 - @ Réseau : 192.33.181.64/26
– Routes (numéro IP du prochain routeur destinataire) :
• 192.33.181.128/26 ? 192.33.181.80
• 192.33.181.224/27 ? 192.33.181.80
• 192.33.181.192/27 ? 192.33.181.80
• 192.33.181.0/26 ? 192.33.181.80
• Reste du monde (default route) ? 192.33.181.80
• La route par défaut (default route - default gateway) suffit
• Toutes les stations doivent être configurées
– Ex : mon PC dans panneau de configuration …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 148
Archi IP : routage IP
• Les routeurs aussi doivent être configurés
– Par port : @ IP, @ Réseau (ou sous-réseau)
– Table routage
• Exemple routeur 3 :
– Port 1 : 192.33.181.230 - réseau 192.33.181.224/27
– Port 2 : 192.33.181.145 – réseau 192.33.181.128/26
– Port 3 : 192.33.181.203 – réseau 192.33.181.192/27
– Port 4 : X – réseau Y
– Table routage
• Route 192.33.181.64/26 ? Port 2 : 192.33.181.150
• Route 192.33.181.0/26 ? Port 1 : 192.33.181.231
• Route default ? Port 4 : routeur du fournisseur d’accès
• Exemple : envoi datagramme B ? C75
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 149
Archi IP : routage IP
• Routage statique
– Mise à jour tables de routage : manuelle
– ICMP redirect : Ce n’est pas ici c’est ailleurs
– Problème : intervention manuelle
• Quand le réseau évolue : modification manuel des tables
• Quand plusieurs chemins possibles et coupures
– Utilisé généralement au niveau des stations, dans
certains routeurs d’extrémités
• Routage dynamique
– Protocoles entre routeurs et entre routeurs et stations
pour mettre à jour automatiquement les tables de
routages : annonces de routes
– Ex : RIP, OSPF, BGP
– Cf cours sur le routage
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 150
Archi IP : routage IP
• L’Internet ne fonctionnerait pas sans bons
protocoles de routage et sans experts pour les
faire fonctionner
• C’est une problématique surtout d’opérateurs
Internet
– A laquelle s’ajoutent les accords de peering
• Routeurs doivent être très rapides
– Traitement du routage directement en ASIC
• Routeurs au cœur de l’Internet : doivent
connaître toutes les routes : impossible ?
Agrégation de plages d’adresses de réseaux IP
• On n’est pas obligé d’avoir une route par défaut
sur tous les équipements : sécurité76
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 151
Archi IP : répartition d’utilisateurs
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 152
Architecture ATM : classical IP
• Objectif :
– Utiliser un réseau ATM pour transporter des
datagrammes IP
• RFC 1483
– Comment encapsuler (transporter) les datagrammes
IP dans des cellules ATM
• RFC 1577
– Comment construire un réseau IP sur un réseau ATM
– Pb ARP par exemple77
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 153
Architecture ATM : classical IP
Commutateur
ATM
Commutateur
ATM
Commutateur
ATM
Réseau ATM
Station IP A
ATM
A
T Routeur IP
M
ATM
Routeur IP
Routeur IP
ATM
Routeur IP
ATM
hub Station IP Eth
Station IP Eth
Station IP Eth
hub Station IP Eth
Station IP Eth
Station IP Eth
hub Station IP Eth
Station IP Eth
Station IP Eth
hub Station IP Eth
Station IP Eth Station IP Eth
Station IP B
ATM
hub
Station IP Eth
Station IP Eth
Serveur ARP
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 154
Architecture ATM : classical IP
• Un sous-réseau IP dans un réseau ATM
– Un serveur ARP
– Gère une table @ IP ? ? @ ATM
• Lorsqu’une station ATM IP se connecte
– Elle connaît l’@ ATM du serveur ARP
• Configuration manuelle
– Elle s’enregistre auprès du serveur ARP
• Indique son adresse ATM et son adresse IP
• Lorsqu’une station ATM-IP veut émettre un
datagramme IP vers une autre station ATM-IP
– Demande au ARP Serveur l’@ ATM de la station IP
– Ouvre un VC avec cette station ATM
– …78
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 155
Architecture ATM : classical IP
• Lacunes :
– Pas de broadcast ou multicast IP
– Un seul serveur ARP : pas de redondance : pb si panne
• On peut avoir plusieurs sous-réseaux IP sur un réseau
ATM :
– Passe par un routeur ATM-IP pour communiquer
• ATM complexe avec IP :
– Mode non connecté (IP) avec techno en mode connecté (ATM)
• Rq : sur un même réseau ATM on peut avoir :
– Des VC ou VP permanents (ouverts en permanence) :
• LS informatique : interconnexions LANs
• Interconnexions PABX
– Des ELAN (plusieurs LANE)
– Des sous-réseaux IP
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 156
MPLS : buts
• MPLS : Multi Protocol Label Switching
• Protocole pour opérateurs de WAN IP
• Lacunes d’un réseau WAN IP « classique »
– Travail d’un routeur important
• Il doit étudier chaque datagramme
• Il doit extraire l’@ IP destinatrice du datagramme IP, consulter sa
table de routage et agir en conséquence
– Pas de partage de charge entre plusieurs liaisons
• Il n’y a qu’une route par destination
– Pas de routage qui tiendrait compte de qualités de
service demandées79
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 157
MPLS
• Les routeurs en bordure de réseau ajoutent (et
enlèvent) une étiquette aux datagrammes selon :
– La route que devra emprunter le datagramme
– La classification du datagramme
• Prioritaire ou non, pour application avec QoS, …
• Les routeurs au cœur du réseau routent selon
cette étiquette
– Rapide (plutôt de la commutation que du routage)
• Protocole pour mettre à jour les tables de
routage des routeurs au cœur du réseau :
– Une fois par « flot »
– Choix de route / étiquette donc / origine, QoS, …
– Réservation de bande passante possible
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 158
Intégration téléphonie – informatique
• Intégration voix - données
• Intégration possible car :
– Téléphone et informatique utilisent :
• Mêmes câbles (FO, TP) et ondes (hertziennes ou radio)
• Eléments actifs similaires : les téléphones sont maintenant numériques
– Ordinateurs :
• Equipés de microphone et hauts-parleurs
• Pourraient remplacer les postes téléphoniques : poste « unique »
• Pourquoi intégrer ? : faire des économies
– En réseau d’entreprise
• Infrastructure et matériel : même réseau (plusieurs sens à réseau)
• Même équipe d’administration
– Dans les réseaux des opérateurs : mêmes économies
– Au niveau des utilisateurs : économies sur les communications
téléphoniques longues distances
• Le coût d’une communication téléphonique dépend de la distance
• Le coût d’une « communication » Internet est indépendante de la
distance80
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 159
Intégration voix-données
• Pourquoi intégrer ? : apporter des nouveaux services
– Evolution des services informatiques
• Chat, mail ? mode de communication vocal (téléphonique)
– Evolution des services téléphoniques
• Communication téléphonique ? transfert de documents, vidéo, …
– Intégration des services
• Annuaires : « téléphoniques » et informatiques (LDAP)
• Messageries : vocales et électroniques
• Comment intégrer ?
– Normes existent : H323, SIP
– Solutions techniques (matériels) existent
– Législation s’assouplit : dérégulation du téléphone
– Différents niveaux d’intégration : tranchées ? réseau et services
• Rappel : contraintes téléphone :
– QoS (voir chapitre ATM précédent) difficiles sur réseau IP
– Existant qui fonctionne parfaitement : PABX à faire évoluer
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 160
Voix-Données : niveaux d’intégration
• Mêmes tranchées, fourreaux, goulottes … (chemins de
câbles) sur un site
2 câblages (et équipements actifs) différents
– 2 réseaux physiques donc logiques différents
– 2 administrations différentes
– Fait depuis plusieurs années entre les bâtiments
– Maintenant en pré-câblage de bâtiment
• Câblage courants faibles
• LS longue distance partagée entre 2 sites
– Interconnexion de PABX
– Interconnexion de LAN (routeurs, commutateurs, ponts)
– Ex : LS 2 Mb/s (MIC) ou hertzienne ou laser éclatée
(multiplexeur et dé-multiplexeur)
• 1 M (16 voix téléphoniques) pour PABX
• 1 Mb/s pour interconnexion de LAN81
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 161
Voix-Données : niveaux d’intégration
• Partage d’un réseau ATM
– VP pour PABX
– VP pour informatique (routeurs, commutateurs)
– FT et les autres opérateurs le font
• Utilisation du réseau téléphonique pour les
données
– Externe (RTC national) ou interne à l’entreprise
– Ordinateur (ou routeur) – Modem – Réseau
téléphonique – Modem – Ordinateur (ou
concentrateur ou routeur ou …)
– V90 (56.6 Kb/s), RNIS (2x64 Kb/s), ADSL (… 1 Mb/s)
• Utilisation du réseau IP pour la voix
– Téléphonie sur IP
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 162
Voix-Données : Tél / IP : services rendus
• Connexion ordinateur – ordinateur (application voix)
– Ordinateur – Réseau IP (Eth, PPP) – Ordinateur
– Netmeeting par exemple
– Un réseau logique différent du réseau téléphonique
• Pas de communication possible avec postes t éléphoniques classiques
– Intéressant pour longues distances
• Economies en coût de communication
• Connexion PABX – PABX
– Téléphones – PABX – passerelle – Réseau IP (Eth, ATM, PPP) –
passerelle – PABX – Téléphones
– Pas de communication téléphonique possible avec ordinateur
connecté dans le mode précédent
– Intéressant si bonne infrastructure IP (beaucoup de débit)
• Intégration totale : « le tout IP»
– Communications postes téléphoniques - ordinateurs possibles82
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 163
Voix-Données : Tél / IP : H323
• Origine : monde des téléphonistes ITU
• Ensemble complet de standards
– Architecture et fonctions d’un système de vidéo-conférence
– Sur réseaux en mode paquet (sans connexion), sans garantie de
QoS comme IP (mais pas uniquement pour IP)
• IP : RTP
– Real-time Transport Protocol
– Transport flux temps réel : vidéo, audio, … dans UDP
– Ajoute des informations pour que le récepteur compense :
variation latence, arrivée de datagrammes dans le désordre, …
• Type de données transport ées
• Horodatage
• Numéro de séquence
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 164
Voix-Données : Tél / IP : H323
• IP : RTCP
– Real-time Transport Control Protocol
– Permet d’avertir l’émetteur de la qualité de la
transmission :
• Le taux de paquets perdus
• La variation de la latence
• …
– Informations sur l’identité des participants
(applications multicast)
• Eléments (matériels ou logiciels)
– Terminal H323 :
• Ordinateur avec netmeeting
• Téléphone sur IP (H323)
• …83
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 165
Voix-Données : Tél / IP : H323
• Eléments (matériels ou logiciels) suite
– Passerelle : entre réseau IP et RTC (ou RNIS)
• Interfaces :
– Ethernet ? réseau IP
– Ports TP ? téléphones classiques ou PABX
• Codage/décodage voix, mise en paquets, suppression d’écho, …
– Garde-barriè re : administration
• Gestion des @adresses : IP ?? E164 (téléphoniques)
• Contrôle les accès
• Peut refuser des appels si bande passante insuffisante
• Contrôle une zone (H323)
– MCU-Pont : Multicast Control Unit : téléconférence
• Gère Multicast
– Transmet avec adresse IP multicast si le réseau le permet
• Ouvre n « connexions » point à point
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 166
Voix-Données : Tél / IP : H323
• Exemple de réseau H323 (entre 2 sites)
Réseau IP (Internet)
Routeur
Routeur
hub Station (H323)
Station (H323)
Téléphone sur IP
(H323)
Passerelle
PABX
Téléphone
analogique
Téléphone
RTC analogique
hub Station (H323)
Téléphone sur IP
(H323)
Passerelle
PABX
Téléphone
analogique
RTC
Garde-barrière84
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 167
Voix-Données : Tél / IP : SIP
• SIP : Session Invitation Protocol
• Origine : IETF : Informatique
• Gestion de sessions multimedia avec 1 ou n
participants
• Adresses : sip:bob@193.10.3.1
• Utilise RTP au-dessus de UDP ou TCP
• Station IP ?? Station IP : le protocole définit
– Appel – Négociation des paramètres
– Communication
– Fermeture de connexion
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 168
Voix-Données : Tél / IP : SIP
• Autres services
– Location server (registrar)
• Pour qu’un client puisse s’enregistrer quand il change d’adresse
IP (mobile, ISP avec adresse dynamique par exemple)
– Proxy server
• Serveur d’un côté (reçoit les appels)
• Client de l’autre (émet des appels)
• Pourquoi ? : Point de contrôle, de facturation
– Redirect server
• Reçoit des appels
• Indique la bonne destination à laquelle s’adresser : proxy , …
• Peut permettre de gérer la répartition de charge entre plusieurs
serveurs
• SIP beaucoup plus basique que H32385
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 169
Voix-Données : bilan aujourd’hui
• Constat : la téléphonie ce n’est pas simple
– Besoin de QoS et habitude de bonne qualité
– Fonctionnalités des PABX et postes téléphoniques sont
maintenant complexes : numéros abrégés, transfert d’appel,
téléconférence, messagerie vocale, …
– 2 équipes d’exploitation avec des cultures différentes
• Téléphonistes - informaticiens
• ? Intégration prudente
– Années 1999-2000 : on va tout mettre sur IP
– Aujourd’hui : on peut basculer certaines parties
• Elt nouveau : arrivée massive du téléphone portable
– Habitude de communications de moins bonne qualité
• Comme le transport de la voix sur un réseau « Best Effort » IP
– Portabilité sans comparaison avec ordinateur portable
• Ne va pas dans le sens d’un terminal unique : téléphone-ordinateur
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 170
Voix-Données : bilan aujourd’hui
• Dans entreprise :
– Dépend de l’historique et de la culture
– Intégration des 2 équipes d’exploitation ?
• Généralement :
– L’utilisateur conserve 2 équipements : téléphone et
ordinateur
– Les infrastructures réseaux d’extrémité (câblage
horizontal) sont différentes mais chemins identiques
• Poste téléphonique : câblage téléphonique ? PABX
• Ordinateur : câblage informatique ? hubs, commutateurs, …
– Interconnexion de PABX sur IP : solution de + en +
déployée
• Car débits du réseau données >> réseau téléphonique
• Avec back-up RNIS par exemple86
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 171
Voix - Video : n participants
• N vers n : réunions avec participants distants :
– Téléconférence (voix uniquement)
• Service FT (équivalent d’un MCU)
• Poste téléphonique habituel ou matériel dédié
– Matériel de visio-conférence (voix + image)
• H323 sur RNIS ? H323 sur IP
• Matériel dédié
• Netmeeting + Webcam
– Multicast IP :
• V IC-RAT + Webcam
• Réseau multicast
• Académique surtout
• 1 vers n : Visio-conférence (sans question de la salle)
– Idem ci-dessus
– Streaming : realplayer
• Unicast ou multicast IP
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 172
Réseaux virtuels : plan
• Pourquoi ?
• VLAN :Virtual LAN
• Avec ATM
• VPN : Virtual Private Network
– PPTP
– L2TP
– IPSEC87
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 173
Réseaux virtuels : pourquoi ?
On regroupe dans un même réseau (Ethernet commuté ou
IP) les stations qui travaillent ensemble (groupe de
travail - workgroup). Conséquences :
• Les applications « groupe de travail » :
– Qui ont besoin de découvrir les serveurs (contrôleur de domaine,
voisinage réseau, imprimantes, serveur DHCP, zone Mac, …)
– Et ces serveurs qui ont besoin d’émettre des messages vers toutes
les stations du groupe de travail
Utilisent les broadcasts Ethernet ou IP
• Le groupe qui a les mêmes besoins de sécurité :
– Contrôle l’accès entrant sur le réseau à la frontière du réseau
(routeur d’accès)
– Est assuré de la confidentialité par rapport à l’extérieur du
groupe car il n’y a pas diffusion à l’extérieur du réseau
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 174
Réseaux virtuels : pourquoi ?
• Le groupe qui à les mêmes besoins de connectivité depuis
et vers l’extérieur :
– Effectue un contrôle d’accès sortant à la frontière du réseau (sur
le routeur d’accès)
– Peut mettre en place une limitation de la bande passante utilisée
vers l’extérieur au point de sortie
• Le groupe peut avoir le même adressage IP et des noms
de stations dans le même domaine :
– Réalisé de fait dans un réseau IP
• Problème : comment peut on avoir les mêmes services
avec un groupe géographiquement dispers é ?
• Solution : avec des réseaux virtuels88
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 175
Réseaux virtuels : pourquoi ?
• Exemples de groupes dispersés
– Université UJF sur plusieurs sites à Grenoble et un à Valence
• Besoin de regrouper les sites dans un seul réseau logique
– Entreprise multi sites interconnectés par Internet :
• Même besoin
– Formation d’ingénieurs sur 2 sites ENSIMAG-ENSERG
• Même besoin
– Unité CNRS (UREC) sur 4 villes
• Même besoin
• Exemples de services dispersés
– Services administratifs (DR) du CNRS
– Services comptabilité d’une entreprise multi-sites
• Mais aussi des groupes mobiles
– Ordinateurs mobiles
– Déménagements, réorganisations ? éclatements géographiques
des équipes
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 176
Réseaux virtuels : principes
• Regrouper « logiquement » un groupe de stations
dispersées géographiquement
– Dans un même réseau : Ethernet ou IP ou …
• Buts :
– Utilisation d’applications « groupe de travail »
– Sécurité
– Contrôle de bande passante
– Noms et adresses IP
– Mobilité
• Plusieurs techniques suivant les buts, WAN/LAN, …
– VLAN
– ELAN
– VPN89
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 177
Réseaux virtuels : VLAN
• Virtual LAN
• But : créer un réseau virtuel de niveau 2
– Un domaine de broadcast (Ethernet)
• Possible avec des commutateurs Ethernet
– Pas avec des hubs
– Intelligence dans les commutateurs (et routeurs)
• Différents types de VLANs
– Par ports (de commutateur) : niveau 1
– Par adresse MAC (Ethernet) : niveau 2
– Suivant la valeur d’autres champs : niveau 3
• Protocole, @ IP, …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 178
Réseaux virtuels : VLAN par ports
Chaque port de commutateur est affecté à un VLAN
Exemple :
VLAN 1 : A,B,C,D,E,F,I,J
VLAN 2 : G,R,K,M,L
VLAN 3 : H,Q
Station L
Station K
hub
Commutateur
Routeur
COMM
Eth 1 Station F
Station G
Station H
COMM
Eth 2 Station J
Station I
Station E
Station D
hub
Station C
Station A
hub Station B
Station R Station Q
Station M
3 1
2 4
5
1
2
3
4
590
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 179
Réseaux virtuels : VLAN par ports
• Configuration VLAN de Eth 1 : 3 VLANS 1-2-3
– Port 1 = VLAN 1 Port 4 = VLAN 3
– Port 2 = VLAN 1 Port 3 = VLAN 2
– Port 5 = Voir après
– Quand Eth1 reçoit une trame de A (VLAN 1) :
• Envoie vers port 2 (et port 5 : cf après)
• Configuration VLAN de Eth 2 : 3 VLANS 1-2- »
– Port 1 = VLAN 1 Port 3 = VLAN 3
– Port 2 = VLAN 1 Port 4 = VLAN 2
– Port 5 = Voir après
– Quand Eth1 reçoit une trame de I (VLAN 1) :
• Envoie vers port 1 (et port 5, cf après)
• Configuration commutateur de Eth1 (idem Eth2) :
– Port 1 : @ MAC A, B, C, D, E
– …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 180
Réseaux virtuels : VLAN par port
• Diffusion
– Les équipements Eth1, Eth2 et le commutateurrouteur
font en sorte que :
• Quand A envoie un broadcast Ethernet ? A,B,C,D,E,F,I,J
(VLAN1)
mais pas vers les autres stations
• Pour communiquer entre Eth1, Eth2, Eth3
– Trame Ethernet F ? G impossible
• Datagramme IP : F ? Commutateur-routeur ? G
– Passe par routeur ou commutateur-routeur
• Remarque
– Cette segmentation peut aussi être réalisée par
brassage manuel dans le local technique où sont les
commutateurs : dans certains cas91
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 181
Réseaux virtuels : VLAN 802.1Q
• Problème : numéro de VLAN sur les truncks
– Schéma précédent : lorsque le commutateur Eth 2 reçoit une
trame Ethernet venant de A, pour savoir vers quelles stations il
doit la rediffuser il faut qu’il sache le numéro de VLAN dont A
est membre
– ? Il faut qu’il trouve cette information dans la trame
• Il faut que sur chaque lien entre les commutateurs
(truncks) les trames soient marquées (taggées)
– Protocoles propriétaires : ISL (CISCO)
– IEEE802.1Q
• Champ type Eth : 8100
• Champ numéro de VLAN : 12 bits (4096)
• Niveau de priorité : 3 bits ? QoS
• ….
• Informations de la trame initiale
• Schéma précédent : 802.1Q est activé entre Eth 1 –
Commut-Routeur – Eth 2
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 182
Réseaux virtuels : VLAN par @ MAC
Chaque station peut appartenir à un VLAN
suivant son adresse MAC
Exemple :
VLAN 1 : A, C, F, I, J, G
VLAN 2 : B, D, K, R
VLAN 3 : L, M, E, Q, H
Station L
Station M hub
Commutateur
Routeur 3
COMM
Eth 1
Station F
Station G
Station H
COMM
Eth 2 Station J
Station I
Station E
Station D
hub
Station C
Station A
hub Station B
Station K Station R Station Q
1
3 2
4
5
1
2
3 4
592
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 183
Réseaux virtuels : VLAN par @ MAC
• Configuration VLAN de Eth 1 : 3 VLANS 1-2-3
– VLAN 1 : @ MAC de A, C, F, G
– VLAN 2 : @ MAC de B, D, Q, R
– VLAN 3 : @ MAC de E, H
– Quand Eth1 reçoit une trame de A (VLAN 1) :
• Envoie vers port 2 (et port 5 : cf après)
• Configuration VLAN de Eth 2 : 3 VLANS 1-2- »
– Port 1 = VLAN 1 Port 3 = VLAN 3
– Port 2 = VLAN 1 Port 4 = VLAN 2
– Port 5 = Voir après
– Quand Eth1 reçoit une trame de I (VLAN 1) :
• Envoie vers port 1 (et port 5, cf après)
• Configuration commutateur de Eth1 (idem Eth2) :
– Port 1 : @ MAC A, B, C, D, E
– …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 184
VLAN par port ou par @ MAC
• Avantages VLAN @MAC / port
– Des stations sur des hubs peuvent appartenir à différents VLANs
• Mais la diffusion n’est pas sélective selon les branches des hubs
– On peut avoir des stations qui sont déplacées (déménagement
ou mobiles) sans besoin de reconfiguration
– On peut identifier chaque station avec son numéro de carte
Ethernet
• Sécurité accrue
• Si adresse MAC inconnue : appartient au VLAN « visiteurs »
• Désavantages VLAN par @ Mac
– Administration plus lourde
• Répertorier et tenir à jour des tables avec toutes les adresses MAC
– Si utilisateur change sa carte Ethernet : modification de
configuration93
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 185
Réseaux virtuels : VLAN niveau 3
• Affecter les trames Ethernet dans un VLAN
différent selon des champs que l’on trouve dans
la trame :
– Champ type Ethernet : protocole : IP, IPX, Appletalk,
…
– L’adresse IP origine : sous-réseau
• mais ce n’est pas du routage
– …
• Peut être utile quand de nombreux protocoles
sont utilisés sur un même réseau
– Support des « anciennes applications »
– De moins en moins utile
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 186
Réseaux virtuels : VLAN
• Commutateurs :
– Ils conservent leur fonction de base : commutation, sans diffusion
inutile
– Certains peuvent ne pas avoir de fonctionnalité VLAN
– Dans les exemples précédents les commutateurs ont la
fonctionnalité d’accepter plusieurs adresses Ethernet et VLAN
par port : ce n’est pas toujours le cas
• Routeurs :
– Peuvent supporter 802.1Q. Si non, il faut autant de cartes
Ethernet que de VLAN pour que le routeur route les VLAN
• Ex de VLANs dans un laboratoire
– 1 / par équipe de recherche pour stations de travail individuelles
– Administration (peut inclure la station de chaque secrétaire
d’équipe de recherche)
– Test : toutes les machines de test des différentes équipes
– Serveurs locaux
– Serveurs Internet
– Visiteurs94
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 187
Réseaux virtuels : VLAN
• Le travail d’administration de VLAN n’est pas
négligeable !
– Il faut bien connaître le réseau (et être plusieurs à le
connaître : pb absence)
– Il faut un outil d’administration
• Théorie : on peut utiliser des commutateurs de
différents constructeurs : IEEE802.1Q
• En pratique : commutateurs homogènes
– Avec un outil d’administration fourni par le
constructeur
• Les VLAN sont des réseaux virtuels pour LAN
– Pas pour MAN ou WAN
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 188
Réseaux virtuels : ATM
• Interconnexion de réseaux Ethernet
– ELAN : principe LANE (cf chapitre précédent)
• Utilisation de VPs ATM pour interconnecter des
bâtiments (LAN) ou des sites (WAN) :
– Réseaux Ethernet ou ATM
– Réseaux IP
– Fonctions :
• Sécurité : appelé aussi VPN ATM
• Garantie de qualité de service (débit / VP)
– Exemple : service ATM de Renater95
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 189
Réseaux virtuels : VPN : but
• VPN : Virtual Private Network
– Terme générique qui regroupe plusieurs techniques
• Relier 2 réseaux distants (ou une station et un réseau) via
un réseau ouvert (Internet) en garantissant :
• Les services de VLAN pour IP : même réseau logique IP
• Etendre le réseau interne
• Des services des sécurité :
• Confidentialité des informations transmises
• Intégrité des données (données non modifiées par un tiers)
• Authentification de l’émetteur et du destinataire (au sens station ou
routeur)
• Sans rechercher une qualité de service particulière (débit …)
• Eviter des infrastructures dédiées à base de LS
– Réduction de coût en utilisant un réseau partagé
• Utilisation du tunneling (tunnelisation)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 190
Réseaux virtuels : VPN : tunnels
• Un tunnel transporte des données entre 2 points
sans que les éléments entre les points
« perturbent » ce transport
– Réseau de transport : transparent
• Entre 2 réseaux ou entre station-serveur
Réseau 1
Réseau 2
Internet Station A
Serveur 1
Station B 96
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 191
Réseaux virtuels : VPN : tunnels
• Encapsulation
– En entrée de tunnel : données insérées (encapsulées) dans un
paquet du protocole de tunnelisation
– En sortie : données extraites : retrouvent leur forme initiale
– Tunnel IP véhiculant des datagrammes IP
• Entête
– @ IP Origine : @ IP entrée du tunnel
– @ IP Destinatrice : @ IP sortie du tunnel
– Protocole : tunnel : par ex : GRE
• Données : datagramme initial IP
– Entête : @ IP station origine - @ IP station destinatrice
– Données
• Plusieurs méthodes et protocoles
– PPTP (RFC2637)
– L2F (RFC2341)
– L2TP (RFC2661)
– IPSEC
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 192
Réseaux virtuels : VPN : PPP
• PPP : Point to Point Protocol
– Permet de transporter des datagrammes IP sur une
liaison point à point (RTC, LS par exemple)
– Mais aussi d’autres protocoles que IP
– Fonctionnalités supplémentaires :
• Authentification des extrêmités : PAP ou CHAP
– Avant tout transfert de données
• Chiffrement des données (confidentialité et intégrité)
• Adressage IP dynamique
• Compression
• …97
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 193
Réseaux virtuels : VPN : PPTP
• PPTP : Point-to-Point Tunneling Protocol
• Origine Microsoft
• VPN surtout sur réseau commuté pour accès particulier
– Station isolée ? LAN entreprise
• Encapsulation IP, IPX, … ? PPP ? GRE ? IP
– Pas uniquement IP
• La station isolée semble appartenir au LAN de
l’entreprise
– Elle peut avoir une adresse IP dans le sous-réseau IP du LAN,
comme si elle était une station du réseau interne
– Elle voit les autres stations du LAN comme si elle était connectée
sur le LAN
– Elle a les mêmes droits d’accès aux ressources du LAN qu’une
station du LAN (serveurs de fichiers, imprimantes, …)
– Elle utilisera la sortie Internet de l’entreprise pour accéder à
l’Internet
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 194
Réseaux virtuels : VPN : PPTP
• Le chemin entre la station et le LAN est sécurisé
– En utilisant les fonctions optionnelles de PPP
– Authentification
– Chiffrement
• Mais il faut bien configurer le serveur PPTP
pour que des stations pirates ne puissent pas se
connecter sur le LAN
• Serveur PPTP
– Serveur NT, Linux, …
– Serveur d’accès PPTP - Routeur
• Client PPTP
– Windows NT, 95/98 …, Linux, Mac, …98
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 195
Réseaux virtuels : VPN : PPTP
2 utilisations
LAN interne
193.51.3/24
Internet
Station
Client PPTP
193.51.3.2
Serveur
193.51.3.5
Serveur
PPTP
Station
Client PPTP
193.51.3.4
LAN interne
193.51.3/24
Internet
Station
Client PPP
193.51.3.2
Serveur
193.51.3.5
Serveur
PPTP
Station
Client PPP
193.51.3.4
Serveur d’accès PPP
Client PPTP
FAI
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 196
Réseaux virtuels : VPN : L2TP
• L2TP : Layer 2 Tunneling Protocol
– Réunion de PPTP et L2F (CISCO)
• Devrait remplacer PPTP
• 3 cas de configuration possibles :
– Tunnels L2TP : clients L2TP et serveur L2TP (idem
PPTP)
– PPP : clients PPP et FAI - Tunnels L2TP : FAI et
serveur L2TP (idem PPTP)
– LAN – Serveur L2TP – Tunnels L2TP – Serveur
L2TP - LAN
• Sécurité
– Utilisation possible des fonctions de PPP
– Pour protéger le tunnel : IPSec 99
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 197
Réseaux virtuels : VPN : IPSec
• IPSec : IP Security Protocol
• IETF : Pour mettre un peu d’ordre dans les différentes
méthodes de tunneling et de sécurisation
• Sécurisation des échanges au niveau IP
– Chaque datagramme est authentifié et/ou chiffré
• Inclus dans IPv6 (intégré dans toutes les piles IPv6)
• Optionnel dans IPv4
• Evolution majeure de IP
• Peut-être mis en œuvre sur tout équipement IP
– Routeur, serveur, station de travail, …
• Peut-être mis en œuvre de bout en bout ou sur un
tronçon du chemin
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 198
Réseaux virtuels : VPN : IPSec
• Entêtes ajoutés :
– AH : Authentication Header
– ESP : Encapsulation Security Payload
• Datagramme avec AH
– Entête IP – AH – (Entête TCP/UDP – Données) en clair
• AH (Authentication Header)
– SPI : Security Parameter Index ? SA (Security Association)
• Index d’une table qui pointe sur tout ce qui est nécessaire au récepteur
pour interpréter cette entête : algorithmes de crypto utilisés …
– Numéro de séquence
• Evite le rejeu du datagramme
– Signature électronique du contenu du datagramme (? entête IP)
• Checksum chiffré
• Garantit intégrité et authentifie l’origine100
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 199
Réseaux virtuels : VPN : IPSec
• Datagramme avec ESP
– Entête IP – Entête ESP – (Entête TCP/UDP – Données) chiffrés –
[Authentication ESP]
• Entête ESP (Encapsulation Security Payload)
– SPI : Security Parameter Index ? SA (Security Association)
– Numéro de séquence
• Authentification ESP
– Optionnelle
– Signature – authentification : checksum chiffré : similaire AH
• AH inclut l’entête IP pas ESP
• Utilisé en mode tunnel pour la signature (pas AH)
• 2 Modes d’utilisation
– Mode transport
– Mode tunnel
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 200
Réseaux virtuels : VPN : modes IPSec
• Mode transport
– L’entête IP d’origine n’est pas contenue dans
l’encapsulation
– Entête IP – AH – Entête TCP – Données
– Entête IP – ESP – (Entête TCP – Données) chiffrées
– Entête IP – AH – ESP – (Entête TCP – Données)
chiffrés
• Mode tunnel
– Entête IP (nouveau) – AH – Entête IP (origine) -
Entête TCP – Données
– Entête IP (nouveau) - ESP - (Entête IP (origine) -
Entête TCP - Données) chiffrées - [Authen ESP]101
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 201
Réseaux virtuels : VPN : IPSec tunnel
• Le mode tunnel permet les fonctionnalités des
VPN que l’on a vues :
– Stations distantes ou sous-réseau distant considérés
comme une partie du LAN (avec le même adressage)
– Sécurité dans le transport
Internet
Routeur
IPSec
Routeur
IPSec 194.21.2/24
194.21.2.3
194.21.2.5
194.21.2.4 IPSec
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 202
Réseaux virtuels : VPN : IPSec-Sécurité
Security associations : SA
• IPSec permet d’utiliser différents algorithmes, clés, … de
cryptographie
– Les 2 extrémités doivent se mettre d’accord
• Pour chaque connexion IPSec : 1 ou 2 SA
– Une SA pour AH
– Une SA pour ESP
• SA
– Algo d’authentification (MD5, …)
– Algo de chiffrement (DES, …)
– Clés de chiffrement
– Clés d’authentification
– Durée de vie des clés
– …102
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 203
Réseaux virtuels : VPN : IPSec
• Gestion des clés
– Manuelle
– IKE Internet Key Exchange (ancien nom : ISAKMP)
• Procédure pour que les 2 extrémités se mettent d’accord :
protocoles, algorithmes, clés
• Management des clés : fourniture de clés de manière sécurisée …
• IPSec
– Très solide, bien conçu et intégré dans toutes les piles
IPv6
– Devrait beaucoup se répandre
– Distinction Auth / Chiff : OK pour les législations
– Mais attention : sécurité IP (pas utilisateur …)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 204
Services de FT : plan
• LS (transfix), RNIS (numeris), ADSL : cf avant
• Interconnexion niveau 2 « traditionnelle » moyen débit
– Frame Relay
– Transrel
• Interconnexion niveau 2 haut-débit
– Turbo DSL
– Intra-Cité
– Inter LAN
– SMHD
– SMHD - Giga
– MultiLAN
• Services IP (pour entreprises)
– Les Classiques Oléane
– Global Intranet
– Global Extranet
– Collecte IP/ADSL103
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 205
Services FT : interconnexion
« traditionnelle » moyen débit
• Frame Relay
– Remplacement de X25 : réseau commuté commuté
avec circuits virtuels
– Débits de 19.2 Kb/s à 8 Mb/s
– Connexion réseaux FR d’entreprise
– Réseau international
• Transrel
– Service point à point
– Interconnexion de réseaux Ethernet, Token Ring
– Interfaces (équipements : ponts)
• Ethernet 10 ou 100 Mb/s
• Token Ring 4 ou 16 Mb/s
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 206
Services FT : interco HD : Turbo DSL
• Même zone (géographique)
• Agences ou particuliers ? Site central
• Liaisons permanentes
• Raccordement site central
– ATM 30, 60, 90 ou 120 Mb/s
• Raccordement extrémités
– ADSL jusqu’à 2 Mb/s – 320 Kb/s104
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 207
Services FT : interco HD : Intra-Cité
• MAN : Voix et données
• Boucle locale FT
• Connexions point à point (LS virtuelles) de 2
sites équivalents à 2 Mb/s, 10 Mb/s ou 100 Mb/s
• Interfaces
– G703 : PABX : 2 Mb/s
– Ethernet 10 ou 100BaseT : 2 Mb/s, 10 Mb/s, 100 Mb/s
• Connexion entreprise
– PABX, routeur IP, commutateur Ethernet
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 208
Services FT : interco HD : Inter LAN
• MAN : données
• Client : PME (petit budget)
• Connexions point à point (LS virtuelles) ou multipoint de
sites équivalents à 2, 4, 20, 40, 60, 100 Mb/s
• Interfaces
– Ethernet 10 ou 100BaseT ou GigaEthernet
– ATM
• Différents niveaux de « qualité de débit »
– Débit minimum garanti (on peut avoir plus si réseau peu chargé)
– Débit permanent garanti
– Débit non garanti (?)
• Connexion entreprise
– Routeur IP, commutateur Ethernet, commutateur ATM105
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 209
Services FT : interco HD : SMHD
• MAN : n sites
• SMHD : Service Multisites Haut-débit
– Protocole SMDH
– Boucle FO MAN dédiée à 155, 622 ou 2.5 Gb/s
– Sécurisation : chaque site est raccordé avec 2
parcours différents
• Les sites se partagent la bande passante de la
boucle
• Liaisons permanentes ou temporaires entre sites
– 2, n x 2, 34, 45 ou 155 Mb/s
• Interfaces
– G703, Ethernet 10 et 100 Mb/s
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 210
Services FT : interco HD : SMHD Giga
• Nouveau
• MAN – 3 sites minimum
• Technologie DWDM
– Multiplexage optique
– Ce n’est donc pas le protocole SMHD
• Liaisons (jusqu’à 32 par lien)
– 622 Mbps ? 2.5 Gigabit/s
– Très hauts débits
• Interfaces d’accès
– Fast Eth, Giga Eth, Fiber Channel, ..
• Bientôt 10 Gigabit/s106
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 211
Services FT : interco HD : MultiLAN
• WAN : 92 villes françaises et aussi international
• Raccordements (physiques) : 2, 34 ou 155 Mb/s
• Connexions point à point (LS virtuelles) de débits de 256
Kb/s à 100 Mb/s
• Interfaces
– ATM
– Ethernet 10 ou 100BaseT
– …
• Infrastructure de réseau FT : ATM
• Connexion entreprise : PABX, commutateur ATM,
équipement vidéo, routeur IP, commutateur Ethernet
• Applications : voix (PABX), données (LAN), vidéo
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 212
Services FT : IP : Classiques Oleane
• Connexion Entreprise à Internet
• Types de raccordement
– Lien permanent avec possibilité de back-up Numeris
– Connexion RTC, Numeris, GSM
– ADSL
• Equipement de connexion
– Routeur IP fourni ou non
• Services à valeur ajoutée
– Adresses IP
– Hébergement, gestion DNS, serveur Web
– Boites aux lettres (anti-virus possible)
– Proxy Web
– ….107
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 213
Services FT : IP : Global Intranet
• Créer un réseau privé virtuel pour l’entreprise
– Sites : moyen débit
– Postes utilisateurs fixes ou mobiles : bas débit
• Techniques
– CV ATM
– Filtrage adresses IP
– Tunelling IP
– Authentification des utilisateurs
• Equipements de connexion
– Routeur fourni ou non
– Poste utilisateur
• Accès
– Permanent 64 Kb/s ? 2 Mb/s
– Commuté : RTC, Numeris, GSM
– ADSL
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 214
Services FT : IP : Global Extranet
• Service d’information de l’entreprise (Extranet)
accessible par RTC ou Internet
– Clients, Partenaires, Fournisseurs
• Facture : téléphone particulier
– Numéros d’appel réservés
• Technique : tunnels IP
Réseau
IP de FT
Réseau Routeur
FT
Internet
Serveur
d’accès FT Routeur
Entreprise
Interface du
service FT
Micro
particulier
Micro
particulier
Micro
particulier Serveurs
Numéris
RTC
Serveur
d’accès FT
RTC108
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 215
Services FT : IP : collecte IP/ADSL
• Pour les fournisseurs d’accès Internet (FAI)
• Pour collecter le trafic des abonnés ADSL
• Routeur FT chez le FAI
– Interfaces Ethernet 10, 100 ou 1000 Mb/s
– Débits : 10 Mb/s? 4 Gb/s
• Les routeurs FT sont transparents : tunneling …
Réseau
IP de FT
Réseau Routeur
FT
Internet
Routeur
FT
Routeur
FT
Routeur
FAI
Interface du
service FT
Région Y
Micro Région X
particulier
Micro
particulier
Micro
particulier
Micro
particulier
Concentrateur
ADSL
Concentrateur
ADSL ADSL
ADSL
ADSL
ADSL
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 216
Services à assurer : plan
Services « obligatoires » à assurer (couche 7)
Uniquement aspect architecture – choix -stratégie
• Noms (machines)
– Principes
– Plan de nommage
• Messagerie
• Annuaires
• Services Web109
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 217
Services : noms
• Buts techniques
– Traduction : nom de machine ? adresse IP
– http://www.inpg.fr ? datagramme IP :
• Ouverture connexion TCP sur port 80
• Adresse IP destinataire : ?
• Comment : www.inpg.fr ? 195.83.76.58 ?
– Ping www.inpg.fr
• Datagramme ICMP - @ destination 195.83.76.58
– Dans l’autre sens aussi : @ IP ? nom de machine
• Configurations, contrôles d’accès, fichiers de trace, … explicités
avec des noms
– Mais aussi messagerie électronique
• jla@urec.cnrs.fr ? serveur messagerie SMTP mail.urec.cnrs.fr
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 218
Services : noms
• Pour que cela fonctionne dans l’Internet
– Noms uniques
– Système très solide : des serveurs DNS « direct» et « reverse »
– Dynamique : ajout de noms décentralisé dans les serveurs DNS
• Unicité
– Nommage hiérarchique arborescent avec des domaines
• .com, .edu, .org, …, .fr, .de, .uk, …
– Plan de nommage dans les organismes-entreprises
• Solidité – Dynamique
– N serveurs de noms administrés localement
• Un serveur primaire par zone
• Plusieurs serveurs secondaires
• Copies régulières des informations primaire ? secondaires
– Caches
• Postes de travail
• Serveurs (primaires – secondaires)
– Serveurs DNS : machines dédiées, aux bons emplacements110
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 219
Services : plan de nommage
• Choix du nom de domaine (pour une entreprise)
– Pas technique : image de l’entreprise
• Serveurs Web, …
• Adresses électroniques
• Un nom a maintenant une valeur commerciale
– Sous .com
• Quelques $
• Pas de vérification
– Sous .fr
• Plusieurs dizaines (centaines) d’euros
• Vérifications
• AFNIC : association ? système « sain »
– Dérives
• Réservation de noms tels que cnrs.com pour revente
• Certains pays (en voie de développement) :
– Société à but uniquement lucratif qui gère le top level domain du pays
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 220
Services : plan de nommage machines
• Choix de sous-domaines : technique
– Un sous-domaine
• ? un serveur DNS « direct »
• ? un administrateur
– Un serveur DNS « reverse »
• ? un sous-réseau IP
• ? un administrateur
– On regroupe souvent serveur « direct » et « reverse »
• Quand ajout de machine : MAJ des 2 nécessaire
– En cas de problèmes : facilité de localisation
• Nom ? Où ?
– Possibilité d’alias sur les noms
• Très souple111
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 221
Services : plan de nommage machines
Exemple : UREC (Paris, Grenoble, Lyon, Marseille)
• Domaine urec.cnrs.fr
– Sous-domaines grenoble.urec.cnrs.fr et paris.urec.cnrs.fr
• Un serveur DNS Paris (un administrateur)
– Primaire : urec.cnrs.fr, paris.urec.cnrs.fr, reverse réseau IP
Paris
– Secondaire : grenoble.urec.cnrs.fr, reverse réseau IP Grenoble
• Un serveur DNS Grenoble (un autre administrateur)
– Primaire pour grenoble.urec.cnrs.fr, reverse réseau IP grenoble
– Secondaire : urec.cnrs.fr, paris.urec.cnrs.fr, reverse réseau IP
Paris
• Lyon, Marseille : nommage machines laboratoires locaux
• Alias dans DNS urec.cnrs.fr, …
– www.urec.cnrs.fr ? www.paris.urec.cnrs.fr : visibilité
– Idem autres services : mail, …
– Autres services dans domaine services.cnrs.fr ? urec.cnrs.fr
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 222
Services : plan de nommage machines
• Exemple : IMAG (fédération de 8 laboratoires)
– Domaine imag.fr - pas de sous-domaine
– Un serveur DNS primaire imag.fr
– N serveurs DNS secondaires imag.fr
• Pour l’extérieur (authoritative) : 3
• En interne, au moins un par laboratoire
– Equipe d’administrateurs soudée
• Choix des noms de toutes les machines centralisé
• Bases de données mise à jour par chaque administrateur de labo
– Script de mise à jour automatique du DNS primaire
– Serveurs Web de labo : nom du labo le nom : image
• www.imag.fr, www-id.imag.fr, www-clips.imag.fr, …
– Choix pas de ss-domaine ? visibilité de la fédération
• Une autre possibilité aurait été : un sous domaine par laboratoire112
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 223
Services : plan nommage machines
• Choix
– Divers : image, organisation entreprise, organisation des
administrateurs, histoire, …
– Qu’ils soient clairs : document de référence :
• Comment est-ce organisé ?
• Qui fait quoi ?
• Visibilité / extérieur
– Pour les noms des serveurs
– Pour le nom des stations clientes : intérieur : choix technique
• Adressage privé - NAT
– 2 nommages : 2 DNS : interne – externe
– Les noms de stations internes ne sont plus visibles de l’extérieur
– Mais il faut néanmoins que les stations internes communiquent
entre elles : document de référence toujours utile
• Les FAI offrent des services de DNS
• Pb : quand rachat … entreprise ? changement de nom ?
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 224
Services : messagerie
• Messagerie Internet : protocole SMTP
– Messagerie interne dans l’entreprise peut être
différence : passerelle nécessaire
– Dans ce chapitre : messagerie interne SMTP, logiciel
Sendmail ou Postfix
• Plan
– Choix de la forme des adresses
– Répartition des serveurs
– Méthodes d’accès aux boites aux lettres
– Format des messages113
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 225
Services : messagerie : adresses
Adresses de messagerie : quelle stratégie ?
• De préférence forme canonique : Prénom.Nom@…
– Exemple : Jean-Luc.Archimbaud@urec.cnrs.fr
– Avantages
• Adresse unique (sauf homonymes)
• Adresse « parlante » : peut éviter un annuaire
• Faire apparaître sous-domaines ou non ?
– Pierre.Durant@etudes.edf.fr ou Pierre.Durant@edf.fr ?
– Pérennité de l’adresse et forme simple / centralisation
• Utiliser des adresses génériques
– webmaster@.., postmaster@…, info@…, …
– Peut-être pour des fonctions : direction@…, secrétariat@…, …
– Avantage : pérennité quand la personne change de fonction
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 226
Services : messagerie : adresses
• « Transformation» d’adresses - redirection
– Différents mécanismes peuvent modifier les champs « To» et
« From » sur les messages arrivants ou partants
– Serveurs-relais de messagerie : messages arrivants
• To : Francis.Duval@edf.fr ? Francis.Duval@der.edf.fr
– Serveurs-relais de messagerie : messages partants
• From : jla ? From : Jean-Luc.Archimbaud@urec.cnrs.fr
– Comptes utilisateurs : .forward (messages arrivants)
• To : jla@imag.fr ? To : Jean-Luc.Archimbaud@urec.cnrs.fr
– Ne pas en abuser
• Doit simplement résoudre les cas particuliers
• Différencier adresse professionnelle et personnelle ?
(au travail)
– Probl ème : correspondance privée : débat non tranché
• « Cacher » les adresses pour limiter les SPAM ?114
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 227
Services : messagerie : serveurs
• 2 services à assurer :
– Relais de messages et hébergement de boites aux lettres
• Entrant : un seul serveur relais avec les boites aux lettres
– Accessible depuis l’Internet
– Avec machine back-up quand indisponible
• DNS : plusieurs MX records
– Probl ème de sécurité : attaque des boites aux lettres
• Entrant : un serveur relais sans boite aux lettres
– Accessible depuis l’Internet
– Redirige vers 1 ou plusieurs serveurs internes suivant l’adresse
du destinataire :
• Si adresses avec sous-domaine ? le serveur interne du sous-domaine
• Sinon, base de données : une adresse ? son serveur interne
– Boites aux lettres sur serveurs internes
– Serveurs internes non accessibles depuis l’Internet
• Sortant : préférable de passer par un seul serveur relais
– Canonisation des adresses, surveillance, traces, …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 228
Services : messagerie : serveurs relais
• Service à surveiller de près
– Très souvent attaqué
– Trace des abus
• Interdire le relayage : @ externe ? @ externes
– Probl ème SPAM : obligatoire
• Installer un anti-virus
– Evite MAJ sur chaque poste interne
• Lutter contre le SPAM
– Outils avec mots clés et/ou black lists (pas de solution miracle)
– La solution est la signature électronique
• Lutte anti-virus - SPAM : accord du personnel nécessaire
• Exemple IMAG
– Un relais de messagerie externe (reçoit To : X@imag.fr )
– N serveurs de messagerie internes avec boites : 1 / labo
– Table : @ d’une personne ? serveur de messagerie interne
– Gestion idem DNS115
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 229
Services : messagerie : accès aux boites
• Connexion interactive sur le serveur
– Qui contient les boites aux lettres : commande Mail Unix …
– Pb : il faut gérer autant de comptes interactifs que de boites
• POP - Post Office Protocol
– Accès depuis une station personnelle avec outil (navigateur, …)
– Les boites aux lettres sont transférées sur la station personnelle
• IMAP - Internet Message Access Protocol
– Accès depuis une station personnelle (navigateur, …)
– Les boites aux lettres restent sur le serveur
• IMAP/POP ?
– De plus en plus de IMAP
– Dépend de l’utilisation :
• Veut-on garder sur le serveur les messages (place, sauvegarde, …) ?
• Les utilisateurs sont ils connectés lorsqu’ils utilisent la messagerie ?
– Versions sécuris ées : POPS – IMAPS
• Authentification ou non des clients
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 230
Service : messagerie : formats messages
• MIME - Multipurpose Internet Mail Extensions
– Standard pour format de messages contenant tous types de
données : texte, video, voix, …
• S/MIME – Security …
– Version sécurisée de MIME
– Certificats électroniques
– Signature électronique
• Authentification
• Intégrité
– Chiffrement
– Concurrent : PGP
• Principal pb messagerie : pas authentification expéditeur
– SPAM, Virus, pas de valeur juridique, …
• Messagerie : service externalisable116
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 231
Annuaires : un standard
• LDAP - Lightweight Directory Access Protocol
– Communications client-serveur (sécurisées si voulu)
– Modèle de données
• Arborescence hiérarchique
• Classes d’objets
• Nommage
– Modèle fonctionnel
• Recherche, comparaison, ajout, …
– API
– Réplication
– …
• Un annuaire LDAP
– Peut utiliser un logiciel de base de données : oracle …
• LDAP : Interface standard d’accès
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 232
Annuaires LDAP : utilisations
• Classique de personnes : adresses électroniques
– Accès avec navigateur – complétion d’adresse
– Gestionnaire de liste de diffusion, …
• De certificats électroniques
• De droits d’accès
– A des systèmes, des applications, …
– Remplacement de NIS, NIS+
• De ressources
– Grilles de calcul
– Equipements (réseau)
• Besoin d’avoir une réflexion sur l’architecture
– Un seul annuaire ou n / utilisation ou groupe
– Séparer LDAPs publics et privés (internes)
– Sécurisation de l’annuaire, pb de SPAM (limitation du nb
d’accès), …117
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 233
Services Web
• Accès aux serveurs Web externes (Internet)
– Autorisation ou non ?
• Décision de direction, pas d’administrateur réseau
– Proxy ou non ?
– Attention aux problèmes de sécurité
• Virus dans documents récupérés
• Exécution de code localement : javascript, …
• ? Proxy utile
• Serveurs Web de l’entreprise
– Différencier administration technique / contenu
– Définir les droits d’accès et une méthode de mise à jour
– Pour Intranet
• Informations internes
• Serveurs dans un sous-réseau non accessible depuis l’extérieur
– Pour Extranet – Internet
• Information publiques
• Serveurs dans un sous-réseau public
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 234
Fonctions «annexes » équipements actifs
PLAN
• Administration
• Tunnels
• IPSec
• NAT
• Filtrage
• Multicast
• Gestion files d’attente118
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 235
Fonctions «annexes » équipements actifs
• Administration
– Agent SNMP
– Traces ? syslog
– Compteurs : charge, nb de datagrammes, de bytes, …
• Tunneling
– Cf chapitre sur les réseaux virtuels : VPN
– Dans les routeurs, stations IP
– Pour sécurité mais aussi IPv6 dans IPv4, multicast
dans unicast, …
• IPSec
– Cf chapitre sur les réseaux virtuels
– Dans les routeurs, stations IP
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 236
Fcts «annexes » éqts actifs : NAT
• NAT – Network Address Translation (traduction)
• Fonction dans routeur d’accès (entre site et Internet)
• Traduit les adresses IP
– Modifie l’entête des datagrammes IP échangés avec l’extérieur
– Dans les sens sortant et entrant
• Une station du site
– Possède une adresse interne 10.1.1.2
• Elle est configurée avec cette adresse
• Les machines internes communiquent avec elle avec cette adresse
– Connue de l’extérieur avec l’adresse 193.96.49.64 (@ externe)
• Les machines de l’Internet communiquent avec elle avec cette adresse
– Le système est transparent pour les stations
• Le routeur entre le site et l’Internet fait la traduction119
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 237
Fcts «annexes » éqts actifs : NAT
Site Extérieur
Station
10.1.1.2
Station
129.88.35.3
Routeur
NAT
Internet Internet LAN
Station
10.1.1.4
@ orig 10.1.1.2
@ dest 129.88.35.3
@ orig 193.96.49.64
@ dest 129.88.35.3
@ orig 129.88.35.3
@ dest 10.1.1.2
@ orig 129.88.35.3
@ dest 193.96.49.64
Table de traduction dans le routeur NAT
@ interne 10.1.1.2 ?? @ externe 193.96.49.64
@ orig 10.1.1.2
@ dest 10.1.1.4
@ orig 10.1.1.4
@ dest 10.1.1.2
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 238
Fcts «annexes » éqts actifs : NAT
• Traduction statique
– 10.1.1.2 ?? 193.96.49.64
– 10.1.1.3 ?? 193.96.49.66
– …
– ? Besoin autant d’adresses IP officielles que de stations
• Traduction dynamique
– Pool d’adresses officielles (externes) pouvant être attribués
• Ex : 193.96.49.0/24
– Attribution d’une adresse externe lors du premier datagramme
reçu par le routeur
– Adresse libérée au bout d’un temps d’inactivité
• Ex : pas de datagramme avec cette adresse reçu depuis 3 heures
– ? On peut avoir plus de stations que d’adresses IP officielles
• On mixte : serveurs : statique - clients : dynamique120
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 239
NAT : PAT Port Address Translation
Site Extérieur
Station
10.1.1.2
Station
129.88.35.3
Routeur
NAT
Internet Internet LAN
Station
10.1.1.4
@ orig 10.1.1.2:1504
@ dest 129.88.35.3:80
@ orig 193.96.49.64:1504
@ dest 129.88.35.3:80
@ orig 129.88.35.3:80
@ dest 10.1.1.2:1504
@ orig 129.88.35.3:80
@ dest 193.96.49.64:1504
Table de traduction dans le routeur NAT (PAT)
@ interne 10.1.1.2:1504 ?? @ externe 193.96.49.64:1504
@ interne 10.1.1.4:1580 ?? @ externe 193.96.49.64:1505
@ orig 10.1.1.4:1580
@ dest 129.88.35.3:80
@ orig 129.88.35.3:80
@ dest 10.1.1.4:1580
@ orig 193.96.49.64:1505
@ dest 129.88.35.3:80
@ orig 129.88.35.3:80
@ dest 193.96.49.64:1505
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 240
Fcts «annexes » éqts actifs : NAT
• Contenu de datagrammes (données) à modifier
– Pour certains services :ICMP, FTP, H323, …
• Besoin de 2 serveurs DNS
– Un interne : non accessible depuis l’extérieur
• Contient toutes les adresses internes
– Un externe : dans la DMZ
• Contient les adresses externes
– Les noms des stations clientes sont « aléatoires »
• Serveurs accédés depuis l’Internet
– Adresses statiques
• L’adressage interne peut s’étendre sur n sites
– Avec un VPN
– Un routeur NAT pour communiquer avec l’extérieur121
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 241
NAT : pourquoi ?
• On manque d’adresses officielles IP (4 bytes)
– On ne peut plus numéroter toutes les stations IP de la planète de
manière unique
– En interne, sur les sites, numérote les stations avec les @ privées
• 10/8, 172.16/12, 192.168/16
• Plusieurs sites peuvent utiliser les mêmes adresses
• Exemple : site avec une @ réseau officielle 193.96.49.0/24
– 5000 machines internes
– Numérote ses stations avec une adresse réseau privée : 10/8
• Peut numéroter des millions de machines
– Quelques adresses 193.96.49.0/24 réservées aux serveurs
• Accédés depuis l’Internet : DNS externe 193.96.49.1, Web externe
193.96.49.2, Mail 193.96.49.3 (avec PAT ce peut être le même numéro)
– Pool d’adresses 193.96.49.[4,254] disponibles (NAT)
• Attribuées dynamiquement aux stations locales quand elles
communiquent avec l’Internet
• 250 machines internes peuvent communiquer avec l’Internet
simultanément : beaucoup plus si on utilise PAT
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 242
NAT : plus et moins
• Avantages
– On dispose d’un espace d’adresses énorme en interne
• Pas de limitation dans l’architecture des sous-réseaux
• Pas de problème quand nouvelles stations à numéroter
– Les stations clientes ont des @ IP dynamiques
• Plus difficiles à attaquer : meilleure sécurité
• Désavantages
– Sécurité : les stations clientes sont « anonymes »
• Difficile de savoir quelle station interne a attaqué un site ext erne
– Contrôle d’accès / @ IP effectué sur certains serveurs
• Impossible sauf si traduction statique
– Rompt le principe IP de connectivité de bout en bout
• Peut avoir des effets de bord sur certaines applications
– Retarde l’arrivée de IPv6122
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 243
NAT : conclusion
• De très nombreux sites l’utilisent
– Peu universitaires car premiers venus sur Internet, ils
disposent de beaucoup d’adresses officielles
– Système très bien huilé maintenant
• NAT / DHCP
– DHCP : autre manière d’économiser des adresses
– Mais beaucoup moins d’économie que NAT
• DHCP : une station a besoin d’une adresse officielle dès qu’elle
communique avec l’extérieur mais aussi avec l’intérieur
• Pas de possibilité de PAT
– On peut faire les 2
• DHCP : pour ses fonctions de configuration dynamique
• NAT : pour ses fonctions de traduction d’adresse
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 244
Fcts «annexes » éqts actifs : filtrage
• Consiste à laisser passer ou non certains flux
selon les informations trouvées dans
– Les entêtes des trames Ethernet
– Les entêtes des datagrammes IP
– Les entêtes des segments TCP, UDP
• Ponts, Commutateurs
– Filtrage de niveau 2
– Sur le contenu des entêtes des trames Ethernet
• Routeurs
– Filtrage de niveau 3
– Sur les entêtes IP, TCP, UDP123
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 245
Filtrage : rappel trame Ethernet – IP
• Entête Ethernet
– @ Ethernet destination
– @ Ethernet origine
– Champ type : protocole : 0800 IP, 0806 ARP, …
• Entête IP
– @ IP origine
– @ IP destination
– Protocole : 1 ICMP, 6 TCP, 17 UDP, …
• Entête TCP ou UDP
– Numéro de port source (application station source)
– Numéro de port destination (application station
destination)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 246
Filtrage : niveau 2
• Ponts – commutateurs / port
– Sur les entêtes Ethernet
• Exemple : filtrer sur un port
– Certains protocoles : Appletalk, IPX, …
• Car il n’y a pas de stations qui utilisent ces procotoles sur ce port
• Diminue la charge du côté du port
– Filtre les trames multicast ou broadcast de ces protocoles
• Evite les erreurs
– Des utilisateurs sans compétence qui pourraient lancer ces
protocoles sur leur station et perturber les autres stations
– Certaines adresses Ethernet origine
• Stations trop bavardes, polluantes
– Certaines adresses Ethernet destination multicast,
broadcast
• But principal : diminuer la charge124
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 247
Filtrage : niveau 3
• Dans les routeurs
– Sur les entêtes IP, TCP, UDP
• But principal
– Sécurité (protection de stations, de services, de serveur)
– Limitation des flux applicatifs (pas de chat, P2P, …)
• Deux politiques :
– Par défaut : tout est autorisé (P1)
• On interdit ce que l’on ne veut pas
– Par défaut : tout est interdit (P2)
• On autorise ce que l’on veut
• Deux types de filtrages
– Sur les adresses IP (de stations ou de (ss-)-réseaux)
– Sur les numéros de ports (applications)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 248
Filtrage : niveau 3
• Filtrage sur @ IP de station ou de (ss-)réseau
– Sens entrant (Internet ? Site) / @ IP destination
• P1 : interdit l’accès à des stations « à protéger »
• P2 : autorise uniquement l’accès à certains serveurs (publics)
– Sens entrant / @ IP origine
• P1 : interdit l’entrée de datagrammes de stations dangereuses
(black-list)
• P2 : autorise l’accès que depuis certaines stations
– Sens sortant (Site ? Internet) / @ IP origine
• P1 : interdit à certaines stations de sortir (sur l’Internet, …)
• P2 : autorise uniquement certaines stations à sortir
– Sens sortant / @ IP destination
• P1 : interdit l’accès à des serveurs à contenu peu recommandable
• P2 : n’autorise l’accès que vers des serveurs répertoriés125
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 249
Filtrage : numéros de port
• Applications IP : mode client –serveur
– Serveur : wellknown ports
• HTTP : 80, Telnet : 23, SMTP : 25, …
– Client
• 1024, 1025, 1026, … pour FTP, Telnet, …
• 1023, 1022, 1021 … pour rexec, rlogin, rsh, rcp, …
• Exemples de filtre sens entrant (Internet ? Site)
– P2 : Laisse passer uniquement les datagrammes avec
port destination = 80 vers @IP destination 194.33.2.5
• Autorise uniquement l’accès HTTP sur le serveur Web 194.33.2.5
• Si un autre utilisateur interne installe un serveur Web, il ne sera pas
accessible depuis l’extérieur
– P1 : Filtre tous les datagrammes avec port destination = 23
• Interdit l’accès en telnet sur toutes les machines internes depuis
l’extérieur
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 250
Filtrage : numéros de port
• Exemple de filtre sens sortant (Site ? Internet)
– P2 : laisse passer tous les datagrammes avec numéros
de ports source > 980
?Autorise toutes les stations à être cliente sur des
serveurs Internet
– P2 : laisse passer les datagrammes avec port dest=25
uniquement vers station 129.88.32.2
? Oblige toutes les stations interne à passer par le relais
de messagerie 129.88.32.2 pour envoyer du courrier126
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 251
Filtrage : exemple de politique
Site 192.56.62/24
Extérieur
Routeur Internet Internet LAN
192.56.62.70
Serveur DNS
SMTP, Web
192.56.62.80
Serveur Telnet
192.56.62.90
A isoler
192.56.62.X
Clientes uniquement
Filtres
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 252
Filtrage : ex (simplifié) de politique 2
• Les filtres sont exécutés en séquence (ACL CISCO)
– Pour chaque datagramme
• Si condition remplie : action - exit
• Sinon : continue les filtres
• Si @ IP dest = 192.56.62.90 : filtre
– Isole 192.56.62.90
• Si @ IP dest = 192.56.62.80 et port dest = 23 : laisse
passer
– Ouvre accès au serveur telnet : 192.56.62.80
• Si @ IP dest = 192.56.62.70 et port dest = (53 ou 25 ou 80)
: laisse passer
– Ouvre accès au serveur DNS, SMTP, Web 192.56.62.70
• Si port dest > 980 : laisse passer
– Laisse passer le trafic vers stations clientes internes
• Reste : filtre
– Interdit tous les autres trafics127
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 253
Filtrage : bilan
• Les filtres peuvent être installés à l’intérieur du
site
– Sur les routeurs entre services, équipes, … par
exemple
– Entre sous-réseaux ou VLAN
• Avec l’Internet : politique 2 recommandée
– On interdit tout sauf …
– Si P1 : nouvelle vulnérabilité découverte ? MAJ des
filtres
• Si fonction dans une boité dédiée avec interface
graphique …? Garde-barrière
– Fonction appelé « filtrage statique » dans les gardesbarrières
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 254
Filtrage : bilan
• Filtrage dans les routeurs
– Beaucoup utilisé en entrée de campus, laboratoires
– En entreprise plutôt entre sous-réseaux internes
• En entrée (site-Internet) : garde-barrière
• Limitations techniques
– Basé sur des numéros de port : les applications
peuvent utiliser d’autres numéros que les wellknown
port (pb cheval de Troie)
– Rebonds applicatifs indétectables
– Tunnels applicatifs non détectable (HTTP par
exemple)
– ? filtrage statefull dans garde -barriè re nécessaire128
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 255
Fcts «annexes » éqts actifs : multicast IP
• Applications habituelles : unicast
– Point à point
– 1 émetteur ? 1 récepteur
• Le récepteur devenant ensuite émetteur
– Adresses Ethernet et IP unicast
• Applications multicast
– 1 émetteur ? n récepteurs (diffusion ciblée)
– Radio (plutôt broadcast)
– Télévision
• Non cryptée : broadcast
• Cryptée (Canal + …) : multicast
– Télé-séminaire, télé-réunion, vidéo-conférence, …
• Dans ce cas un récepteur peut aussi devenir émetteur
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 256
Multicast IP
• Media idéal de transport : air
– Ondes radio avec émetteurs terrestres, satellites, …
– Pas de problème sauf partage des fréquences
Emetteur
Récepteur 1
Récepteur 2
Récepteur 5
Récepteur 4
Récepteur 3129
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 257
Multicast IP
• Réseau filaire IP avec technique classique
– On transporte n fois les mêmes données
– On utilise beaucoup de bande passante
• Pour ne transporter qu’une fois les données :
– Adresses, protocoles, routages, … multicast
Emetteur
Récepteur 1
Récepteur 2
Récepteur 5
Récepteur 4
R
R Récepteur 3 Internet Internet
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 258
Multicast IP
• Participants à une appli multicast : groupe multicast
• Identification du groupe multicast : @ IP
– Une adresse IP de classe D : 224.0.0.0 ? 239.255.255.255
– Emetteur ? groupe : @ IP destination = @ IP multicast
• Choix d’une adresse multicast : statique
• Choix d’une adresse multicast : dynamique
– Annuaire de groupes multicast en cours (ex : application SDR)
– Responsable du groupe ? annuaire
• Je veux ouvrir une session « cours ARR » pour tel créneau horaire
• Fournis moi une adresse multicast
– Annuaire
• Donne une adresse multicast au responsable : 224.2.0.1
• Publie : « cours ARR » a telle @ multicast
– Participants au groupe
• Consultent annuaire et récupère l’adresse multicast du groupe130
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 259
Multicast IP
• Protocoles : UDP, RTP, RTCP (cf H323), …
• L’émetteur émettra ses données
– Avec @ IP destination multicast : 224.2.0.1
– @ IP origine : son @ IP (unicast)
• Les récepteurs se mettront à l’écoute
– Pour recevoir les datagrammes avec cette @ dest
• Emetteur-récepteurs sur même réseau Ethernet
– Utilisation du multicast Ethernet
• Premier octet de l’@ impair
• IEEE a attribué 01.00.5E.X.Y.Z pour applications multicast IP
– @ Destination Ethernet : 01.00.5E.X.Y.Z
• IP : 224.2.0.1 ? Ethernet 01.00.5E.02.00.01
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 260
Multicast IP : routeurs
• Pb : quand il y a des routeurs entre émetteur et récepteurs
• Les routeurs : @ dest 224.2.0.1 : que faire ?
– R3 doit les renvoyer vers R4 et R7 mais pas vers R2
• ? tables de routages et protocoles de routage spécifiques
Emetteur
Récepteur
Récepteur
Récepteur
Récepteur
Récepteur
Récepteur hub
hub
hub
hub
R2
R4
R6
R8
R1
R5
R7
R3131
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 261
Multicast IP : protocoles de routage
Protocole entre stations et premier routeur
• Principe : stations : je veux m’abonner
– Je veux recevoir le flux multicast 224.2.0.1
– R4, R6, R8 vont recevoir ce message
– R2 ne va pas le recevoir
• Exemple : IGMP
– Internet Group Management Protocol
– Le routeur émet un datagramme toutes les minutes
• Qui veut s’abonner à des groupes multicast ?
– Les stations intéressées répondent
– Le routeur le redemande régulièrement
• Pour savoir si de nouvelles stations sont intéressées
• Pour savoir si les anciennes abonnées sont toujours intéressées
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 262
Multicast IP: protocoles de routage
Protocole entre routeurs
Exemple PIM Protocol Independant Multicast
• But : arriver à un arbre de diffusion : 2 principes
• Dense mode
– Les routeurs envoient à tous les routeurs tous les flux multicast
• Au départ. Exemple : R3 vers R4, R7, R2
– Les routeurs non intéressés demandent d’arrêter l’émission
• R2 indique à R3 : il y a personne chez moi d’intéressé par 224.2.0.1
• R3 arrêtera d’émettre vers R2 ce flux : pruning
• Sparse mode
– Le routeur émetteur s’enregistre auprès du RP
• RP : Rendez vous Point
• Je vais diffuser vers 224.2.0.1
• Aucun routeur n’émet encore à ce stade
– Quand station intéressée : s’enregistre auprès du RP
• Celui-ci « avertit » les routeurs concernés d’émettre132
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 263
Multicast IP
• Quand partie du réseau non multicast : tunnels
– Ex : uniquement les routeurs de sites R1, R4, R6 et R8
supporte le multicast (au cœur réseau d’opérateur)
Emetteur
Récepteur
Récepteur
Récepteur
Récepteur
Récepteur
Récepteur hub
hub
hub
hub
R2
R4
R6
R8
R1
R5
R7
R3
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 264
Multicast IP
• Réseaux (routeurs) : complexe
• Travail d’opérateur : très important
– En France uniquement Renater offre réellement ce
service
– On peut faire des tunnels
• Aujourd’hui
– Beaucoup d’expérimentations autour du multicast
– Réseau MBONE (opérationnel)
– Télévision sur Internet : idée abandonnée
– Radio sur Internet : pas multicast
– Vidéoconfé rence : 3 solutions
• Multicast IP
• H323
• RNIS133
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 265
Fcts «annexes » éqts actifs :
gestion des files d’attente
• Dans les routeurs : files d’attente
– En entrée : généralement gérées basiquement
– En sortie, pour chaque interface, choix :
• Taille de la file d’attente
– Important car quand elle est pleine le routeur jette les datagrammes
• La classification
– Permet de faire passer en priorité certains datagrammes (voix / FTP par
exemple)
• Gestion des files d’attente : fondamental dans un réseau
en mode non connecté (IP)
• Différentes techniques implémentées
– FIFO
– WFQ
– PQ
– CQ
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 266
Gestion des files d’attente : FIFO
• FIFO – First In First Out
– Mécanisme simple :
• Une file d’attente / interface de sortie
• Emission par ordre d’arrivée
– Plus : simple donc logiciels performants
– Pas de problème quand réseau peu chargé et files
d’attente de taille suffisante
• Pas de perte de datagramme
• Temps de traitement (latence) court
– Dans le cas contraire
• Temps de traitement peut-être trop long pour certaines sessions
TCP ou autre (par exemple s’il y a un gros transfert FTP en
cours, il va bloquer le flux H323 d’une communication voix)
– Perte de datagrammes (file d’attente pleine)
– Latence trop grande
– TCP ? retransmission, slow start, … : service très dégradé134
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 267
Gestion des files d’attente : PQ
• PQ : Priority Queuing
• Plusieurs files d’attente / interface de sortie
– Une file par priorité
– La file la plus prioritaire est envoyée avant les autres
– Le routeur peut déterminer la priorité selon
• Le protocole niveau 3 : IP/IPX
• Le protocole niveau 4 : TCP/UDP
• Les applications : Telnet/FTP/H323/…
• …
• Pb : certains types de trafic (priorité trop basse)
peuvent ne jamais être émis
– Coupures de session, … : catastrophe
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 268
Gestion des files d’attente : CBQ
• CBQ : Class Based Queuing
– Ou CQ - Custom Queuing
– Amélioration du PQ
• Exemple : 3 files d’attente / interface de sortie
– Haute, moyenne et basse priorité
– A chaque « rotation» le routeur envoie 10
datagrammes de la file haute, 6 de ma moyenne, 3 de
la basse.
• Evite que la basse priorité ne soit jamais émise
• Peut être une méthode pour partager une bande
passante (entre classes de services)
• Pb : nécessite du CPU pour du très haut débit135
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 269
Gestion des files d’attente
• WFQ : Weighted Fair Queuing
– Modification du CBQ en prenant en compte le volume
de données (nb de bytes) dans la répartition
– Evite que les flux avec des gros datagrammes
d’écrasent ceux avec des petits datagrammes
• Exemple d’efficacité de ces mécanismes
– Expérience CISCO sur une liaison surchargée
– Flux Telnet, FTP, Voix combinés sur un routeur
• Sans ces mécanismes : occupation bande passante 57 %
• Avec ces mécanismes : occupation bande passante 98 %
• Pb : réglage de ces mécanismes
– Le constructeur fournit des exemples
– Mais ça dépend de l’environnement : flux, …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 270
Fcts «annexes » éqts actifs : bilan
• Les routeurs peuvent être très simples à configurer et
administrer
– Entre 2 Ethernet, avec uniquement la fonction de routage pour
connecter un réseau de classe C avec l’extérieur
– Une dizaine de lignes de configuration
• Mais aussi très complexes
– Si on rajoute : comptabilité, tunnels, IPSec, routage dynamique,
filtrage, NAT, multicast, files d’attente, …
– Plusieurs centaines, voire milliers de lignes de configuration
– Demande des experts : chaque ligne de configuration est
importante
• Choix lors de l’achat d’un nouveau matériel
– Tendance à prendre toujours le même constructeur
• Expérience, habitude des ingénieurs
– Attention au monopole
– Des « Clones » d’OS de routeurs connus existent136
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 271
Qualité de service QoS (IP)
• Internet (IP) de base : best effort
– Le réseau peut avoir une mauvaise qualité (pertes, …) voire
devenir inutilisable
• La QoS repose sur quelques paramètres techniques
– Débit (bande passante)
– Pertes
– Latence (délai de transmission)
– Variation de la latence : gigue ou jitter
Mais impossibles à garantir dans l’Internet entre 2 utilisateurs
• QoS pour l’utilisateur : le réseau doit être transparent
• QoS où ?
– Entre deux sites
– Entre deux utilisateurs
– Pour un type d’application ?
– …
• 2 standards (principes) pour Internet : RSVP et DiffServ
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 272
Qualité de service (IP) : RSVP
• RSVP : Resource Reservation Protocol
• Protocole en // de TCP, UDP
– Comme ICMP et les protocoles de routage
• Principes
– La station (réceptrice) demande une QoS au réseau (bande
passante, …)
– Tous les routeurs le long du chemin
• Prennent en compte cette demande et réservent les ressources
nécessaires : CPU, mémoire, … (ils peuvent refuser)
• Tiennent à jour une table avec toutes les réservations effectuées
• Problème : (trop) complexe
– Adapté au mode connecté, pas à IP
• Que se passe-t-il quand le routage est dissymétrique ou change ? …
• Flux multicast ?137
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 273
Qualité de service (IP) : Diffserv
• Diffserv : Differentiated Services
• Les datagrammessont marqués / contenu
– Champ TOS dans IPv4, Traffic Class dans IPv6
– Par la station / routeur d « entrée »
• Chaque routeur traite différemment les
datagrammes
– Mécanismes dans routeur : gestion files d’attente
adaptée au champ TOS ou Traffic Class
• Simple mais peu précis
– Peut être facilement implémenté
– Là ou cela peut être utile (sur une partie du chemin)
• Liaisons à moyen, bas débits
• Pour certaines applications
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 274
Qualité de service (IP)
• Quand bande passante « à profusion» : QoS inutile
– Le cas généralement des LAN
– La bande passante disponible sur FO devient énorme
• Problème
– Besoin de QoS quand la bande passante est limitée car chère
c’est à dire dans les WAN
– Or c’est le plus difficile car présence d’un opérateur et souvent
même de plusieurs opérateurs
• Comment vérifier que le client respecte le contrat ?
– Non traité dans ce cours : policy
• On ne pourra pas implémenter un mécanisme de qualité
de service global dans tout l’Internet
• Les opérateurs utilisent plutôt des mécanismes « légers »
– Sur certaines portions, pour certains clients/applications
• Entreprises : choisissent des équipements qui supportent
DiffServ, au cas où …138
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 275
Administration de réseau : plan
• Que faut il administrer ?
• Les hommes
– Administrateurs et utilisateurs
• Les standards
– SNMP …
• La configuration des équipements
• La surveillance
– Détection des anomalies
• Le dépannage
• Les stations d’administration
• La sécurité
• La métrologie
– Qui consomme quoi ? ? Comptabilité
– Performances ? Evolution (anticiper)
• Remarques
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 276
Administration de réseau : quoi ?
• Que faut il administrer ?
– Tout ce que l’on a vu, en particulier :
• Le câblage
– Disposer des plans A JOUR
– Garder les cahiers de recette
– Disposer de valises de tests pour les grands réseaux
• Eléments d’interconnexion
– Hubs, ponts, commutateurs, routeurs
– Configuration, surveillance, métrologie
• Services (couche 7)
– DNS
• Configurer, mettre à jour
– Relais et serveurs de messagerie
• Configurer, mettre à jour, surveiller (spool), métrologie
– …
• Sécurité139
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 277
Administration de réseau : les hommes
• Constituer une équipe d’administrateurs
– Qui fait quoi ? Sur quoi ?
– Opérateurs – Techniciens – Ingénieurs – Gourous
• Faut il séparer très strictement les niveaux ?
– Difficile car évolution des réseaux très rapide
• Selon les stades d’installation : besoins différents de compétences
– Exemple entreprise : 3 équipes
• Infrastructure : câblage
• Ingénierie : configuration équipements d’interco, services, routage
• Supervision : surveillance, métrologie, sécurité
– Exemple opérateur Internet
• NOC : Network Operation Center : fait marcher
– Configuration, surveillance, …
– Procédures en cas d’incidents : tickets d’incidents, base de données, …
• NIC : Network Information Center : interface avec les utilisateurs
– Nommage, informations aux utilisateurs, hot line, …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 278
Administration de réseau : les hommes
• Où s’arrête le service d’administration réseau ?
– Administration des serveurs Web ?
– Installation des clients de messagerie sur les postes utilisateurs ?
– ….
• Astreinte ?
– Selon les besoins de l’entreprise : cela coûte cher
– Peut être externalisée
• Assistance (hot line) pour les utilisateurs
– Ca ne marche pas !
– Obligatoire
– Centrale puis dispatching
– Locale puis appel à l’assistance centrale si besoin
– Difficile pour un utilisateur de séparer réseau / application
• Il faut une très bonne organisation humaine
– Ne pas hésiter à décentraliser (noms, adresses, …)
– Compétences : formation continue obligatoire140
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 279
Administration de réseau : standards
• ICMP
– Echo, TTL exceeded, Dest unreachable, redirect, …
– Utilisé par les outils ping, traceroute par exemple
– Avantage : supporté par toute station IP (ordi, routeur, …)
– Peut sembler anodin mais en fait très utilisé
• SNMP - Simple Network Management Protocol
– Agent (serveur) dans hub, commut, routeur, station, …
– Manager depuis station d’administration
– MIB : informations (@, …) – standard ou constructeur
– Fonctions : GET – SET – TRAP sur UDP
– Sécurité embryonnaire ? config ne se fait pas avec SNMP
• RMON – RMON2 : MIBs pour sondes
• Les standards permettent d’avoir un même outil pour
administrer des matériels hétérogènes
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 280
Administration de réseau :
configuration des équipements
• Avec telnet ou interface Web
– Pas SNMP
– Telnet est souvent plus précis (pour les spécialistes)
– Attention aux mots de passe : ajouter filtrage / @ IP
• Perte de la configuration quand arrêt de l’équipement ?
• Stockage des différentes configurations
– Généralement : TFTP
• Permet de sauvegarder une configuration sur un serveur
• Inversement de charger cette configuration depuis ce serveur dans
l’équipement actif
– Attention : pas de mot de passe dans TFTP
• Outils de constructeurs qui permettent de gérer plusieurs
versions de configuration et d’OS …141
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 281
Administration de réseau : surveillance
• But : détecter (rapidement) des anomalies
• 2 types d’informations utiles
– Alarmes : lien coupé, élément arrêté, daemon/service inactif, …
– Relevés (courbes, tableaux, …) sur une courte période indiquant
des charges, utilisations anormales (inhabituelles)
• Longue période ? métrologie
• Transport : liens, équipements actifs
– Traps SNMP émis par les équipements
– Outils à base de ping et/ou traceroute depuis un point
– Lors récupération de compteurs SNMP, sondes : courbes
inhabituelles
• Services : messagerie, …
– Daemon (service) inactif, spool plein, …
– Ex d’outil : Big Brother
• Depuis une station interroge un daemon spécifique sur chaque machine
de service
• Détecte si service inactif, remonte des alarmes sur des seuils, …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 282
Administration de réseau : surveillance
• Alarmes et relevés
– Arrivent sur ou partent de la station d’administration
– Alarmes peuvent générer des mails … aux admins
• Des éléments de charges, activités anormales
permettent de détecter des problèmes de sécurité
– Brusque trafic vers une station, d’une application, …
• Les construire avec l’expérience
– On peut récupérer énormément d’informations
– Lesquelles sont pertinentes ?
• Les utilisateurs sont souvent plus rapides que les
outils
– Pour avertir : ça ne marche pas !142
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 283
Administration de réseau : dépannage
• Où se situe le problème ? Quand localisé : réponse simple
• Faire preuve de logique
– Première question : qu’est-ce qui a changé ?
– Procéder par élimination
• Ex de démarche : telnet www.inpg.fr ne marche pas
– Est-ce que la machine est accessible : ping www.inpg.fr ?
– Si non, où s’arrête l’accès : traceroute www.inpg.fr ?
• Tout de suite : problème très local
– Ping machine locale ? pb sur routeur sortant ou sur réseau local
– Câblage ? Essai d’une prise voisine …
• Si arrêt à un routeur : lequel ?
– Sur le site distant : téléphone à l’administrateur distant …
– Sur le site local
» Est-ce uniquement vers ce site : essaie d’atteindre un autre site de l’Internet
» …
• …
– Si oui, service arrêté ? Problème de filtrage ?
– …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 284
Administration de réseau : dépannage
• Demande de connaître
– La théorie : protocoles, fonctions des équipements, …
– Son réseau, ses utilisateurs et leurs applications
• Analyseurs de protocoles
– Quand vraiment on ne peut pas faire autrement
– Ex de logiciel du domaine public :TcpDump
– Station portable avec logiciel commercial
– Il faut bien connaître les protocoles
• Problèmes logiciels : d’autres ont eu le même pb
– Ne pas hésiter à utiliser les moteurs de recherche,
news, …143
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 285
Admin réseau : station d’administration
• Objectif : disposer d’UNE station qui
– Permette de configurer tous les équipements et de stocker toutes
les configurations
– Reçoive toutes les alarmes (Traps SNMP, …)
– Permette d’exécuter des scripts de surveillance développés, …
– Dessine (automatiquement) la carte du réseau : liens, stations,
équipements actifs, services
– Affiche en rouge ce qui ne marche pas
– Récupère des données de métrologie, les stocke, les affiche …
• Trois types
– Stations « générales » (Sun, HP, IBM, …)
• Beaucoup de temps pour les maîtriser
– Stations de constructeurs d’équipements (CISCO)
– Stations « artisanales » avec outils du domaine public
• Actuellement personne vise l’unicité (LA station)
– Les grands sites ont les 3 types de stations précédentes
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 286
Administration de réseau : sécurité
• De plus en plus de problèmes de sécurité liés au réseau
– Intrusion depuis l’Internet sur des machines internes
– Attaque de serveurs Internet :Web, messagerie, DNS
– Virus dans les messages électroniques, SPAM
– Vers se propageant par le réseau
– Spoofing d’@ IP, d’@ de messagerie
– Charge de liens (trafic parasite) ? deny de service
– …
• Organisation – coopération étroite entre responsable
sécurité et administrateur réseau
– Surveillance du réseau ? peut indiquer des probl èmes de
sécurité
– Architecture de réseau ? permet d’appliquer facilement une
politique de sécurité
• Maintenant la sécurité est un critère de choix important
dans l’architecture et les équipements144
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 287
Administration de réseau : métrologie
• But : répondre aux questions
– A quoi sert le réseau ? A quelles applications ? A qui ? Quand ?
– Qui l’utilise ? ? comptabilité si nécessaire
– Y-a-t-il des goulots d’étranglement ? Des problèmes de
performances ? ? Qualité de service
– Quelle évolution ? ? Anticiper les besoins
• Commander l’augmentation de débit d’une liaison avant sa saturation
• Ensemble de compteurs ? tableaux, courbes, …
• Qui fournit les informations ?
– Equipements en écoute passive sur le réseau
• Sondes RMON, RMON2
• Logiciel IPTrafic
• Pb : nb d’équipements nécessaires, où les mettre (pb commutation)
– Equipements actifs du réseau : commutateurs, routeurs
• Comptent différentes choses ? compteurs sp écifiques ou MIBs
• Sont interrogés « par telnet » ou SNMP
• Peuvent ne plus compter correctement quand d’autres urgences (charge)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 288
Administration de réseau : métrologie
• Quelles informations ?
– Charge et taux de collisions / interface
– Issues de comptage de différents champs des datagrammes
• @ IP (? numéros de réseaux), ports (? applications)
• Exemples d’informations fournies
– Le graphe journalier, hebdomadaire … de la charge de chaque
brin Ethernet, de chaque liaison, du taux de collision
– La répartition entre HTTP, MAIL, FTP, … sur chaque liaison
– Les 20 stations les plus consommatrices
– Le pourcentage de trafic intra-entreprise et extra-entreprise
– Le pourcentage de bande passante de l’accès Internet consommé
par chaque service de l’entreprise
• MRTG : logiciel graphique
– Visualise le trafic sur les interfaces des commutateurs, routeurs,
stations
– Informations dans MIBs, obtenues par SNMP145
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 289
Administration de réseau : remarques
• Fondamentale quand réseau d’envergure
• Surveillance :
– Confidentialité des relevés
– Respect de la vie privée
• Constats
– Les équipements et les liaisons fonctionnent bien
– IP est très solide
? Conséquence négative sur le besoin d’administration
• Il faut se construire soi-même sa boite à outils
– Pas une seule solution avec un seul produit
– Difficile de conduire une approche théorique globale
• Beaucoup d’outils du domaine public existent
– Mais chaque outil a un but particulier
– Un administrateur doit bien savoir ce qu’il veut obtenir
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 290
Administration de réseau : remarques
Exemple de choix de logiciels du domaine public
• Outil de dépannage : tcpdump
– Analyseur sur station Unix
• Outil de surveillance de liaison : MTR
– Utilise ping et traceroute
– Détecte rapidement une anomalie sur une liaison (coupure, engorgement). Sort des
statistiques.
• Outil de surveillance de trafic : NTOP
– Sonde
– Indique à quoi est utilisé le réseau : charge, stations les plus bavardes, qui dialogue avec qui,
avec quels protocoles, …
– Sur une courte période
• Outil de surveillance de services : Mon
– Services surveillés : messagerie, Web, FTP, SMTP, POP, IMAP, …
– Alerte (mail) quand indisponibles
• Outil de métrologie : Cricket basé sur MRTG
– Interroge des routeurs, commutateurs en SNMP
– Charge, trafic sur une longue période
• Outil de métrologie orienté comptabilité : acct-cisco
– Comptabilité (et répartition de charge) sur un routeur CISCO146
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 291
Eléments de sécurité
• De protection contre les agressions externes en
provenance de l’Internet (donc via le réseau)
• Garde-barrière
– Equipement entre l’extérieur (hostile) et l’intérieur
(de confiance) : routeur, équipement spécifique
– 3 ensembles principaux de contrôle
• Filtrage IP « de base » : cf cours sur les fonctions annexes des
routeurs
• Filtrage IP statefull : analyse des sessions applicatives
• Relais applicatifs
– Ex telnet : login sur garde-barrière puis login sur machine interne
– Permet de concentrer les contrôles sur une machine
– Difficile d’avoir des débits très élevés (Gigabits : non)
– Fiabilité : prévoir un équipement de secours
– Entre réseau interne de l’entreprise et l’Internet
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 292
Eléments de sécurité
• Architecture segmentée : un exemple
Internet Internet R
WWW
Relais
Mail
DNS
…
DMZ
Serveurs Internet
G-B
R
Serveurs internes
Mail WWW DNS
Calcul Stockage …
Service administratif
Service R&D
Service X
NAT
Sonde147
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 293
Eléments de sécurité
• Un pb de cette architecture : travail à distance
– Comment consulter son courrier à distance ?
– Comment accéder à l’Intranet à distance ?
– Solutions : cf connexion depuis l’Internet
• Un autre pb : portables
– Où les connecter en interne (peuvent transporter des virus ou
vers) ?
• Garde-barrière
– Ne pas se reposer uniquement sur sa protection
• Sonde de détection d’intrusions
– Sonde avec bibliothèque de signatures d’attaques
• Logiciel de simulation d’intrusions
– Test de vulnérabilités à travers le réseau
• Rq : jamais de sécurité à 100 % (ne pas connecter ?)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 294
Accès à l’Internet (Web)
• Station interne – LAN entreprise ? Internet
• Connexion directe (sans NAT)
– @ IP officielle station ? @ IP serveur Web
• Connexion directe avec NAT
– @ IP privée station ? @ IP serveur Web
– NAT
– @ IP officielle ? @ IP serveur Web
• Proxy-cache Web : serveur dans DMZ
– @ IP station ? @ IP proxy Web
– @ IP proxy Web ? @ IP serveur Web
– 2 sessions TCP (HTTP) : Station–Proxy et Proxy– Serveur Web
– Cache, gain bande passante, filtrage, traces, anti-virus
• Sécurisé : 3ième méthode > 2nde > 1ère
• Accès à l’Internet : autorisation ou non aux salariés ?148
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 295
Accès depuis l’Internet
Serveurs Internet – Extranet de l’entreprise
• Où les mettre ?
– Dans la DMZ
• Zone Démilitarisée, semi-ouverte
– Chez un fournisseur d’accès ou hébergeur
• Stations dédiées
• Serveurs aux CNRS
– Plutôt apache et Linux
– Un peu IIS et Win-NT : bcq trop de pbs de sécurité
• Prévoir un mécanisme de MAJ
• Bien les sécuriser
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 296
Accès depuis l’Internet
au réseau de l’entreprise
• Comment travailler à distance ?
– Consulter sa messagerie et émettre des messages
– Accéder (interactif) aux stations internes
– Transférer des fichiers
– Accéder globalement à toutes les ressources de l’Intranet (réseau
interne)
De manière sécurisée (pas de mot de passe en clair sur le réseau)
• Consulter sa boite aux lettres
– Accès interactif, POP, IMAP trop dangereux
– SSL : POPS, IMAPS, Passerelle Web (HTTPS)
• Chiffrement uniquement
• Chiffrement et authentification du client : certificat client
• Emettre des messages
– Relais « public » ou Sendmail-TLS149
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 297
Accès depuis l’Internet
au réseau de l’entreprise
• Accès interactif et transfert de fichiers
– Sécurisation niveau application : SSH par exemple
– Garde-barrière
• Accéder à toutes les ressources internes
– VPN
– PPT, L2TP, IPSec
• Tous ces mécanismes demandent des
compétences pointues pour ne pas créer des
trous de sécurité
• Personnel très mobile : tout sur le portable ?
– Attention aux vols
– Prévoir sauvegardes
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 298
Construire un réseau « solide »
Fiabilité, disponibilité, tolérance aux pannes, …
• Faire une architecture (physique et logique) simple
– IP est très souple : ne pas abuser des possibilités pointues
• Faire des cahiers des charges (pour chaque évolution)
– Qu’est-ce qu’on veut comme fonctionnalités ?
– Laisser répondre les intégrateurs
• Choisir des équipements spécialisés
– Un PC avec Linux n’est pas un routeur
• Ne pas hésiter à multiplier les machines dédiées /services
– Web – FTP – Mail - DNS - …
• Services réseaux
– Sous Unix ou sous NT ?
– Selon compétences – habitudes – schéma directeur150
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 299
Construire un réseau « solide »
• Faire en fonction des moyens dont on dispose
– Identifier ce qui est vital et non
• Cela va dépendre des applications
• L’expérience est très utile
– De chaque incident on tire une leçon
– Il est difficile de travailler uniquement en théorie
• Ex de question : les équipements et les liaisons sont ils fiables ?
• Comment le savoir sans expérience ?
• Les routeurs par exemple sont jusqu’à présent très fiables
• Faire appel aux entreprises du métier
– Ne pas faire son câblage soi-même
– Utiliser les services des opérateurs
– …
– Mais comprendre et contrôler (le domaine évolue vite)
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 300
Réseau « solide » : disponibilité
• Des liaisons
– Chaque contrat avec opérateur garantit :
• Délai d’intervention
• Délai de rétablissement : 4 h par exemple
• …
– Etablir le même principe en interne
• Pb bien connu : « coup de pelleteuse »
• Des équipements d’interconnexion (matériel)
– Spare
– Contrats de maintenance
– Garantie : souvent à vie maintenant
– Dans locaux réservés et protégés (accès, feu, climatisation ?, …)
• Des serveurs
– Classique informatique
• Ces aspects sont très important (pbs engendrés graves)
– Les informaticiens peuvent avoir tendance à le sous-estimé151
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 301
Réseau « solide » : tolérance aux pannes
• Pannes
– Rupture de liens
– Arrêt d’équipements actifs et de services
• Liaisons (niveau 1)
– Réseau maillé sur site
• Câbles mais aussi tranchées
• Bâtiment : deux accès différents ?
– Liaisons externes LS
• 2 LS différentes ? : rare
– Opérateurs : assurent le maillage
• Back up par réseaux commutés : souvent
– Débits inférieurs : est-ce que les applications fonctionnent toujours
? ? Est-ce utile ?
• 2 points d’arrivées des liaisons externes différents ?
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 302
Réseau « solide » : tolérance aux pannes
Niveau 2 : difficulté : Ethernet = bus (? étoile)
• Pas de structure d’anneau ou de maillage : pas
de maillage possible en extrémité
– (dans réseau capillaire : stations)
– Sauf manipulation (changement de prise …)
• Au cœur : réseau maillé de commutateurs
possible
– Algorithme de Spanning Tree
– Mais construction d’un arbre
• Un seul chemin utilis é à un moment
• L’autre inutilis é : « gaspillage »152
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 303
Réseau « solide » : tolérance aux pannes
Niveau 3 IP :
Routage dynamique sur réseau maillé de routeurs
• Fonctionne très bien : permet de basculer d’un chemin à
un autre sans intervention manuelle
• Pb (similaire à Eth) : à un instant une seule route vers
une destination
– On peut avoir 2 chemins différents pour une destination mais
avec des poids différents
• Quand tout va bien : utilise le chemin avec le poids le plus fort
• Bascule sur l’autre quand le premier chemin est coupé
• Pas de répartition de charge / destination
– Mais on peut répartir plusieurs destinations entre des chemins
différents
• Avec des poids différents permettant de basculer tout le trafic sur un
chemin ou l’autre en cas de rupture d’un des chemins
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 304
Réseau « solide » : tolérance aux pannes
Services : serveurs secondaires
• DNS : ce service doit être très fiable
– Bien répartir les serveurs secondaires
– Au moins un sur le même site
• Pas à côté du primaire (en cas de coupure de lien, …)
– 2 autres ailleurs
• Messagerie (relais) : serveurs secondaires
– DNS : MX records / domaine avec poids différents
– Mécanisme supplémentaire de file d’attente sur serveur émetteur
• Reste 4 j par défaut si serveur distant ne répond pas
• Mais c’est moins que la durée des périodes de fermeture des entreprises
• Serveurs Web de l’entreprise
– Si service important : image de marque, source de revenue, outil
de travail (B2B) avec fournisseur/client …
– Réplication de serveurs … : solutions commerciales disponibles153
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 305
Réseau « solide » : sécurité
• Problème sécurité souvent très coûteux
– Serveurs indisponibles, réseau bloqué, vols d’information, …
– Or attaques viennent maintenant du réseau
• Outils imparfaits
– Disparates (un peu à tous les niveaux …)
– Ne colmatent qu’une partie des trous : toujours de nouveaux
• IP et Internet : conçus sans souci de sécurité
– Principe d’un réseau global, égalitaire, sans frontière
• Pas conçu pour modèle réaliste : réseaux internes (entreprises) et un
réseau d’interconnexion
– Pas de limitation de débit / station ou application
– Transport en clair des informations (mot de passe donc)
– Pas garantie émetteur dans messagerie électronique
– …
• Actuellement la sécurité est une partie très importante
du travail d’un administrateur de réseaux
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 306
Réseau « solide » : qualité de service
• Le réseau est vital pour toutes les activités
– On « demande plus » au réseau
• Et à ses administrateurs
– Pas uniquement de garantir la connectivité
• Que le ping marche ne suffit plus
– Mais que les applications fonctionnent correctement
• ? Qualité de service
– Savoir réserver des bandes passantes (avec certaines
qualités) à
• Des utilisateurs (fonctionnellement à des sous-réseaux IP)
• Des applications (fonctionnellement à des numéros de ports)
– Mécanismes
• Cf chapitres : files d’attente routeurs et QoS154
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 307
La conception de réseaux
• Assemblage de briques un peu disparates
• Mais l’architecte doit avoir une vision globale
– Câbles ? applications
– Connaissances dans des domaines très divers
• Le réseau demande un budget conséquent
– Difficile à faire accepter à la direction
– Arguments trop techniques
• Métier difficile
– A risques
• Si le réseau ne marche pas ? catastrophe pour l’entreprise
– Forte évolution des technologies
• Remise à niveau continuel des connaissances
– Sens relationnel obligatoire
• Psychonet parfois
• Mais intéressant …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 308
Etudes de cas : plan
• Réseau de petit laboratoire éclaté : UREC
– Réseau d’une PME sur 2 sites
• Réseau de campus
– Réseau d’un gros site d’une entreprise
• Réseau Renater (national)
– Réseau opérateur télécom
– Réseau grande entreprise multi-sites155
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 309
Réseau UREC : stations Paris-Grenoble
• Paris
– 7 personnes
– 5 bureaux, salle machines (climatisée)
• Grenoble
– 4 personnes + stagiaires
– 6 bureaux, salle machines (climatisée), local technique
• Choix OS
– Stations personnelles : bureautique ? Windows
– Serveur fichiers interne et sauvegarde ? Windows
– Serveurs Internet (DNS, Mail, Web, …) ? Linux
– Développement, tests ? Cela dépend
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 310
Réseaux UREC : câblage
• Câblages effectués par 2 sociétés spécialisées
– Cahier de recette : plans, repérage des prises, résultats tests
• TP catégorie 5 : 100 Mbps OK
– Post-câblage à Grenoble
– Pré-câblage à Paris (nouveaux bureaux)
– Lors du déménagement Paris : abandon de la FO
– 3 prises par personne : 2 informatiques, 1 téléphone
• Cœur étoiles
– Local technique à Grenoble, salle machine à Paris
– Armoires de brassage
• Chemins de câble
– Goulottes dans les bureaux et faux plafonds ailleurs
• Evolution à court terme
– Bornes sans fil : portables, visiteurs156
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 311
Réseaux UREC
• Equipements actifs
– Paris et Grenoble : un commutateur routeur
– 2 ports FO Gbps Ethernet
– 48 ports TP 10-100 Mbps Ethernet
– Contrat de maintenance
– Avant : routeurs, commutateurs Ethernet et ATM,
Hub Ethernet, Stations Eth et/ou ATM
– Connexion extérieure : prise Giga Eth réseau de
campus
• Plan d’adressage
– 1 numéro de classe C officiel à Paris
– 1 numéro de classe C officiel à Grenoble
– Sous-réseaux sur les sites : utilisation des VLAN
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 312
Réseaux UREC sur 2 sites : VLAN
Commut
Routeur
• Autre possibilité : faire des VLAN étendus sur 2
sites
– Pas vraiment de besoin (serveurs mail … dupliqués)
– Trop de dépendance d’un site / l’autre (pb si coupure
Renater par exemple)
FO
Campus
Stations utilisateurs
Serveurs Internet : DNS, mail, Web, …
Serveurs internes : fichiers, log, mail, Web Intranet
Stations visiteurs
Stations tests157
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 313
Réseau UREC : noms machines
(Rappel : déjà expliqué avant)
• Domaine urec.cnrs.fr
– Ss-domaine grenoble.urec.cnrs.fr : toutes machines de Grenoble
– Ss-domaine paris.urec.cnrs.fr : toutes les machines de Paris
• Alias
– www.urec.fr ? elea.paris.urec.cnrs.fr
– mail.urec.cnrs.fr ? thinos.paris.urec.cnrs.fr
– …
– services.cnrs.fr ? kaki.grenoble.urec.cnrs.fr
• Serveur DNS serveur Paris
– Primaire urec.cnrs.fr et paris.urec.cnrs.fr
– Secondaire grenoble.urec.cnrs.fr
• Serveur DNS Grenoble
– Primaire grenoble.urec.cnrs.fr
– Secondaire paris.urec.cnrs.fr et urec.cnrs.fr
• Serveurs DNS secondaires : Jussieu, Grenoble, …
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 314
UREC : messagerie
• Objectifs architecture
– Adresses standards : Prénom.Nom@urec.cnrs.fr
– Utiliser 2 serveurs (back up) : Paris et Grenoble
• MX urec.cnrs.fr ? Serveurs :
– Mail.paris.urec.cnrs.fr (prioritaire)
– Mail.grenoble.urec.cnrs.fr
• Alias par personne :
– Jean-Luc.Archimbaud@urec.cnrs.fr? JeanLuc.Archimbaud@grenoble.urec.cnrs.fr
• Service accès aux boites aux lettres :
– IMAP en local
– IMAPS avec certificats électroniques à distance158
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 315
UREC : autres services (pour l’UREC)
• Web Intranet :
– Contrôle d’accès par certificat
• Annuaire LDAP : interne
• Service listes de diffusion : SYMPA
• Multicast : routeurs configurés pour le recevoir
• NAT : pas utilisé
• Videoconf (actuellement téléconférence)
– Etude pour l’achat d’un matériel H323 dédié (écran
…)
• Administration
– Un administrateur à Paris, un à Grenoble
– Utilisation de BigBrother
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 316
UREC : sécurité
• Basée sur la segmentation et le filtrage
• Connexion vers l’extérieur
– Tout est possible pour toutes les stations du personnel
– Pour les autres (serveurs, machines tests, …) : limitée au
maximum
• Connexion depuis l’extérieur
– Vers certains serveurs locaux, depuis certains réseaux
• Filtres IP : aucun accès possible :
– Extérieur ? ? machines tests, serveurs internes
– Extérieur ? machines utilisateurs
– Machines tests ? machines utilisateurs
– …
• Filtres IP : accès restreints :
– Extérieur ? serveur Web : uniquement Web
– …159
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 317
UREC : sécurisation accès distants
• Actuellement : n applications
– Telnet, FTP, IMAP, HTTP vers Intranet
– Sécurisation
• Filtrage : uniquement depuis certaines stations
• Mot de passe ? SSL des applications (telnets, ftps, imps, https)
avec utilisation des certificats électroniques
• A l’étude : IPSec avec certificats électroniques
– Station distante considérée comme station locale
– Problèmes :
• Paramétrage de IPSec (fragmentation UDP)
• Plus de débit nécessaire sur la liaison
• Montages en tous sens demande bande passante
• LA STATION NOMADE DOIT ETRE DE CONFIANCE
– Pas d’autres connexions à l’Internet possible depuis cette station
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 318
Réseau de campus
• CNRS Meudon : 10 bâtiments
• Câblage :
– Interconnexion FO
– Intérieur des bâtiments TP Cat5
• Niveau 2-3
– Cœur de réseau : commutateur 100 et GigaEth
– A l’entrée de chaque bâtiment : routeur
– A l’intérieur des bâtiments : commutateurs – hubs
– Sortie vers Renater : routeur
• Adressage IP
– 3 classes C160
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 319
Réseau de campus : services
• Messagerie
• Serveur Web
– Internet
– Intranet : contrôle d’accès par numéro IP
• Sécurité
– Filtres sur les routeurs
– Contrôle d’accès et traces sur les serveurs (tcpwrapper)
• Equipe
– 2 ingénieurs
– Groupe des correspondants de laboratoire
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 320
RENATER : services
• REseau NAtional de la Technologie, de l’Enseignement et
de la Recherche
– GIP : Min Ens Sup, CNRS, INRIA, CEA, …
• Service interconnexion IP
– Réseaux région
– Réseaux métropolitains (MAN)
– Gros sites
– Autres opérateurs français : GIX : SPHINX
– Connexion internationale
• Autres services
– IPv6
– Multicast
– VPN
– CERT161
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 321
RENATER : architecture
• Opérateurs
– N opérateurs pour les liaisons (FO)
– Principaux : TD et FT
– Un opérateur pour l’administration des équipements
actifs (routeurs) : CS
• Architecture
– ATM (VC avec IP) ? IP sur SDH
– VPN : VC ATM ? IPSec
• NRDs : Nœuds de raccordement
– Locaux techniques avec routeurs
– Dans sites en région
JL Archimbaud CNRS/UREC Interconnexion et conception de réseaux 2002 322
Outils Logiques pour l’Informatique
Roberto M. Amadio
To cite this version:
Roberto M. Amadio. Outils Logiques pour l’Informatique. Ecole d’ing´enieur. 2006, Universit´e ´
Paris 7, 2007, pp.86.
HAL Id: cel-00163821
https://cel.archives-ouvertes.fr/cel-00163821
Submitted on 18 Jul 2007
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Outils Logiques pour l’Informatique∗
Roberto M. Amadio
Universit´e Paris 7
18 juillet 2007
R´esum´e
Ces notes sont une introduction `a la logique math´ematique et aux techniques de
d´eduction automatique dans le cadre du calcul propositionnel classique avec des applications
`a la r´esolution de probl`emes combinatoires et `a la mod´elisation et analyse de
syst`emes informatiques.
1 Introduction
Dans ces notes on aborde les th`emes suivants.
– Calcul propositionnel classique. Interpr´etation. Formes normales. M´ethode de Davis
Putnam. Fonctions d´efinissables. Relation avec les circuits combinatoires.
– Syst`eme de preuve de Gentzen. Correction, compl´etude et compacit´e. M´ethode de
preuve par r´esolution.
– M´ethodes bas´ees sur les diagrammes de d´ecision binaire. Application `a l’analyse de
syst`emes finis.
– Langages formels et automates finis. Non-d´eterminisme et d´eterminisation.
– Notions de calculabilit´e. Machines de Turing. Enum´erations. D´ecidabilit´e. Th´eor`eme de ´
Rice.
– Notions de complexit´e. Classes P et NP. R´eduction en temps polynomial. Le probl`eme
SAT et la notion de NP-compl´etude. Th´eor`eme de Cook-Levin.
– Ordres bien fond´es et principe d’induction.
– M´ethodes de terminaison. Plongement monotone. Ordres produit et lexicographique.
Lemme de K¨onig. Ordre sur les multi-ensembles.
– Travail Pratique. Mise en oeuvre d’une proc´edure de d´eduction automatique type DavisPutnam,
R´esolution,
– Travail Pratique. Utilisation d’un SAT solver type SATO ou CHAFF et application `a
la r´esolution de probl`emes combinatoires type planification, ordonnancement, programmation
lin´eaire sur les entiers,. . .
On pourra se r´ef´erer aux textes suivants pour une pr´esentation plus approfondie.
– J. Barwise, Handbook of mathematical logic (chapitres r´edig´es par J. Barwise et H. Schwichtenberg),
Elsevier.
∗Ces notes sont bas´ees sur un cours que j’ai assur´e `a l’Universit´e de Paris 7 en 2005 et 2006. Elles sont
compl´et´ees par une s´election de travaux dirig´es et pratiques.
1– J. Gallier. Logic for computer science (chapitres 1-4), Harper et Row (disponible en
ligne).
– J. Goubault-Larrecq et I. Mackie. Proof theory and automated deduction (chapitre 1),
Kluwer Academic Publishers.
– M. Sipser. Introduction to the theory of computation (chapitres 3-7), Thomson.
On trouve aussi plusieurs textes d’introduction `a la logique r´edig´es en fran¸cais qui comprennent
un chapitre sur le calcul propositionnel. Par exemple :
– R. Cori, D. Lascar. Logique math´ematique, tome 1 : calcul propositionnel - cours et
exercices, Dunod.
Le texte
– P. Wolper. Introduction `a la calculabilit´e, InterEditions.
comprend une introduction ´el´ementaire aux machines de Turing et `a la complexit´e.
22 Calcul Propositionnel
La logique est `a l’origine une r´eflexion sur le discours (logos) et sur sa coh´erence. En
particulier, la logique math´ematique s’int´eresse `a l’organisation et `a la coh´erence du discours
math´ematique et donc aux notions de validit´e et de preuve. Dans le calcul propositionnel
classique, on dispose d’un certain nombre de propositions qui peuvent ˆetre vraies ou fausses
et d’un certain nombre d’op´erateurs qui permettent de combiner ces propositions.
2.1 Formules
– Soit V = {x1, x2, . . .} un ensemble d´enombrable de variables propositionnelles.
– L’ensemble Form des formules est le plus petit ensemble tel que Form ⊇ V et si A, B ∈
Form alors
¬A (n´egation),
(A ∧ B) (conjonction)
(A ∨ B) (disjonction)
sont des formules.1
– Si A ∈ V on dit que A est une formule atomique.
– Si A ∈ V ou A = ¬B et B ∈ V on dit que A est un litt´eral. Dans le premier cas on dit
que le litt´eral est positif et dans le deuxi`eme qu’il est n´egatif. On d´enote un litt´eral avec
`, `0
, . . .
– L’ensemble Var (A) des variables pr´esentes dans la formule A est d´efini par :
Var (x) = {x}, Var (¬A) = Var (A), Var (A ∧ B) = Var (A ∨ B) = Var (A)∪ Var (B).
2.2 Interpr´etation
– 2 = {0, 1} est l’ensemble des valeurs bool´eennes, d’apr`es George Boole. De fa¸con
´equivalente on peut utiliser B = {faux, vrai} avec la convention que faux correspond `a 0
et vrai `a 1.
– Une affectation est une fonction partielle
v : V * 2
avec domaine de d´efinition dom(v).
– Si v est une affectation, x est une variable propositionnelle et b une valeur bool´eenne
alors v[b/x] est l’affectation d´efinie par
v[b/x](y) = (
b si y = x
v(y) autrement
– L’interpr´etation [[A]]v d’une formule A par rapport `a l’affectation v est d´efinie par
r´ecurrence sur la structure de A en supposant que Var (A) ⊆ dom(v) (autrement l’interpr´etation
n’est pas d´efinie) :
[[x]]v = v(x) [[¬A]]v = NOT([[A]]v)
[[A ∧ B]]v = AND([[A]]v, [[B]]v) [[A ∨ B]]v = OR([[A]]v, [[B]]v).
1
Il s’agit d’un exemple de d´efinition inductive d’un ensemble dont il sera question dans la section 8.
3o`u les fonctions NOT, AND, OR sont d´efinies par :
x NOT(x) x y AND(x, y) x y OR(x, y)
0 1 0 0 0 0 0 0
1 0 0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
Parfois, il est pr´ef´erable d’utiliser une notation plus compacte, `a savoir : x = NOT(x),
x + y = OR(x, y) et x · y = AND(x, y).
– On ´ecrit v |= A si [[A]]v = 1.
– On dit que A est satisfiable s’il existe une affectation v telle que v |= A.
– On dit que A est valide (ou une tautologie) si pour toute affectation v, v |= A.
Exercice 2.1 Montrez que A est valide si et seulement si ¬A n’est pas satisfiable.
Exercice 2.2 Si X est un ensemble de variables et v est une affectation alors v|X est la
restriction de v `a X. Soit A une formule et X ⊇ Var (A). Montrez que si v|X = v
0
|X
alors
[[A]]v = [[A]]v
0
. Donc l’interpr´etation [[A]]v est ind´ependante des valeurs de l’affectation v sur
les variables propositionnelles qui ne sont pas pr´esentes dans A.
2.3 Substitution
La substitution [B/x]A d’une formule B pour une variable propositionnelle x dans la
formule A est d´efinie par :
[B/x](y) = (
B si y = x
y autrement
[B/x](¬A) = ¬[B/x]A,
[B/x](A ∧ A0
) = ([B/x]A ∧ [B/x]A0
) [B/x](A ∨ A0
) = ([B/x]A ∨ [B/x]A0
)
Proposition 2.3 [[[B/x]A]]v = [[A]]v[[[B]]v/x].
Idee de la preuve ´ . Par r´ecurrence sur la structure de A. •
2.4 Equivalence logique ´
On d´efinit les formules :
0 =def x ∨ ¬x 1 =def x ∧ ¬x (A → B) =def ¬A ∨ B (A ↔ B) =def (A → B) ∧ (B → A)
Si |= A ↔ B on dit que A et B sont logiquement ´equivalentes et on ´ecrit aussi A ≡ B.
Exercice 2.4 Montrez que A et B sont logiquement ´equivalentes si et seulement si pour toute
affectation v, [[A]]v = [[B]]v.
Exercice 2.5 Montrez :
(A ∨ 0) ≡ A, (A ∨ 1) ≡ 1, (A ∨ B) ≡ (B ∨ A),
((A ∨ B) ∨ C) ≡ (A ∨ (B ∨ C)), (A ∨ A) ≡ A
(A ∧ 0) ≡ 0, (A ∧ 1) ≡ A, (A ∧ B) ≡ (B ∧ A),
((A ∧ B) ∧ C) ≡ (A ∧ (B ∧ C)), (A ∧ A) ≡ A,
(A ∧ B) ∨ C ≡ (A ∧ C) ∨ (B ∧ C), (A ∨ B) ∧ C ≡ (A ∧ C) ∨ (A ∧ C),
¬¬A ≡ A, ¬(A ∨ B) ≡ ((¬A) ∧ (¬B)), ¬(A ∧ B) ≡ ((¬A) ∨ (¬B)) .
4On appelle les deux derni`eres ´equivalences de l’exercice pr´ec´edent lois de De Morgan.
Si {Ai
| i ∈ I} est une famille de formules index´ees sur l’ensemble I on peut ´ecrire :
V
{Ai
|i∈I} ou V
i∈I Ai
, W
{Ai
|i∈I} ou W
i∈I Ai
.
Comme la disjonction et la conjonction sont associatives et commutatives, cette notation
d´efinit une formule unique `a ´equivalence logique pr`es. Par convention, si I est vide on a :
^
∅ = 1 et _
∅ = 0 .
2.5 Fonctions d´efinissables et formes normales
– Soit x1, . . . , xn une liste de variables distinctes telle que {x1, . . . , xn} ⊇ var (A). Une
formule A d´efinit une fonction fA : 2
n → 2 par
fA(b1, . . . , bn) = [[A]][b1/x1, . . . , bn/xn]
Notez que la fonction fA non seulement d´epend de A mais aussi de la liste de variables
x1, . . . , xn. Par exemple, la formule x d´efinit la premi`ere projection par rapport `a la
liste x, y et la deuxi`eme projection par rapport `a la liste y, x.
– Une formule est en forme normale disjonctive (DNF pour Disjunctive Normal Form) si
elle est une disjonction de conjonctions de litt´eraux.
– On appelle clause une disjonction de litt´eraux. Une formule est en forme normale
conjonctive (CNF pour Conjuctive Normal Form) si elle est une conjonction de clauses.
Th´eor`eme 2.6 Toute fonction f : 2
n → 2 est d´efinissable par une formule A en forme
normale disjonctive telle que Var (A) = {x1, . . . , xn}.
Idee de la preuve ´ . On construit un tableau de v´erit´e avec 2n
entr´ees. Si f(b1, . . . , bn) = 1
avec bi ∈ {0, 1} alors on construit un monˆome (`1 ∧ · · · ∧ `n) o`u `i = xi si bi = 1 et `i = ¬xi
autrement. La formule A est la disjonction de tous les monˆomes obtenus de cette fa¸con. Par
exemple, si f(0, 1) = f(1, 0) = 1 et f(0, 0) = f(1, 1) = 0 alors on obtient A = (¬x1 ∧ x2) ∨
(x1 ∧ ¬x2). •
Corollaire 2.7 Toute fonction f : 2
n → 2 est d´efinissable par une formule A en forme
normale conjonctive telle que Var (A) = {x1, . . . , xn}.
Idee de la preuve ´ . Par le th´eor`eme 2.6 on peut construire une formule A en forme normale
disjonctive pour la fonction NOT ◦ f : 2
n → 2. Donc la formule ¬A d´efinit la fonction f. On
applique maintenant les lois de De Morgan et on obtient :
¬
_
i∈I
(
^
j∈Ji
`i,j ) ≡
^
i∈I
(¬(
^
j∈Ji
`i,j )) ≡
^
i∈I
(
_
j∈Ji
(¬`i,j ) ) ≡
^
i∈I
(
_
j∈Ji
`
0
i,j )
o`u `
0
i,j = ¬xi,j si `i,j = xi,j et `
0
i,j = xi,j si `i,j = ¬xi,j . Bien sˆur, on utilise ici l’´equivalence
logique A ≡ ¬¬A. •
5Remarque 2.8 Tout ensemble fini X peut ˆetre cod´e par les ´el´ements d’un ensemble 2
n
pour n suffisamment grand. Toute fonction f : 2
n → 2
m se d´ecompose en m fonctions
f1 : 2
n → 2, . . . , fm : 2
n → 2. Ainsi toute fonction f : X → Y o`u X et Y sont finis
peut ˆetre d´efinie, modulo codage, par un vecteur de formules du calcul propositionnel. Avec un
peu de r´eflexion, tout objet fini peut ˆetre repr´esent´e par des formules du calcul propositionnel.
Cette puissance de repr´esentation explique en partie la grande vari´et´e d’applications possibles
du calcul propositionnel.
Exercice 2.9 Montrez que toute formule est logiquement ´equivalente `a une formule compos´ee
de n´egations et de conjonctions (ou de n´egations et de disjonctions).
Exercice 2.10 La taille |A| d’une formule A peut se d´efinir par :
|x| = 1, |¬A| = 1 + |A|, |A ∧ B| = 1 + |A| + |B|, |A ∨ B| = 1 + |A| + |B| .
Donnez une borne sup´erieure `a la taille d’une formule qui d´efinit une fonction f : 2
n → 2.
Exercice 2.11 (1) Montrez que :
_
i=1,...,m
(
^
j=1,...,ni
`i,j ) ≡
^
1≤i≤m,1≤ki≤ni
(`1,k1 ∨ · · · ∨ `m,km)
(2) Supposez ni = n pour i = 1, . . . , m. Exprimez la taille des formules dans (1) en fonction
de n et m.
(3) D´erivez une proc´edure pour transformer une formule en CNF.
Exercice 2.12 (1) Montrez l’´equivalence logique :
(A ∧ B) ∨ (¬A ∧ B) ≡ B (1)
(2) On peut appliquer cette ´equivalence logique pour simplifier une forme normale disjonctive.
Par exemple, consid´erez la fonction f(x, y, z) d´efinie par le tableau de v´erit´e :
x\yz 00 01 11 10
0 0 1 1 0
1 1 1 1 1
Calculez la forme normale disjonctive de f et essayez de la simplifier en utilisant l’´equivalence
logique 1.
(3) La pr´esentation du tableau de v´erit´e n’est pas arbitraire. . . Proposez une m´ethode graphique
pour calculer une forme normale disjonctive simplifi´ee.
Exercice 2.13 Soit f une fonction sur les nombres naturels. Dire qu’un probl`eme est d´ecid´e
en O(f), signifie qu’on dispose d’un algorithme A et de n0, k nombres naturels tels que pour
toute entr´ee dont la taille n est sup´erieure `a n0, le temps de calcul de A sur l’entr´ee en
question est inf´erieure `a k · f(n).
(1) Montrez que la satisfaction d’une formule en DNF et la validit´e d’une formule en CNF
peuvent ˆetre d´ecid´ees en O(n).
(2) Soit pair (x1, . . . , xn) = (Σi=1,...,nxi) mod 2 la fonction qui calcule la parit´e d’un vecteur de
bits. Montrez que la repr´esentation en DNF ou CNF de cette fonction est en O(2n
). Peut-on
appliquer (1) pour simplifier la repr´esentation ?
6Exercice 2.14 (if-then-else) La fonction ternaire ITE est d´efinie par ITE(1, x, y) = x et
ITE(0, x, y) = y. Montrez que toute fonction f : 2
n → 2, n ≥ 0 s’exprime par composition de
la fonction ITE et des (fonctions) constantes 0 et 1.
Exercice 2.15 (nand,nor) Les fonctions binaires NAND et NOR sont d´efinies par NAND(x, y) =
NOT(AND(x, y)) et NOR(x, y) = NOT(OR(x, y)). Montrez que toute fonction f : 2
n → 2,
n ≥ 0, s’exprime comme composition de la fonction NAND (ou de la fonction NOR). Montrez
que les 4 fonctions unaires possibles n’ont pas cette propri´et´e et que parmi les 16 fonctions
binaires possibles il n’y en a pas d’autres qui ont cette propri´et´e.
Exercice 2.16 L’or exclusif ⊕ (xor) est d´efini par
A ⊕ B ≡ (A ∧ ¬B) ∨ (¬A ∧ B)
Montrez que :
(1) ⊕ est associatif et commutatif.
(2) x ⊕ 0 ≡ x et x ⊕ x ≡ 0.
(3) Toute fonction bool´eenne f : 2
n → 2 peut ˆetre repr´esent´ee `a partir de 1, ∧ et ⊕.
2.6 M´ethode de Davis-Putnam
La m´ethode de Davis Putnam permet de d´ecider si une formule en forme normale conjonctive
est satisfiable. On repr´esente une formule A en CNF comme un ensemble (´eventuellement
vide) de clauses {C1, . . . , Cn} et une clause C comme un ensemble (´eventuellement vide) de
litt´eraux. Dans cette repr´esentation, on d´efinit la substitution [b/x]A d’une valeur bool´eenne
b ∈ {0, 1} dans A comme suit :
[b/x]A = {[b/x]C | C ∈ A et [b/x]C 6= 1}
[b/x]C =
1 si (b = 1 et x ∈ C) ou (b = 0 et ¬x ∈ C)
C\{`} si (b = 1 et ` = ¬x ∈ C) ou (b = 0 et ` = x ∈ C)
C autrement
On d´efinit une fonction DP qui agit r´ecursivement sur une formule A en CNF dans la
repr´esentation d´ecrite ci-dessus :
function DP(A) = case
(1) A = ∅ : true
(2) ∅ ∈ A false
(3) {x,¬x} ⊆ C ∈ A : DP(A\{C})
(4) {x} ∈ A : DP([1/x]A)
(5) {¬x} ∈ A : DP([0/x]A)
(6) else : choisir x dans A;
DP([0/x]A) or DP([1/x]A)
Dans (1), nous avons une conjonction du vide qui par convention est ´equivalente `a true. Dans
(2), A contient une clause vide. La disjonction du vide ´etant ´equivalente `a false, la formule A
est aussi ´equivalente `a false. Dans (3), une clause contient un litt´eral et sa n´egation et elle est
7donc ´equivalente `a true. Dans (4) et (5), A contient une clause qui est constitu´ee uniquement
d’une variable ou de sa n´egation. Ceci permet de connaˆıtre la valeur de la variable dans toute
affectation susceptible de satisfaire la formule. Dans (6), nous sommes oblig´es `a consid´erer les
deux valeurs possibles d’une affectation sur une variable.
Exercice 2.17 (1) Montrez que si A est une fonction en CNF alors la fonction DP termine.
(2) Montrez que DP(A) retourne true (false) si et seulement si A est satisfiable (ne l’est pas).
Exercice 2.18 Expliquez comment utiliser la m´ethode de Davis-Putnam pour d´ecider la validit´e
d’une formule.
Exercice 2.19 Modifiez la fonction DP pour que, si la formule A est satisfiable, elle retourne
une affectation v qui satisfait A.
Exercice 2.20 R´efl´echissez aux structures de donn´ees et aux op´erations n´ecessaires `a la mise
en oeuvre de l’algorithme en Java.
Exercice 2.21 En logique classique, on peut d´efinir l’implication A → B comme ¬A ∨ B.
Analysez la satisfiabilit´e et la validit´e des formules suivantes :
(x → w) → ((y → z) → ((x ∨ y) → w))
(x → y) → ((y → ¬w) → ¬x)
Calculez la CNF des deux formules et de leurs n´egations. Appliquez la m´ethode de DavisPutnam
pour d´eterminer la satisfiabilit´e des formules obtenues.
Exercice 2.22 Une clause de Horn est une clause (c’est-`a-dire une disjonction de litt´eraux)
qui contient au plus un litt´eral positif. Une formule de Horn est une formule en CNF dont les
clauses sont des clauses de Horn.
(1) Montrez que toute formule de Horn est ´equivalente `a la conjonction (´eventuellement vide)
de clauses de Horn de la forme :
(1) x
(2) ¬x1 ∨ · · · ∨ ¬xn
(3) ¬x1 ∨ · · · ∨ ¬xn ∨ xn+1
o`u n ≥ 1 et xi 6= xj si i 6= j. Dans ce cas on dit que la formule de Horn est r´eduite.
(2) Montrez qu’une formule de Horn r´eduite qui ne contient pas de clauses de la forme (1)
ou qui ne contient pas de clauses de la forme (2) est satisfiable.
(3) Donnez une m´ethode efficace (temps polynomial) pour d´eterminer si une formule de Horn
est satisfiable.
2.7 Circuits
Une formule A du calcul propositionnel avec variables x1, . . . , xn peut ˆetre vue comme un
arbre. On a vu que A d´efinit une fonction fA : 2
n → 2. Une fa¸con naturelle de calculer la
fonction fA est de propager les valeurs de v´erit´e des feuilles vers la racine. On peut mesurer
la complexit´e du calcul en comptant le nombre de portes ou en comptant la longueur du
chemin le plus long. Intuitivement, la premi`ere mesure correspond `a l’espace occup´e par le
calcul alors que la deuxi`eme correspond au temps n´ecessaire au calcul.
82.7.1 Circuits bool´eens
Une formule/arbre A peut pr´esenter une certaine redondance. Par exemple, consid´erons
la formule :
(x3 ∧ ¬((x1 ∨ x2) ∧ (¬x1 ∨ ¬x2))) ∨ (¬x3 ∧ (x1 ∨ x2) ∧ (¬x1 ∨ ¬x2))
Les formules x1, x2, x3, (x1 ∨ x2), (¬x1 ∨ ¬x2) paraissent plusieurs fois dans la formule A. On
peut alors envisager de donner une repr´esentation plus compacte de A dans laquelle les sous
formules identiques sont partag´ees. On arrive ainsi `a la notion de circuit bool´een.
Un circuit bool´een est un graphe dirig´e acyclique G = (N, A) o`u on appelle les noeuds dans
N portes logiques. A chaque porte logique on associe une ´etiquette ∧,∨,¬, 0, 1, x1, . . . , xn. Les
noeuds avec ´etiquettes ∧,∨ ont 2 arˆetes entrantes, les noeuds avec ´etiquette ¬ ont 1 arˆete
entrante et les noeuds avec ´etiquettes 0, 1, x1, . . . , xn n’ont pas d’arˆete entrante. Les noeuds
qui n’ont pas d’arˆete entrante correspondent aux entr´ees du circuit. Les noeuds qui n’ont pas
d’arˆete sortante correspondent aux sorties du circuit. Chaque sortie correspond `a une fonction
(avec entr´ees x1, . . . , xn) repr´esent´ee par le circuit.
Les fonctions calcul´ees par le circuit sont obtenues en affectant des valeurs de v´erit´e aux
variables x1, . . . , xn et en propageant ces valeurs de v´erit´e des entr´ees vers les sorties. Le fait
que le graphe est acyclique assure que ce calcule peut toujours ˆetre effectu´e et que le r´esultat
est d´etermin´e de fa¸con unique.
2.7.2 Circuits combinatoires
Les circuits bool´eens sont une abstraction math´ematique de dispositifs ´electroniques qu’on
appelle circuits combinatoires. Dans les circuits combinatoires, les portes logiques sont r´ealis´ees
par des transistors, les arˆetes correspondent `a des interconnexions et les valeurs bool´eennes
correspondent `a des tensions. Typiquement, 0 est repr´esent´e par la masse (tension 0V ) et 1
par 5V .
Dans les circuits combinatoires les boucles sont interdites, ce qui correspond `a la condition
d’acyclicit´e dans les circuits bool´eens. Cette condition permet de garantir que suite `a une
variation des tensions en entr´ee, la tension du circuit en sortie se stabilise sur une valeur
significative (proche de 0V ou de 5V apr`es un temps qui est li´e `a des variables physiques
comme la temp´erature et la longueur des interconnexions).
Remarquons que les mesures de complexit´e que nous avons ´evoqu´ees pour les circuits
logiques ont une interpr´etation imm´ediate en terme de circuits combinatoires. Le nombre de
noeuds du circuit bool´een correspond au nombre de portes logiques, c’est-`a-dire au nombre
de transistors n´ecessaires `a la mise en oeuvre du circuit. Coupl´ee avec la topologie des interconnexions,
cette mesure d´etermine l’espace occup´e par le circuit. La longueur du chemin le
plus long correspond au temps qu’il faut attendre entre une variation du signal en entr´ee et
la stabilisation du signal en sortie.
La notion de circuit bool´een fait abstraction de la notion de temps (le calcul du r´esultat
est instantan´e) et dans une certaine mesure de distance (on compte le nombre de portes mais
on ne compte pas la longueur des interconnexions) et il permet de simplifier grandement la
conception d’un circuit combinatoire. Dans la suite nous allons consid´erer dans un certain
d´etail la conception d’un additionneur.
92.7.3 Additionneur
On consid`ere un vecteur bn, . . . , b0 o`u bi ∈ {0, 1} comme un nombre en base 2. Ainsi le
nombre repr´esent´e est Σi=0,...,nbi2
i qu’on d´enote aussi avec (bn · · · b0)2.
Un multiplexeur est un circuit bool´een avec n + 2n
entr´ees cn−1, . . . , c0, x2n−1, . . . , x0 et
une sortie y tel que
y = x(cn−1···c0)2
Exercice 2.23 Construisez un circuit bool´een qui r´ealise un multiplexeur dont le nombre de
portes est proportionnel `a 2
n
et dont la longueur du chemin le plus long est proportionnelle `a
n.
Un additionneur est un circuit bool´een avec 2n entr´ees xn−1, yn−1, . . . , x0, y0 et n + 1
sorties rn, sn−1, . . . , s0 tel que
(xn−1 · · · x0)2 + (yn−1 · · · y0)2 = (rnsn−1 · · · s0)2
On peut r´ealiser un additionneur en utilisant l’algorithme standard qui propage la retenue de
droite `a gauche.
Exercice 2.24 (1) R´ealisez un circuit A avec 3 entr´ees x, y, r et deux sorties s, r0
tel que
(r
0
s)2 = (x)2 + (y)2 + (r)2
(2) Expliquez comment inter-connecter n circuits A pour obtenir un additionneur sur n bits.
(3) Montrez que dans le circuit en question le nombre de portes et la longueur du chemin le
plus long sont proportionnels `a n.
Exercice 2.25 Le but de cet exercice est de r´ealiser un additionneur dont le nombre de portes
est encore polynomiale en n mais dont la longueur du chemin le plus long est proportionnelle
`a lg(n). Pour ´eviter que la retenue se propage `a travers tout le circuit, l’id´ee est d’anticiper sa
valeur. Ainsi pour additionner 2 vecteurs de longueur n, on additionne les premiers n/2 bits
(ceux de poids faible) et en mˆeme temps on additionne les derniers n/2 bits (ceux de poids
fort) deux fois (en parall`ele) une fois avec retenue initiale 0 et une fois avec retenue initiale
1. On applique cette m´ethode r´ecursivement sur les sous-vecteurs de longueur n/4, n/8, . . .
selon le principe diviser pour r´egner.
(1) Construisez explicitement un tel circuit pour n = 4.
(2) D´eterminez en fonction de n le nombre de portes et la longueur du chemin le plus long
du circuit obtenu.
Exercice 2.26 Un d´ecodeur est un circuit avec n entr´ees xn−1, . . . , x0 et 2
n
sorties y2n−1, . . . , y0
tel que
yi = 1 ssi i = (xn−1 · · · x0)2
R´ealisez un tel circuit.
10Exercice 2.27 On dispose d’un circuit combinatoire CE avec 2 entr´ees x, y et 2 sorties <, =
dont le comportement est sp´ecifi´e par le tableau suivant (bien sˆur, les symboles choisis pour
les sorties ne sont pas arbitraires) :
x y < =
0 0 0 1
0 1 1 0
1 0 0 0
1 1 0 1
Un comparateur n bits est une fonction bool´eenne C avec 2n entr´ees et 1 sortie telle que :
C(xn−1, yn−1, . . . , x0, y0) = 1 ssi (xn−1 · · · x0)2 < (yn−1 · · · y0)2
On remarque que :
(xn−1 · · · x0)2 < (yn−1 · · · y0)2 ssi (xn−1 < yn−1) ou
((xn−1 = yn−1) et (xn−2 · · · x0)2 < (yn−2 · · · y0)2)
Montrez comment construire un circuit combinatoire qui impl´emente un comparateur 4 bits
en disposant de : (i) 4 circuits CE , (ii) 8 portes AND binaires (vous n’ˆetes pas oblig´es de
les utiliser toutes) et 1 porte OR avec 4 entr´ees. Si vous ˆetes bloqu´e, essayez d’abord le
comparateur 2 bits.
113 Syst`emes de preuve
Pour l’instant on a consid´er´e un langage logique (la logique propositionnelle classique)
et une notion de validit´e. Comment s’assurer qu’une formule est valide ? Dans le cas de
la logique propositionnelle, on peut envisager de v´erifier toutes les affectations mais cette
m´ethode demande 2n v´erifications pour une formule qui contient n variables. De plus pour
v´erifier la validit´e de formules en logique du premier ordre on aurait `a consid´erer une infinit´e
de cas car les domaines d’interpr´etation sont infinis. D’o`u l’id´ee de se donner des axiomes
et des r`egles pour d´eduire avec un effort fini de calcul des formules valides. Par exemple, on
pourrait avoir les axiomes :
(A1) A → (B → A)
(A2) (A → (B → C)) → ((A → B) → (A → C))
et on pourrait avoir une r`egle :
(R)
A A → B
B
A partir des axiomes et des r`egles on peut construire des ` preuves. Une preuve est un arbre
dont les feuilles sont ´etiquet´ees par des axiomes et dont les noeuds internes sont ´etiquet´es par
des r`egles d’inf´erence. La formule qui se trouve `a la racine de l’arbre est la formule que l’on
d´emontre. Par exemple, en prenant B = (A → A) et C = A on peut construire une preuve
de A → A par application des axiomes (A1 − 2) et de la r`egle (R) (2 fois). On remarquera
qu’axiomes et r`egles sont toujours donn´es en forme sch´ematique. Par exemple, dans l’axiome
(A1) il est entendu qu’on peut remplacer les formules A et B par des formules arbitraires.
3.1 Correction et compl´etude
On dit qu’un syst`eme de preuve est :
correct s’il permet de d´eduire seulement des formules valides,
complet si toute formule valide peut ˆetre d´eduite.
Il est trivial de construire des syst`emes corrects ou complets mais il est beaucoup plus
d´elicat de construire des syst`emes corrects et complets. On va examiner un syst`eme correct
et complet propos´e par Gerhard Gentzen en 1930. Une id´ee g´en´erale est d’´ecrire des r`egles
d’inf´erence qui permettent de r´eduire la ‘complexit´e structurale (ou logique)’ des formules
jusqu’`a une situation qui peut ˆetre trait´ee directement par un axiome.
Exercice 3.1 Soit A = `1 ∨ · · · ∨ `n une disjonction de litt´eraux. Montrez que A est valide si
et seulement si une variable propositionnelle x et sa n´egation ¬x sont pr´esentes dans A.
Ceci sugg`ere un axiome :
x ∨ ¬x ∨ B
ou plus en g´en´eral
A ∨ ¬A ∨ B
On consid`ere maintenant la situation pour la conjonction et la disjonction.
12Exercice 3.2 Montrez que :
|= A ∧ B ssi |= A et |= B
Ceci sugg`ere une r`egle pour la conjonction :
A B
A ∧ B
Exercice 3.3 Montrez que :
|= A ∨ B si |= A ou |= B
Ceci sugg`ere deux r`egles pour la disjonction :
A
A ∨ B
B
A ∨ B
Comment traiter la n´egation ? L’exercice suivant montre comment r´eduire la n´egation en
faisant passer la formule `a droite ou `a gauche d’une implication.
Exercice 3.4 Montrez que :
|= B → (¬A ∨ C) ssi |= (B ∧ A) → C
|= (B ∧ ¬A) → C ssi |= B → (A ∨ C)
Ce type de consid´erations nous m`enent `a la notion de s´equent.
D´efinition 3.5 Un s´equent est un couple (Γ, ∆) qu’on ´ecrit Γ ` ∆ d’ensembles finis (´eventuellement
vides) de formules. Un s´equent Γ ` ∆ est valide si la formule
(
^
A∈Γ
A) → (
_
B∈∆
B)
est valide.
Par convention, on ´ecrit un s´equent {A1, . . . , An} ` {B1, . . . , Bm} comme A1, . . . , An `
B1, . . . , Bm et un ensemble Γ ∪ {A} comme Γ, A. On remarquera que la virgule ‘,’ est interpr´et´ee
comme une conjonction `a gauche et comme une disjonction `a droite du s´equent. On
va maintenant reformuler nos id´ees sur la simplification des formules en utilisant la notion de
s´equent.
(Ax )
A, Γ ` A, ∆
(∧ `)
A, B, Γ ` ∆
A ∧ B, Γ ` ∆
(` ∧)
Γ ` A, ∆ Γ ` B, ∆
Γ ` A ∧ B, ∆
(∨ `)
A, Γ ` ∆ B, Γ ` ∆
A ∨ B, Γ ` ∆
(` ∨)
Γ ` A, B, ∆
Γ ` A ∨ B, ∆
(¬ `)
Γ ` A, ∆
¬A, Γ ` ∆
(` ¬)
A, Γ ` ∆
Γ ` ¬A, ∆
13Ce syst`eme est remarquable par sa simplicit´e conceptuelle : il comporte un axiome ‘identit´e’
qui dit que de A on peut d´eriver A et des r`egles d’inf´erence. Pour chaque op´erateur de la
logique, on dispose d’une r`egle qui introduit l’op´erateur `a gauche du ` et d’une autre qui
l’introduit `a droite.
Exercice 3.6 Montrez que :
(1) Un s´equent A, Γ ` A, ∆ est valide.
(2) Pour chaque r`egle d’inf´erence la conclusion est valide si et seulement si les hypoth`eses
sont valides.
Th´eor`eme 3.7 Le syst`eme de Gentzen d´erive exactement les s´equents valides.
Idee de la preuve ´ . Par l’exercice 3.6 tout s´equent d´erivable est valide. Donc le syst`eme
est correct. Soit Γ ` ∆ un s´equent valide. On applique les r`egles jusqu’`a ce que toutes les
formules dans les s´equents soient atomiques. Ensuite on remarque qu’un s´equent valide dont
toutes les formules sont atomiques peut ˆetre d´eriv´e par application de l’axiome (Ax ). Cette
remarque est une simple reformulation de l’exercice 3.1. •
D´efinition 3.8 Soit A une formule. L’ensemble sf (A) des sous formules de A est d´efini par
sf (A) =
{A} si A atomique
{A} ∪ sf (B) si A = ¬B
{A} ∪ sf (B1) ∪ sf (B2) si A = B1 ∧ B2 ou A = B1 ∨ B2
Exercice 3.9 (sous-formule) Montrez que si un s´equent est d´erivable alors il y a une preuve
du s´equent qui contient seulement des sous formules de formules dans le s´equent.
Exercice 3.10 (affaiblissement) Montrez que si le s´equent Γ ` ∆ est d´erivable alors le
s´equent Γ ` A, ∆ l’est aussi.
Exercice 3.11 (implication) Dans le syst`eme de Gentzen on peut donner un traitement
direct de l’implication :
(→`)
Γ ` A, ∆ B, Γ ` ∆
A → B, Γ ` ∆
(`→)
Γ, A ` B, ∆
Γ ` A → B, ∆
Red´emontrez le th´eor`eme 3.7 pour le syst`eme de Gentzen ´etendu avec ces r`egles.
Exercice 3.12 Montrez que les r`egles pour la disjonction et l’implication sont d´erivables des
r`egles pour la conjonction et la n´egation en utilisant les ´equivalences : A ∨ B ≡ ¬(¬A ∧ ¬B)
et A → B ≡ ¬A ∨ B.
Exercice 3.13 (1) Ecrire l’axiome et les r`egles d’inf´erence du calcul des s´equents pour les ´
op´erateurs logiques de n´egation ¬ et d’implication →. Rappel : on peut retrouver les r`egles
pour l’implication `a partir des r`egles pour la n´egation et la disjonction.
(2) Utilisez les syst`eme de preuve d´ecrit pour construire une preuve des s´equents suivants :
` (¬¬A → A) et (A → B),(A → ¬B) ` ¬A
14Exercice 3.14 Trouvez les r`egles (` NAND) et (NAND `) pour l’op´erateur logique NAND
en utilisant le fait que NAND(A, B) s’´ecrit comme ¬(A ∧ B).
Exercice 3.15 (coupure) La r`egle de coupure (ou cut) est :
(coupure)
A, Γ ` ∆ Γ ` A, ∆
Γ ` ∆
Montrez que le syst`eme de Gentzen ´etendu avec cette r`egle est toujours correct (et complet).
Exercice 3.16 D´erivez du syst`eme de Gentzen un algorithme pour v´erifier si une formule A
est valide. Quelle est la complexit´e en temps de votre algorithme ?
Exercice 3.17 On consid`ere les formules suivantes :
A = (x ∨ z) ∧ (y ∨ w), B = (¬x ∨ ¬y) ∧ (¬z ∨ ¬w), C = (¬x ∨ ¬z) ∧ (¬y ∨ ¬w)
1. Consid´erez le s´equent A, C ` B. S’il est valide, construisez une preuve du s´equent,
autrement donnez une affectation des variables x, y, z, w qui montre qu’il ne l’est pas.
2. Mˆeme probl`eme pour le s´equent A, B ` C.
3.2 Compacit´e
Un ensemble (´eventuellement infini) de formules T est satisfiable s’il existe une affectation
qui satisfait chaque formule dans T.
Exercice 3.18 Si T est satisfiable alors chaque sous ensemble fini de T est satisfiable.
On va montrer que la r´eciproque est aussi vraie.
D´efinition 3.19 (1) Un ensemble T de formules est finement satisfiable si tout sous ensemble
fini de T est satisfiable.
(2) Un ensemble T de formules finement satisfiable est maximal si pour toute formule A soit
A ∈ T soit ¬A ∈ T.
Exercice 3.20 Montrez que :
(1) Si S est un ensemble finement satisfiable et maximal alors :
A ∈ S ssi ¬A /∈ S
A ∧ B ∈ S ssi A ∈ S et B ∈ S
A ∨ B ∈ S ssi A ∈ S ou B ∈ S
(2) Soit S un ensemble de formules finement satisfiable et maximal. On d´efinit une affectation
vS par :
vS(x) = (
1 si x ∈ S
0 si ¬ ∈ S
Pourquoi cette d´efinition est-elle correcte ?
(3) Soit S finement satisfiable et maximal. Montrez que S est satisfiable.
(4) Soit T un ensemble de formules. Montrez que s’il existe S ⊇ T finement satisfiable et
maximal alors T est satisfiable.
15Exercice 3.21 Soit T un ensemble de formules finement satisfiable et A une formule. Alors,
soit T ∪ {A} est finement satisfiable soit T ∪ {¬A} est finement satisfiable.
Th´eor`eme 3.22 (compacit´e) Si un ensemble de formules T est finement satisfiable alors
il est satisfiable.
Idee de la preuve ´ . Soit {An | n ∈ N} une ´enum´eration de toutes les formules. On d´efinit
T0 = T et
Tn+1 =
(
Tn ∪ {An} si Tn ∪ {An} est finement satisfiable
Tn ∪ {¬An} autrement
S =
S
n∈N Tn
On d´emontre que Tn est finement satisfiable par r´ecurrence sur n en utilisant l’exercice 3.21.
On en d´erive que S est finement satisfiable car si X ⊆ S et X est fini alors ∃ n X ⊆ Tn. On
v´erifie aussi que S est maximal car pour toute formule A il existe n tel que A = An et donc
A ∈ Tn+1 ou ¬A ∈ Tn+1. Donc par l’exercice 3.20, S est satisfiable et donc T l’est aussi. •
Exercice 3.23 Soit T un ensemble de formules. On ´ecrit T |= A si pour toute affectation v,
si v satisfait T alors v satisfait A. Montrez que si T |= A alors il existe T0 sous-ensemble fini
de T tel que T0 |= A. Suggestion : utilisez le th´eor`eme de compacit´e.
3.3 M´ethode de preuve par r´esolution
Exercice 3.24 Montrez que la r`egle d’inf´erence suivante est valide :
A ∨ ¬C B ∨ C
A ∨ B
(2)
Exercice 3.25 Pour repr´esenter les formules en CNF on adopte la mˆeme notation ensembliste
utilis´ee pour d´ecrire la m´ethode de Davis-Putnam.
– Une clause C est un ensemble de litt´eraux.
– Une formule A est un ensemble de clauses.
Nous consid´erons une variante de la r`egle (2) :
A ∪ {C ∪ {x}} ∪ {C
0 ∪ {¬x}} x /∈ C ¬x /∈ C
0
A ∪ {C ∪ {x}} ∪ {C
0 ∪ {¬x}} ∪ {C ∪ C
0}
(3)
Dans la suite on appelle (3) r`egle de r´esolution.
2 L’effet de l’application de la r`egle consiste
`a ajouter une nouvelle clause C ∪ C
0
qu’on appelle r´esolvant des deux clauses C ∪ {x} et
C
0 ∪ {¬x}.
(1) Montrez que l’hypoth`ese est logiquement ´equivalente `a la conclusion.
(2) Conclure que si la conclusion n’est pas satisfiable alors l’hypoth`ese n’est pas satisfiable.
En particulier, si la conclusion contient la clause vide alors l’hypoth`ese n’est pas satisfiable.
2Sans les conditions x /∈ C et ¬x /∈ C
0
on pourrait par exemple ‘simplifier’ les clauses {x} et {¬x} en
{x,¬x}.
16Fait Si une formule A en CNF n’est pas satisfiable alors la r`egle de r´esolution permet de
d´eriver une formule A0 avec une clause vide. On dit que la r`egle de r´esolution est compl`ete
pour la r´efutation, c’est-`a-dire pour la d´erivation de la clause vide. La m´ethode peut ˆetre
impl´ement´ee it´erativement. A chaque it´eration on ajoute toutes les clauses qui sont un
r´esolvant de deux clauses. Cette it´eration termine forc´ement car le nombre de clauses qu’on
peut construire est fini. Parfois, il convient de repr´esenter la d´erivation comme un graphe
dirig´e acyclique (ou DAG pour directed acyclic graph) dont les noeuds sont ´etiquet´es par les
clauses. Initialement on a autant de noeuds que de clauses et pas d’arˆetes. Chaque fois qu’on
applique la r`egle de r´esolution (3) on introduit un nouveau noeud qui est ´etiquet´e avec la
clause r´esolvant C ∪ C
0
et deux nouvelles arˆetes qui vont des noeuds ´etiquet´es avec les clauses
C ∪ {x} et C
0 ∪ {¬x} vers le noeud ´etiquet´e avec la clause C ∪ C
0
.
Exercice 3.26 Construire la formule A en CNF qui correspond au principe du nid de pigeon
avec 2 pigeons et 1 nid. D´erivez la clause vide en utilisant la r`egle de r´esolution. Mˆeme
probl`eme avec 3 pigeons et 2 nids (attention le calcul risque d’ˆetre long).
Exercice 3.27 Soit A une formule en CNF avec m variables et n clauses. Montrez qu’il y a
au plus m · (n · (n − 1)/2) fa¸cons d’appliquer la r`egle de r´esolution.
Exercice 3.28 Soit A une formule en CNF et C une clause. Expliquez comment utiliser la
m´ethode de r´esolution pour ´etablir si l’implication A → C est valide.
Exercice 3.29 Un exercice de r´evision. On consid`ere les formules en CNF suivantes :
1. ¬x ∨ (¬y ∨ x)
2. (x ∨ y ∨ ¬z) ∧ (x ∨ y ∨ z) ∧ (x ∨ ¬y) ∧ ¬x.
3. (x ∨ y) ∧ (z ∨ w) ∧ (¬x ∨ ¬z) ∧ (¬y ∨ ¬w).
Pour chaque formule :
1. Si la formule est valide calculez une preuve de la formule dans le syst`eme de Gentzen.
2. Si la formule est satisfiable mais pas valide calculez une affectation qui satisfait la formule
en utilisant la m´ethode de Davis-Putnam.
3. Si la formule n’est pas satisfiable d´erivez la clause vide en utilisant la m´ethode par
r´esolution.
174 Diagrammes de d´ecision binaire et applications
Les diagrammes de d´ecision binaire (BDD pour Binary Decision Diagrams) sont une
repr´esentation des fonctions bool´eennes. Cette repr´esentation avait d´ej`a ´et´e remarqu´ee par
Lee en 1959 mais son int´erˆet algorithmique a ´et´e r´ealis´e plus r´ecemment par Bryant en 1986.
Les BDD repr´esentent une fonction bool´eenne comme un circuit compos´e de multiplexeurs
(if-then-else) et de constantes 0 et 1. Une propri´et´e importante de cette repr´esentation est
qu’´etant donn´e un ordre sur les variables, le BDD peut ˆetre r´eduit efficacement `a une forme
canonique. On parle alors de diagramme de d´ecision binaire ordonn´e et r´eduit (ROBDD
pour reduced ordered binary decision diagram). En pratique, la repr´esentation canonique est
consid´erablement plus compacte que la repr´esentation explicite dont la taille est exponentielle
dans le nombre de variables de la fonction.
Une deuxi`eme propri´et´e importante est qu’il est possible de manipuler directement les
repr´esentations canoniques pour calculer la conjonction, la disjonction, le compl´ementaire,. . .
La situation est similaire `a celle des langages r´eguliers o`u un langage peut ˆetre repr´esent´e par
un automate et les op´erations d’union, intersection, compl´ementaire sur les langages peuvent
ˆetre calcul´ees directement sur les automates. Aujourd’hui, les BDD sont courrament utilis´es
dans la synth`ese et analyse de circuits.
4.1 OBDD
Soit f : 2
n → 2 une fonction bool´eenne `a n variables x1, . . . , xn. Si b ∈ {0, 1} est une
valeur bool´eenne, on d´enote par [b/xi
]f : 2
(n−1) → 2 la fonction bool´eenne `a n − 1 variables
o`u la variable xi est remplac´ee par b. On appelle restriction cette op´eration sur les fonctions.
En utilisant la restriction, on peut exprimer une fonction `a n variables comme une combinaison
bool´eenne de fonctions `a n − 1 variables.
f = xi
[1/xi
]f + xi
[0/xi
]f
On nomme cette transformation expansion de Shannon. On remarquera que la quantification
universelle et existentielle sur une variable propositionnelle s’exprime aussi par le biais de la
restriction :
∀xi f = ([1/xi
]f)([0/xi
]f) ∃xi f = ([1/xi
]f) + ([0/xi
]f)
Cette transformation entraˆıne un doublement de la taille de la formule pour chaque quantifi-
cation.
On abr`ege l’op´erateur ternaire if then else par → , . Ainsi :
x → f, f0 = (xf) + xf0
o`u x est une variable bool´eenne. On utilise cette notation, pour reformuler l’expansion de
Shannon :
f = xi → [1/xi
]f, [0, xi
]f
On fixe un ordre sur les variables, par exemple x1 < · · · < xn. On d´efinit par r´ecurrence
l’ensemble des expressions qui d´ependent d’un sous-ensemble de variables :
– Les expressions 0 et 1 d´ependent de l’ensemble vide.
– Si les expressions e1 et e2 d´ependent de {xi+1, . . . , xn}, alors l’expression xi → e1, e2
d´epend de {xi
, xi+1, . . . , xn}.
18– Si l’expression e d´epend de X et X ⊆ X0 alors e d´epend de X0
.
A partir de la fonction f on peut it´erer l’expansion de Shannon en commen¸cant par la
variable x1 et en terminant avec les fonctions constantes 0 et 1. Ainsi on construit :
f = x1 → [1/x1]f, [0/x1]f
= x1 → (x2 → [1/x2, 1/x1]f, [0/x2, 1/x1]f),(x2 → [1/x2, 0/x1]f, [0/x2, 0/x1]f)
· · ·
= · · ·
On peut repr´esenter l’expression comme un arbre binaire complet de profondeur n − 1 o`u les
noeuds internes sont ´etiquet´es par les variables et les noeuds terminaux par 0 ou 1, et les deux
arˆetes sortantes d’un noeud interne sont ´etiquet´ees par 0 et 1. Cette repr´esentation d´epend
de l’ordre des variables et pour cette raison on parle de BDD ordonn´es (OBDD).
On remarquera que cette repr´esentation a aussi une taille O(2n
). Cependant, la repr´esentation
d’un OBDD comme un arbre binaire est souvent redondante et une repr´esentation plus
compacte est possible par partage de sous-arbres communs. Dans ce cas, le BDD est repr´esent´e
par un graphe dirig´e acyclique (DAG) connexe et avec une racine.
4.2 Simplification
Soit N un ensemble fini de noeuds et V = {x1, . . . , xn} un ensemble de variables ordonn´e
par x1 < · · · < xn. On peut repr´esenter un OBDD comme suit :
v : N → {0, 1} ∪ V (´etiquette des noeuds)
l : N → (N ∪ {↑}) (arˆete sortant ´etiquet´e par 0)
h : N → (N ∪ {↑}) (arˆete sortant ´etiquet´e par 1)
tel que :
– Le graphe r´esultat est acyclique et tous les noeuds sont accessibles `a partir d’un noeud
identifi´e comme ´etant la racine.
– Les noeuds non-terminaux sont ´etiquet´es par des variables et les noeuds terminaux sont
´etiquet´es par 0 ou 1. En d’autres termes :
v(n) ∈ V ⇒ l(n), h(n) ∈ N v(n) ∈ {0, 1} ⇒ l(n) = h(n) =↑
– L’ordre des variables est respect´e :
v(n) ∈ V and v(l(n)) ∈ V ⇒ v(n) < v(l(n))
v(n) ∈ V and v(h(n)) ∈ V ⇒ v(n) < v(h(n))
A partir d’un OBDD on applique trois r`egles de simplification :
– Soient n et n
0 deux noeuds terminaux distincts avec la mˆeme ´etiquette. Alors tous les
pointeurs `a n
0 peuvent ˆetre redirig´es sur n et n
0 peut ˆetre ´elimin´e.
– Soit n un noeud non-terminal et l(n) = h(n) = n
0
. Alors tous les pointeurs `a n peuvent
ˆetre redirig´es sur n
0
, et n peut ˆetre ´elimin´e.
– Soient n et n
0 deux noeuds non-terminaux distincts tels que v(n) = v(n
0
), l(n) = l(n
0
)
et h(n) = h(n
0
). Alors tous les pointeurs `a n
0 peuvent ˆetre redirig´es sur n et n
0 peut
ˆetre ´elimin´e.
On ´ecrit B 7→ B0
si un OBDD B est transform´e en B0 par une des r`egles de simplification.
On dit que B est un forme normale s’il ne peut pas ˆetre simplifi´e.
19Th´eor`eme 4.1 (1) Si B est un OBDD bien form´e par rapport `a un ordre donn´e et B 7→ B0
alors B0
est un OBDD bien form´e par rapport au mˆeme ordre.
(2) Toute s´equence de simplification termine.
(3) Si B 7→ B0
et B 7→ B00 alors ou bien B0 = B00 ou bien il existe B0
1
et B00
1
tels que B0
7→ B0
1
,
B00 7→ B00
1
et B0
1
et B00
1
sont ´egaux `a renommage des noeuds pr`es.
(4) Tout OBDD peut ˆetre simplifi´e en une forme normale et cette forme est unique `a renommage
des noeuds pr`es.
Exercice 4.2 Calculez le ROBDD pour la fonction f : 2
3 → 2 avec ordre x < y < z.
xyz 000 001 010 011 100 101 110 111
f(x, y, z) 0 0 0 1 0 1 0 1
Exercice 4.3 (1) Calculez le ROBDD pour la fonction (a∧b)∨(c∧d) avec ordre a < b < c.
(2) Calculez le ROBDD pour un comparateur de 2-bits ∧i=1,2(ai = bi) en utilisant les ordres
a1 < b1 < a2 < b2 et a1 < a2 < b1 < b2.
(3) G´en´eraliser `a un comparateur de n-bits et d´eterminez le nombre de noeuds dans le
ROBDD pour les ordres a1 < b1 < · · · < an < bn et a1 < · · · an < b1 < · · · < bn.
Exercice 4.4 Soit p : 2
n → 2 la fonction pour le contrˆole de parit´e, c’est-`a-dire
p(x1, . . . , xn) = (Σi=1,...,nxi) mod 2
Donnez le sch´ema et pr´ecisez le nombre de noeuds du ROBDD (BDD ordonn´e et r´eduit) qui
repr´esente la fonction p par rapport `a l’ordre x1 < · · · < xn.
Exercice 4.5 Montrez que la satisfaction et la validit´e d’une fonction bool´eenne repr´esent´ee
par un ROBDD peut ˆetre d´ecid´ee en O(1).
Exercice 4.6 On sait qu’un langage r´egulier (ou rationnel) ´eventuellement infini peut ˆetre
repr´esent´e par un graphe ´etiquet´e fini. On pourrait repr´esenter une fonction f : 2
n → 2 par
le langage :
Lf = {x1 . . . xn | f(x1, . . . , xn) = 1} ⊂ {0, 1}
∗
Comparez l’automate Mf qui reconnaˆıt le langage Lf avec le ROBDD associ´e `a la fonction
f. Est-ce-que les deux repr´esentations ont la mˆeme taille ?
4.3 Ordre des variables
L’ordre des variables a un effet important sur la taille d’un ROBDD. Par exemple,
consid´erons la fonction Σi=1,...,naibi
. Avec l’ordre a1 < b1 < · · · < an < bn la taille du
ROBDD est O(n) alors qu’avec l’ordre a1 < · · · an < b1 < · · · < bn la taille du ROBDD est
O(2n
).
Une bonne heuristique est de garder proche dans l’ordre les variables qui interagissent
dans le calcul du r´esultat. Il est int´eressant d’´etudier la meilleure et la pire repr´esentation
possible pour certaines classes de fonctions.
– Pour les fonctions sym´etriques, c’est-`a-dire pour les fonctions dont le r´esultat est invariant
par permutation de l’entr´ee, la taille du ROBBD varie entre O(n) et O(n
2
).
– Pour le bit central de la fonction d’addition sur n bits la taille varie entre O(n) et O(2n
).
20– Pour le bit central de la fonction de multiplication sur n bits la taille est toujours O(2n
).
Exercice 4.7 (1) Montrez que f : 2
n → 2 est sym´etrique si et seulement si il y a une
fonction h : {0, . . . , n} → 2 telle que f(x1, . . . , xn) = h(Σi=1,...,nxi).
(2) Conclure qu’une fonction sym´etrique a une repr´esentation comme ROBDD dont la taille
est O(n
2
).
4.4 Restriction
Etant donn´e un OBDD pour la fonction ´ f, le calcul de la restriction, par exemple [0/x]f,
consiste `a rediriger toute arˆete qui pointe au noeud n tel que v(n) = x vers l(n). Le calcul de
[1/x]f est similaire.
Exercice 4.8 Montrez que l’application de l’algorithme de restriction sur un ROBDD peut
ne pas produire un ROBDD.
4.5 Application
On d´efinit un algorithme A pour l’application qui prend l’OBDD de deux fonctions
bool´eennes f, g : 2
n → 2 et une op´eration binaire op : 2
2 → 2, et retourne un OBDD
pour la fonction (f op g) : 2
n → 2 (par rapport au mˆeme ordre).
La remarque fondamentale est que l’op´eration op commute avec l’expansion de Shannon :
f op g = x → ([1/x]f op [1/x]g),([0/x]f op [0/x]g)
L’algorithme visite les deux OBDD en profondeur d’abord. En supposant que nf et ng soient
les racines des deux OBDD, l’appel A(nf , n0
g
, op) retournera la racine de l’OBDD pour f op g.
L’algorithme r´ecursif est d´ecrit dans la table 1, o`u new est une fonction qui retourne un
nouveau noeud.
Cet algorithme peut ˆetre amen´e `a ´evaluer plusieurs fois le mˆeme couple de sous-arbres.
Pour ´eviter cela, on consid`ere une optimisation qui consiste `a garder dans un tableau de
hachage les couples de sous-arbres d´ej`a visit´es. Une deuxi`eme optimisation est d’arrˆeter les
appels r´ecursifs chaque fois qu’on arrive `a une feuille d’un des sous-arbres avec la propri´et´e
que la valeur de la feuille est suffisante pour d´eterminer le r´esultat de l’op´eration op. Enfin,
il est possible de modifier l’algorithme de fa¸con `a ce qu’il recherche `a la vol´ee une des 3
simplifications. De cette fa¸con, on peut g´en´erer directement un ROBDD `a partir de ROBDD.
Quand toutes ces optimisations sont mises en oeuvre et ´etant donn´e un tableau d’hachage
qui garantit un temps d’acc`es constant en moyenne, il est possible de montrer que la
complexit´e de l’op´eration d’application est de l’ordre du produit de la taille des OBDD qui
repr´esentent f et g. En gros, une op´eration logique peut au plus ´elever au carr´e la taille de la
repr´esentation. Bryant appelle cela une propri´et´e de d´egradation gracieuse (bien sˆur l’it´eration
d’un carr´e donne un exponentiel !)
Exercice 4.9 On consid`ere la fonction bool´eenne f : 2
2n → 2 telle que
f(xn−1, . . . , x0, yn−1, . . . , y0) = 1 ssi (xn−1 · · · x0)2 ≤ (yn−1 · · · y0)2
o`u (zn−1 · · · z0)2 est la valeur en base 2 de la suite zn−1 · · · z0. On ordonne les variables de la
fa¸con suivante :
xn−1 < yn−1 < · · · < x0 < y0
21A(n, n0
, op) = case
v(n) = v(n
0
) ∈ V : n
00 := new; v(n
00) := v(n);
l(n
00) := A(l(n), l(n
0
), op); h(n
00) := A(h(n), h(n
0
), op); n
00
v(n) et (iv) les noeuds
qui correspondent aux ´etats finaux ont un double contour.
Dans la suite, on proc`ede en trois ´etapes :
1. On d´efinit la notion de configuration d’un automate.
2. On d´ecrit comment un automate peut se d´eplacer d’une configuration `a une autre.
3. On sp´ecifie quels mots sont accept´es par l’automate.
Une m´ethodologie similaire est utilis´ee dans la suite pour un type d’automate plus g´en´eral
qu’on appelle Machine de Turing.
D´efinition 5.2 Soit M = (Σ, Q, qo, F, δ) un AFD. Une configuration est un couple (w, q) ∈
Σ
∗ × Q. On d´efinit une relation de r´eduction `M par (aw, q) `M (w, δ(a, q)) et on suppose
que `
∗
M est la clˆoture r´eflexive et transitive de `M. Le langage L(M) reconnu (ou accept´e)
par M est d´efini par :
L(M) = {w ∈ Σ
∗
| (w, qo) `
∗
M (, q) and q ∈ F} .
Exemple 5.3 Soit M = ({a, b}, {1, 2}, 1, {2}, δ) avec fonction de transition δ sp´ecifi´ee comme
suit :
Etat ´ Entr´ee
a b
1 1 2
2 1 2
Il n’est pas difficile de montrer que L(M) est l’ensemble des mots qui terminent par b.
Remarque 5.4 Dans la d´efinition de AFD on insiste pour que pour chaque ´etat q et pour
chaque caract`ere a de l’alphabet il y ait exactement une arˆete sortante de q avec ´etiquette a.
En pratique, on peut relˆacher cette condition et demander juste qu’il y ait au plus une arˆete
sortante de q avec ´etiquette a. Un tel automate peut ˆetre transform´e facilement en un AFD
en introduisant un ´etat ‘puits’ qs et en ´etendant la fonction de transition δ de fa¸con telle que
δ(a, qs) = qs pour tout a ∈ Σ et δ(a, q) = qs chaque fois que δ(a, q) n’est pas d´efini.
Remarque 5.5 (minimisation) Il est facile de construire diff´erents AFD qui acceptent le
mˆeme langage. Cependant on peut montrer que parmi ces automates il y en a un qui a un
nombre minimum d’´etats. De plus cet automate est unique `a renommage des ´etats pr`es.
255.3 Automates non-d´eterministes
Nous consid´erons trois extensions de la notion d’AFD qui nous m`enent `a la notion d’automate
fini non-d´eterministe (AFN).
1. On permet de lire plus qu’un caract`ere dans un pas de calcul.
2. On permet de ne pas lire un caract`ere (-transition).
3. Pour un noeud donn´e, on autorise deux ou plus arˆetes sortantes ´etiquet´ees avec le mˆeme
mot.
D´efinition 5.6 (AFN) Un automate fini non-d´eterministe (AFN) N est un vecteur (Σ, Q,
qo, F, δ) o`u Σ est un alphabet, Q est un ensemble fini d’´etats, qo est l’´etat initial, F ⊆ Q est
l’ensemble des ´etats finaux et δ : Q × Σ
∗ → 2
Q est une fonction de transition qui s’´evalue
dans l’ensemble vide presque partout.
Une configuration pour un AFN est un couple (w, q) ∈ Σ
∗ × Q. La relation de r´eduction
`N est d´efinie par :
(w, q) `N (w
0
, q0
) si w = w
00w
0
et q
0 ∈ δ(w
00, q)
et le langage reconnu L(N) est d´efini par
L(N) = {w ∈ Σ
∗
| (w, qo) `
∗
N (, q) et q ∈ F} .
Dans un AFD, ´etant donn´e un mot w on trouve un chemin de calcul unique qui va de (w, qo)
`a (, q), pour un certain q. Par opposition, dans un AFN on peut avoir plusieurs chemins, et
le w est accept´e si au moins un chemin m`ene `a un ´etat final. Un probl`eme fondamental est de
comprendre si et dans quel mesure le calcul non-d´eterministe est plus puissant que le calcul
d´eterministe.
Th´eor`eme 5.7 (d´eterminisation) Pour tout AFN on peut construire un AFD qui accepte
le mˆeme langage.
Proof hint. (1) Si un automate peux ex´ecuter le pas de calcul (a1 · · · an, q) ` (, q0
) avec
n ≥ 2 alors on introduit n−1 nouveaux ´etats non-finaux q1, . . . , qn−1 et on red´efinit la fonction
de transition pour que :
(a1 · · · an, q) ` (a2 · · · an, q1) ` · · · ` (an, qn−1) ` (, q0
) .
(2) On peut donc supposer que dans une transition un automate N = (Σ, Q, qo, F, δ) lit
au plus un caract`ere et que la fonction de transition a le type δ : (Σ ∪ {}) × Q → 2
Q.
Maintenant, l’id´ee est d’´eliminer les -transitions, en ajoutant une transition ´etiquet´ee par a
de q `a q1, chaque fois qu’il y a un chemin de q `a q1 dont toutes les arˆetes sont ´etiquet´ees par
sauf une qui est ´etiquet´ee par a.
Formellement, on introduit une notion de -clˆoture d’un ´etat q comme suit :
E(q) = {q
0
| (, q) `
∗
(, q0
)} .
Ensuite on construit un nouveau automate N0 = (Σ, Q, qo, F0
, δ0
) o`u F
0 = {q ∈ Q | E(q)∩F 6=
∅} et δ
0
: Σ × Q → 2
Q est d´efinie par
δ
0
(a, q) = [
q
0∈E(q)
{E(q
00) | q
00 ∈ δ(a, q0
)} .
26Dans d’autres termes, (a, q) `N0 (, q1) ssi
(a, q) `
∗
N (a, q0
) `N (, q00) `
∗
N (, q1) .
(3) On peut supposer que l’automate N a une fonction de transition δ avec le type suivant
δ : Σ × Q → 2
Q. Supposons que de l’´etat q, en lisant a, l’automate peut aller ou bien dans q1
ou bien dans q2, c.-a.-d., δ(a, q) = {q1, q2}. Pour simuler ce comportement non-d´eterministe
avec un AFD M on dit que M plac´e dans l’´etat q, en lisant a, peut aller dans un ‘nouveau
´etat’ {q1, q2} qui est capable de ‘simuler’ le comportement `a la fois de q1 et q2.
Formellement, on construit un AFD M = (Σ, 2
Q, {qo}, FM, δM) dont les ´etats sont des
sous-ensembles de l’ensemble des ´etats de N et tel que :
FM = {X ⊆ Q | X ∩ F 6= ∅}
δM(a, X) = S
q∈X δ(a, q) .
•
Exemple 5.8 Consid´erons l’AFN N = ({a, b}, {1, 2, 3}, 1, {2}, δ) avec
δ(, 1) = {2} δ(bb, 1) = {3} δ(a, 2) = {2} δ(, 3) = {1} δ(a, 3) = {3} .
On ´elimine la transition ´etiquet´ee par bb en introduisant un ´etat auxiliaire, ensuite on ´elimine
les -transitions, et enfin on d´eterminise l’automate.
Remarque 5.9 (coˆut) Il y a des AFN tels que chaque AFD ´equivalent a un nombre d’´etats
qui est exponentiel dans le nombre d’´etats de l’AFN.
Remarque 5.10 (langages r´eguliers) On dit qu’un langage accept´e par un automate fini
est r´egulier (ou rationnel). La classe des langages r´eguliers a une th´eorie tr`es riche qui sera
l’objet d’un cours au deuxi`eme semestre.
Exercice 5.11 Montrez que pour tout langage L, L
∗ = (L
∗
)
∗
.
Exercice 5.12 Montrez qu’il existe des langages L1 et L2 tels que (L1 ∪ L2)
∗ 6= L
∗
1 ∪ L
∗
2
.
Exercice 5.13 Montrez qu’il existe des langages L1 et L2 tels que (L1 · L2)
∗ 6= L
∗
1
· L
∗
2
.
Exercice 5.14 Consid´erons l’automate fini M = (Q, Σ, δ, q0, F), o`u Q = {q0, q1, q2, q3}, Σ =
{0, 1}, F = {q0} et la fonction δ est d´efinie par le tableau suivant :
Etat ´ Entr´ee
0 1
q0 q2 q1
q1 q3 q0
q2 q0 q3
q3 q1 q2
V´erifiez si les chaˆınes 1011010 et 101011 sont accept´ees par M. Prouvez que L(M) est l’ensemble
des mots compos´es d’un nombre pair de 0 et d’un nombre pair de 1.
27Exercice 5.15 Pour chacun des langages suivants, construire un automate fini non d´eterministe
qui l’accepte :
1. Les repr´esentations binaires des nombres pairs.
2. Les repr´esentations d´ecimales des multiples de 3.
3. Le langage des mots sur l’alphabet {a, b} contenant ou bien la chaˆıne aab ou bien la
chaˆıne aaab.
4. Le langage des mots sur l’alphabet {0, 1} dont le troisi`eme caract`ere de droite existe et
est ´egale `a 1.
Construire des automates d´eterministes pour les langages d´ecrits ci-dessus.
Exercice 5.16 Soient M un AFD qui accepte un langage L et N1, N2 deux AFN qui acceptent
les langages L1, L2, respectivement (sur un alphabet Σ fix´e).
1. Montrez qu’on peut construire un AFD qui accepte le langage compl´ementaire Σ
∗\L.
2. Montrez qu’on peut construire un AFN qui accepte le langage L1 ∪L2 et le langage it´er´e
(L1)
∗
.
3. Conclure que la classe des langages accept´es par un AFD est stable par union, intersection,
compl´ementaire et it´eration.
Exercice 5.17 Soit l’automate fini non-d´eterministe M = (Q, Σ, δ, q0, F), o`u Q = {q0, q1, q2},
Σ = {0, 1, 2}, F = {q0, q2}, et la fonction de transition δ est d´efinie par le tableau suivant :
Etat ´ Entr´ee
0 1 2
q0 {q0, q1, q2} {q1, q2} {q2}
q1 ∅ {q1, q2} {q2}
q2 ∅ ∅ {q2}
Transformez cet automate en automate fini d´eterministe.
Exercice 5.18 Transformez l’automate M = (Q, Σ, δ, q0, F) suivant en automate fini d´eterministe.
On suppose que Q = {q0, q1, q2}, Σ = {0, 1, 2}, F = {q2}, et la fonction de transition δ est
d´efinie par le tableau suivant :
Etat ´ Entr´ee
0 1 2
q0 {q0} {q1} ∅ {q2}
q1 ∅ {q1} ∅ {q2}
q2 ∅ ∅ {q2} ∅
286 Calculabilit´e
Certains probl`emes calculatoires demandent une m´emoire qui est fonction de la taille de
l’entr´ee (par exemple le tri d’une liste d’´el´ements ou la multiplication de deux matrices). De
tels probl`emes ne peuvent pas ˆetre r´esolus par des automates finis dont la m´emoire est born´ee
a priori. On consid`ere le probl`eme de formaliser un mod`ele de calcul suffisamment g´en´eral
pour calculer tout ce qu’un ‘ordinateur’ pourrait calculer en disposant d’une quantit´e illimit´ee
de temps et de m´emoire. Plusieurs mod`eles ´equivalents ont ´et´e propos´es `a partir des ann´ees
’30. On base la pr´esentation sur les machines de Turing (MdT) qui peuvent ˆetre vues comme
une simple g´en´eralisation des automates finis.
6.1 Machines de Turing
Un automate fini dispose d’un contrˆole fini et d’un ruban sur lequel il peut d´eplacer sa
tˆete de lecture de gauche `a droite. Une machine de Turing a en plus la possibilit´e d’´ecrire sur
le ruban et de d´eplacer la tˆete de lecture de droite `a gauche.
D´efinition 6.1 Une machine de Turing (d´eterministe) M est un vecteur M = (Q, Σ, Γ,t,
q0, qa, qr, δ) o`u :
– Q est un ensemble fini d’´etats.
– Σ est l’alphabet d’entr´ee.
– Γ est l’alphabet du ruban.
– t ∈ Γ\Σ est un symbole sp´ecial,
– q0, qa, qr ∈ Q sont des ´etats. En particulier q0 est l’´etat initial et qa, qr sont deux ´etats
finaux distincts qui entraˆınent l’arrˆet du calcul.
– δ : Q × Γ → Q × Γ × {L, R} est la fonction (d´eterministe) de transition o`u L pour left
et R pour right sont deux symboles.
Une configuration de la machine M est un mot wqw0 o`u w, w0 ∈ Γ
∗
et q ∈ Q. Une configuration
initiale est un mot q0w o`u w ∈ Σ
∗
repr´esente l’entr´ee de la machine.
Une MdT calcule sur un ruban dont la taille n’est pas born´ee `a droite. Soit t
ω
le mot
infini t t t · · · Une configuration wqw0 d´ecrit : (i) le contenu du ruban qui est ww0t
ω
, (ii)
l’´etat q de la machine et (iii) la position de la tˆete de lecture qui lit le premier caract`ere du
mot w
0t
ω
.
4
Un pas de calcul est d´ecrit par la fonction δ. En fonction de l’´etat courant et du symbole
en lecture, la machine se d´eplace dans un nouvel ´etat, ´ecrit un symbole `a la place du symbole
lu et d´eplace la tˆete de lecture `a gauche ou `a droite. Le d´eplacement de la tˆete de lecture `a
gauche est impossible si le mot w de la configuration courante est vide. Dans ce cas la tˆete
de lecture reste sur place.
4Remarquez que les configurations wqw0
, wqw0t, wqw0 t t, · · · sont ´equivalentes dans le sens qu’elles
d´ecrivent la mˆeme situation.
29Pour formaliser ces id´ees, on d´efinit une relation binaire `M. En supposant que q /∈ {qa, qr},
la relation `M est la plus petite relation sur les configurations qui satisfait :
wqaw0 `M wbq0w
0
si δ(q, a) = (q
0
, b, R)
wq `M wbq0
si δ(q, t) = (q
0
, b, R)
wcqaw0 `M wq0
cbw0
si δ(q, a) = (q
0
, b, L)
qaw0 `M q
0
bw0
si δ(q, a) = (q
0
, b, L)
wcq `M wq0
cb si δ(q, t) = (q
0
, b, L)
q `M q
0
b si δ(q, t) = (q
0
, b, L)
On remarque que, la fonction δ ´etant totale, le calcul de M s’arrˆete si et seulement si la
machine arrive `a un ´etat final.
Exercice 6.2 Examinez la d´efinition de machine de Turing et r´epondez aux questions suivantes
:
1. Une MdT peut-elle ´ecrire le symbole t sur le ruban ?
2. L’alphabet d’entr´ee et du ruban peuvent-ils ˆetre ´egaux ?
3. La tˆete de lecture peut-elle rester au mˆeme endroit pendant deux ´etapes cons´ecutives ?
4. Une MdT peut-elle contenir un seul ´etat ?
Un automate fini peut accepter ou refuser un mot, une MdT peut aussi boucler. Dans
la d´efinition de langage accept´e par une MdT il faut prendre en compte cette troisi`eme
possibilit´e.
D´efinition 6.3 (1) Un ensemble L ⊆ Σ
∗
est semi-d´ecidable s’il existe une MdT M telle que
L = {w | q0w `
∗
M w
0
qaw
00}. Dans ce cas on dit que M semi-d´ecide (ou accepte) L.
(2) Un ensemble L est d´ecidable s’il existe une MdT M dont le calcul termine toujours et
qui semi-d´ecide L. Dans ce cas on dit que M d´ecide L.
Exemple 6.4 On construit une MdT qui d´ecide {a
n
b
m | n, m ≥ 0}. On a Σ = {a, b},
Γ = Σ∪ {t} et Q = {q0, qa, qr, q1}. On remarque qu’il est inutile de sp´ecifier le comportement
de la fonction δ sur les ´etats qa et qr car par d´efinition la MdT s’arrˆete quand elle arrive
`a ces ´etats. Par ailleurs, il est aussi inutile de sp´ecifier le caract`ere ´ecrit et le d´eplacement
effectu´e par la tˆete de lecture pour toute transition qui va dans les ´etats finaux. En effet, pour
les probl`emes de d´ecision on s’int´eresse seulement `a l’´etat final et on ignore le contenu du
ruban et la position de la tˆete de lecture. Enfin, on peut interpr´eter l’absence de sp´ecification
comme une transition dans l’´etat qr. Avec ces conventions, on peut d´ecrire le comportement
de la fonction δ par le tableau :
a b t
q0 q0, a, R q1, b, R qa, ,
q1 q1, b, R qa, ,
Comme dans les automates finis, on peut introduire une notation graphique. Par exemple, on
´ecrira :
q
a/b,L → q
0
30pour signifier que la MdT dans l’´etat q et en lisant a, ´ecrit b, se d´eplace `a gauche (L) et va
dans l’´etat q
0
.
On remarquera que dans ce cas notre MdT se comporte comme un automate fini : elle se
d´eplace seulement `a droite et elle ne modifie pas le contenu du ruban.
Exemple 6.5 On construit une MdT qui d´ecide {a
n
b
n
| n ≥ 0}. On a Σ = {a, b}, Γ =
Σ ∪ {X, Y,t} et Q = {q0, qa, qr, q1, q2, q3, q4}. La fonction δ est sp´ecifi´ee comme suit :
a b X Y t
q0 q1, X, R qa, ,
q1 q1, a, R q2, Y, L q1, Y, R
q2 q2, a, L q3, X, R q2, Y, L
q3 q1, X, R q4, Y, R
q4 q4, Y, R qa, ,
Exemple 6.6 Soit Σ = {0, 1, ]} et L = {w]w | w ∈ {0, 1}
∗}. On peut construire une MdT qui
d´ecide L en prenant Γ = Σ ∪ {t, X}. La machine lit le premier caract`ere b de w, le remplace
par X, puis d´eplace sa tˆete de lecture `a droite pour v´erifier que le premier symbole `a droite
de ] est b, le remplace par X, puis revient `a gauche du ] et ainsi de suite. Un observateur qui
regarderait le contenu du ruban verrait par exemple :
01]01t
ω X1]01 t
ω
· · · X1]X1 t
ω
· · · XX]X1 t
ω
· · · XX]XXt
ω
Exercice 6.7 Donnez la description formelle d’une MdT qui d´ecide le langage {w]w | w ∈
{0, 1}
∗}.
Exercice 6.8 (programmation MdT) Pr´esentez le graphe de transition d’une MdT M
d´eterministe avec alphabet d’entr´ee Γ = {0, 1,(0, 0),(0, 1),(1, 0),(1, 1)} qui a la propri´et´e suivante
: `a partir de la configuration initiale q0(xn−1, yn−1)· · ·(x0, y0), M va parcourir l’entr´ee
de gauche `a droite et la remplacer par zn−1 · · · z0 o`u (zn−1 · · · z0)2 = max{(xn−1 · · · x0)2,
(yn−1 · · · y0)2} et s’arreter dans un ´etat accepteur qa. En d’autres termes, M doit calculer le
maximum des entr´ees.
Exercice 6.9 On se propose de programmer une Machine de Turing avec alphabet d’entr´ee
Σ = {0, 1, ]} qui a la propri´et´e suivante : `a partir d’une configuration initiale q0]w o`u w est
un mot fini compos´e de 0 et 1 la machine s’arrˆete dans un ´etat accepteur qa avec un ruban
qui contient le mot ]]w. En d’autres termes, la fonction de la machine est de d´ecaler d’une
case vers la droite le mot w en ins´erant le symbole ] dans la case qui est ainsi lib´er´ee.
1. Donnez la repr´esentation graphique d’une Machine de Turing qui impl´emente la fonction
de d´ecalage d´ecrite ci-dessus.
Suggestion Il est possible de programmer cette tˆache avec une MdT dont la tˆete de lecture se d´eplace
toujours `a droite.
2. Tracez le calcul de la machine de la configuration initiale q0]10 `a la configuration finale.
Exercice 6.10 Donnez la description formelle d’une MdT qui d´ecide le langage des mots sur
l’alphabet {0} dont la longueur est une puissance de 2 : 2
0
, 2
1
, 2
2
, . . .
31Exercice 6.11 D´ecrivez informellement une MdT qui d´ecide le langage :
{a
i
b
j
c
k
| i · j = k et i, j, k ≥ 1} .
Si un calcul termine on peut aussi voir le ‘contenu du ruban’ comme le r´esultat du calcul.
Plus pr´ecis´ement on consid`ere comme ‘r´esultat du calcul’ la concat´enation de tous les symboles
dans l’alphabet d’entr´ee qui sont sur le ruban `a la fin du calcul. Par exemple, si le ruban a
la forme ta t tbat
ω
et a, b sont des symboles de l’alphabet d’entr´ee, le r´esultat du calcul est
aba. On ´ecrit M(w) ↓ si la MdT M avec entr´ee w termine et M(w) = w
0
si M(w) ↓ avec
r´esultat w
0
.
D´efinition 6.12 (1) Une fonction partielle f : Σ∗ * Σ
∗
est une fonction partielle r´ecursive
s’il existe une MdT M avec alphabet d’entr´ee Σ telle que f(w) = w
0
si et seulement si
M(w) = w
0
.
(2) Une fonction r´ecursive est une fonction partielle r´ecursive totale, c’est-`a-dire qui est
d´efinie sur chaque entr´ee.
Exercice 6.13 Soit Σ = {0, 1} et suc : Σ∗ → Σ
∗
la fonction ‘successeur’ en base 2 telle que :
(suc(w))2 = (w)2 + 1
Montrez que suc est r´ecursive.
6.2 Enum´erations ´
Une vari´et´e de structures finies comme arbres, graphes, polynˆomes, grammaires, MdT,. . .
peuvent ˆetre cod´ees comme mots finis d’un alphabet fini.
Exemple 6.14 (probl`emes et langages) Un graphe dirig´e fini est un couple (N, A) o`u N
est un ensemble fini de noeuds et A ⊆ N × N est un ensemble d’arˆetes. Deux graphes dirig´es
(N, A) et (N0
, A0
) sont isomorphes s’il existe une bijection f : N → N0
telle que (n, n0
) ∈ A
ssi (f(n), f(n
0
)) ∈ A0
. Notre objectif est de fixer un alphabet fini Σ et de repr´esenter les
graphes dirig´es comme un langage sur cet alphabet fini. Plus pr´ecis´ement on va repr´esenter les
graphes dirig´es `a ‘isomorphisme pr`es’. Ceci est justifi´e par le fait qu’en g´en´eral on s’int´eresse
aux propri´et´es des graphes qui sont invariantes par isomorphisme (connectivit´e, diam`etre,
isomorphisme,. . .). On suppose que l’ensemble des noeuds N est un segment initial des nombres
naturels cod´es en binaire, par exemple N = 0, 1, 10, 11. En cons´equence, A est maintenant un
ensemble de couples de nombres naturels cod´es en binaire. On peut ajouter un symbole ] qui
agit comme un s´eparateur. Maintenant le graphe ({0, 1, 2, 3}, {(2, 0),(1, 3),(2, 3)}) peut ˆetre
repr´esent´e par le mot fini sur l’alphabet Σ = {0, 1, ]} :
]0]1]10]11]]10]0]1]11]10]11]
Par le biais de ce codage, on peut consid´erer `a isomorphisme pr`es l’ensemble des graphes
dirig´es comme un certain langage de mots finis sur un alphabet fini. Si G est un graphe
dirig´e, on d´enote par hGi son codage. Supposons maintenant qu’on s’int´eresse au probl`eme
de savoir si deux graphes dirig´es sont isomorphes.5 On peut reformuler ce probl`eme comme
le probl`eme de la reconnaissance du langage :
L = {hGi]]]hG
0
i | G et G
0
sont isomorphes}
5Notez qu’on peut avoir plusieurs codages qui repr´esentent le mˆeme graphe `a isomorphisme pr`es.
32Exemple 6.15 (fixer un alphabet) On applique maintenant la mˆeme m´ethode aux MdT.
Une MdT est un programme. Il est clair que le ‘nom’ des ´etats n’affecte pas le comportement
d’une MdT. Ainsi on peut supposer que les ´etats sont cod´es, par exemple, en binaire.
Consid´erons maintenant l’ensemble Γ. Il est possible de simuler le comportement d’une MdT
M qui utilise un alphabet Γ avec une autre MdT M0
qui utilise seulement un alphabet {0, 1,t}.
Si Γ a n ´el´ements on code chaque ´el´ement de Γ par une suite binaire de longueur k = dlg ne.
Pour simuler un pas de calcul de M, M0 doit : (i) lire k symboles cons´ecutifs et en fonction
de ces k symboles et de l’´etat courant (ii) ´ecrire k symboles et (iii) d´eplacer la tˆete de lecture
de k symboles `a droite ou `a gauche. Donc, `a un codage pr`es, le comportement de toute MdT
qui op`ere sur un alphabet arbitraire peut ˆetre simul´e par une MdT qui op`ere sur un alphabet
fini qui est fix´e une fois pour toutes.
Exemple 6.16 (´enum´eration de MdT) On s’int´eresse maintenant `a la repr´esentation comme
mots finis des MdT sur un alphabet donn´e. On peut fixer un codage pour le symbole t, pour
les ´etats q0, qa, qr et pour les symboles L, R. Ensuite, la fonction δ peut ˆetre repr´esent´ee en listant
son graphe (on peut ´eventuellement ajouter un symbole sp´ecial pour s´eparer les diff´erents
´el´ements de la liste comme on l’a fait dans le cas des graphes). En proc´edant de la sorte
toute MdT est repr´esent´ee par un mot fini sur un alphabet fini. Soit MdT(Σ) ⊆ Σ
∗
l’ensemble
des codages de MdT sur l’alphabet Σ choisi. Les mots qui composent cet ensemble doivent
repr´esenter comme une liste la fonction δ d’une MdT. Il est donc d´ecidable de savoir si un
mot appartient `a MdT(Σ). Par ailleurs, on peut d´efinir une fonction r´ecursive et surjective
ϕ : Σ∗ → MdT(Σ). Soit w0 le codage d’une MdT. La fonction ϕ est d´efinie par :
ϕ(w) = (
w si w code une MdT
w0 autrement
Mots ou nombres ? On a ´etudi´e la calculabilit´e de langages de mots finis. Une autre
possibilit´e aurait ´et´e de consid´erer la calculabilit´e de sous-ensembles de nombres naturels. La
th´eorie n’est pas vraiment affect´ee par ce choix car les mots finis peuvent ˆetre cod´es par des
nombres naturels et le codage est effectivement calculable comme on va le montrer dans les
exercices qui suivent.
Exercice 6.17 On peut ´enum´erer les couples de nombres naturels en proc´edant ‘par diagonales’
:
(0, 0), (1, 0),(0, 1), (2, 0),(1, 1),(0, 2), (3, 0). . .
Montrez que la fonction hm, ni = (m + n)(m + n + 1)/2 + n est une bijection entre N × N et
N. D´ecrire un algorithme pour calculer la fonction inverse.
Exercice 6.18 On d´efinit les fonctions h ik : Nk → N pour k ≥ 2 :
hm, ni2 = hm, ni
hn1, . . . , nkik = hhn1, . . . , nk−1ik−1, nki si k ≥ 3
Montrez que les fonctions h ik sont des bijections.
Exercice 6.19 On consid`ere l’ensemble N∗ des mots finis de nombres naturels. Notez que
N∗
est en correspondance bijective avec S
k≥0 Nk
. D´efinissez une bijection entre N∗
et N.
33Exercice 6.20 Soit Σ = {a, b, . . . , z} un alphabet fini. On peut ´enum´erer les ´el´ements de Σ
∗
comme suit :
, a, b, . . . , z, aa, . . . , az, ba, . . . , bz, za, . . . , zz, aaa, . . .
Si Σ contient k ´el´ements on aura k
0 mots de longueur 0, k mots de longueur 1, k
2 mots de
longueur 2, . . . D´efinissez une bijection entre Σ
∗
et N.
MdT universelle Un corollaire de ces exercices est qu’il y a une bijection h , i : Σ∗×Σ
∗ →
Σ. Par le biais de cette bijection, une MdT peut interpr´eter tout mot w comme un couple de
mots hw1, w2i. Par ailleurs, par le biais de la fonction ϕ une MdT peut interpr´eter tout mot
comme le codage d’une MdT.
On peut alors construire une MdT U qu’on appelle MdT universelle telle que
U(hw1, w2i) = ϕ(w1)(w2)
La machine U –dont on omet les d´etails de construction– re¸coit un mot w qui est interpr´et´e
comme un couple de mots w1, w2. Ensuite le mot w2 est interpr´et´e comme l’entr´ee de la MdT
d´ecrite par le premier mot w1. La MdT U simule la MdT ϕ(w1) sur l’entr´ee w2. Ainsi, la
machine U se comporte comme un interpr`ete qui re¸coit en argument un programme et une
entr´ee et calcule le r´esultat du programme sur l’entr´ee.
Exercice 6.21 (1) Montrez qu’un langage est semi-d´ecidable si et seulement si il est le
domaine de d´efinition d’une fonction partielle r´ecursive.
(2) On dit qu’un langage L ⊆ Σ
∗
est r´ecursivement ´enum´erable s’il est l’image d’une fonction
partielle r´ecursive. Montrez qu’un langage L est r´ecursivement ´enum´erable si et seulement si
il est semi-d´ecidable.
Suggestion : Soit M une MdT et w0, w1, w2, . . . une suite d’entr´ees. On peut simuler M
sur w0 pour 0 pas, sur w0 pour 1 pas, sur w1 pour 0 pas, sur w0 pour 2 pas, sur w1 pour 1
pas, sur w2 pour 0 pas,. . .
Exercice 6.22 (1) Rappel : tout nombre naturel n ≥ 2 admet une d´ecomposition unique
comme produit p
n1
1
· · · p
nk
k
o`u k ≥ 1, p1 < · · · < pk sont des nombres premiers et n1, . . . , nk ≥
1. En utilisant ce fait, d´efinissez une fonction surjective de N dans les parties finies de N.
(2) On ne peut pas g´en´eraliser aux parties de N ! Supposez une ´enum´eration e : N → 2
N.
Consid´erez X = {n | n /∈ e(n)}. Comme e est surjective, il existe nX tel que e(nX) = X et
soit nX ∈ X soit nX ∈/ X. Montrez que dans les deux cas on arrive `a une contradiction.
(3) On dit qu’un ensemble X est d´enombrable s’il y a une fonction bijective entre X et les
nombres naturels N.
(3.1) Montrez que l’ensemble des langages sur un alphabet Σ n’est pas d´enombrable.
(3.2) Conclure qu’il y a des langages qui ne sont pas semi-d´ecidables.
On r´esume ces consid´erations comme suit :
– Un probl`eme algorithmique peut ˆetre (souvent) reformul´e comme un probl`eme de reconnaissance
d’un langage.
– Sans perte de g´en´eralit´e, nous pouvons limiter notre attention aux MdT qui op`erent sur
un alphabet Γ fix´e une fois pour toutes.
34– On peut coder une MdT comme un mot fini et on peut ´enum´erer tous les codages de
MdT sur un alphabet donn´e.
– A un codage pr`es, il y a autant de MdT que de nombres naturels alors que l’ensemble
des langages a la cardinalit´e des parties de nombres naturels. Il doit donc y avoir des
langages qui ne sont pas d´ecidables.
– On peut s’int´eresser de fa¸con ´equivalente `a la calculabilit´e de langages de mots finis,
d’ensembles de couples de mots finis, d’ensembles de nombres naturels,. . .
– On peut construire une MdT universelle qui re¸coit en entr´ee le codage d’une MdT M
et une entr´ee w et simule le calcul de M sur w.
6.3 Temps de calcul
Un pas de calcul d’une MdT est une op´eration ´el´ementaire qui demande un effort de
calcul born´e : il s’agit de consulter un tableau fini, d’´ecrire un symbole et de d´eplacer d’une
position la tˆete de lecture. Il semble donc raisonnable de mesurer le temps de calcul d’une
MdT simplement comme le nombre de pas de calcul n´ecessaires pour arriver `a un ´etat final.
D´efinition 6.23 Soit M une MdT qui termine sur toute entr´ee. La complexit´e en temps de
M est une fonction t : N → N o`u t(n) est le nombre maximal de pas de calcul n´ecessaires `a
la machine pour terminer sur une entr´ee de taille n (la taille d’un mot est sa longueur).
Souvent on s’int´eresse seulement `a l’ordre de grandeur de la complexit´e.
D´efinition 6.24 Soient f, g : N → N deux fonctions sur les nombres naturels. On dit que f
est O(g) s’ils existent n0, c ∈ N tels que pour tout n ≥ n0, f(n) ≤ cg(n).
En d’autres termes, f est O(g) si presque partout f est domin´ee par g `a une constante
multiplicative pr`es.
Exercice 6.25 Montrez que : 6n
3 + 2n
2 + 20n + 45 est O(n
3
).
Il est int´eressant d’analyser comment la notation O interagit avec le logarithme et l’exposant.
Une premi`ere remarque est qu’on peut n´egliger la base du logarithme et prendre
toujours le logarithme en base 2. En effet, logbn = log2n/log2
b. En ce qui concerne l’exposant,
on remarquera que la fonction 3n n’est pas O(2n
). Cependant elle est O(2(cn)
) en prenant par
exemple c = 2. Pour cette raison, on introduit la notation 2O(f)
. Par exemple, la notation
2
O(n)
indique une fonction 2cn pour une constante c. Ainsi 745n
est 2O(n)
. Notez cependant
que 2n
2
n’est pas 2O(n)
.
D´efinition 6.26 Soit g : N → N une fonction sur les nombres naturels et M une MdT. On
dit que M est O(g) si la complexit´e en temps t de M est O(g).
Par exemple, dire qu’une machine M est O(n) veut dire qu’ils existent n0, c ∈ N tels que
pour toute entr´ee w de taille n ≥ n0 le temps de calcul de M sur l’entr´ee w est au plus cn.
Exercice 6.27 Montrez qu’il y a une MdT M qui d´ecide le langage L = {w]w | w ∈ {0, 1}
∗}
qui est O(n
2
).
356.4 Variantes de MdT
Plusieurs variantes de MdT ont ´et´e consid´er´ees. Ces variantes n’affectent pas la notion de
langage semi-d´ecidable ou d´ecidable mais peuvent changer de fa¸con significative la complexit´e
du calcul.
Machines multi-rubans Une MdT multi-rubans est une MdT qui dispose d’un nombre
fini k de rubans. Sa d´efinition formelle suit celle d’une MdT standard modulo le fait que le
type de la fonction de transition δ est maintenant
δ : Q × Γ
k → Q × Γ
k × {L, R, S}
k
Un pas de calcul se d´eroule de la fa¸con suivante : en fonction de l’´etat courant et des symboles
lus sur les k rubans, la machine va dans un autre ´etat, remplace les symboles lus par d’autres
symboles et d´eplace les tˆetes de lecture. Avec la directive S pour stay on a la possibilit´e de
garder une tˆete de lecture `a la mˆeme place.
Proposition 6.28 Soit M une MdT multi-rubans. On peut construire une MdT standard M0
qui simule M. Si la complexit´e de M est t(n) ≥ n la complexit´e de M0
est O(t(n)
2
).
Idee de la preuve ´ . Supposons que la MdT M dispose de 3 rubans dont le contenu est
0101t
ω
, aabt
ω
et bat
ω
et dont les tˆetes de lecture sont en deuxi`eme, troisi`eme et premi`ere
position respectivement. La MdT M0 m´emorise les trois rubans sur un seul ruban de la fa¸con
suivante :
]0101]aab]ba]t
ω
On notera que M0 dispose d’un nouveau symbole ] pour s´eparer les rubans et que pour chaque
symbole a de M on introduit un nouveau symbole a. Le symbole soulign´e indique la position
de la tˆete de lecture.
Un pas de calcul de M est simul´e de la fa¸con suivante :
– M0
commence par parcourir son ruban de gauche `a droite pour calculer les symboles en
lecture et d´eterminer les actions `a effectuer.
– Ensuite, M0
effectue un deuxi`eme passage dans lequel elle remplace le symbole en lecture
(les symboles soulign´es) par des nouveaux symboles et ´eventuellement d´eplace la tˆete
de lecture (c’est-`a-dire, remplace un symbole par un symbole soulign´e).
– Si le symbole soulign´e pr´ec`ede le symbole ] et le calcul pr´evoit un d´eplacement `a droite
il est n´ecessaire d’allouer une nouvelle case. A cette fin, la machine M0 d´ecale `a droite
le contenu du ruban.
La borne O(t(n)
2
) sur le temps de calcul de la simulation est obtenue de la fa¸con suivante.
D’abord on observe que si la complexit´e de M est t(n), la taille des rubans manipul´es par
M ne peut jamais d´epasser t(n). Ensuite on d´etermine le nombre d’op´erations n´ecessaires `a
simuler un pas de calcul de M. Le premier passage est O(t(n)). Le deuxi`eme passage est aussi
O(t(n)) car le d´ecalage `a droite peut ˆetre effectu´e au plus k fois si la machine M comporte k
rubans et chaque d´ecalage peut ˆetre effectu´e en O(t(n)). •
Les machines multi-rubans permettent de donner une preuve simple du fait suivant.
Proposition 6.29 Un langage L est d´ecidable si et seulement si L et son compl´ementaire
L
c
sont semi-d´ecidables.
36Idee de la preuve ´ . (⇒) Par d´efinition un langage d´ecidable est semi-d´ecidable. D’une
MdT M qui d´ecide L on obtient une MdT M0 qui d´ecide L
c
simplement en ´echangeant les
´etats finaux qa et qr.
(⇐) Soient M et M0
les MdT qui d´ecident L et L
c
, respectivement. On d´erive une MdT
N avec 2 rubans qui copie d’abord l’entr´ee w du premier au deuxi`eme ruban et qui simule
ensuite alternativement un pas de r´eduction de la machine M et un pas de r´eduction de la
machine M0
. La machine N accepte si M arrive `a l’´etat qa et elle refuse si M0 arrive `a l’´etat
q
0
a
. La machine N termine toujours car tout mot w est accept´e soit par M soit par M0
. •
MdT non-d´eterministes Une MdT non-d´eterministe M est une MdT dont la fonction de
transition δ a le type :
δ : Q × Γ → 2
(Q×Γ×{L,R})
La notion de pas de calcul est adapt´ee imm´ediatement. Par exemple, on ´ecrira
wqaw0 `M wbq0w
0
si (q
0
, b, R) ∈ δ(q, a)
Exercice 6.30 Compl´etez la d´efinition de pas de calcul d’une machine non-d´eterministe.
La d´efinition 6.3 de langage semi-d´ecidable et d´ecidable s’applique directement aux MdT
non-d´eterministes.6 On remarquera que pour qu’une entr´ee w soit accept´ee il suffit qu’il existe
un calcul qui m`ene de la configuration initiale `a l’´etat qa.
Proposition 6.31 Soit N une MdT non-d´eterministe. On peut construire une MdT standard
M qui simule N. Si la complexit´e de N est t(n) ≥ n la complexit´e de M est 2
O(t(n))
.
Idee de la preuve ´ . Dans une MdT non-d´eterministe N il y a une constante k qui borne
le nombre d’alternatives possibles dans la suite du calcul. Ainsi on peut repr´esenter le calcul
d’une MdT non-d´eterministe comme un arbre ´eventuellement infini mais dont le branchement
est born´e par la constante k.
Les noeuds de cet arbre correspondent `a des mots sur {0, . . . , k − 1}
∗
. On peut ´enum´erer
tous les noeuds de l’arbre en explorant l’arbre en largeur d’abord :
, 0, . . . , k − 1, 00, . . . , 0(k − 1), 10, . . . , 1(k − 1), . . .(k − 1)0, . . . ,(k − 1)(k − 1), 000, . . .
Une MdT peut calculer le successeur imm´ediat d’un mot π par rapport `a cette ´enum´eration.
Pour simuler la machine N on utilise une MdT M avec 3 rubans. La proposition 6.28
nous assure qu’on peut toujours remplacer M par une MdT standard. Le premier ruban de
M contient l’entr´ee w, le deuxi`eme contient le chemin de l’arbre π qui est actuellement explor´e
et le troisi`eme contient le ruban de la machine N lorsqu’elle calcule en effectuant les choix
selon le chemin π.
Pour un chemin donn´e π, la machine M copie l’entr´ee du premier ruban au troisi`eme et
effectue ensuite un calcul en simulant l’ex´ecution de N sur le chemin π.
– Le calcul peut bloquer car le chemin π ne correspond pas `a un choix possible. Dans ce
cas on consid`ere le successeur imm´ediat de π et on it`ere.
6Ce n’est pas le cas pour la notion de fonction partielle r´ecursive car il faut d´ecider d’abord quel est le
r´esultat d’une MdT non-d´eterministe. . .
37– Le calcul arrive `a la fin du chemin π mais la machine ne se trouve pas dans l’´etat qa.
Dans ce cas aussi on consid`ere le successeur imm´ediat de π et on it`ere.
– Le calcul arrive `a la fin du chemin π et la machine se trouve dans l’´etat qa. Dans ce cas
on accepte et on arrˆete le calcul.
– La simulation peut aussi noter qu’il ne reste plus de chemins `a explorer et dans ce cas
elle s’arrˆete et refuse.
Si la complexit´e de N est t(n), la taille des chemins `a consid´erer est aussi O(t(n)). Le
nombre de chemins `a simuler est 2O(t(n)). Donc la complexit´e de M est 2O(t(n)). Enfin, la
MdT standard qui simule M est aussi 2O(t(n)) car (2cn)
2
est 2O(n)
. •
Exercice 6.32 (1) Montrez que les langages accept´es par un automate fini sont d´ecidables.
(2) Montrez que la collection des langages d´ecidables est stable par rapport aux op´erations
d’union, compl´ementaire, concat´enation et it´eration.
(3) Montrez que la collection des langages semi-d´ecidables est stable par rapport aux op´erations
d’union et concat´enation.
Suggestion : utilisez le non-d´eterminisme.
Th`ese de Church-Turing Il est ´evident que le calcul d’une MdT est effectif dans le sens
qu’une personne (une machine ´electronique) peut simuler le calcul d’une MdT `a condition
de disposer d’une quantit´e de papier (d’une quantit´e de m´emoire) qui peut ˆetre ´etendue
ind´efiniment. La th`ese de Church-Turing affirme que :
Tout langage semi-d´ecidable par une “proc´edure effective” est semi-d´ecidable par
une MdT.
On ne peut pas d´emontrer cette affirmation tant que la notion de “proc´edure effective”
n’est pas formalis´ee. Le probl`eme est qu’il n’y a pas de d´efinition g´en´erale de “proc´edure
effective”. On dispose seulement d’exemples de “proc´edures effectives” (par exemple les MdT,
les programmes assembleurs, les programmes Java, les syst`emes de preuve,. . .) et ce qu’on
peut faire est de d´emontrer que ces exemples sont ´equivalents au sens o`u ils permettent de
semi-d´ecider le mˆeme ensemble de langages. Nombreuses preuves de ce type ont ´et´e effectu´ees
depuis les ann´ees 30 et ceci nous permet d’avoir un certain niveau de confiance dans la validit´e
de la th`ese.
6.5 Langages ind´ecidables
On rappelle qu’il y a une bijection h , i entre les mots finis et les couples de mots finis et
que tout mot w peut ˆetre vu comme la repr´esentation d’une MdT ϕ(w). En particulier, on
utilise la notation M, M0
, . . . pour des mots qui sont consid´er´es comme des MdT. On ´ecrit
aussi ϕ(M)(w) pour indiquer le r´esultat du calcul de la MdT repr´esent´ee par ϕ(M) sur une
entr´ee w.
D´efinition 6.33 Le langage H est d´efini par
H = {hM, wi | ϕ(M)(w) ↓}
38Le langage H est semi-d´ecidable par la MdT universelle. Le langage H formalise un
probl`eme int´eressant qu’on appelle probl`eme de l’arrˆet : ´etant donn´e une MdT (un programme)
M et une entr´ee w on se demande si le calcul de M sur l’entr´ee w termine.
On peut aussi consid´erer le comportement d’une machine M lorsque elle re¸coit comme
entr´ee le codage d’une machine M0
. En particulier, on peut s’int´eresser au r´esultat de l’application
de la machine M `a son propre codage.
D´efinition 6.34 Le langage K est d´efini par
K = {M | ϕ(M)(M) ↓}
On va montrer que les langages H et K ne sont pas d´ecidables. Au passage, par la proposition
6.29 cela implique que les langages compl´ementaires Hc
et Kc ne sont mˆeme pas
semi-d´ecidables.
Th´eor`eme 6.35 Le langage K n’est pas d´ecidable.
Idee de la preuve ´ . Si K est d´ecidable il devrait y avoir une MdT ϕ(M) telle que
ϕ(M)(M0
) ↓ ssi M0 ∈ Kc
Si on applique ϕ(M) `a M on a deux possibilit´es :
1. Si ϕ(M)(M) ↓ alors M ∈ Kc
et donc ¬ϕ(M)(M) ↓.
2. Si ¬ϕ(M)(M) ↓ alors M /∈ Kc
et donc ϕ(M)(M) ↓.
Les deux possibilit´es m`enent `a une contradiction, donc Kc n’est pas semi-d´ecidable.7 •
Plutˆot que d´emontrer directement que H n’est pas d´ecidable on va introduire une technique
pour r´eduire l’analyse d’un langage `a l’analyse d’un autre langage.
D´efinition 6.36 Soient L, L0 deux langages sur un alphabet Σ. On dit que L se r´eduit `a L
0
et on ´ecrit L ≤ L
0
s’il existe une fonction r´ecursive f : Σ∗ → Σ
∗
telle que
w ∈ L ssi f(w) ∈ L
0
.
Si L ≤ L
0 alors les m´ethodes de d´ecision qu’on d´eveloppe pour L
0 peuvent ˆetre appliqu´ees
`a L aussi.
Proposition 6.37 Si L ≤ L
0
et L
0
est semi-d´ecidable (d´ecidable) alors L est semi-d´ecidable
(d´ecidable).
Idee de la preuve ´ . On sait qu’il existe une fonction r´ecursive f telle que w ∈ L ssi f(w) ∈ L
0
.
Supposons que Mf soit une MdT qui calcule f et M0 une MdT qui semi-d´ecide L
0
. Pour semid´ecider
(d´ecider) L il suffit de composer M0
et Mf . •
Exemple 6.38 On obtient que K ≤ H en utilisant la fonction f(M) = hM, Mi. Comme K
n’est pas d´ecidable, H ne peut pas ˆetre d´ecidable non plus.
7On appelle cette technique de preuve diagonalisation. On l’a d´ej`a utilis´ee dans l’exercice 6.22.
39Le fait que le probl`eme de l’arrˆet soit ind´ecidable n’est que la pointe de l’iceberg. . .
D´efinition 6.39 On dit que deux MdT sont extensionnellement ´equivalentes si elles terminent
sur les mˆemes entr´ees en donnant la mˆeme r´eponse (accepter/refuser).8
D´efinition 6.40 On dit qu’un langage P ⊆ Σ
∗
est une propri´et´e extensionnelle si P ne
distingue pas les codages de deux machines qui sont extensionnellement ´equivalentes.9 On dit
aussi que P est triviale si P ou P
c
est l’ensemble vide.
Th´eor`eme 6.41 (Rice) Toute propri´et´e extensionnelle P non triviale est ind´ecidable.
Idee de la preuve ´ . Soit M∅
le codage d’une MdT qui accepte le langage vide. Supposons que
M∅ ∈/ P (autrement on montre que P
c
est ind´ecidable). Supposons aussi que M1 ∈ P. Soit f
la fonction qui associe au codage d’une MdT M le codage d’une MdT qui re¸coit une entr´ee w,
calcule ϕ(M)(M) et si elle termine calcule M1(w). La machine f(M) est extensionnellement
´equivalente `a M1 (et donc appartient `a P) si et seulement si M ∈ K. Donc la fonction f
montre que K ≤ P. •
Exercice 6.42 En utilisant le th´eor`eme de Rice, montrez que les langages suivants sont
ind´ecidables :
(1) L’ensemble K des codages de MdT qui terminent sur l’entr´ee et acceptent .
(2) L’ensemble Tot des codages de MdT qui terminent sur toute entr´ee.
(3) L’ensemble Eq des codages de couples de MdT qui sont extensionnellement ´equivalentes.
Une cons´equence de (2) est qu’il ne peut pas y avoir un langage de programmation dans
lequel on peut programmer exactement les fonctions totales. Il ne serait pas d´ecidable de savoir
si un programme de ce langage est bien form´e. Il est donc n´ecessaire de donner des crit`eres
d´ecidables qui assurent la terminaison mais qui excluent certains programmes qui terminent.
Une cons´equence de (3) est qu’on ne peut pas automatiser le probl`eme de l’´equivalence de
deux programmes. Dans ce cas aussi on est amen´e `a faire des approximations.
Exercice 6.43 Montrez ou invalidez les assertions suivantes :
1. Il y a une MdT qui accepte les mots sur l’alphabet {0, 1} qui contiennent autant de 0
que de 1 (si la MdT existe, il suffira d’en donner une description informelle).
2. Rappel : si A et B sont deux langages, on ´ecrit A ≤ B s’il existe une r´eduction de A `a
B.
Si A est s´emi-d´ecidable et A ≤ Ac alors A est d´ecidable.
3. L’ensemble des (codages de) MdT qui reconnaissent un langage fini est d´ecidable.
Exercice 6.44 Montrez ou donnez un contre-exemple aux assertions suivantes :
1. L’ensemble des (codages de) MdT qui terminent sur le mot vide est d´ecidable.
2. L’ensemble des (codages de) MdT qui divergent sur le mot vide est semi-d´ecidable.
8
Il y a des variations possibles de cette d´efinition. Par exemple, on peut dire que les machines sont
´equivalentes si elles calculent la mˆeme fonction partielle.
9En d’autres termes, si M et M0
sont extensionnellement ´equivalentes alors soit {M, M0
} ⊆ P soit {M, M0
}∩
P = ∅.
403. L’ensemble des (codages de) MdT qui terminent sur le mot vide en 10100 pas de calcul
est d´ecidable.
Exemple 6.45 On termine en mentionnant (sans preuve) quelques probl`emes ind´ecidables
remarquables.
(1) Soit Σ un alphabet et soit (v1, w1)· · ·(vk, wk) une suite finie de couples de mots dans Σ
∗
.
Le probl`eme de correspondance de Post (PCP) consiste `a d´eterminer s’ils existent n ≥ 1 et
i1, . . . , in ∈ {1, . . . , k} tels que :
vi1
· · · vin = wi1
· · · win
.
Par exemple, consid´erez {(ab, a),(bcc, bb),(c, cc)}. On ne peut pas concevoir un algorithme
qui pour tout PCP d´ecide si le probl`eme a une solution. En d’autres termes, le probl`eme de
correspondance de Post est ind´ecidable.
(2) Soit p(x1, . . . , xn) un polynˆome de degr´e arbitraire avec variables x1, . . . , xn et avec coef-
ficients dans Z. Par exemple, p(x, y, z) = 6x
3yz2 + 3xy2 − x
3 − 10. Le dixi`eme probl`eme de
Hilbert consiste `a d´eterminer si le polynˆome p a des racines dans Z, c’est-`a-dire :
∃ x1, . . . , xn ∈ Z p(x1, . . . , xn) = 0
Ce probl`eme a ´et´e propos´e comme un challenge parmi d’autres en 1900 par D. Hilbert et
il a ´et´e montr´e ind´ecidable par Matijasevich en 1970 (le mˆeme probl`eme sur les r´eels est
d´ecidable).
(3) La logique du premier ordre est l’extension du calcul propositionnel o`u l’on introduit la
quantification. Par exemple, on peut ´ecrire ∀ x ∃ y A(x, y). Une telle formule est valide si
pour tout ensemble U 6= ∅ et pour toute relation binaire RA sur U il est vrai que pour tout
u ∈ U il existe v ∈ V tel que (u, v) ∈ RA. La validit´e d’une formule du premier ordre est
ind´ecidable.
(4) On peut s’int´eresser aux formules du premier ordre sur un alphabet particulier qui
comprend les symboles +,∗ et < qui sont interpr´et´es comme l’addition, la multiplication et
l’in´egalit´e de nombres naturels. De mˆeme, les quantificateurs sont interpr´et´es maintenant sur
les nombres naturels. Par exemple, ∀ x ∃ y x < y est une formule qui dit que pour chaque
nombre naturel x on peut trouver un nombre naturel y qui est strictement plus grand. La validit´e
d’une formule du premier ordre (interpr´et´ee sur les nombres naturels) est (hautement)
ind´ecidable.10
10On peut construire une hi´erarchie qu’on appelle hi´erarchie arithm´etique de probl`emes ind´ecidables et
toujours ‘plus durs’.
417 Complexit´e : les classes P et NP
On s’int´eresse au probl`emes d´ecidables en temps polynomial (d´eterministe ou non-d´eterministe).
D´efinition 7.1 P (NP) est la classe des langages qui sont d´ecidables par une MdT d´eterministe
(non-d´eterministe) en temps O(n
k
) pour un certain k.
Il suit de la d´efinition que tout probl`eme dans P est aussi dans NP. Les classes P et NP
sont suffisamment robustes pour ne pas ˆetre affect´ees par une modification du mod`ele de
calcul. Par exemple, ces classes ne d´ependent pas du fait que les MdT disposent de un ou de
plusieurs rubans. On peut mˆeme enrichir le mod`ele de calcul en supposant que la machine
dispose d’une m´emoire illimit´ee en acc`es direct (RAM pour random access memory). Dans une
telle machine l’acc`es `a une cellule de m´emoire est effectu´e en O(1). On peut d´emontrer qu’une
MdT d´eterministe peut simuler une machine avec RAM avec une d´egradation polynomiale
des performances, c’est-`a-dire qu’il y a un (petit) nombre k tel que si la machine avec RAM
a complexit´e O(t(n)) la MdT qui la simule a complexit´e O(t(n)
k
).
Une grande partie des probl`emes qui sont consid´er´es dans un cours standard d’algorithmique
font partie de la classe P. Par exemple, les probl`emes de tri, la r´esolution de syst`emes
d’´equations lin´eaires, les probl`emes de recherche dans un arbre, le probl`eme de la connectivit´e
d’un graphe,. . . Dans la suite on va consid´erer un certain nombre de probl`emes qui sont dans
la classe NP.
Exemple 7.2 (1) Le probl`eme de savoir si une formule du calcul propositionnel est satisfiable
est dans NP. Il suffit de deviner une affectation et de v´erifier.
(2) Soit G = (V, E) un graphe non-dirig´e. Le probl`eme du circuit hamiltonien consiste `a
d´eterminer s’il existe un parcours du graphe qui contient chaque sommet du graphe une et
une seule fois. Un algorithme dans NP qui r´epond `a la question devine une permutation des
sommets et v´erifie si elle correspond `a un parcours dans le graphe.
(2) Soit V un ensemble de villes et d une fonction qui associe `a chaque paire de villes (v, v0
)
la distance d(v, v0
) ≥ 0 pour aller de v `a v
0
. Le probl`eme du voyageur de commerce11 est
de d´eterminer s’il existe un parcours qui traverse chaque ville exactement une fois dont la
longueur est inf´erieure `a b. En d’autres termes, dans TSP on consid`ere un graphe non-dirig´e,
complet (chaque couple de noeuds est connect´e par une arˆete) et avec une fonction de coˆut sur
les arˆetes et on cherche `a d´eterminer si le graphe contient un circuit hamiltonien dont le coˆut
est inf´erieur `a b. Un algorithme dans NP qui r´epond `a la question devine une permutation
des villes et v´erifie si la somme des distances est inf´erieure `a b.
12
7.1 R´eduction polynomiale
Faute de pouvoir d´emontrer que les probl`emes dans l’exemple 7.2 sont ou ne sont pas
dans P, on va essayer de les comparer. A cette fin, on reprend la notion de r´eduction entre
probl`emes (d´efinition 6.36) en ajoutant la contrainte que la r´eduction est calculable en temps
polynomiale (d´eterministe).
11Aussi connu comme TSP pour Travelling Salesman Problem.
12Ce probl`eme est aussi formul´e comme un probl`eme d’optimisation o`u l’on cherche `a minimiser la longueur
d’un parcours ferm´e.
42D´efinition 7.3 Soient L, L0 deux langages sur un alphabet Σ. On dit que L se r´eduit `a L
0
en temps polynomial et on ´ecrit L ≤P L
0
s’il existe une fonction r´ecursive f : Σ∗ → Σ
∗
calculable en temps polynomial telle que
w ∈ L ssi w ∈ L
0
Exemple 7.4 Il y a une r´eduction polynomiale du probl`eme du circuit hamiltonien au probl`eme
du voyageur de commerce. L’ensemble des noeuds correspond `a l’ensemble des villes. La distance
d est d´efinie par :
d(v, v0
) = (
1 si (v, v0
) arˆete
2 autrement
La constante b est ´egale au nombre des villes. Maintenant, on remarque :
– S’il existe un parcours de longueur b alors ce parcours ne peut contenir que des chemins
entre villes de longueur 1. Donc ce parcours correspond `a un chemin hamiltonien.
– Inversement, s’il y a un chemin hamiltonien alors la r´eponse au probl`eme du voyageur
de commerce est positive.
Exercice 7.5 Une formule est en 3-CNF si elle est en CNF et chaque clause (disjonction de
litt´eraux) comporte exactement 3 litt´eraux. Le probl`eme 3-SAT consiste `a d´eterminer si une
formule en 3-CNF est satisfiable. Montrez que :
(1) 3-SAT est dans NP.
(2) Une clause `1 ∨ · · · ∨ `n avec n > 3 peut ˆetre remplac´ee par
(`1 ∨ `2 ∨ y1) ∧ (¬y1 ∨ `3 ∨ y2) ∧ · · ·(¬yn−3 ∨ `n−1 ∨ `n)
o`u y1, . . . , yn−3 sont des nouvelles variables.
(3) Une clause avec 1 ou 2 litt´eraux peut ˆetre remplac´ee par une clause avec 3 litt´eraux.
(4) Conclure qu’il y a une r´eduction polynomiale de SAT `a 3-SAT.
Exercice 7.6 Montrez que la notion de r´eduction polynomiale est transitive : L1 ≤P L2 et
L2 ≤P L3 implique L1 ≤P L3.
7.2 SAT et NP-compl´etude
D´efinition 7.7 Un probl`eme L (langage) est NP-complet s’il est dans NP et si tout probl`eme
L
0 dans NP admet une r´eduction polynomiale `a L.
Dans un certain sens les probl`emes NP-complets sont les plus durs. Si on trouve un
algorithme polynomial pour un probl`eme NP-complet alors on a un algorithme polynomial
pour tous les probl`emes de la classe NP. Un fait remarquable est que plusieurs probl`emes
naturels sont NP-complets.
Th´eor`eme 7.8 (Cook-Levin 1971) Le probl`eme SAT est NP-complet.
Idee de la preuve ´ . Soit L un langage d´ecid´e par une MdT M non d´eterministe polynomiale
en temps p(n). Donc w ∈ L ssi `a partir de la configuration initiale q0w la machine M peut
arriver `a l’´etat qa. On d´ecrit une r´eduction polynomiale qui associe `a chaque mot w une
43formule en CNF Aw qui est satisfiable si et seulement si w ∈ L. L’id´ee est que la formule
Aw va d´ecrire les calculs possibles (M est non-d´eterministe !) de la machine M sur l’entr´ee
w. La remarque fondamentale est qu’un calcul d’une machine de Turing en temps p(n) sur
un mot w de taille n peut ˆetre repr´esent´e par un tableau de taille p(n) × p(n) dont la case
de coordonn´ees (i, j) contient la valeur du ruban au temps i et `a la position j. Si le calcul
termine avant p(n) on peut toujours recopier le ruban jusqu’au temps p(n).
On peut associer `a chaque case (i, j) et `a chaque symbole a une variable propositionnelle
xi,j,a avec l’id´ee que xi,j,a = 1 si et seulement si la case (i, j) contient le symbole a.
Ensuite on peut construire des formules (de taille polynomiale en n) qui assurent que :
– Exactement un symbole est dans chaque case.
– Les cases (1, j) correspondent `a la configuration initiale.
– Chaque case (i + 1, j) est obtenue des cases (i, j − 1),(i, j),(i, j + 1) selon les r`egles de
la Machine.
– La configuration finale accepte.
Exemple 7.9 On construit une CNF qui correspond au calcul de la MdT M dans l’exemple
6.4 sur l’entr´ee aab.
13 Le calcul de la MdT pourrait ˆetre :
1 2 3 4 5
1 q0 a a b t
2 a q0 a b t
3 a a q0 b t
4 a a b q1 t
5 a a b t qa
Pour repr´esenter le calcul on introduit les variables xi,j,u o`u i, j ∈ {1, . . . , 5} et u ∈ {a, b, q0, q1, qa}.
La configuration initiale est sp´ecifi´ee par :
Ainit = x1,1,q0 ∧ x1,2,a ∧ x1,3,a ∧ x1,4,b ∧ x1,5,t
On doit imposer la contrainte que `a chaque instant exactement un symbole est pr´esent `a
chaque position. Par exemple, pour l’instant i `a la position j on ´ecrira :
Ai,j = (xi,j,a ∨ · · · ∨ xi,j,qa
) ∧ (¬xi,j,a ∨ ¬xi,j,b) ∧ · · · ∧ (¬xi,j,q1 ∨ ¬xi,j,qa
)
L’objectif est d’arriver `a une configuration qui contient l’´etat qa. Cela revient `a demander :
Aaccept = ∨1≤i,j≤5xi,j,qa
Enfin on doit d´ecrire les ‘r`egles de calcul’ de la machine M. Par exemple, on pourrait exprimer
δ(q0, a) = (q0, a, R) par la conjonction de formules de la forme
(xi−1,j−1,q0 ∧ xi−1,j,a) → (xi,j−1,a ∧ xi,j,q0
)
Il est possible de proc´eder d’une fa¸con plus syst´ematique. Une propri´et´e int´eressante des MdT
est qu’`a chaque instant le calcul est localis´e dans une r´egion de taille born´ee. Si w1qw2 `M
w
0
1
q
0w
0
2
la diff´erence entre les deux configurations est localis´ee dans une r´egion de taille 3 qui
13Il s’agit d’un cas tr`es sp´ecial car la MdT en question se comporte comme un automate fini d´eterministe.
Cependant les id´ees se g´en´eralisent.
44comprend l’´etat et les deux symboles contigu¨es. L’id´ee est alors de regarder toutes les fenˆetres
de largeur 3 et de hauteur 2 dans le tableau qui repr´esente le calcul (il y en a un nombre
polynomial) et de s’assurer que le contenu de chaque fenˆetre est conforme aux r`egles de la
machines.
La formule en question peut ˆetre exprim´ee en CNF. Par exemple, on pourrait avoir une
formule de la forme :
((x1 ∧ x2) → (y1 ∧ y2)) ∨ ((x1 ∧ x2) → (w1 ∧ w2)) ∨ ((x1 ∧ x2) → (z1 ∧ z2))
pour dire que si deux cases contiennent les symboles a1, a2 (variables x1, x2) alors deux autres
cases contiennent ou bien les symboles b1, b2 (variables y1, y2) ou bien les symboles c1, c2
(variables w1, w2) ou bien les symboles d1, d2 (variables z1, z2).
Une telle formule peut se r´e-´ecrire en CNF comme suit.
(¬x1 ∨ ¬x2 ∨ y1 ∨ w1 ∨ z1)∧
(¬x1 ∨ ¬x2 ∨ y1 ∨ w1 ∨ z2)∧
(¬x1 ∨ ¬x2 ∨ y1 ∨ w2 ∨ z1)∧
(¬x1 ∨ ¬x2 ∨ y1 ∨ w2 ∨ z2)∧
(¬x1 ∨ ¬x2 ∨ y2 ∨ w1 ∨ z1)∧
(¬x1 ∨ ¬x2 ∨ y2 ∨ w1 ∨ z2)∧
(¬x1 ∨ ¬x2 ∨ y2 ∨ w2 ∨ z1)∧
(¬x1 ∨ ¬x2 ∨ y2 ∨ w2 ∨ z2)
La transformation est exponentielle dans le nombre de possibilit´es (3 dans notre cas), mais
pour une MdT donn´ee, ce nombre est born´e par une constante.
Exercice 7.10 On dispose d’un ensemble P = {1, . . . , m} de pigeons et d’un ensemble N =
{1, . . . , n} de nids. Le principe du nid de pigeon14 est le suivant :
1. Chaque pigeon a un nid.
2. Chaque nid a au plus un pigeon.
D´ecrivez le principe par une formule du calcul propositionnel en CNF qui utilise comme
formules atomiques oi,j pour i = 1, . . . , m et j = 1, . . . , n o`u la validit´e de oi,j repr´esente le
fait que le pigeon i occupe le nid j. La formule en question doit ˆetre satisfiable si et seulement
si m ≤ n. Quelle est la taille de la formule en fonction de m, n ?
Remarque : si on prend m = n+1 on obtient une formule en CNF qui n’est pas satisfiable.
Cette formule est utilis´ee souvent comme un test pour les m´ethodes de preuve (Davis-Putnam,
r´esolution,. . .)
Exercice 7.11 On dispose d’une grille 4 × 4 qui se d´ecompose en 4 sous-grilles 2 × 2. On
d´enote par le couple (i, j), o`u i, j ∈ {1, 2, 3, 4}, les coordonn´ees d’une case de la grille. Chaque
case de la grille contient un ensemble de nombres naturels contenu dans {1, 2, 3, 4}. On introduit
64 variables propositionnelles xi,j,k pour i, j, k ∈ {1, 2, 3, 4} avec l’interpr´etation suivante :
xi,j,k est ‘vrai’ si et seulement si la case de coordonn´ees (i, j) contient le nombre k.
14Traduction approximative de pigeon principle.
45Soit A une formule qui utilise les variables xi,j,k et P une propri´et´e de la grille. On dit
que A exprime P si, dans l’interpr´etation ci-dessus, A est satisfiable si et seulement si P est
v´erifi´ee. Par exemple, par la formule A = x1,1,2 ∨ x1,1,3 on exprime la propri´et´e que la case
de coordonn´ees (1, 1) contient ou bien 2 ou bien 3.
1. D´efinissez des formules en forme normale conjonctive qui expriment les propri´et´es suivantes
:
(a) La case de coordonn´ees (2, 2) contient au moins un num´ero compris entre 1 et 4.
(b) On ne peut pas trouver deux cases sur la premi`ere ligne qui contiennent le num´ero
4.
(c) La case (3, 2) contient au plus un num´ero.
2. Donnez une borne sup´erieure au nombre de litt´eraux contenus dans une formule en
forme normale conjonctive qui exprime la propri´et´e suivante : il n’y a pas deux cases
sur la mˆeme ligne, sur la mˆeme colonne ou sur la mˆeme sous-grille 2×2 qui contiennent
le mˆeme num´ero. Expliquez votre calcul.
Exercice 7.12 Pour n ≥ 1 on introduit n
2
variables propositionnelles xi,j avec 1 ≤ i, j ≤ n.
(1) Construisez une formule An en forme normale conjonctive qui a la propri´et´e suivante :
une affectation v satisfait An exactement quand il existe une permutation π : {1, . . . , n} →
{1, . . . , n} telle que v(xi,j ) = 1 si et seulement si π(i) = j. Par exemple, pour n = 2 il n’y a
que deux affectations qui peuvent satisfaire A2 `a savoir soit (v(x1,1) = v(x2,2) = 1 et v(x1,2) =
v(x2,1) = 0) soit (v(x1,1) = v(x2,2) = 0 et v(x1,2) = v(x2,1) = 1). Ecrivez explicitement ´ An
pour n = 3 et ensuite donnez le sch´ema de la formule An pour un n arbitraire. Suggestion :
une permutation sur un ensemble fini X est la mˆeme chose qu’une fonction injective sur X.
(2) Un graphe fini non-dirig´e G est un couple (N, E) o`u N = {1, . . . , n}, n ≥ 2 est un
ensemble qui repr´esente les noeuds du graphe et E est un ensemble de sous-ensembles de N
de cardinalit´e 2 qui repr´esente les arˆetes du graphe. On dit que G admet un circuit hamiltonien
s’il existe une permutation π : {1, . . . , n} → {1, . . . , n} telle que
{π(1), π(2)} ∈ E, . . . , {π(n − 1), π(n)} ∈ E
Montrez que le probl`eme de savoir si un graphe admet un circuit hamiltonien a une r´eduction
polynomiale au probl`eme de la satisfiabilit´e d’une formule en CNF du calcul propositionnel.
Suggestion : on utilise la formule An de l’exercice 7.12 pour sp´ecifier l’existence d’une permutation
et on ajoute des variables yi,j , i, j = 1, . . . , n, i 6= j pour sp´ecifier les arˆetes du
graphe.
Exercice 7.13 On dispose d’un ´echiquier (une matrice carr´ee) n × n. Une reine qui occupe
une position de l’´echiquier peut attaquer toutes les positions sur la mˆeme ligne, la mˆeme colonne
ou sur les diagonales inclin´ees de 45 d´egr´ees. On cherche `a placer r reines sur l’´echiquier
de fa¸con `a ce qu’elles ne puissent pas s’attaquer mutuellement. A cette fin, ´ecrivez une formule
en CNF qui est satisfiable si et seulement si le probl`eme a une solution. On utilisera des
formules atomiques oi,j pour i = 1, . . . , m et j = 1, . . . , n o`u la validit´e de oi,j repr´esente le
fait qu’une reine occupe la position (i, j).
Remarque : la formule obtenue est aussi un test int´eressant pour les m´ethodes de preuve.
Par exemple, pour n = r = 4 ou n = r = 8 le probl`eme a une solution.
46Exercice 7.14 Soit A une matrice et b un vecteur `a coefficients dans Z. Le probl`eme de
programmation lin´eaire enti`ere (ILP pour integer linear programming) consiste `a d´eterminer
s’il existe un vecteur ~x `a coefficients dans Nm tel que A~x = ~b.
15 Ce probl`eme est dans NP. On
utilise des notions d’alg`ebre lin´eaire pour montrer que si le probl`eme a une solution alors il en
a une dont la taille est polynomiale dans la taille de la matrice A. Ensuite on peut appliquer
la m´ethode standard qui consiste `a deviner un vecteur ~x et `a v´erifier qu’il est une solution.
A partir de ce fait, le but de l’exercice est de montrer que le probl`eme est NP-complet par
r´eduction du probl`eme SAT. Il peut ˆetre utile de consid´erer d’abord les probl`emes suivants.
– Montrez qu’en introduisant des variables auxiliaires on peut exprimer la satisfaction
d’une contrainte d’in´egalit´e comme un probl`eme d’ILP.
– Montrez qu’on peut exprimer la contrainte x ∈ {0, 1}.
– Montrez qu’on peut exprimer la contrainte x = y o`u x, y ∈ {0, 1}, 0 = 1 et 1 = 0.
– Montrez comment coder la validit´e d’une clause (disjonction de litt´eraux).
Exercice 7.15 Soit G un graphe non-dirig´e (cf. exercice 8.6). Un k-clique est un ensemble
de k noeuds de G qui ont la propri´et´e que chaque couple de noeuds est connect´ee par une
arˆete.
Le langage CLIQUE est compos´e de couples hG, ki o`u (i) G est le codage d’un graphe, (ii)
k est un nombre naturel et (iii) G contient comme sous-graphe un k-clique.
Le langage 3-SAT est compos´e de formules en forme normale conjonctive o`u chaque clause
contient 3 litt´eraux.
1. Montrez que le langage CLIQUE est dans NP.
2. On souhaite construire une r´eduction polynomiale de 3-SAT `a CLIQUE. Si la formule
A contient k clauses alors le graphe associ´e GA contient k groupes de noeuds o`u chaque
groupe est compos´e de 3 noeuds et chaque noeud est ´etiquet´e par un litt´eral. Par exemple,
si la clause est (x ∨ ¬y ∨ z) alors on aura un groupe de 3 noeuds ´etiquet´es avec x, ¬y et
z.
(a) D´ecrivez les arˆetes de GA de fa¸con `a ce que le graphe GA contienne une k-clique
si et seulement si la formule A est satisfiable et dessinez le graphe GA dans le cas
o`u
A = (x ∨ y) ∧ (¬x ∨ ¬y) ∧ (¬x ∨ y) ∧ (x ∨ ¬y)
(la formule en question comporte seulement deux litt´eraux par clause mais la
construction du graphe GA s’applique aussi bien `a ce cas).
(b) Quelle conclusion peut-on tirer de la construction pr´ec´edente ? Motivez votre r´eponse :
i. Si 3-SAT est un probl`eme polynomiale d´eterministe alors CLIQUE est un
probl`eme polynomiale d´eterministe.
ii. CLIQUE est un probl`eme NP-complet.
Exercice 7.16 Un graphe (non-dirig´e) G est compos´e d’un ensemble fini non-vide de noeuds
N et d’un ensemble A d’arˆetes qui connectent les noeuds. Formellement, une arˆete est un
ensemble {i, j} de noeuds de cardinalit´e 2. On dit que deux noeuds sont adjacents s’il y a une
arˆete qui les connecte.
15Comme pour le probl`eme du voyageur de commerce, le probl`eme ILP est souvent formul´e comme un
probl`eme d’optimisation. Par exemple, il s’agit de minimiser une fonction lin´eaire ~cT
~x sous les contraintes
A~x = ~b et ~x ≥ 0.
47Probl`eme du coloriage Etant donn´e un graphe ´ G = (N, A) et un nombre naturel k ≥ 2
on d´etermine s’il existe une fonction c : N → {1, . . . , k} telle que si i, j sont deux noeuds
adjacents alors c(i) 6= c(j).
16
Probl`eme de l’emploi du temps Etant donn´e (i) un ensemble d’´etudiants ´ E = {1, . . . , n}
(n ≥ 2), (ii) un ensemble de cours C = {1, . . . , m} (m ≥ 2), (iii) un ensemble de plages
horaires P = {1, . . . , p} (p ≥ 2) et (iv) une relations binaire R telle que (i, j) ∈ R si et
seulement si l’´etudiant i suit le cours j on d´etermine s’il existe une fonction emploi du temps
edt : C → P telle que si un ´etudiant suit deux cours diff´erents j 6= j
0 alors edt(j) 6= edt(j
0
).
D´emontrez ou donnez un contre-exemple aux assertions suivantes :
1. Le probl`eme de l’emploi du temps se r´eduit au probl`eme du coloriage.
2. Le probl`eme de l’emploi du temps se r´eduit en temps polynomial au probl`eme du coloriage.
3. Le probl`eme du coloriage est dans NP.
Remarque 7.17 (1) On connaˆıt un bon millier de probl`emes NP-complets. Cependant, certains
probl`emes comme l’isomorphisme de graphes (cf. exemple 6.14) r´esistent `a une classi-
fication. A l’´etat de nos connaissances, il est possible que le probl`eme de l’isomorphisme de
graphes soit ni NP-complet ni dans P.
(2) La question de savoir s’il y a un langage dans NP qui n’est pas dans P est ouverte depuis
1971. C’est un probl`eme naturel de la th´eorie de la complexit´e et il est aussi le probl`eme le
plus m´ediatis´e de l’informatique th´eorique. 17
(3) Une autre fa¸con de mesurer la complexit´e du calcul d’une MdT est de compter l’espace,
c’est-`a-dire le nombre de cellules du ruban qu’elle utilise. La classe PSPACE (NPSPACE) est
la classe des probl`emes qui peuvent ˆetre r´esolus par une MdT d´eterministe (non-d´eterministe)
en utilisant un espace polynomial dans la taille de l’entr´ee. Il n’est pas tr`es difficile de montrer
que PSPACE=NPSPACE. On en d´eduit imm´ediatement que P ⊆ NP ⊆ PSPACE mais on
ne sait pas si une de ces inclusions est stricte.
(4) Nombreuses autres classes de complexit´e ont ´et´e introduites. Par exemple : LOGSPACE,
la classe des probl`emes qui peuvent ˆetre r´esolus en espace logarithmique (LOGSPACE ⊆ P) et
EXPTIME, la classe des probl`emes qui peuvent ˆetre r´esolus en temps exponentiel (PSPACE
⊆ EXPTIME).
16On peut voir les valeurs {1, . . . , k} comme des couleurs qu’on affecte aux noeuds, d’o`u le nom du probl`eme.
17Le probl`eme P vs. NP est cit´e parmi les “7 probl`emes math´ematiques du troisi`eme mill´enaire” par la
Clay Foundation `a cot´e de l’hypoth`ese de Riemann, la conjecture de Poincar´e, la r´esolution des ´equations de
Navier-Stokes,. . . La preuve de la conjecture de Poincar´e a ´et´e annonc´ee r´ecemment, il ne reste donc que 6
probl`emes. . .
488 Preuves par induction
On s’int´eresse d’abord aux d´efinitions inductives. Dans une d´efinition inductive on construit
un ensemble ‘inductif’ par stratifications successives et on dispose d’un principe de r´ecurrence
ainsi que d’un ordre implicite. Les ensembles librement engendr´es constituent un exemple remarquable
d’ensemble inductif. Par ailleurs, on peut g´en´eraliser la notion d’ordre et arriver `a
la notion d’ensemble bien fond´e. Les ensembles bien fond´es admettent un principe d’induction
qui g´en´eralise le principe de r´ecurrence habituel.
8.1 Ensembles inductifs
Soit A un ensemble, X ⊆ A un sous-ensemble, et F = {fi
: Ani → A | i ∈ I} un
ensemble d’op´erations sur A. A partir de (A, X, F) on voudrait d´efinir inductivement un
ensemble Ind(A, X, F) comme le plus petit sous-ensemble de A qui contient X et qui est
stable par rapport aux op´erations dans F, c’est-`a-dire pour tout i ∈ I si y1, . . . yni ∈ Y alors
fi(y1, . . . , yni
) ∈ Y .
Exemple 8.1 Soit Z l’ensemble des nombres entiers et suc et + les op´erations successeur et
addition, respectivement. On pourrait d´efinir :
(1) L’ensemble des nombres naturels comme le plus petit sous-ensemble de Z qui contient
{0} et qui est stable par rapport `a l’op´eration de successeur.
(2) L’ensemble des nombres pairs positifs comme le plus petit sous-ensemble de Z qui contient
{0, 2} et qui est stable par rapport `a l’op´eration d’addition.
Il n’est pas si ´evident qu’une d´efinition inductive d´efinit bien un ensemble. Il faut d’abord
s’assurer que le plus petit ensemble dont parle la d´efinition existe. A partir de (A, X, F) on
peut d´efinir une fonction F : 2A → 2
A comme suit :
F(Z) = X ∪ {fi(z1, . . . , zni
) | i ∈ I, zj ∈ Z, j = 1, . . . , ni}
On remarque que la condition F(Z) ⊆ Z est satisfaite si et seulement si X ⊆ Z et Z est
stable par rapport aux op´erations dans F. Maintenant consid´erons l’intersection de tous les
ensembles Z ⊆ A qui satisfont cette condition :
Y =
\
{Z ⊆ A | F(Z) ⊆ Z} . (5)
Proposition 8.2 Le plus petit ensemble Ind(A, X, F) existe et est ´egale `a Y.
Idee de la preuve ´ . Par d´efinition, si F(Z) ⊆ Z alors Y ⊆ Z. Pour s’assurer de l’existence
du plus petit ensemble tel que. . . il reste `a d´emontrer que F(Y ) ⊆ Y . D’abord on observe que
F est monotone, c’est-`a-dire :
X1 ⊆ X2 ⇒ F(X1) ⊆ F(X2)
Si F(Z) ⊆ Z par d´efinition de Y on d´erive que Y ⊆ Z et par monotonie que F(Y ) ⊆ F(Z).
Donc
F(Y ) ⊆
\
{F(Z) | Z ⊆ A, F(Z) ⊆ Z} ⊆ \
{Z | Z ⊆ A, F(Z) ⊆ Z} = Y .
•
Si F(Z) = Z on dit que Z est un point fixe de F.
49Proposition 8.3 (it´eration) (1) L’ensemble Y d´efini par l’´equation (5) est le plus petit
point fixe de F.
(2) De plus on peut donner une d´efinition it´erative de Y . Si on d´efinit,
F
0 = ∅ Fn+1 = F(F
n
) F
ω =
[
n≥0
F
n
alors F
n ⊆ Fn+1 et F
ω = Y .
Idee de la preuve ´ . (1) On sait F(Y ) ⊆ Y . Par monotonie, F(F(Y )) ⊆ F(Y ). Par d´efinition
de Y , Y ⊆ F(Y ).
(2) On observe, F
n ⊆ Y implique par monotonie F
n+1 ⊆ F(Y ) ⊆ Y . Donc F
ω ⊆ Y . Ensuite,
on v´erifie que F(F
ω
) ⊆ Fω
, ce qui implique Y ⊆ Fω
. •
Proposition 8.4 Tout ensemble Y d´efini inductivement `a partir de (A, X, F) admet le principe
d’induction suivant :
Z ⊆ Y, F(Z) ⊆ Z
Z = Y
(6)
Si on explicite le principe dans le cas des nombres naturels N, on obtient le principe de
r´ecurrence habituel :
Z ⊆ N, 0 ∈ Z, ∀ n n ∈ Z → n + 1 ∈ Z
Z = N
(7)
Exercice 8.5 (transitivit´e) Soit R une relation binaire sur un ensemble. Sa clˆoture r´eflexive
et transitive R∗
est la plus petite relation qui contient la relation identit´e, la relation R et telle
que si (x, y),(y, z) ∈ R∗ alors (x, z) ∈ R∗
. Montrez que R∗ peut ˆetre vu comme un ensemble
d´efini inductivement.
Exercice 8.6 Un graphe non-dirig´e G est compos´e d’un ensemble fini non-vide de noeuds
N et d’un ensemble A d’arˆetes qui connectent les noeuds. Formellement, une arˆete est un
ensemble {i, j} de noeuds de cardinalit´e 2. Le degr´e d’un noeud i dans un graphe est le
nombre d’arˆetes qui le contiennent. Par exemple, un noeud isol´e a degr´e 0. D´emontrez en
utilisant le principe de r´ecurrence l’assertion suivante :
Chaque graphe avec au moins 2 noeuds contient 2 noeuds avec le mˆeme degr´e.
8.2 Treillis complets et points fixes
Un ordre partiel (L, ≤) est un ensemble L ´equip´e d’une relation r´eflexive, anti-sym´etrique
et transitive. Soit X ⊆ L (´eventuellement vide). Un ´el´ement y ∈ L est une borne sup´erieure
pour X si ∀ x ∈ X x ≤ y. Un ´el´ement y ∈ L est le sup de X s’il est la plus petite borne
sup´erieure. De fa¸con duale, on d´efinit la notion de borne inf´erieure et de inf.
D´efinition 8.7 Un treillis complet est un ordre partiel (L, ≤) tel que tout sous-ensemble a
un sup.
D´efinition 8.8 Une fonction monotone f sur un ordre partiel L est une fonction qui respecte
l’ordre. On dit que x est point fixe de f si f(x) = x.
50Proposition 8.9 (Tarski) (1) Les parties d’un ensemble ordonn´ees par inclusion forment
un treillis complet.
(2) Tout sous-ensemble d’un treillis complet a un inf.
(3) Toute fonction monotone sur un treillis complet a un plus grand et un plus petit point
fixe qui s’expriment respectivement par sup{x | x ≤ f(x)} et inf {x | f(x) ≤ x}.
Idee de la preuve ´ . (1) Le sup est l’union et l’inf est l’intersection d’ensembles.
(2) Soit X ⊆ L et BI(X) l’ensemble des bornes inf´erieures de X. On consid`ere z =
sup(BI(X)) et on montre que z = inf (X).
(3) On pose z = sup{x | x ≤ f(x)}. Si f(y) = y alors y ≤ z. Donc il reste `a montrer que
z est un point fixe. On montre d’abord que z ≤ sup{f(x) | x ≤ f(x)} ≤ f(z). Ensuite par
monotonie, f(z) ≤ f(f(z)) et par d´efinition de z on arrive `a f(z) ≤ z. •
Exercice 8.10 Soit (N∪{∞}, ≤) l’ensemble des nombres naturels avec un ´el´ement maximum
∞, 0 < 1 < 2 < . . . < ∞. Montrez que toute fonction monotone f sur cet ordre admet un
point fixe, c’est-`a-dire un ´el´ement x tel que f(x) = x.
8.3 Ensembles librement engendr´es
Nous allons consid´erer une forme particuli`erement importante de d´efinition inductive. Soit
L un ensemble de symboles `, `0
, . . . avec arit´e ar (`) ∈ N. On peut d´efinir un ensemble T(L)
par :
T(L)0 = {` ∈ L | ar (`) = 0}
T(L)n+1 = T(L)n ∪ {(`, t1, . . . , tn) | ` ∈ L, ar (`) = n, ti ∈ T(L)n, i = 1, . . . , n}
T(L) = S
n≥0 T(L)n
On peut voir les ´el´ements de T(L) comme des arbres finis ordonn´es dont les noeuds sont
´etiquet´es par des symboles dans L de fa¸con compatible avec leur arit´e. Maintenant, on peut
associer `a chaque symbole ` ∈ L une fonction `a ar (`) arguments sur T(L) qui est d´efinie par :
`(t1, . . . , tn) = (`, t1, . . . , tn) (8)
Supposons maintenant X ⊆ {` ∈ L | ar (`) = 0} et Σ ⊆ L avec X ∩ Σ = ∅. On peut d´efinir un
ensemble inductif Y = Ind(T(L), X, Σ) qui est compos´e d’arbres finis dans T(L) qui utilisent
uniquement les symboles dans X ∪Σ comme ´etiquettes. On dit que l’ensemble Y est librement
engendr´e `a partir de X et Σ.
Exemple 8.11 L’ensemble des formules du calcul propositionnel peut ˆetre vu comme librement
engendr´e `a partir d’un ensemble V de symboles de ‘variables’ d’arit´e 0 et de symboles
‘fonctionnels’ Σ = {¬,∧,∨} o`u ar (¬) = 1 et ar (∧) = ar (∨) = 2. En d’autres termes,
Form = Ind(T(L), V, Σ)
On peut donc formuler un principe d’induction pour les formules du calcul propositionnel qui
s’´enonce de la fa¸con suivante :
F ⊆ Form V ⊆ F (A, B ∈ F implique ¬A, A ∧ B, A ∨ B ∈ F)
F = Form
51et qui correspond `a l’intuition que Form est le plus petit ensemble tel que. . .
18
Exercice 8.12 On consid`ere l’ensemble de symboles fonctionnels
Σ = {, a, b}
o`u ar () = 0 et ar (a) = ar (b) = 1. Calculez l’ensemble librement engendr´e associ´e `a Σ. Cet
ensemble est-il isomorphe `a un ensemble d´ej`a consid´er´e dans le cours ?
8.4 Ensembles bien fond´es
Dans un ensemble inductif on peut d´efinir le rang d’un ´el´ement comme
rang(y) = min{n | y ∈ Fn
}
Ainsi on peut voir un ensemble inductif comme un ensemble stratifi´e (ou ordonn´e) en niveaux
0, 1, 2, . . . On peut imaginer des ensembles avec une structure d’ordre diff´erente. Par exemple,
consid´erons N∪ {∞} avec ∞ > n si n ∈ N. Clairement, le principe de r´ecurrence (7) n’est pas
valide dans cet ensemble car mˆeme si un ensemble Z contient 0 et est stable par successeur
il n’est pas forcement ´egal `a N ∪ {∞}. On va donc consid´erer un principe d’induction plus
g´en´eral qui s’applique aussi `a des structures comme N ∪ {∞}.
D´efinition 8.13 (ensemble bien fond´e) Un ensemble bien fond´e est un couple (W, >) o`u
(1) W est un ensemble, (2) >⊆ W × W est une relation transitive et (3) il n’existe pas de
s´equence infinie w0 > w1 > w2 > · · · dans W.
19
Exemple 8.14 L’ensemble des nombres naturels avec l’ordre usuel est bien fond´e. L’ensemble
des nombres entiers ou l’ensemble des nombres rationnels positifs ne le sont pas. L’ensemble
N ∪ {∞} est bien fond´e.
Exemple 8.15 L’ensemble des formules du calcul propositionnel ordonn´ees selon leur taille
est bien fond´e.
Exercice 8.16 Soient N l’ensemble des nombres naturels, Nk
le produit cart´esien N×· · ·×N
k fois et A =
S
{Nk
| k ≥ 1}. Soit < une relation binaire sur A telle que : (x1, . . . , xn) <
(y1, . . . , ym) ssi il existe k ≤ min(n, m) (x1 = y1, . . . , xk−1 = yk−1, xk < yk) Est-il vrai que <
est un ordre bien fond´e ? Donner soit une preuve soit un contre-exemple.
Si x ∈ W on d´enote par ↓ (x) l’ensemble {y | x > y} des ´el´ements strictement plus petits
que x.
D´efinition 8.17 (principe d’induction) Soit (W, >) un ordre bien fond´e et Z ⊆ W. Chaque
ordre bien fond´e admet le principe de raisonnement par induction suivant :
∀x(↓ (x) ⊆ Z → x ∈ Z)
Z = W
(9)
18Si on est p´edant on devrait ´ecrire (¬, A), (∧, A, B) et (∨, A, B).
19Il en suit que > est un ordre strict, c’est-`a-dire pour tout w ∈ W, w 6> w.
52Par exemple, consid´erons W = N∪ {∞}. Maintenant on ne peut pas appliquer le principe
`a Z = N car ↓ (∞) ⊆ N mais ∞ ∈/ N. Il est instructif d’expliciter le principe quand W est
l’ensemble des nombres naturels avec l’ordre standard >. Dans ce cas la condition ↓ (x) ⊆ Z
s’exprime aussi par : ∀ y < x y ∈ Z. Donc pour montrer que Z = N il suffit de montrer :
∀ x ∀ y < x y ∈ Z → x ∈ Z c’est-`a-dire : pour tout nombre x, il faut montrer que le fait
que les ´el´ements plus petits que x sont dans Z implique que x est dans Z aussi. On peut
reformuler cette condition par :
(indN)
0 ∈ Z ∀ x > 0 ((∀ y < x y ∈ Z) → x ∈ Z)
Z = N
La condition est alors tr`es proche du principe de r´ecurrence standard :
(recN)
0 ∈ Z ∀ x > 0 (x − 1 ∈ Z → x ∈ Z)
Z = N
En effet on peut montrer que les deux principes sont ´equivalents.
Le principe d’induction (9) et la notion de bonne fondation sont deux faces de la mˆeme
m´edaille.
Th´eor`eme 8.18 Soit (W, >) un ordre. (W, >) est bien fond´e si et seulement si le principe
d’induction (9) est valide.
Idee de la preuve ´ . (⇒) Supposons que le principe (9) ne soit pas valide. Donc il y a un
ensemble Z tel que ∀x(↓ (x) ⊆ Z → x ∈ Z) mais x0 ∈/ Z. Mais alors il doit exister x1 ∈↓ (x0)
tel que x1 ∈/ Z. Par le mˆeme argument on trouve x2 ∈↓ (x1) tel que x2 ∈/ Z. Donc on trouve
une s´equence infinie x0 > x1 > x2 > · · · dans W ce qui contredit l’hypoth`ese de bonne
fondation.
(⇐) Soit
Z = {x | il n’y a pas de suite descendante infinie `a partir de x}
L’ensemble Z satisfait la condition
∀x(↓ (x) ⊆ Z → x ∈ Z)
ainsi par le principe d’induction (9), Z = W et donc W est bien fond´e. •
539 M´ethodes de terminaison
Un probl`eme fondamental en informatique consiste `a d´emontrer la terminaison d’un programme
ou d’un syst`eme de r´eduction.
D´efinition 9.1 (syst`eme de r´eduction) Un syst`eme de r´eduction est un couple (A,→) o`u
A est un ensemble et →⊆ A × A.
Exemple 9.2 Un automate fini M = (Σ, Q, q0, F, δ) o`u δ : Σ × Q → 2
Q, d´efinit un syst`eme
de r´eduction sur l’ensemble des configurations (Σ∗ × Q×) par (w, q) → (w
0
, q0
) si w = aw0
et
q
0 ∈ δ(q, a).
Exemple 9.3 Le comportement d’un programme peut ˆetre d´efini par un syst`eme de r´eduction.
Par exemple, consid´erons un langage imp´eratif ´el´ementaire compos´e de :20
Variables v ::= x | y | · · ·
Expressions e ::= v | t | f | · · ·
Programmes P ::= skip | v := e | if e then P else P | while e do P | P; P
Une m´emoire µ est une fonction qui affecte `a chaque variable une valeur (dans notre cas,
true, false, . . .). Maintenant, le comportement d’un programme peut ˆetre d´efini par un syst`eme
de r´eduction sur les couples (P, µ). D’abord on d´efinit la valeur [[e]]µ d’une expression e dans
une m´emoire µ :
21
[[x]]µ = µ(x), [[t]]µ = true, [[f]]µ = false, · · ·
Ensuite, on donne des r`egles pour ´evaluer un couple (P, µ).
(x := e, µ) → (skip, µ[[[e]]µ/x])
(if e then P else Q, µ) → (Q, µ) si [[e]]µ = false
(if e then P else Q, µ) → (P, µ) si [[e]]µ = true
(while e do P, µ) → (skip, µ) si [[e]]µ = false
(while e do P, µ) → (P; (while e do P), µ) si [[e]]µ = true
(skip; P, µ) → (P, µ)
(P; Q, µ) → (P
0
; Q, µ0
) si (P, µ) → (P
0
, µ0
)
Remarque 9.4 La d´efinition de la relation → est aussi de nature inductive. Soit Prog l’ensemble
des programmes et Mem l’ensemble des m´emoires. La relation → est le plus petit
ensemble contenu dans (Prog × Mem)
2
qui contient les couples ((P, µ),(P
0
, µ0
)) qui satisfont
une des premi`ere 6 conditions (r`egles) et qui est stable par rapport `a une famille de fonctions
{fQ | Q ∈ Prog} d´efinie par fQ((P, µ),(P
0
, µ0
)) = ((P; Q, µ),(P
0
; Q, µ0
)).
D´efinition 9.5 (terminaison) Un syst`eme de r´e´ecriture (X, →) termine s’il n’existe pas de
suite infinie x0 → x1 → x2 → · · ·.
20On pr´esente ici la grammaire selon la notation BNF (Backus-Naur Form). Comme dans le cas des formules
du calcul propositionnel, on pourrait voir les programmes comme les ´el´ements d’un ensemble librement
engendr´e.
21On remarquera l’analogie avec l’interpr´etation d’une formule du calcul propositionnel par rapport `a une
affectation.
54Soit →+ la clˆoture transitive de la relation →, `a savoir :
→1=→ →n+1= (→) ◦ (→n
) →+=
[
n≥1
→n
Il y a une relation naturelle entre terminaison et ordres bien fond´es.
D´efinition 9.6 (plongement monotone) Soit (X, →) un syst`eme de r´e´ecriture et (W, >)
un ordre bien fond´e. X admet un plongement monotone dans W s’il existe une fonction
µ : X → W telle que x → y implique µ(x) > µ(y).
Th´eor`eme 9.7 Soit X = (X, →) un syst`eme de r´e´ecriture. Les assertions suivantes sont
´equivalentes :
(1) X termine.
(2) (X, →+) est bien fond´e.
(3) X admet un plongement monotone dans un ordre bien fond´e.
Idee de la preuve ´ . (1) ⇒ (2) Si (X, →+) n’est pas bien fond´e, on a une s´equence x0 →+
x1 →+ x2 →+ · · ·. Donc (X, →) ne termine pas.
(2) ⇒ (3) Il suffit de prendre comme ordre bien fond´e (X, →+) et comme plongement
l’identit´e.
(3) ⇒ (2) Si (X, →) ne termine pas on a une s´equence x0 → x1 → · · · ce qui induit une
s´equence µ(x0) > µ(x1) > · · · dans l’ordre bien fond´e. •
D´efinition 9.8 Soit (X, →) un syst`eme de r´e´ecriture.
(1) L’ensemble des successeurs imm´ediats d’un ´el´ement x ∈ X est d´efini par :
suc(x) = {y | x → y}
(2) L’ensemble des successeurs d’un ´el´ement x ∈ X est d´efini par :
suc+(x) = {y | x →+ y}
(3) On dit que le syst`eme est `a branchement fini si pour tout x ∈ X, suc(x) est fini.
Proposition 9.9 Soit X = (X, →) un syst`eme de r´e´ecriture `a branchement fini.
(1) Si X termine alors pour tout x, suc+(x) est fini.
(2) X termine si et seulement si il admet un plongement dans N.
Idee de la preuve ´ . (1) Si suc+(x0) est infini alors il existe x1 ∈ suc(x0) tel que suc+(x1)
est infini donc il existe x2 ∈ suc(x1) tel que suc+(x2) . . . On obtient ainsi une s´equence
x0 → x1 → x2 → · · · qui contredit l’hypoth`ese que le syst`eme termine.
(2) (⇐) Par le th´eor`eme 9.7. (⇒) On peut d´efinir µ(x) = ]suc+(x). Alternativement, on peut
d´efinir µ(x) comme la longueur de la plus longue s´equence de r´eduction qui commence avec
x. Dans les deux cas on v´erifie que si x → y alors µ(x) > µ(y). •
55Exercice 9.10 On consid`ere des programmes imp´eratifs while dont les variables prennent
comme valeurs des nombres naturels. Montrez que le programme suivant termine o`u l’on sait
que le test Φ termine et n’a pas d’effet de bord (c’est-`a-dire que l’´evaluation du test n’affecte
pas la valeur associ´ee aux variables) :
while u > l + 1 do
(r := (u + l) div 2;
if Φ then u := r else l := r)
9.1 Confluence, terminaison et forme normale
Soit (X, →) un syst`eme de r´e´ecriture. Soit ∗→ la clˆoture r´eflexive et transitive de →, `a
savoir ∗→=→+ ∪Id o`u Id est la relation identit´e.
D´efinition 9.11 On dit que le syst`eme est confluent si pour tout x ∈ X
x
∗→ y1 et x
∗→ y2 implique ∃ z (y1
∗→ z et y2
∗→ z) (10)
On dit que le syst`eme est localement confluent si pour tout x ∈ X
x → y1 et x → y2 implique ∃ z y1
∗→ z et y2
∗→ z
On dit que y est une forme normale de x si x
∗→ y et ¬∃ z y → z.
Proposition 9.12 (Newman) Soit X = (X, →) un syst`eme de r´e´ecriture.
(1) Si X est confluent alors il est localement confluent.
(2) Si X termine et est localement confluent alors il est confluent.
(3) Si X est confluent alors chaque ´el´ement a au plus une forme normale.
(4) Si X termine et est localement confluent alors chaque ´el´ement a exactement une forme
normale.
Idee de la preuve ´ . (1) Par d´efinition.
(2) On montre que tout ´el´ement x est confluent. Si x → x1
∗→ y1 et x → x2
∗→ y2, par
confluence locale x1
∗→ y et x2
∗→ y. Par hypoth`ese inductive x1 et x2 sont confluents et ceci
implique que x est confluent aussi.
(3) Si x
∗→ y1 et x
∗→ y2 et y1, y2 sont des formes normales alors y1 = y2 car autrement on
contredit la confluence.
(4) Par (2) si le syst`eme est localement confluent alors il est confluent et donc si x
∗→ x1, x2
et x1, x2 sont des formes normales alors x1 = x2. •
Exercice 9.13 Soit ({a, b, c, d},→) un syst`eme de r´e´ecriture o`u →= {(c, a),(c, d),(d, c),(d, b)}.
Dire si : le syst`eme termine, est localement confluent, est confluent.
569.2 Ordre lexicographique
Il y a des syst`emes de r´e´ecriture qui ne sont pas `a branchement fini et dont la terminaison
ne peut pas ˆetre d´emontr´ee par un plongement dans N.
Exemple 9.14 On consid`ere le syst`eme de r´e´ecriture (N × N,→) o`u
(i + 1, j) → (i, k) (i, j + 1) → (i, j) pour i, j, k ∈ N
Ce syst`eme n’est pas `a branchement fini `a cause de la premi`ere r`egle et il n’admet pas de
plongement monotone dans N. Si µ : N × N → N est monotone, on devrait avoir :
k = µ(1, 1) > µ(0, k) > µ(0, k − 1) > · · · > µ(0, 0)
mais on a seulement k nombres naturels sous k alors que la chaˆıne qu’on vient de construire
a longueur k + 1. Cependant, on peut montrer sa terminaison par plongement dans un ordre
lexicographique que nous allons construire dans la suite.
D´efinition 9.15 Soient (A, >A) et (B, >B) deux ordres stricts. L’ordre lexicographique >l
sur A × B est d´efini par :
(x, y) >l (x
0
, y0
) si x >A x
0
ou (x = x
0
et y >B y
0
)
Th´eor`eme 9.16 (1) L’ordre lexicographique de deux ordres stricts est encore un ordre strict.
(2) L’ordre lexicographique de deux ordres bien fond´es est encore bien fond´e.
Idee de la preuve ´ . (1) Il est imm´ediat que (x, y) 6>l (x, y). Supposons (x1, y1) >l (x2, y2)
et (x2, y2) >l (x3, y3).
• Si x1 > x2 alors x1 > x3 donc (x1, y1) >l (x3, y3).
• Si x1 = x2 alors y1 > y2. Si x2 > x3 alors (x1, y1) >l (x3, y3). Si par contre x2 = x3 alors
y2 > y3 et donc (x1, y1) >l (x3, y3).
(2) Par contradiction. Supposons (x0, y0) >l (x1, y1) >l
· · · Ceci implique x0 ≥ x1 ≥ · · ·
Comme A est bien fond´e il existe i tel que xj = xi pour j ≥ i. Mais ceci implique yi > yi+1 >
yi+2 > · · · ce qui est impossible si B est bien fond´e. •
Exercice 9.17 (1) Montrez que le syst`eme dans l’exemple 9.14 termine.
(2) Montrez que le syst`eme (N × N,→) o`u
(i, j + 1) → (i, j) et (i + 1, j) → (i, i)
termine.
(3) Trouvez (s’il existe) un plongement monotone du syst`eme pr´ec´edent dans (N, >).
(4) Utilisez le principe d’induction pour d´emontrer l’existence d’une fonction (r´ecursive)
a : N × N → N telle que :
a(0, n) = n + 1
a(m + 1, 0) = a(m, 1)
a(m + 1, n + 1) = a(m, a(m + 1, n))
57(5) Calculez `a l’aide d’un programme autant de valeurs a(n, n) que possible.
(6) On ´etend l’ordre lexicographique `a un produit A = A1 × · · · × An, n ≥ 3, d’ordres bien
fond´es (Ai
, >i) :
(x1, . . . , xn) > (y1, . . . , yn) si ∃ k ≤ n (x1 = y1, . . . , xk−1 = yk−1 et xk >k yk)
Montrez que (A, >) est bien fond´e.
Exercice 9.18 Soit A = {a, b, c}
∗
l’ensemble des mots finis sur l’alphabet {a, b, c}. Soit →
une relation binaire sur A∗
telle que :
w → w
0
ssi (w = w1aaw2 et w
0 = w1bcw2) ou
(w = w1bbw2 et w
0 = w1acw2) ou
(w = w1cccw2 et w
0 = w1acw2)
Donc w se r´eduit `a w
0
si w
0
est obtenu de w en rempla¸cant ou bien un sous-mot aa par bc,
ou bien un sous-mot bb par ac ou bien un sous-mot ccc par ac. Construisez un plongement
monotone dans un ordre bien fond´e qui montre la terminaison de ce syst`eme de r´eduction.
Suggestion : on peut commencer par remarquer que la derni`ere r`egle diminue le nombre de
caract`eres.
Exercice 9.19 Soit A = {0, 1}
∗
l’ensemble des mots finis sur l’alphabet {0, 1}. Si w est un
mot on d´enote par |w| sa longueur. Soit → une relation binaire sur A telle que :
w → w
0
ssi ∃ w1, w2 ∈ A (w = w101w2 et w
0 = w1100w2)
En d’autres termes, un pas de r´e´ecriture revient `a remplacer un sous-mot 01 par le mot 100.
1. Trouvez deux fonctions fi
: N → N, i = 0, 1 sur les nombres naturels N = {0, 1, 2, 3, . . .}
telles que :
A Si n > n0 alors fi(n) > fi(n
0
) pour i = 0, 1.
B Pour tout n, f1(f0(n)) > f0(f0(f1(n))).
2. On d´efinit une fonction µ : A → N par
µ() = 0, µ(wi) = fi(µ(w)) pour i = 0, 1
Montrez que µ est un plongement monotone du syst`eme de r´e´ecriture (A,→) dans l’ordre
bien fond´e (N, >).
Suggestion Montrez par r´ecurrence sur |w2| que µ(w101w2) > µ(w1100w2).
3. Supposons que : w0 → w1 → · · · → wn et |w0| = m. En d’autres termes, il y a n pas de
r´eduction `a partir d’un mot de longueur m.
(a) Utilisez le plongement monotone µ pour donner une borne sup´erieure `a n en fonction
de m.
(b) D´emontrez ou donnez un contre-exemple `a l’assertion suivante : n ≤ 2m3+4m+3.
58Exercice 9.20 (ordre produit) Soient (Ai
, >i) pour i = 1, . . . , n des ordres bien fond´es.
On d´efinit une relation > sur le produit cart´esien A1 × · · · × An par
(a1, . . . , an) > (a
0
1
, . . . , a0
n
) si ai ≥i a
0
i
, i = 1, . . . , n et ∃ i ∈ {1, . . . , n} ai >i a
0
i
(1) La relation > est-elle un ordre bien fond´e ?
(2) Comparez la relation > `a l’ordre lexicographique sur le produit d´efini dans l’exercice 9.17.
Exercice 9.21 Consid´erons les programmes while :
while m 6= n do
if m > n then m := m − n else n := n − m
while m 6= n do
if m > n then m := m − n
else h := m; m := n; n := h
Dire si les programmes terminent quand les variables varient sur les nombres naturels positifs.
Exercice 9.22 Soit A = {a, b}
∗
l’ensemble des mots finis sur l’alphabet {a, b}. Soit → une
relation binaire sur A telle que :
w → w
0
ssi w = w1abw2 et w
0 = w1bbaw2
Donc w se r´eduit `a w
0
si w
0
est obtenu de w en rempla¸cant un sous-mot ab avec bba.
Montrez ou invalidez les assertions suivantes (il est conseill´e de s’appuyer sur les r´esultats
d´emontr´es dans le cours) :
1. Le syst`eme de r´eduction (A,→) est `a branchement fini.
2. Le syst`eme termine.
3. Le syst`eme est localement confluent.
4. Le syst`eme est confluent.
9.3 Lemme de K¨onig
Soit N l’ensemble des nombres naturels et N∗
l’ensemble des mots finis de nombres naturels.
On va repr´esenter un arbre comme l’ensemble des chemins possibles dans l’arbre.
Formellement, on dit qu’un arbre D est un sous-ensemble de N∗ qui satisfait les conditions
suivantes :
(1) Si w ∈ D et w
0
est un pr´efixe de w (c’est-`a-dire ∃ w
00 w = w
0w
00) alors w
0 ∈ D.
(2) Si wi ∈ D et j < i alors wj ∈ D.
On peut ainsi repr´esenter des arbres infinis avec un nombre d´enombrable de noeuds et
mˆeme des arbres avec des noeuds qui ont un nombre d´enombrable de fils. On dit qu’un arbre
est `a branchement fini si chaque noeud a un nombre fini de fils.
Remarque 9.23 Parfois il est commode d’ajouter des symboles L sur les noeuds d’un arbre.
Dans ce cas on d´efinit un arbre ´etiquet´e comme une fonction partielle t : N∗ * L dont le
domaine de d´efinition est un arbre.
59Lemme 9.24 (K¨onig) Tout arbre `a branchement fini qui comporte un nombre infini de
noeuds admet un chemin infini.
Idee de la preuve ´ . On utilise le mˆeme argument mentionn´e dans la preuve de la proposition
9.9(1). Soit π = i1 · · ·ik ∈ D un chemin tel que le sous-arbre de racine π est infini. Comme D
est `a branchement fini il existe un ik+1 tel que πik+1 ∈ D et le sous-arbre de racine πik+1 est
infini. En continuant ainsi on peut construire un chemin infini dans D. •
9.4 Ordre sur les mots
On donne un premier exemple d’application du lemme de K¨onig. Soit (Σ, >) un ensemble
bien fond´e. Soit Σ∗
l’ensemble des mots finis sur Σ. On ´ecrit w w
0
si on peut obtenir w
0 de
w en rempla¸cant un caract`ere a ∈ Σ par un mot w
00 tel que tous les caract`eres dans w
00 sont
plus petits que a dans la relation >. Par exemple, si a > b > c alors on obtient aab abcbcb
en rempla¸cant le deuxi`eme caract`ere a par bcbc.
(1) On remarque que n’est pas transitive. Par exemple, aab()()bac mais aab 6 bac. Soit
donc + la clˆoture transitive de .
(2) Ajoutons `a l’alphabet Σ un caract`ere > qui domine tous les autres et un caract`ere ⊥ qui
est domin´e par tous les autres. Maintenant, toute suite
w0 w1 w2 · · ·
peut ˆetre r´e´ecrite comme
> w0 w1 w2 · · ·
en ajoutant > au d´ebut de la suite. Aussi, en supposant l’ordre alphab´etique sur Σ, la suite
bc defc defg dhifg difg
se r´e´ecrit en
> bc defc defg dhifg d⊥ifg .
Ainsi le caract`ere h qui est remplac´e par le mot vide dans la premi`ere suite est remplac´e par
⊥ dans la deuxi`eme.
(3) On remarquera que le d´eveloppement se repr´esente ais´ement par un arbre ´etiquet´e. En
effet on a ajout´e le caract`ere > pour commencer le calcul `a la racine d’un arbre et le caract`ere
⊥ pour couvrir le cas o`u un caract`ere est remplac´e par le mot vide.
A partir de cette repr´esentation il est facile de voir que l’ordre + est bien fond´e. Il suffit
de montrer que la relation n’admet pas de suite descendante infinie. Si une telle suite
existait, il serait possible de lui associer un arbre comme on vient de le voir. Or cet arbre
est `a branchement fini car un caract`ere est remplac´e par un nombre fini de caract`eres. Par
K¨onig, l’arbre en question doit comporter un chemin infini. Mais dans ce chemin on devrait
trouver une suite infinie de caract`eres a > b > c > · · · ce qui contredit l’hypoth`ese.
Exercice 9.25 Soit N∗
l’ensemble des mots finis sur les nombres naturels avec l’ordre habituel.
Montrez la terminaison du syst`eme :
u(i + 1)v → uiiv pour u, v ∈ N∗
609.5 Ordre sur les multi-ensembles
Un multi-ensemble est un ensemble dont les ´el´ements peuvent apparaˆıtre avec une certaine
multiplicit´e.
D´efinition 9.26 Un multi-ensemble M sur un ensemble A est une fonction M : A → N. Un
multi-ensemble est fini si {x | M(x) 6= 0} est fini.
On utilise la notation {| |} pour les multi-ensembles. Par exemple, {|a, b, a|} est le multiensemble
compos´e de deux occurrences de a et une de b. Certaines notations, op´erations et
relations disponibles sur les ensembles peuvent s’adapter aux multi-ensembles. Par exemple :
x ∈ M si M(x) > 0
M ⊆ N si ∀ x ∈ A M(x) ≤ N(x)
(M ∪ N)(x) = M(x) + N(x)
(M\N)(x) = M(x)
.
− N(x)
o`u n
.
− m = n − m si n − m ≥ 0 et 0 autrement. Si A est un ensemble on d´enote avec M(A)
l’ensemble des multi-ensembles finis sur A.
Remarque 9.27 Un multi-ensemble fini sur A peut ˆetre repr´esent´e par un mot fini sur A.
Cette repr´esentation est unique si l’on suppose que l’op´eration de concat´enation est commutative.
D´efinition 9.28 Soient (A, >) un ordre strict et M, N ∈ M(A). On ´ecrit : M >M(A) N s’ils
existent X, Y ∈ M(A) tels que X 6= ∅, X ⊆ M, N = (M\X) ∪ Y et ∀ y ∈ Y ∃ x ∈ X x > y.
Par exemple, si A = N avec l’ordre usuel alors {|5, 3, 1, 1|} >M(N) {|4, 3, 3, 1|}. Pour v´erifier
l’in´egalit´e on peut choisir X = {|5, 1|} et Y = {|4, 3|} mais on peut aussi choisir X = {|5, 3, 3, 1|}
et Y = {|4, 3, 3, 1|}.
Proposition 9.29 Si > est un ordre strict sur A alors >M(A) est un ordre strict sur M(A).
Idee de la preuve ´ . Il faut v´erifier X 6>M(A) X et que >M(A) est transitif. La deuxi`eme
propri´et´e demande un peu de travail. Supposons que :
X ∪ {|x1, . . . , xm|} >M(A) X ∪ {|y1, . . . , yn|} = X0 ∪ {|w1, . . . , wp|} >M(A) X0 ∪ {|z1, . . . zq|}
On peut d´ecomposer X en X1 ∪ X2 et {|y1, . . . , yn|} en Y1 ∪ Y2 pour que X0 = X1 ∪ Y1 et
{|w1, . . . , wp|} = X2 ∪ Y2. Donc on obtient
X1 ∪ X2 ∪ {|x1, . . . , xm|} >M(A) X1 ∪ X2 ∪ Y1 ∪ Y2 >M(A) X1 ∪ Y1 ∪ {|z1, . . . , zq|}
Maintenant il suffit de v´erifier que chaque ´el´ement dans Y1 ∪ {|z1, . . . , zq|} est domin´e par un
´el´ement dans X2 ∪ {|x1, . . . , xm|}. •
Exercice 9.30 On ´ecrit X >1 Y si Y est obtenu de X en rempla¸cant un ´el´ement de X par
un multi-ensemble d’´el´ements strictement plus petits. Montrez que : (1) la relation >1 n’est
pas transitive (mˆeme si > est total) et (2) la clˆoture transitive de >1 est ´egale `a >M(A)
.
61Proposition 9.31 L’ordre (A, >) est bien fond´e si et seulement si l’ordre (M(A), >M(A)
)
est bien fond´e.
Idee de la preuve ´ . (⇐) Si a0 > a1 > · · · est une suite d´ecroissante dans A alors
{|a0|} >M(A) {|a1|} >M(A)
. . . en est une dans M(A).
(⇒) Il suffit de montrer que >1 est bien fond´e. L’argument est similaire `a celui utilis´e pour
l’ordre sur les mots et il fait aussi appel au lemme de K¨onig. •
Exercice 9.32 Soit N∗
les mots finis de nombres naturels. Montrez la terminaison du syst`eme :
u(i + 1)v → iviui pour u, v ∈ N∗
62A TD : Calcul propositionnel 1 (m´ethode de Davis Putnam)
La m´ethode de Davis Putnam permet de d´ecider si une formule en forme normale conjonctive
est satisfiable. On repr´esente une formule A en CNF comme un ensemble (´eventuellement
vide) de clauses {C1, . . . , Cn} et une clause C comme un ensemble (´eventuellement vide) de
litt´eraux. Dans cette repr´esentation, on d´efinit la substitution [b/x]A d’une valeur bool´eenne
b ∈ {0, 1} dans A comme suit :
[b/x]A = {[b/x]C | C ∈ A et [b/x]C 6= 1}
[b/x]C =
1 si (b = 1 et x ∈ C) ou (b = 0 et ¬x ∈ C)
C\{`} si (b = 1 et ` = ¬x ∈ C) ou (b = 0 et ` = x ∈ C)
C autrement
On d´efinit une fonction DP qui agit r´ecursivement sur une formule A en CNF dans la
repr´esentation d´ecrite ci-dessus :
function DP(A) = case
(1) A = ∅ : true
(2) ∅ ∈ A false
(3) {x,¬x} ⊆ C ∈ A : DP(A\{C})
(4) {x} ∈ A : DP([1/x]A)
(5) {¬x} ∈ A : DP([0/x]A)
(6) else : choisir x dans A;
DP([0/x]A) or DP([1/x]A)
Dans (1), nous avons une conjonction du vide qui par convention est ´equivalente `a true. Dans
(2), A contient une clause vide. La disjonction du vide ´etant ´equivalente `a false, la formule A
est aussi ´equivalente `a false. Dans (3), une clause contient un litt´eral et sa n´egation et elle est
donc ´equivalente `a true. Dans (4) et (5), A contient une clause qui est constitu´ee uniquement
d’une variable ou de sa n´egation. Ceci permet de connaˆıtre la valeur de la variable dans toute
affectation susceptible de satisfaire la formule. Dans (6), nous consid´erons les deux valeurs
possibles d’une affectation d’une variable.
Exercice A.1 Appliquez DP aux formules {{x,¬y}, {¬x, y}} et {{x, y}, {¬x, y}, {x,¬y}, {¬x,¬y}}.
Exercice A.2 (1) Montrez que si A est une fonction en CNF alors la fonction DP termine.
(2) Montrez que DP(A) retourne true (false) si et seulement si A est satisfiable (ne l’est pas).
Exercice A.3 Fait : toute formule peut ˆetre transform´ee en CNF. Expliquez comment utiliser
la m´ethode de Davis-Putnam pour d´ecider la validit´e d’une formule.
Exercice A.4 Modifiez la fonction DP pour que, si la formule A est satisfiable, elle retourne
une affectation v qui satisfait A.
Exercice∗ A.5 R´efl´echissez aux structures de donn´ees et aux op´erations n´ecessaires `a la
mise en oeuvre de l’algorithme en Java.
63B TD : Calcul Propositionnel 2 (´equivalence et d´efinissabilit´e)
Exercice B.1 Montrez les ´equivalences logiques :
(A ∨ 0) ≡ A, (A ∨ 1) ≡ 1, (A ∨ B) ≡ (B ∨ A),
((A ∨ B) ∨ C) ≡ (A ∨ (B ∨ C)), (A ∨ A) ≡ A
(A ∧ 0) ≡ 0, (A ∧ 1) ≡ A, (A ∧ B) ≡ (B ∧ A),
((A ∧ B) ∧ C) ≡ (A ∧ (B ∧ C)), (A ∧ A) ≡ A,
(A ∧ B) ∨ C ≡ (A ∨ C) ∧ (B ∨ C), (A ∨ B) ∧ C ≡ (A ∧ C) ∨ (B ∧ C),
¬¬A ≡ A, ¬(A ∨ B) ≡ ((¬A) ∧ (¬B)), ¬(A ∧ B) ≡ ((¬A) ∨ (¬B)) .
Exercice B.2 (1) Montrez l’´equivalence logique :
(A ∧ B) ∨ (¬A ∧ B) ≡ B (11)
(2) On peut appliquer cette ´equivalence logique pour simplifier une forme normale disjonctive.
Par exemple, consid´erez la fonction f(x, y, z) d´efinie par le tableau de v´erit´e :
x\yz 00 01 11 10
0 0 1 1 0
1 1 1 1 1
Calculez la forme normale disjonctive de f et essayez de la simplifier en utilisant l’´equivalence
logique (11).
(3) La pr´esentation du tableau de v´erit´e n’est pas arbitraire. . . Proposez une m´ethode graphique
pour calculer une forme normale disjonctive simplifi´ee.
Exercice B.3 Soit f une fonction sur les nombres naturels. Dire qu’un probl`eme est d´ecid´e
en O(f), signifie qu’on dispose d’un algorithme A et de n0, k nombres naturels tels que pour
toute entr´ee dont la taille n est sup´erieure `a n0, le temps de calcul de A sur l’entr´ee en
question est inf´erieure `a k · f(n).
(1) Montrez que la satisfaction d’une formule en DNF et la validit´e d’une formule en CNF
peuvent ˆetre d´ecid´ees en O(n).
(2) Soit pair (x1, . . . , xn) = (Σi=1,...,nxi) mod 2 la fonction qui calcule la parit´e d’un vecteur de
bits. Montrez que la repr´esentation en DNF ou CNF de cette fonction est en O(2n
). Peut-on
appliquer l’´equivalence logique (11) pour simplifier la repr´esentation ?
Exercice B.4 (if-then-else) La fonction ternaire ITE est d´efinie par ITE(1, x, y) = x et
ITE(0, x, y) = y. Montrez que toute fonction f : 2
n → 2, n ≥ 0 s’exprime par composition de
la fonction ITE et des (fonctions) constantes 0 et 1.
Exercice B.5 L’or exclusif ⊕ (xor) est d´efini par A ⊕ B ≡ (A ∧ ¬B) ∨ (¬A ∧ B). Montrez
que :
(1) ⊕ est associatif et commutatif.
(2) x ⊕ 0 ≡ x et x ⊕ x ≡ 0.
(3) Toute fonction bool´eenne f : 2
n → 2 peut ˆetre repr´esent´ee `a partir de 1, ∧ et ⊕.
64Exercice B.6 (nand,nor) Les fonctions binaires NAND et NOR sont d´efinies par NAND(x, y) =
NOT(AND(x, y)) et NOR(x, y) = NOT(OR(x, y)). Montrez que toute fonction f : 2
n → 2,
n ≥ 0, s’exprime comme composition de la fonction NAND (ou de la fonction NOR). Montrez
que les 4 fonctions unaires possibles n’ont pas cette propri´et´e et que que parmi les 16 fonctions
binaires possibles il n’y en a pas d’autres qui ont cette propri´et´e.
65C TD : Calcul Propositionnel 3 (clauses de Horn et circuits
combinatoires)
Exercice C.1 Une clause de (Alfred) Horn est une clause (c’est-`a-dire une disjonction de
litt´eraux) qui contient au plus un litt´eral positif. Une formule de Horn est une formule en
CNF dont les clauses sont des clauses de Horn.
(1) Montrez que toute formule de Horn est ´equivalente `a la conjonction (´eventuellement vide)
de clauses de Horn de la forme :
(1) x
(2) ¬x1 ∨ · · · ∨ ¬xn
(3) ¬x1 ∨ · · · ∨ ¬xn ∨ xn+1
o`u n ≥ 1 et xi 6= xj si i 6= j. Dans ce cas on dit que la formule de Horn est r´eduite.
(2) Montrez qu’une formule de Horn r´eduite qui ne contient pas de clauses de la forme (1)
ou qui ne contient pas de clauses de la forme (2) est satisfiable.
(3) Donnez une m´ethode efficace (temps polynomial) pour d´eterminer si une formule de Horn
est satisfiable.
Exercice C.2 Un d´ecodeur est un circuit avec n entr´ees xn−1, . . . , x0 et 2
n
sorties y2n−1, . . . , y0
tel que
yi = 1 ssi i = (xn−1 · · · x0)2
R´ealisez un tel circuit.
Exercice C.3 Un additionneur est un circuit bool´een avec 2n entr´ees xn−1, yn−1, . . . , x0, y0
et n + 1 sorties rn, sn−1, . . . , s0 tel que
(xn−1 · · · x0)2 + (yn−1 · · · y0)2 = (rnsn−1 · · · s0)2
On peut r´ealiser un additionneur en utilisant l’algorithme standard qui propage la retenue de
droite `a gauche.
(1) R´ealisez un circuit A avec 3 entr´ees x, y, r et deux sorties s, r0
tel que
(r
0
s)2 = (x)2 + (y)2 + (r)2
(2) Expliquez comment inter-connecter n circuits A pour obtenir un additionneur sur n bits.
(3) Montrez que dans le circuit en question le nombre de portes et la longueur du chemin le
plus long sont proportionnels `a n.
Exercice∗ C.4 Le but de cet exercice est de r´ealiser un additionneur dont le nombre de portes
est encore polynomiale en n mais dont la longueur du chemin le plus long est proportionnelle
`a lg(n). Pour ´eviter que la retenue se propage `a travers tout le circuit, l’id´ee est d’anticiper sa
valeur. Ainsi pour additionner 2 vecteurs de longueur n, on additionne les premiers n/2 bits
(ceux de poids faible) et en mˆeme temps on additionne les derniers n/2 bits (ceux de poids
fort) deux fois (en parall`ele) une fois avec retenue initiale 0 et une fois avec retenue initiale
1. On applique cette m´ethode r´ecursivement sur les sous-vecteurs de longueur n/4, n/8, . . .
selon le principe diviser pour r´egner.
(1) Construisez explicitement un tel circuit pour n = 4.
(2) D´eterminez en fonction de n le nombre de portes et la longueur du chemin le plus long
du circuit obtenu.
66D TD : Syst`eme de preuve de Gentzen et compacit´e
Rappel : voici le syst`eme de preuve de Gentzen.
(Ax )
A, Γ ` A, ∆
(∧ `)
A, B, Γ ` ∆
A ∧ B, Γ ` ∆
(` ∧)
Γ ` A, ∆ Γ ` B, ∆
Γ ` A ∧ B, ∆
(∨ `)
A, Γ ` ∆ B, Γ ` ∆
A ∨ B, Γ ` ∆
(` ∨)
Γ ` A, B, ∆
Γ ` A ∨ B, ∆
(¬ `)
Γ ` A, ∆
¬A, Γ ` ∆
(` ¬)
A, Γ ` ∆
Γ ` ¬A, ∆
Exercice D.1 Montrez que :
(1) Un s´equent A, Γ ` A, ∆ est valide.
(2) Pour chaque r`egle d’inf´erence la conclusion est valide si et seulement si les hypoth`eses
sont valides.
Exercice D.2 (sous-formule) Montrez que si un s´equent est d´erivable alors il y a une
preuve du s´equent qui contient seulement des sous formules de formules dans le s´equent.
Exercice∗ D.3 (affaiblissement) Montrez que si le s´equent Γ ` ∆ est d´erivable alors le
s´equent Γ ` A, ∆ l’est aussi.
Exercice D.4 (implication) Dans le syst`eme de Gentzen on peut donner un traitement
direct de l’implication :
(→`)
Γ ` A, ∆ B, Γ ` ∆
A → B, Γ ` ∆
(`→)
Γ, A ` B, ∆
Γ ` A → B, ∆
D´emontrez la correction et compl´etude du syst`eme de Gentzen ´etendu avec ces r`egles.
Exercice D.5 Montrez que les r`egles pour la disjonction et l’implication sont d´erivables des
r`egles pour la conjonction et la n´egation en utilisant les ´equivalences : A ∨ B ≡ ¬(¬A ∧ ¬B)
et A → B ≡ ¬A ∨ B.
Exercice D.6 (coupure) La r`egle de coupure (ou cut) est :
(coupure)
A, Γ ` ∆ Γ ` A, ∆
Γ ` ∆
Montrez que le syst`eme de Gentzen ´etendu avec cette r`egle est toujours correct (et complet).
Exercice D.7 Soit T un ensemble de formules. On ´ecrit T |= A si pour toute affectation v,
si v satisfait T alors v satisfait A. Montrez que si T |= A alors il existe T0 sous-ensemble fini
de T tel que T0 |= A. Suggestion : utilisez le th´eor`eme de compacit´e.
67E TD : R´esolution
Exercice E.1 Montrez que la r`egle d’inf´erence suivante est valide :
A ∨ ¬C B ∨ C
A ∨ B
(12)
Exercice E.2 Pour repr´esenter les formules en CNF on adopte la mˆeme notation ensembliste
utilis´ee pour d´ecrire la m´ethode de Davis-Putnam.
– Une clause C est un ensemble de litt´eraux.
– Une formule A est un ensemble de clauses.
Nous consid´erons la r`egle :
A ∪ {C ∪ {x}} ∪ {C
0 ∪ {¬x}} x /∈ C ¬x /∈ C
0
A ∪ {C ∪ {x}} ∪ {C
0 ∪ {¬x}} ∪ {C ∪ C
0}
(13)
Dans la suite on appelle (13) r`egle de r´esolution.
22 L’effet de l’application de la r`egle consiste
`a ajouter une nouvelle clause C ∪ C
0
qu’on appelle r´esolvant des deux clauses C ∪ {x} et
C
0 ∪ {¬x}.
(1) Montrez que l’hypoth`ese est logiquement ´equivalente `a la conclusion.
(2) Conclure que si la conclusion n’est pas satisfiable alors l’hypoth`ese n’est pas satisfiable.
En particulier, si la conclusion contient la clause vide alors l’hypoth`ese n’est pas satisfiable.
Fait Si une formule A en CNF n’est pas satisfiable alors la r`egle de r´esolution permet de
d´eriver une formule A0 avec une clause vide. On dit que la r`egle de r´esolution est compl`ete
pour la r´efutation, c’est-`a-dire pour la d´erivation de la clause vide. La m´ethode peut ˆetre
impl´ement´ee it´erativement. A chaque it´eration on ajoute toutes les clauses qui sont un
r´esolvant de deux clauses. Cette it´eration termine forcement car le nombre de clauses qu’on
peut construire est fini. Parfois, il convient de repr´esenter la d´erivation comme un graphe
dirig´e acyclique (ou DAG pour directed acyclic graph) dont les noeuds sont ´etiquet´es par les
clauses. Initialement on a autant de noeuds que de clauses et pas d’arˆetes. Chaque fois qu’on
applique la r`egle de r´esolution (13) on introduit un nouveau noeud qui est ´etiquet´e avec la
clause r´esolvant C ∪ C
0
et deux nouvelles arˆetes qui vont des noeuds ´etiquet´es avec les clauses
C ∪ {x} et C
0 ∪ {¬x} vers le noeud ´etiquet´e avec la clause C ∪ C
0
.
Exercice E.3 Soit A une formule en CNF et C une clause. Expliquez comment utiliser la
m´ethode de r´esolution pour ´etablir si l’implication A → C est valide.
Exercice E.4 Construire la formule A en CNF qui correspond au principe du nid de pigeon
avec 2 pigeons et 1 nid. Appliquez la r`egle de r´esolution. Mˆeme probl`eme avec 2 pigeons et 2
nids.
Exercice E.5 Soit A une formule en CNF avec m variables et n clauses. Montrez qu’il y a
au plus m · (n · (n − 1)/2) fa¸cons d’appliquer la r`egle de r´esolution.
Exercice E.6 Un exercice de r´evision. On consid`ere les formules en CNF suivantes :
22Sans les conditions x /∈ C et ¬x /∈ C
0
on pourrait par exemple ‘simplifier’ les clauses {x} et {¬x} en
{x,¬x}.
681. ¬x ∨ (¬y ∨ x)
2. (x ∨ y ∨ ¬z) ∧ (x ∨ y ∨ z) ∧ (x ∨ ¬y) ∧ ¬x.
3. (x ∨ y) ∧ (z ∨ w) ∧ (¬x ∨ ¬z) ∧ (¬y ∨ ¬w).
Pour chaque formule :
1. Si la formule est valide calculez une preuve de la formule dans le syst`eme de Gentzen.
2. Si la formule est satisfiable mais pas valide calculez une affectation qui satisfait la formule
en utilisant la m´ethode de Davis-Putnam.
3. Si la formule n’est pas satisfiable d´erivez la clause vide en utilisant la m´ethode par
r´esolution.
69F TD : Langages formels et automates finis
Exercice F.1 Montrez que pour tout langage L, L
∗ = (L
∗
)
∗
.
Exercice F.2 Montrez qu’il existe des langages L1 et L2 tels que (L1 ∪ L2)
∗ 6= L
∗
1 ∪ L
∗
2
.
Exercice F.3 Montrez qu’il existe des langages L1 et L2 tels que (L1 · L2)
∗ 6= L
∗
1
· L
∗
2
.
Exercice F.4 Pour chacun des langages suivants, construire un automate fini non d´eterministe
qui l’accepte :
1. Les repr´esentations binaires des nombres pairs.
2. Le langage des mots sur l’alphabet {a, b} contenant ou bien la chaˆıne aab ou bien la
chaˆıne aaab.
3. Le langage des mots sur l’alphabet {0, 1} dont le troisi`eme caract`ere de droite existe et
est ´egale `a 1.
Construire des automates d´eterministes pour les langages d´ecrits ci-dessus.
Exercice∗ F.5 Soient M un AFD qui accepte un langage L et N1, N2 deux AFN qui acceptent
les langages L1, L2, respectivement (sur un alphabet Σ fix´e).
1. Montrez qu’on peut construire un AFD qui accepte le langage compl´ementaire Σ
∗\L.
2. Montrez qu’on peut construire un AFN qui accepte le langage L1 ∪L2 et le langage it´er´e
(L1)
∗
.
3. Conclure que la classe des langages accept´es par un AFD est stable par union, intersection,
compl´ementaire et it´eration.
70G TD : Calculabilit´e 1 (machines de Turing et ´enum´erations)
Exercice G.1 Donnez la description formelle d’une MdT qui d´ecide le langage {w]w | w ∈
{0, 1}
∗}.
Exercice G.2 Donnez la description formelle d’une MdT qui d´ecide le langage des mots sur
l’alphabet {0} dont la longueur est une puissance de 2 : 2
0
, 2
1
, 2
2
, . . .
Exercice G.3 D´ecrivez informellement une MdT qui d´ecide le langage :
{a
i
b
j
c
k
| i · j = k et i, j, k ≥ 1} .
Exercice G.4 Soit Σ = {0, 1} et suc : Σ∗ → Σ
∗
la fonction ‘successeur’ en base 2 telle que :
(suc(w))2 = (w)2 + 1
Montrez que suc est r´ecursive.
Exercice G.5 On peut ´enum´erer les couples de nombres naturels en proc´edant ‘par diagonales’
:
(0, 0), (1, 0),(0, 1), (2, 0),(1, 1),(0, 2), (3, 0). . .
Montrez que la fonction hm, ni = (m + n)(m + n + 1)/2 + n est une bijection entre N × N et
N. D´ecrire un algorithme pour calculer la fonction inverse.
Exercice G.6 On d´efinit les fonctions h ik : Nk → N pour k ≥ 2 :
hm, ni2 = hm, ni
hn1, . . . , nkik = hhn1, . . . , nk−1ik−1, nki si k ≥ 3
Montrez que les fonctions h ik sont des bijections.
71H TD : Calculabilit´e 2 (´enum´erations et ind´ecidabilit´e)
Exercice H.1 On consid`ere l’ensemble N∗ des mots finis de nombres naturels. Notez que
N∗
est en correspondance bijective avec S
k≥0 Nk
. D´efinissez une bijection entre N∗
et N.
Exercice H.2 Soit Σ = {a, b, . . . , z} un alphabet fini. On peut ´enum´erer les ´el´ements de Σ
∗
comme suit :
, a, b, . . . , z, aa, . . . , az, ba, . . . , bz, za, . . . , zz, aaa, . . .
Si Σ contient k ´el´ements on aura k
0 mots de longueur 0, k mots de longueur 1, k
2 mots de
longueur 2, . . . D´efinissez une bijection entre Σ
∗
et N.
Exercice∗ H.3 (1) Montrez qu’un langage est semi-d´ecidable si et seulement si il est le
domaine de d´efinition d’une fonction partielle r´ecursive.
(2) On dit qu’un langage L ⊆ Σ
∗
est r´ecursivement ´enum´erable s’il est l’image d’une fonction
partielle r´ecursive. Montrez qu’un langage L est r´ecursivement ´enum´erable si et seulement si
il est semi-d´ecidable.
Suggestion : Soit M une MdT et w0, w1, w2, . . . une suite d’entr´ees. On peut simuler M
sur w0 pour 0 pas, sur w0 pour 1 pas, sur w1 pour 0 pas, sur w0 pour 2 pas, sur w1 pour 1
pas, sur w2 pour 0 pas,. . .
Exercice∗ H.4 (1) Montrez que les langages accept´es par un AFN sont d´ecidables.
(2) Montrez que la collection des langages d´ecidables est stable par rapport aux op´erations
d’union, compl´ementaire, concat´enation et it´eration.
(3) Montrez que la collection des langages semi-d´ecidables est stable par rapport aux op´erations
d’union et concat´enation.
Suggestion : utilisez le non-d´eterminisme.
Exercice H.5 Montrez ou invalidez les assertions suivantes :
1. Il y a une MdT qui accepte les mots sur l’alphabet {0, 1} qui contiennent autant de 0
que de 1 (si la MdT existe, il suffira d’en donner une description informelle).
2. Rappel : si A et B sont deux langages, on ´ecrit A ≤ B s’il existe une r´eduction de A `a
B.
Si A est semi-d´ecidable et A ≤ Ac alors A est d´ecidable.
3. L’ensemble des (codages de) MdT qui reconnaissent un langage fini est d´ecidable.
Exercice H.6 Montrez ou donnez un contre-exemple aux assertions suivantes :
1. L’ensemble des (codages de) MdT qui terminent sur le mot vide est d´ecidable.
2. L’ensemble des (codages de) MdT qui divergent sur le mot vide est semi-d´ecidable.
3. L’ensemble des (codages de) MdT qui terminent sur le mot vide en 10100 pas de calcul
est d´ecidable.
72I TD : Complexit´e (r´eductions polynomiales)
Exercice I.1 Un graphe (non-dirig´e) G est compos´e d’un ensemble fini non-vide de noeuds
N et d’un ensemble A d’arˆetes qui connectent les noeuds. Formellement, une arˆete est un
ensemble {i, j} de noeuds de cardinalit´e 2. On dit que deux noeuds sont adjacents s’il y a une
arˆete qui les connecte.
Probl`eme du coloriage Etant donn´e un graphe ´ G = (N, A) et un nombre naturel k ≥ 2
on d´etermine s’il existe une fonction c : N → {1, . . . , k} telle que si i, j sont deux noeuds
adjacents alors c(i) 6= c(j).
23
Probl`eme de l’emploi du temps Etant donn´e (i) un ensemble d’´etudiants ´ E = {1, . . . , n}
(n ≥ 2), (ii) un ensemble de cours C = {1, . . . , m} (m ≥ 2), (iii) un ensemble de plages
horaires P = {1, . . . , p} (p ≥ 2) et (iv) une relations binaire R telle que (i, j) ∈ R si et
seulement si l’´etudiant i suit le cours j on d´etermine s’il existe une fonction emploi du temps
edt : C → P telle que si un ´etudiant suit deux cours diff´erents j 6= j
0 alors edt(j) 6= edt(j
0
).
D´emontrez ou donnez un contre-exemple aux assertions suivantes :
1. Le probl`eme de l’emploi du temps se r´eduit au probl`eme du coloriage.
2. Le probl`eme de l’emploi du temps se r´eduit en temps polynomial au probl`eme du coloriage.
3. Le probl`eme du coloriage est dans NP.
Exercice I.2 Soit G un graphe non-dirig´e (cf. exercice I.1). Un k-clique est un ensemble de
k noeuds de G qui ont la propri´et´e que chaque couple de noeuds est connect´ee par une arˆete.
Le langage CLIQUE est compos´e de couples hG, ki o`u (i) G est le codage d’un graphe, (ii)
k est un nombre naturel et (iii) G contient comme sous-graphe un k-clique.
Le langage 3-SAT est compos´e de formules en forme normale conjonctive o`u chaque clause
contient 3 litt´eraux.
1. Montrez que le langage CLIQUE est dans NP.
2. On souhaite construire une r´eduction polynomiale de 3-SAT `a CLIQUE. Si la formule
A contient k clauses alors le graphe associ´e GA contient k groupes de noeuds o`u chaque
groupe est compos´e de 3 noeuds et chaque noeud est ´etiquet´e par un litt´eral. Par exemple,
si la clause est (x ∨ ¬y ∨ z) alors on aura un groupe de 3 noeuds ´etiquet´es avec x, ¬y et
z.
(a) D´ecrivez les arˆetes de GA de fa¸con `a ce que le graphe GA contienne une k-clique
si et seulement si la formule A est satisfiable et dessinez le graphe GA dans le cas
o`u
A = (x ∨ y) ∧ (¬x ∨ ¬y) ∧ (¬x ∨ y) ∧ (x ∨ ¬y)
(la formule en question comporte seulement deux litt´eraux par clause mais la
construction du graphe GA s’applique aussi bien `a ce cas).
(b) Quelle conclusion peut-on tirer de la construction pr´ec´edente ? Motivez votre r´eponse :
23On peut voir les valeurs {1, . . . , k} comme des couleurs qu’on affecte aux noeuds, d’o`u le nom du probl`eme.
73i. Si 3-SAT est un probl`eme polynomiale d´eterministe alors CLIQUE est un
probl`eme polynomiale d´eterministe.
ii. CLIQUE est un probl`eme NP-complet.
Exercice I.3 Soit A une matrice et b un vecteur `a coefficients dans Z. Le probl`eme de programmation
lin´eaire enti`ere (ILP pour integer linear programming) consiste `a d´eterminer s’il
existe un vecteur ~x `a coefficients dans Nm tel que A~x = ~b.
24 Ce probl`eme est dans NP. On
utilise des notions d’alg`ebre lin´eaire pour montrer que si le probl`eme a une solution alors il en
a une dont la taille est polynomiale dans la taille de la matrice A. Ensuite on peut appliquer
la m´ethode standard qui consiste `a deviner un vecteur ~x et `a v´erifier qu’il est une solution.
A partir de ce fait, le but de l’exercice est de montrer que le probl`eme est NP-complet par
r´eduction du probl`eme SAT. Il peut ˆetre utile de consid´erer d’abord les probl`emes suivants.
– Montrez qu’en introduisant des variables auxiliaires on peut exprimer la satisfaction
d’une contrainte d’in´egalit´e comme un probl`eme d’ILP.
– Montrez qu’on peut exprimer la contrainte x ∈ {0, 1}.
– Montrez qu’on peut exprimer la contrainte x = y o`u x, y ∈ {0, 1}, 0 = 1 et 1 = 0.
– Montrez comment coder la validit´e d’une clause (disjonction de litt´eraux).
24Comme pour le probl`eme du voyageur de commerce, le probl`eme ILP est souvent formul´e comme un
probl`eme d’optimisation. Par exemple, il s’agit de minimiser une fonction lin´eaire ~cT
~x sous les contraintes
A~x = ~b et ~x ≥ 0.
74J TD : Preuves par induction
Exercice J.1 (transitivit´e) Soit R une relation binaire sur un ensemble. Sa clˆoture r´eflexive
et transitive R∗
est la plus petite relation qui contient la relation identit´e, la relation R et telle
que si (x, y),(y, z) ∈ R∗ alors (x, z) ∈ R∗
. Montrez que R∗ peut ˆetre vu comme un ensemble
d´efini inductivement.
Exercice J.2 Un graphe non-dirig´e G est compos´e d’un ensemble fini non-vide de noeuds
N et d’un ensemble A d’arˆetes qui connectent les noeuds. Formellement, une arˆete est un
ensemble {i, j} de noeuds de cardinalit´e 2. Le degr´e d’un noeud i dans un graphe est le
nombre d’arˆetes qui le contiennent. Par exemple, un noeud isol´e a degr´e 0. D´emontrez en
utilisant le principe de r´ecurrence l’assertion suivante :
Chaque graphe avec au moins 2 noeuds contient 2 noeuds avec le mˆeme degr´e.
Exercice J.3 Soit (N∪ {∞}, ≤) l’ensemble des nombres naturels avec un ´el´ement maximum
∞, 0 < 1 < 2 < . . . < ∞. Montrez que toute fonction monotone f sur cet ordre admet un
point fixe, c’est-`a-dire un ´el´ement x tel que f(x) = x.
Exercice J.4 On consid`ere l’ensemble de symboles fonctionnels
Σ = {, a, b}
o`u ar () = 0 et ar (a) = ar (b) = 1. Calculez l’ensemble librement engendr´e associ´e `a Σ. Cet
ensemble est-il isomorphe `a un ensemble d´ej`a consid´er´e dans le cours ?
Exercice J.5 Soient N l’ensemble des nombres naturels, Nk
le produit cart´esien N×· · ·×N
k fois et A =
S
{Nk
| k ≥ 1}. Soit < une relation binaire sur A telle que : (x1, . . . , xn) <
(y1, . . . , ym) ssi il existe k ≤ min(n, m) (x1 = y1, . . . , xk−1 = yk−1, xk < yk) Est-il vrai que <
est un ordre bien fond´e ? Donner soit une preuve soit un contre-exemple.
75K TD : Terminaison 1
Exercice K.1 On consid`ere des programmes imp´eratifs while dont les variables prennent
comme valeurs des nombres naturels. Montrez que le programme suivant termine o`u l’on sait
que le test Φ termine et n’a pas d’effet de bord (c’est-`a-dire que l’´evaluation du test n’affecte
pas la valeur associ´ee aux variables) :
while u > l + 1 do
(r := (u + l) div 2;
if Φ then u := r else l := r)
Exercice K.2 Soit ({a, b, c, d},→) un syst`eme de r´e´ecriture o`u →= {(c, a),(c, d),(d, c),(d, b)}.
Dire si le syst`eme termine, est localement confluent, est confluent.
Exercice K.3 (1) Utilisez le principe d’induction pour d´emontrer la terminaison de la fonction
r´ecursive a telle que :
a(0, n) = n + 1
a(m + 1, 0) = a(m, 1)
a(m + 1, n + 1) = a(m, a(m + 1, n))
(2) Calculez `a l’aide d’un programme autant de valeurs a(n, n) que possible.
Exercice K.4 On ´etend l’ordre lexicographique `a un produit A = A1 × · · · × An, n ≥ 3,
d’ordres bien fond´es (Ai
, >i) :
(x1, . . . , xn) > (y1, . . . , yn) si ∃ k ≤ n (x1 = y1, . . . , xk−1 = yk−1 et xk >k yk)
Montrez que (A, >) est bien fond´e.
Exercice K.5 (ordre produit) Soient (Ai
, >i) pour i = 1, . . . , n des ordres bien fond´es.
On d´efinit une relation > sur le produit cart´esien A1 × · · · × An par
(a1, . . . , an) > (a
0
1
, . . . , a0
n
) si ai ≥i a
0
i
, i = 1, . . . , n et ∃ i ∈ {1, . . . , n} ai >i a
0
i
(1) La relation > est-elle un ordre bien fond´e ?
(2) Comparez la relation > `a l’ordre lexicographique sur le produit d´efini dans l’exercice K.4.
76L TD : Terminaison 2
Exercice L.1 Consid´erons les programmes while :
while m 6= n do
if m > n then m := m − n else n := n − m
while m 6= n do
if m > n then m := m − n
else h := m; m := n; n := h
Dire si les programmes terminent quand les variables varient sur les nombres naturels positifs.
Exercice L.2 Soit A = {a, b}
∗
l’ensemble des mots finis sur l’alphabet {a, b}. Soit → une
relation binaire sur A telle que :
w → w
0
ssi w = w1abw2 et w
0 = w1bbaw2
Donc w se r´eduit `a w
0
si w
0
est obtenu de w en rempla¸cant un sous-mot ab avec bba.
Montrez ou invalidez les assertions suivantes (il est conseill´e de s’appuyer sur les r´esultats
d´emontr´es dans le cours) :
1. Le syst`eme de r´eduction (A,→) est `a branchement fini.
2. Le syst`eme termine.
3. Le syst`eme est localement confluent.
4. Le syst`eme est confluent.
Exercice∗ L.3 Soient X, Y ∈ M(A). On ´ecrit X >1 Y si Y est obtenu de X en rempla¸cant
un ´el´ement de X par un multi-ensemble d’´el´ements strictement plus petits. Montrez que la
clˆoture transitive de >1 est ´egale `a >M(A)
.
Exercice L.4 Soit N∗
les mots finis de nombres naturels. Montrez la terminaison du syst`eme :
u(i + 1)v → iviui pour u, v ∈ N∗
77M TP : M´ethode de Davis-Putnam
M.1 Objectifs
Le but de ce TP est d’implanter en langage Java la proc´edure de Davis-Putnam : vous
devez r´ealiser un programme qui prend en entr´ee une formule A en forme normale conjonctive,
puis d´ecide si cette formule est satisfiable et si c’est le cas, renvoie une interpr´etation qui
satisfait A. Le programme que vous allez r´ealiser va lire les formules `a traiter dans un fichier.
Ce fichier respecte un format particulier : le format DIMACS. Le choix des structures de
donn´ees `a employer est de votre ressort. Il est fortement conseill´e de bien r´efl´echir `a l’int´egralit´e
de l’algorithme avant d’impl´ementer les classes et les m´ethodes dont vous aurez besoin.
M.2 D´efinitions
Rappelons quelques d´efinitions :
– un litt´eral est une variable propositionnelle x ou sa n´egation ¬x ;
– une clause est une disjonction de litt´eraux ;
– une clause est une tautologie si et seulement si elle contient une variable x et sa n´egation
¬x.
– une clause est dite unitaire si elle contient exactement un litt´eral,
– une formule en forme normale conjonctive est une conjonction de clauses,
– une affectation v est une fonction partielle des variables aux valeurs bool´eennes.
M.3 Format DIMACS
(http ://www.satlib.org/Benchmarks/SAT/satformat.ps)
Par exemple, la formule :
(x1 ∨ x3 ∨ ¬x4) ∧ (x4) ∧ (x2 ∨ ¬x3)
peut ˆetre cod´ee par :
c Exemple fichier au format CNF
p cnf 4 3
1 3 -4 0
4 0
2 -3
– la ligne c est une ligne commentaire,
– la ligne p sp´ecifie qu’il s’agit d’une formule en CNF avec 4 variables et 3 clauses,
– les lignes suivantes sp´ecifient les clauses. Le litt´eral xi est cod´e par i et le litt´eral ¬xi
par −i o`u i ≥ 1 (et dans ce cas i ≤ 4),
– les clauses peuvent ˆetre sur plusieurs lignes et elles sont s´epar´ees par 0.
Dans la page du cours, nous fournissons les fonctions afficheDimacs et ecrisDimacs,
qui sont un exemple de lecture et d’´ecriture de fichiers DIMACS. Vous pourrez vous baser sur
ces exemples pour r´ealiser l’interface de votre programme.
La r´ealisation de l’algorithme de Davis-Putnam exige la manipulation de formules, de
clauses et d’affectations. Vous devrez donc d´efinir les classes correspondantes ainsi que les
m´ethodes dont vous aurez besoin. Voici quelques m´ethodes de base (il s’agit de simples suggestions,
certaines m´ethodes pourront ˆetre omises ou ajout´ees selon vos besoins).
78Classe formule :
– un constructeur qui lit une formule CNF en format DIMACS et construit la formule
correspondante,
– vide qui teste si la formule est vide,
– affiche qui ´ecrit une formule dans un fichier au format DIMACS,
– verifie qui prend en argument une affectation et qui renvoie true si la formule est vraie
dans cette affectation.
Classe clause :
– appartient qui prend en argument un litt´eral et qui renvoie true s’il apparaˆıt dans la
clause,
– unitaire qui renvoie true si la clause ne contient qu’un seul litt´eral,
– vide qui renvoie true si la clause est vide,
– verifie qui prend en argument une affectation, et qui renvoie true si la clause est vraie
dans cette affectation.
Classe affectation :
– fixe qui prend en argument un litt´eral et un bool´een et qui ajoute le litt´eral `a l’affectation
avec la valeur du bool´een,
– valeur qui prend en argument un litt´eral et renvoie sa valeur dans l’affectation.
M.4 Davis-Putnam
La m´ethode de Davis-Putnam permet de d´ecider si une formule en forme normale conjonctive
est satisfiable. On repr´esente une formule A en CNF comme un ensemble (´eventuellement
vide) de clauses {C1, . . . , Cn} et une clause C comme un ensemble (´eventuellement vide) de
litt´eraux. Dans cette repr´esentation, on d´efinit la substitution [b/x]A d’une valeur bool´eenne
b dans A comme suit :
[b/x]A = {[b/x]C | C ∈ A et [b/x]C 6= 1}
[b/x]C =
1 si (b = 1 et x ∈ C) ou (b = 0 et ¬x ∈ C)
C\{`} si (b = 1 et ` = ¬x ∈ C) ou (b = 0 et ` = x ∈ C)
C autrement
La m´ethode de Davis-Putnam fonctionne comme suit. Au d´epart, A est une formule CNF :
– si A est vide, retourner true.
– si A contient la clause vide, retourner false.
– si A contient une clause C qui contient `a la fois les litt´eraux x et ¬x, appeler la fonction
davis-putnam sur la formule A \ C.
– si A contient une clause {x} (resp. {¬x}), appeler la fonction davis-putnam sur [1/x]A
(resp. [0/x]A).
– sinon, choisir une variable x dans A. Appliquer la proc´edure DP r´ecursivement sur
[1/x]A et [0/x]A. Retourner true si l’un des r´esultats est true, retourner false sinon.
Vous devrez d´efinir des m´ethodes pour chacune de ces op´erations. La derni`ere, en particulier,
doit ˆetre trait´ee avec attention : si la premi`ere affectation choisie ´echoue, il faut pouvoir
revenir `a l’´etat courant pour tester la deuxi`eme ; une forme de sauvegarde ou de duplication
sera donc n´ecessaire.
79Exercice M.1 1- Programmez une m´ethode estSatisfiable qui d´ecide si la formule est satis-
fiable en utilisant la proc´edure de Davis-Putnam
2- Modifiez la fonction estSatisfiable pour que si la formule est satisfiable, elle affiche une
affectation v qui satisfait A.
M.5 Test
Il s’agit maintenant de tester la correction et l’efficacit´e de votre programme.
– Il est facile de v´erifier si une formule A est satisfiable par une affectation v.
Exercice M.2 Programmez une m´ethode permettant ce test.
– Il est plus compliqu´e de v´erifier qu’une formule n’est pas satisfiable. Une possibilit´e est
de g´en´erer de fa¸con al´eatoire un certain nombre d’affectations et de v´erifier qu’elles ne
satisfont pas la formule.
Exercice M.3 Programmez une m´ethode qui r´ealise ce test sur une centaine d’affectations
prises au hasard.
– Sur quelles formules tester votre programme ? Il est pratique de disposer d’un g´en´erateur
de formules. Par exemple, on peut programmer une fonction G(n, m, p) qui g´en`ere une
formule avec n clauses et m variables avec la propri´et´e que :
– le litt´eral xj est pr´esent dans la clause Ci avec probabilit´e p/2 ;
– le litt´eral ¬xj est pr´esent dans la clause Ci avec probabilit´e p/2 ;
– les litt´eraux xj et ¬xj ne sont jamais pr´esents ensemble dans une clause Ci (et donc
ils sont absents avec probabilit´e (1 − p)).
Exercice M.4 Programmez une proc´edure qui prend les param`etres (n, m, p, k), g´en`ere
k formules en utilisant la fonction G(n, m, p), applique la proc´edure DP pour d´eterminer
la satisfiabilit´e et applique les m´ethodes d´evelopp´ees dans les exercices M.2 et M.3 pour
v´erifier le r´esultat.
M.6 Heuristique
Le choix d’une variable x dans la derni`ere ´etape peut avoir beaucoup d’influence sur la
rapidit´e de la proc´edure. Une heuristique possible est de choisir x de sorte que le nombre
de clauses dans lesquelles x apparaˆıt multipli´e par le nombre de clauses dans lesquelles ¬x
apparaˆıt est maximal, et de tester DP([1/x]A) d’abord s’il y a plus de clauses contenant x
que de clauses contenant ¬x, et DP([0/x]A) sinon.
Exercice M.5 1. Implanter cette strat´egie dans la fonction DP . Soit DPH la fonction
obtenue.
2. Modifiez le code de la fonction DP et de la fonction DPH pour qu’elles retournent le
nombre de fois que le pas de ‘choix’ DP([0/x]A) or DP([1/x]A) est ex´ecut´e.
3. Programmez une proc´edure qui prend les param`etres (n, m, p, k), g´en`ere k formules en
utilisant la fonction G(n, m, p), applique les proc´edures DP et DPH aux formules, v´erifie
80qu’elles produisent le mˆeme r´esultat (satisfiable ou pas satisifiable) et pour chaque formule
imprime le nombre de fois que le pas de ‘choix’ est ex´ecut´e par DP et DPH.
M.7 Le principe du pigeonnier (pigeon principle)
On dispose de m pigeons et de n nids. Le probl`eme P(m, n) a une solution si :
– Chaque pigeon a un nid.
– Chaque nid contient au plus un pigeon.
Il est ´evident que le probl`eme n’a de solution que si m est inf´erieur ou ´egal `a n, mais la
v´erification de ce fait par la m´ethode de Davis-Putnam peut s’av´erer tr`es coˆuteuse.
On ´ecrit le probl`eme du pigeonnier en CNF de la fa¸con suivante :
– On introduit les variables oi,j pour i ∈ [1..m], j ∈ [1..n]. On interpr`ete oi,j par le pigeon
i occupe le nid j.
– On introduit la CNF
^
i=1,...,m
(
_
j=1,...,n
oi,j )
qui exprime le fait que chaque pigeon doit se trouver dans un nid.
– On introduit la CNF
^
j=1,...,n, i,k=1,...,m,i tar xvf sato4.2.tgz
– compiler le programme en ex´ecutant dans le dossier de SATO la commande :
> make
Plus d’informations sont disponibles dans le fichier README `a la mˆeme adresse.
Vous pouvez tester le solveur en utilisant par exemple le g´en´erateur programm´e dans
le TP1 et comparer les performances avec votre impl´ementation de l’algorithme de DavisPutnam.
N.3 Le jeu du Sudoku
Le Sudoku est un puzzle en forme de grille. Le but du jeu est de remplir la grille avec des
chiffres allant de 1 `a 9 en respectant certaines contraintes, quelques chiffres ´etant d´ej`a dispos´es
dans la grille. La grille de jeu est un carr´e de neuf cases de cˆot´e, subdivis´e en autant de
carr´es identiques, appel´es r´egions.
5 3 7 9
6 1 9 5
9 8 6
8 6 3
4 8 3 1
7 2 6
6 8
4 1 9 5
8 7 9
La r`egle du jeu est simple : chaque ligne, colonne et r´egion ne doit contenir qu’une seule fois
tous les chiffres de 1 `a 9. Formul´e autrement, chacun de ces ensembles doit contenir tous les
82chiffres de 1 `a 9.
L’entr´ee de votre programme est un fichier qui repr´esente la grille sous la forme d’une
matrice 9×9. Lorsque le chiffre d’une case n’est pas d´efini, on note 0. Ainsi l’exemple pr´ec´edent
est repr´esent´e dans ce fichier sous la forme :
835 3 0 0 7 0 9 0 0
6 0 0 1 9 5 0 0 0
0 9 8 0 0 0 0 6 0
8 0 0 0 6 0 0 0 3
4 0 0 8 0 3 0 0 1
7 0 0 0 2 0 0 0 6
0 6 0 0 0 0 0 8 0
0 0 0 4 1 9 0 0 5
0 0 0 0 8 0 0 7 9
N.4 Interface
La principale tˆache `a effectuer est l’interfa¸cage entre le Sudoku et SATO. Dans une premier
temps on doit traduire le probl`eme du Sudoku vers un probl`eme de satisfiabilit´e. Puis on doit
transformer une affectation qui satisfait la formule g´en´er´ee en une solution du Sudoku.
Notez qu’en Java, on ne peut faire d’appel syst`eme, il faudra donc ex´ecuter le programme
final `a l’aide d’un script de la forme :
java Sudoku2SAT fic entree
./sato fic dimacs > fic sol
java SAT2Sudoku fic sol
O`u fic entree est le fichier qui repr´esente la grille d’entr´ee, fic dimacs est la traduction
du probl`eme en format DIMACS produit par le programme Sudoku2SAT et SAT2Sudoku traduit
l’affectation retourn´ee par SATO en solution du probl`eme initial. Le but du TP est de
programmer Sudoku2SAT et SAT2Sudoku.
N.5 Sudoku → SATO
Pour chaque case (x, y) de la grille (ligne x et colonne y) et chaque valeur z ∈ [1..9] on
introduit une variable propositionnelle sxyz. Le probl`eme du Sudoku peut ˆetre traduit vers
une formule CNF de la fa¸con suivante :
– Tout d’abord on veut que chaque case (x, y) contienne au moins un chiffre entre 1 9.
Par exemple, pour la case (1, 1) la clause g´en´er´ee sera :
s111 ∨ s112 ∨ s113 ∨ . . . ∨ s119.
– Ensuite, chaque chiffre de 1 `a 9 apparaˆıt au plus une fois dans chaque ligne. Par exemple,
le fait que le chiffre 1 apparaˆıt au plus une fois dans la ligne 1 correspond `a l’ensemble
de clauses :
(¬s111 ∨ ¬s121) ∧ (¬s111 ∨ ¬s131) ∧ . . . ∧ (¬s111 ∨ ¬s191) ∧ (¬s121 ∨ ¬s131) ∧ . . .
– De mˆeme, chaque chiffre de 1 `a 9 apparaˆıt au plus une fois dans chaque colonne.
– Chaque chiffre de 1 `a 9 apparaˆıt au plus une fois dans chaque r´egion.
– Enfin, il faut s’occuper des cases pr´e-remplies dans la grille de d´epart. Chacune de ces
cases correspond `a une clause avec un seul litt´eral.
84Notez que si on s’arrˆete l`a le codage est suffisant, mais on peut ajouter les contraintes suivantes
:
– Chaque case (x, y) contient au plus un chiffre entre 1 et 9.
– Chaque chiffre apparaˆıt au moins une fois dans chaque ligne.
– Chaque chiffre apparaˆıt au moins une fois dans chaque colonne.
– Chaque chiffre apparaˆıt au moins une fois dans chaque r´egion.
Exercice N.1 Ecrire un programme qui traduit un probl`eme de Sudoku en une formule CNF ´
sous le format DIMACS. Ce programme prend comme entr´ee un fichier sous la forme d´efinie
dans la partie pr´ec´edente et doit ´ecrire le r´esultat de la traduction dans un fichier de sortie.
N.6 SATO → Sudoku
Il reste `a transformer une affectation renvoy´ee par le solveur en solution pour le Sudoku.
Exercice N.2 Ecrire, une fonction qui transforme une affectation qui satisfait la formule en ´
solution du Sudoku et l’affiche.
Vous pouvez maintenant tester votre programme en essayant de r´esoudre des grilles propos´ees
par exemple aux adresses suivantes :
http ://logiciel.sudoku.free.fr/
http ://www.esudoku.fr/
...
Vous pouvez aussi tester dans quelle mesure l’ajout de contraintes suppl´ementaires am´eliore
les performances du programme.
85O TP : R´esolution
Pour repr´esenter les formules en CNF on adopte la mˆeme notation ensembliste utilis´ee
pour d´ecrire la m´ethode de Davis-Putnam.
– Une clause C est un ensemble de litt´eraux.
– Une formule A en CNF est un ensemble de clauses.
Soient C ∪ {x} et C
0 ∪ {¬x} deux clauses o`u l’on suppose que x /∈ C et ¬x /∈ C
0
.
On dit que C ∪ C
0
est un r´esolvant des deux clauses.
La m´ethode de r´esolution peut ˆetre formul´ee de la fa¸con suivante. Soit A un ensemble fini
de clauses. Si X est un ensemble de clauses, on pose
FA(X) = A ∪ X ∪ {C | C est un r´esolvant de deux clauses dans X}
Soit Res(A) le plus petit point fixe de FA. On peut montrer que la formule A est insatisfiable
si et seulement si Res(A) contient la clause vide.
Exercice O.1 Montrez (sur papier) que Res(A) est fini et peut ˆetre calcul´e.
On rappelle qu’une clause de Horn est une clause qui contient au plus un litt´eral positif.
Par ailleurs, une clause unitaire est une clause qui contient un litt´eral. Dans la m´ethode de
r´esolution unitaire on se limite `a calculer les r´esolvants de couples de clauses dont au moins
une est unitaire. On peut montrer qu’une conjonction de clauses de Horn n’est pas satisfiable
si et seulement si la m´ethode de r´esolution unitaire d´erive la clause vide.
Exercice O.2 Construire un programme qui re¸coit en entr´ee une formule A qui est une
conjonction de clauses de Horn au format dimacs et v´erifie si A est insatisfiable en utilisant
la m´ethode de r´esolution unitaire. Le programme imprime Res(A) (adapt´e pour la r´esolution
unitaire) s’il n’arrive pas `a g´en´erer la clause vide.
Exercice O.3 Estimez (sur papier) la complexit´e de votre programme en fonction de la taille
de la formule A.
86
Robotique Mobile
David Filliat
To cite this version:
David Filliat. Robotique Mobile. Ecole d’ing´enieur. Robotique Mobile, ENSTA ParisTech, ´
2011, pp.175.
HAL Id: cel-00655005
https://cel.archives-ouvertes.fr/cel-00655005
Submitted on 24 Dec 2011
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.David FILLIAT
École Nationale Supérieure de Techniques Avancées ParisTech
Robotique Mobile2Cette création est mise à disposition selon le Contrat Paternité-Pas d’Utilisation CommercialePartage
des Conditions Initiales à l’Identique 2.0 France disponible en ligne :
http://creativecommons.org/licenses/by-nc-sa/2.0/fr/
ou par courrier postal à Creative Commons, 171 Second Street, Suite 300, San Francisco,
California 94105, USA.
Ce document évolue régulièrement. La dernière version se trouve sur ma page personnelle
: http://www.ensta-paristech.fr/~filliat/
Si vous avez des remarques ou des suggestions pour m’aider à le faire progresser, ou simplement
si il vous a été utile, n’hésitez pas à m’écrire : david.filliat@ensta-paristech.fr
Dernière mise à jour : 5 octobre 2011Robotique Mobile - david.filliat@ensta-paristech.fr 4TABLE DES MATIÈRES
Table des matières
1 Introduction 9
1.1 Robot Mobile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2 Objectifs du cours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3 (Très) Bref aperçu historique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4 Exemples d’applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.5 Pour aller plus loin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
I Les bases de la navigation 15
2 Les différents types de navigation 19
2.1 Les stratégies de navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2 Les architectures de contrôle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.2.1 Contrôleurs Hiérarchiques . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2.2 Contrôleurs réactifs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.2.3 Contrôleurs hybrides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2.4 Pour aller plus loin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3 Les sources d’information 27
3.1 Informations proprioceptives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.2 Informations extéroceptives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.2.1 Variabilité perceptuelle . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.2.2 Perceptual aliasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.2.3 Utilisation directe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2.4 Utilisation d’un modèle métrique . . . . . . . . . . . . . . . . . . . . . . . 30
3.3 Fusion d’informations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4 Matériels courants en robotique mobile 35
4.1 Les bases mobiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.1.1 Holonomie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.1.2 Les plates-formes différentielles . . . . . . . . . . . . . . . . . . . . . . . 35
4.1.3 Les plates-formes omnidirectionnelles . . . . . . . . . . . . . . . . . . . . 36
4.1.4 Les plates-formes non holonomes . . . . . . . . . . . . . . . . . . . . . . 37
4.1.5 Les plates-formes à pattes . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5 Robotique Mobile - david.filliat@ensta-paristech.frTABLE DES MATIÈRES
4.2 Les capteurs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2.1 Les capteurs proprioceptifs . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2.2 Les télémètres . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.2.3 Les caméras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.2.4 Autres capteurs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.3 Pour aller plus loin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
II Navigation réactive 53
5 Navigation vers un but 57
5.1 Véhicules de Braitenberg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.2 Modèle de Cartwright et Collet . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.3 Asservissement visuel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
6 Évitement d’obstacles 61
6.1 Méthode des champs de potentiel . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.2 Méthode Vector Field Histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.3 Méthode de la fenêtre dynamique . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7 Apprentissage par renforcement 67
7.1 Formalisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
7.2 Programmation dynamique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.2.1 Évaluation d’une politique . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.2.2 Amélioration d’une politique . . . . . . . . . . . . . . . . . . . . . . . . . 72
7.2.3 Algorithmes d’apprentissage . . . . . . . . . . . . . . . . . . . . . . . . . 72
7.3 Méthodes de Monte-Carlo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.3.1 Évaluation d’un politique . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.3.2 Besoin d’exploration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.3.3 Algorithmes d’apprentissage . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.4 Apprentissage par différences temporelles . . . . . . . . . . . . . . . . . . . . . 74
7.5 Traces d’éligibilité . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
7.6 Application pratique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.7 Exemple de mise en œuvre . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
7.8 Pour aller plus loin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
III Navigation utilisant une carte 81
8 Localisation, Cartographie et Planification 85
8.1 Les trois problèmes de la navigation par carte . . . . . . . . . . . . . . . . . . . . 85
8.2 Quelques hypothèses de travail . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
8.2.1 Estimation de la position et de la direction . . . . . . . . . . . . . . . . . . 86
8.2.2 Environnements statiques et dynamiques . . . . . . . . . . . . . . . . . . 87
Robotique Mobile - david.filliat@ensta-paristech.fr 6TABLE DES MATIÈRES
9 Les représentations de l’environnement 89
9.1 Cartes topologiques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
9.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
9.1.2 Avantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
9.1.3 Inconvénients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
9.1.4 Mise en œuvre . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
9.2 Cartes métriques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
9.2.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
9.2.2 Avantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
9.2.3 Inconvénients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
9.2.4 Mise en œuvre . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
9.3 Représentations hybrides et hiérarchiques . . . . . . . . . . . . . . . . . . . . . . 100
10 Localisation 103
10.1 Différentes capacités de localisation . . . . . . . . . . . . . . . . . . . . . . . . . 103
10.2 Estimation de la position par les perceptions . . . . . . . . . . . . . . . . . . . . 105
10.2.1 Cartes topologiques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
10.2.2 Cartes métriques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
10.2.3 Corrélation de cartes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
10.2.4 Limitations de l’estimation de la position par les perceptions . . . . . . . . 110
10.3 Suivi d’une hypothèse unique . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
10.3.1 Cartes topologiques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
10.3.2 Cartes métriques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
10.3.3 Le filtrage de Kalman pour la localisation . . . . . . . . . . . . . . . . . . . 112
10.3.4 Limitations du suivi de position . . . . . . . . . . . . . . . . . . . . . . . . 119
10.4 Suivi de plusieurs hypothèses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
10.4.1 Suivi explicite de plusieurs hypothèses . . . . . . . . . . . . . . . . . . . . 120
10.4.2 Le filtrage Bayésien . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
10.4.3 Filtrage Bayésien dans le cas discret . . . . . . . . . . . . . . . . . . . . . 126
10.4.4 Filtrage particulaire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
10.5 Comparaison des méthodes de localisation . . . . . . . . . . . . . . . . . . . . . 133
11 Cartographie 135
11.1 Les problèmes de la cartographie . . . . . . . . . . . . . . . . . . . . . . . . . . 135
11.1.1 Limitation des méthodes de localisation . . . . . . . . . . . . . . . . . . . 135
11.1.2 Fermetures de boucles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
11.1.3 Cartographie incrémentale et retour en arrière . . . . . . . . . . . . . . . . 136
11.2 Cartographie incrémentale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
11.2.1 Cartes Topologiques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
11.2.2 Cartes métriques : corrélation de scan . . . . . . . . . . . . . . . . . . . . 140
11.2.3 Cartes métriques : grilles d’occupation . . . . . . . . . . . . . . . . . . . . 141
11.2.4 Stratégies d’exploration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
11.3 Retour sur les modifications passées . . . . . . . . . . . . . . . . . . . . . . . . 144
7 Robotique Mobile - david.filliat@ensta-paristech.frTABLE DES MATIÈRES
11.3.1 Méthodes de relaxation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
11.3.2 Cartographie par filtrage de Kalman étendu . . . . . . . . . . . . . . . . . 147
11.3.3 Fast SLAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
11.4 Comparaison des méthodes de cartographie . . . . . . . . . . . . . . . . . . . . 154
11.5 Pour aller plus loin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
12 Planification 155
12.1 Espace des configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
12.2 Discrétisation de l’espace de recherche . . . . . . . . . . . . . . . . . . . . . . . 156
12.3 Recherche de chemin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
12.3.1 Deux types de plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
12.3.2 Calcul de politique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
12.3.3 Calcul d’un chemin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
12.4 Exemples de politiques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
12.5 Choix de l’action avec une position incertaine . . . . . . . . . . . . . . . . . . . . 162
12.6 Pour aller plus loin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Index 164
Bibliographie 165
Robotique Mobile - david.filliat@ensta-paristech.fr 8CHAPITRE 1. INTRODUCTION
Chapitre 1
Introduction
1.1 Robot Mobile
La robotique est un très bon exemple de domaine pluri-disciplinaire qui implique de nombreuses
thématiques telles que la mécanique, la mécatronique, l’électronique, l’automatique, l’informatique
ou l’intelligence artificielle. En fonction du domaine d’origine des auteurs, il existe donc
diverses définitions du terme robot, mais elles tournent en général autour de celle-ci :
Un robot est une machine équipée de capacités de perception, de décision et d’action
qui lui permettent d’agir de manière autonome dans son environnement
en fonction de la perception qu’il en a.
FIGURE 1.1 – Schéma des interactions d’un robot avec son environnement. Selon les approches,
un modèle interne de l’environnement peut être utilisé ou non.
Cette définition s’illustre par un schéma classique des interactions d’un robot avec son environnement
(Figure 1.1). Les différentes notions que nous présenterons dans ce cours sont essentiellement
issues de cette vision de la robotique, très orientée sur l’Intelligence Artificielle, qui
9 Robotique Mobile - david.filliat@ensta-paristech.fr1.2. OBJECTIFS DU COURS
place au centre des préoccupations l’enchaînement de ce cycle Perception/Décision/Action . La
manière dont un robot gère ces différents éléments est définie par son architecture de contrôle,
qui la plupart du temps va faire appel à un modèle interne de l’environnement qui lui permettra de
planifier ses actions à long terme.
1.2 Objectifs du cours
L’objectif de ce cours est de fournir un aperçu des problèmes de la robotique mobile et des
solutions actuelles. Ce cours se veut proche de la recherche, en présentant des méthodes apparues
dans les dernières années, mais présente également les notions de base nécessaires à
leur compréhension, ainsi qu’un panorama de techniques classiques dont la portée va au delà de
leur application en robotique mobile. La lecture des nombreuses références à des articles scienti-
fiques ou à des ouvrages de référence (la plupart du temps en anglais) n’est évidement pas utile
pour la compréhension du cours, mais doit permettre d’approfondir des points particuliers hors
de la portée de ce cours.
La robotique mobile est un domaine dans lequel l’expérience pratique est particulièrement
illustratrice et importante pour la compréhension des problèmes. Au delà des méthodes présentée
dans ce texte, les travaux dirigés ou le projet pratique associés que réalisent les étudiants
apporteront également leur lot de connaissances irremplaçables.
1.3 (Très) Bref aperçu historique
FIGURE 1.2 – La tortue de Grey Walter (nommée “machina speculatrix” et surnommée Elsie)
et une illustration de sa trajectoire pour rejoindre sa niche.
Le terme de robot apparaît pour la première fois dans une pièce de Karel Capek en 1920 :
Rossum’s Universal Robots. Il vient du tchèque ’robota’ (∼ servitude) et présente une vision des
robots comme serviteurs dociles et efficaces pour réaliser les taches pénibles mais qui déjà vont
se rebeller contre leurs créateurs.
Robotique Mobile - david.filliat@ensta-paristech.fr 10CHAPITRE 1. INTRODUCTION
La Tortue construite par Grey Walter dans les année 1950 (Figure 1.2), est l’un des premiers
robots mobiles autonomes. Grey Walter n’utilise que quelques composants analogiques, dont
des tubes à vide, mais son robot est capable de se diriger vers une lumière qui marque un
but, de s’arrêter face à des obstacles et de recharger ses batteries lorsqu’il arrive dans sa niche.
Toutes ces fonctions sont réalisées dans un environnement entièrement préparé, mais restent des
fonctions de base qui sont toujours des sujets de recherche et de développement technologiques
pour les rendre de plus en plus génériques et robustes.
FIGURE 1.3 – A gauche : Robot "Beast" de l’université John Hopkins dans les années 1960.
A droite : Le robot Shakey de Stanford en 1969 a été une plate-forme de démonstration des
recherches en intelligence artificielle.
Dans les années 60, les recherches en électronique vont conduire, avec l’apparition du transistor,
à des robots plus complexes mais qui vont réaliser des tâches similaires. Ainsi le robot
"Beast" (Figure 1.3) de l’université John Hopkins est capable de se déplacer au centre des couloirs
en utilisant des capteurs ultrason, de chercher des prises électriques (noires sur des murs
blanc) en utilisant des photo-diodes et de s’y recharger.
Les premier liens entre la recherche en intelligence artificielle et la robotique apparaissent
à Stanford en 1969 avec Shakey (Figure 1.3). Ce robot utilise des télémètres à ultrason et une
caméra et sert de plate-forme pour la recherche en intelligence artificielle, qui à l’époque travaille
essentiellement sur des approches symboliques de la planification. La perception de l’environnement,
qui à l’époque est considérée comme un problème séparé, voire secondaire, se révèle
particulièrement complexe et conduit là aussi à de fortes contraintes sur l’environnement. Ces
développements de poursuivent avec le Stanford Cart dans la fin des années 1970, avec notamment
les premières utilisations de la stéréo-vision pour la détection d’obstacles et la modélisation
11 Robotique Mobile - david.filliat@ensta-paristech.fr1.3. (TRÈS) BREF APERÇU HISTORIQUE
FIGURE 1.4 – Le Stanford Cart date de la fin des années 1970. Le robot Hilare du LAAS a été
construit en 1977.
de l’environnement. En France, le robot Hilare est le premier robot construit au LAAS, à Toulouse
(Figure 1.4).
Une étape importante est à signaler au début des années 1990 avec la mise en avant de
la robotique réactive, représentée notamment par Rodney Brooks. Cette nouvelle approche de la
robotique, qui met la perception au centre de la problématique, a permis de passer de gros robots
très lents à de petits robots (Figure 1.5), beaucoup plus réactifs et adaptés à leur environnement.
Ces robots n’utilisent pas ou peu de modélisation du monde, problématique qui s’est avérée être
extrêmement complexe.
FIGURE 1.5 – Genghis, développé par Rodney Brooks au MIT au début des années 1990.
Ces développements ont continué et l’arrivée sur le marché depuis les années 1990 de platesformes
intégrées telles que le pioneer de la société Mobile Robots a permis à de très nombreux
laboratoires de travailler sur la robotique mobile et à conduit à une explosion de la diversité des
thèmes de recherche. Ainsi, même si les problèmes de déplacement dans l’espace et de moRobotique
Mobile - david.filliat@ensta-paristech.fr 12CHAPITRE 1. INTRODUCTION
délisation de l’environnement restent difficiles et cruciaux, des laboratoires ont pu par exemple
travailler sur des approches multi-robot, la problématique de l’apprentissage ou sur les problèmes
d’interactions entre les hommes et les robots.
1.4 Exemples d’applications
Aujourd’hui, le marché commercial de la robotique mobile est toujours relativement restreint
en dehors des robots aspirateurs vendus à plusieurs millions d’exemplaires. Cependant, il existe
de nombreuses perspectives de développement qui en feront probablement un domaine important
dans le futur. Les applications des robots peuvent se trouver dans de nombreuses activités
"ennuyeuses, salissantes ou dangereuses" (3 D’s en anglais pour Dull, Dirty, Dangerous),
mais également pour des applications ludiques ou de service, comme l’assistance aux personnes
âgées ou handicapées.
FIGURE 1.6 – Exemples de robots commerciaux ou de recherche.
13 Robotique Mobile - david.filliat@ensta-paristech.fr1.5. POUR ALLER PLUS LOIN
Parmi les domaines d’applications possibles de la robotique, citons :
– La robotique de service (hôpital, bureaux, maison),
– La robotique de loisir (jouets, robot ’compagnon’),
– La robotique industrielle ou agricole (entrepôts logistiques, récolte de productions agricoles,
mines),
– La robotique en environnement dangereux (spatial, industriel, militaire, catastrophes naturelles).
A cela, s’ajoute a l’heure actuelle des nombreuses plates-formes conçues essentiellement
pour les laboratoires de recherche. La figure 1.6 montre quelques exemples de robots existants.
1.5 Pour aller plus loin
Les illustrations de ce chapitre sont, entre autre, tirées du livre "ROBOT : mere machine to
transcendent mind" de Hans Moravec [102], dont les illustrations sont disponibles en ligne 1
.
Le livre de Daniel Ichbiah "Robots, Genèse d’un peuple artificiel" [71] donne également un
bon aperçu "grand public" de la robotique et de sont histoire 2
.
1. http ://www.frc.ri.cmu.edu/ hpm/book98/
2. http ://ichbiah.online.fr/pagerobots.htm
Robotique Mobile - david.filliat@ensta-paristech.fr 14Première partie
Les bases de la navigation
15 Robotique Mobile - david.filliat@ensta-paristech.frDans cette partie, nous présentons les différentes catégories de méthodes de navigation utilisables
pour un robot mobile et les architectures de contrôle associées. Nous présentons ensuite
les informations qu’un robot pourra utiliser pour se déplacer, ainsi que les capteurs et les platesformes
couramment utilisées en robotique.
17 Robotique Mobile - david.filliat@ensta-paristech.frRobotique Mobile - david.filliat@ensta-paristech.fr 18CHAPITRE 2. LES DIFFÉRENTS TYPES DE NAVIGATION
Chapitre 2
Les différents types de navigation
2.1 Les stratégies de navigation
Les stratégies de navigation permettant à un robot mobile de se déplacer pour rejoindre un
but sont extrêmement diverses, de même que les classifications qui peuvent en être faites. Afin
de situer les différentes méthodes de navigation que nous allons étudier dans un contexte géné-
ral, nous reprenons ici une classification établie par Trullier et al. [138, 140]. Cette classification
a été établie en prenant en compte à la fois les stratégies des robots et des animaux. Elle pré-
sente l’avantage de distinguer les stratégies sans modèles internes et les stratégies avec modèle
interne.
Cette classification comporte cinq catégories, de la plus simple à la plus complexe :
– Approche d’un objet : cette capacité de base permet de se diriger vers un objet visible
depuis la position courante du robot. Elle est en général réalisée par une remontée de
gradient basée sur la perception de l’objet, comme dans l’exemple célèbre des véhicules
de Valentino Braitenberg [19] (voir section 5.1) qui utilisent deux capteurs de lumière pour
atteindre ou fuir une source lumineuse. Cette stratégie utilise des actions réflexes, dans
lesquelles chaque perception est directement associée à une action. C’est une stratégie
locale, c’est-à-dire fonctionnelle uniquement dans la zone de l’environnement pour laquelle
le but est visible.
– Guidage : cette capacité permet d’atteindre un but qui n’est pas un objet matériel directement
visible, mais un point de l’espace caractérisé par la configuration spatiale d’un ensemble
d’objets remarquables, ou amers, qui l’entourent ou qui en sont voisins. La straté-
gie de navigation, souvent une descente de gradient également, consiste alors à se diriger
dans la direction qui permet de reproduire cette configuration. Cette capacité semble
utilisée par certains insectes, comme les abeilles [26], et a été utilisée sur divers robots
[54, 86, 58, 114] (voir sections 5.2 et 5.3). Cette stratégie utilise également des actions ré-
flexes et réalise une navigation locale qui requiert que les amers caractérisant le but soient
visibles.
– Action associée à un lieu : cette capacité est la première capacité réalisant une navigation
globale, c’est-à-dire qui permette de rejoindre un but depuis des positions pour lesquelles
19 Robotique Mobile - david.filliat@ensta-paristech.fr2.1. LES STRATÉGIES DE NAVIGATION
a
D
A
a
a a a
a
a
a
a a
a
Direction à prendre pour atteindre le lieu A
Trajectoire suivie par l’animat
Obstacles
Lieux mémorisés
Zone inexplorée
FIGURE 2.1 – Action associée à un lieu. En chaque lieu, représenté par un cercle, l’action à
accomplir pour rejoindre le but A est représentée par une flèche indiquant la direction à suivre
à partir de ce lieu. Cette stratégie permet de rejoindre un but distant dans l’environnement
mais repose sur des chemins figés. Dans cet exemple, le chemin joignant le lieu D au lieu
A et passant par la droite de l’obstacle a été appris. Rejoindre le lieu A depuis le lieu D ne
pourra alors être réalisé que par ce chemin. Le raccourci empruntant le chemin de gauche,
par exemple, est inutilisable.
ce but ou les amers qui caractérisent son emplacement sont invisibles (par exemple [114].
Elle requiert une représentation interne de l’environnement qui consiste à définir des lieux
comme des zones de l’espace dans lesquelles les perceptions restent similaires, et à associer
une action à effectuer à chacun de ces lieux (cf. figure 2.1). L’enchaînement des
actions associées à chacun des lieux reconnus définit une route qui permet de rejoindre le
but. Ces modèles permettent donc une autonomie plus importante mais sont limités à un
but fixé. Une route qui permet de rejoindre un but ne pourra en effet pas être utilisée pour
rejoindre un but différent. Changer de but entraînera l’apprentissage d’une nouvelle route,
indépendante des routes permettant de rejoindre les autres buts.
B
D
A
Possibilité de passer d’un lieu à un autre
Trajectoire suivie par l’animat
Obstacles
Lieux mémorisés
Zone inexplorée
FIGURE 2.2 – Navigation topologique. Cette stratégie permet de mémoriser un ensemble
de lieux et les possibilités de passer de l’un à l’autre, indépendamment de tout but. Pour
rejoindre un but, il faut alors une étape de planification qui permet de rechercher, parmi tous
les chemins possibles, le chemin rejoignant le but. Dans notre exemple, le chemin le plus
court entre D et A peut alors être calculé, mais uniquement parmi les lieux et les chemins
déjà connus. Cette stratégie permet, par exemple, de contourner l’obstacle par la gauche
mais ne permet pas de le traverser en ligne droite de D à A.
Robotique Mobile - david.filliat@ensta-paristech.fr 20CHAPITRE 2. LES DIFFÉRENTS TYPES DE NAVIGATION
– Navigation topologique : cette capacité est une extension de la précédente qui mémorise
dans le modèle interne les relations spatiales entre les différents lieux. Ces relations
indiquent la possibilité de se déplacer d’un lieu à un autre, mais ne sont plus associées à
un but particulier. Ainsi le modèle interne est un graphe qui permet de calculer différents
chemins entre deux lieux arbitraires. Ce modèle ne permet toutefois que la planification de
déplacements parmi les lieux connus et suivant les chemins connus (cf. figure 2.2).
B
D
A
Trajectoire suivie par l’animat
Possibilité de passer d’un lieu à un autre
déduite de leur position relative
x
y
Obstacles
Lieux mémorisés
Possibilité de passer d’un lieu à un autre
Zone inexplorée
FIGURE 2.3 – Navigation métrique. Cette stratégie permet de calculer le chemin le plus court
entre deux lieux mémorisés, permettant même de planifier des raccourcis au sein de zones
inexplorées de l’environnement. Pour cela, la carte mémorise la position métrique relative de
chacun des lieux visités par le robot. Ainsi il est possible de prévoir un déplacement entre
deux lieux, même si la possibilité de ce déplacement n’est pas enregistrée dans la carte.
Dans cet exemple, cette stratégie permet de d’aller du lieu A au lieu D en traversant la zone
inexplorée.
– Navigation métrique : cette capacité est une extension de la précédente car elle permet
au robot de planifier des chemins au sein de zones inexplorées de son environnement.
Elle mémorise pour cela les positions métriques relatives des différents lieux, en plus de
la possibilité de passer de l’un à l’autre. Ces positions relatives permettent, par simple
composition de vecteurs, de calculer une trajectoire allant d’un lieu à un autre, même si la
possibilité de ce déplacement n’a pas été mémorisée sous forme d’un lien (cf. figure 2.3).
Les modèles des trois premières catégories utilisent des actions réflexes pour guider le robot
et se différencient essentiellement par le type de perceptions utilisées pour déclencher ces actions.
Ils se regroupent sous le terme générique de navigation réactive dont nous parlerons dans
la partie II. Ils peuvent être très simple, ne nécessitent pas de modèle global de l’environnement
mais ont un domaine d’application souvent restreint. Dans le monde vivant, ces stratégies sont
très répandues, notamment chez les insectes. Les comportements de ce type restent toutefois
essentiels dans les robots modernes car, du fait de leur simplicité, il sont généralement exécutés
très rapidement et ils permettent de réaliser des taches de bas-niveau, comme l’évitement des
obstacles imprévus, essentielles à la sécurité d’un robot.
Les modèles des deux dernières catégories autorisent pour leur part une navigation globale
et permettent de rejoindre un but arbitraire au sein de l’environnement. Ils s’appuient pour cela
sur un modèle interne du monde, une carte, qui supporte une planification. Ce modèle interne
mémorise donc la structure spatiale de l’environnement, indépendamment d’un but précis. Cha-
21 Robotique Mobile - david.filliat@ensta-paristech.fr2.2. LES ARCHITECTURES DE CONTRÔLE
cune des positions mémorisées dans ce modèle interne peut alors être utilisée comme but par
le processus de planification dont le rôle est de calculer une route vers ce but. Ce sont ces deux
stratégies qui sont regroupées sous le terme de navigation par carte, objet du chapitre III .
Une telle représentation interne est naturelle pour les êtres humains, pour lesquels des processus
cognitifs de haut niveau sont utilisés pour créer et utiliser une carte. Ces processus de
haut niveau sont toutefois très difficile à copier pour un robot réel qui ne dispose que de systèmes
rudimentaires de perception et de traitement des informations en comparaison avec un
homme. Par exemple, en environnement urbain, le processus de mise en correspondance de la
carte avec l’environnement réel afin de déterminer sa position fait souvent appel, pour l’homme,
à la lecture du nom des rues inscrit sur les bâtiments, ce qui est relativement difficile à automatiser,
à cause de la diversité des configurations dans lesquelles peuvent ce trouver ces noms.
On notera au passage que l’homme a quasiment toujours recours à des aménagements particuliers
de l’environnement pour connaitre sa position, par exemple celui qui consiste à nommer les
rues ou à lancer des satellites dans l’espace pour bénéficier du GPS. Le système de navigation
idéal pour un robot mobile sera probablement celui qui sera capable de tirer partie de toutes ces
informations, qui ne lui étaient pas destinées à l’origine.
L’utilisation de cartes par un robot mobile comme le font les hommes est probablement hors de
notre portée pendant quelques années, cependant il existe également des preuves de l’existence
de représentations internes similaires à de telles cartes chez les animaux, par exemple chez les
rats. Ces représentations sont identifiables au niveau neurologiques dans certaines parties de
leur cerveau, notamment dans l’hippocampe. Cela montre que des cartes sont utilisée par des
êtres vivants, sans le support de concept abstraits tels que les utilisent les humains. Ce type de
carte qui fait appel à des structures neurologiques de base et probablement à des perceptions
relativement simples, est un paradigme intéressant pour les robots mobiles.
En robotique mobile, comme pour l’homme ou certains animaux, l’utilisation de cartes est
quasiment indispensable pour permettre d’effectuer des tâches de navigation dans des conditions
environnementales complexes, qui ne sont pas spécialement adaptées pour le robot. La
construction et l’utilisation de telles cartes posent cependant de nombreux problèmes, notamment
pour garantir l’adéquation entre la carte et le monde réel. Pour cette raison, la plupart des
robots trouvent aujourd’hui un compromis entre une approche réactive et une approche utilisant
une carte afin de bénéficier de la rapidité et de la robustesse de la première et de la capacité de
déplacement à long terme de la seconde.
2.2 Les architectures de contrôle
Un robot est un système complexe qui doit satisfaire à des exigences variées et parfois contradictoires.
Un exemple typique pour un robot mobile est l’arbitrage qui doit être fait entre l’exécution
la plus précise possible d’un plan préétabli pour atteindre un but et la prise en compte d’éléments
imprévus, tels que les obstacles mobiles. Ces arbitrages, que ce soit au niveau du choix de stratégie,
ou au niveau de l’utilisation des capteurs, des effecteurs ou des ressources de calcul, sont
réglés par un ensemble logiciel appelé architecture de contrôle du robot. Cette architecture permet
donc d’organiser les relations entre les trois grandes fonctions que sont la perception, la
Robotique Mobile - david.filliat@ensta-paristech.fr 22CHAPITRE 2. LES DIFFÉRENTS TYPES DE NAVIGATION
décision et l’action .
Nous pouvons reprendre la définition de Ronald Arkin [4] de l’art de concevoir de telles architectures
:
Robotic architecture is the discipline devoted to the design of highly specific and individual robots
from a collection of common software building blocks.
Selon cette définition une architecture doit donc être conçue pour un robot précis, mais en
utilisant des modules génériques. De manière plus générale il existe également des règles de
conception relativement générales qui permettent de réaliser ces implémentations. En fonction
de ces règles, les architectures de contrôle peuvent être classées en trois grandes catégories
que nous détaillerons par la suite : les contrôleurs hiérarchiques, les contrôleurs réactifs et les
contrôleurs hybrides (Figure 2.4). Comme le précise cette définition, toutes ces architectures ne
diffèrent pas forcement par les méthodes élémentaires employées mais plutôt par leur agencement
et leur relations.
A B C
PERCEPTION
PLANIFICATION
ACTION
PERCEPTION ACTION
PLANIFICATION
PERCEPTION ACTION
FIGURE 2.4 – Illustration des architectures classiques des contrôleurs pour les robots mobiles
: Hiérarchique (A), Réactive (B) et Hybride (C) (Voir le texte pour la description détaillée).
2.2.1 Contrôleurs Hiérarchiques
Historiquement, les premiers robots mobiles dérivés des recherches en intelligence artificielle
utilisaient des contrôleurs hiérarchiques (cf. figure 2.4 A) dont le fonctionnement repose essentiellement
sur la capacité de décision travaillant sur un modèle du monde supposé quasiment-parfait.
Ces architectures fonctionnent selon un cycle rigide de modélisation de l’environnement, planifi-
cation des actions au sein de cette représentation, puis exécution du plan. La capacité de décision
était issue des premiers travaux en intelligence artificielle et reposait essentiellement sur des traitements
de données symboliques. Ces architectures ont rapidement montré leurs limites et leur
incapacité à fonctionner dans un environnement qui ne soit pas statique et simplifié à l’extrême.
L’essentiel des problèmes de ces architectures provient de l’utilisation d’un modèle interne
central qui est le seul pris en compte pour guider le robot. Elles se trouvent confrontées à tout les
problèmes des premiers développements de l’intelligence artificielle symbolique.
23 Robotique Mobile - david.filliat@ensta-paristech.fr2.2. LES ARCHITECTURES DE CONTRÔLE
Ces architectures supposent premièrement qu’un modèle informatique du monde puisse représenter
toutes les informations pertinentes pour le déplacement du robot. Or un tel modèle ne
peut être suffisant dans un environnement dynamique car au moment de la réalisation de l’action
l’environnement peut avoir suffisamment changé pour que la décision ne soit plus valide. Ce
problème était particulièrement crucial au début de la robotique mobile ou les capacités de calcul
limitées entraînaient des temps de planification de l’ordre de plusieurs dizaines de minutes. Mais
l’augmentation des capacités de calcul ne suffit pas à résoudre ce problème qui ne permet pas
de gérer un environnement de travail réaliste. C’est un problème intrinsèque lié d’une part à la
trop grande longueur de la boucle qui relie la perception à l’action et d’autre part à l’invalidité de
l’hypothèse de monde clos faite en intelligence artificielle 1
.
De plus, ces architectures permettent peu de contrôle sur l’exécution des actions. En effet,
une fois l’action choisie, elle est exécutée en supposant le modèle du monde correct et il n’y a pas
de retour direct de la perception sur l’exécution de l’action. Les écarts modèles/environnement ne
peuvent être pris en compte que via un nouveau cycle perception/modélisation/planification, ce
qui, par définition, est très peu réactif et conduit rapidement à de graves problèmes.
2.2.2 Contrôleurs réactifs
Rodney Brooks [20] a proposé une solution radicale à tous ces problèmes sous la forme d’une
architecture réactive (cf. figure 2.4 B). Dans cette architecture, un ensemble de comportements
réactifs, fonctionnant en parallèle, contrôle le robot sans utiliser de modèle du monde. Cette architecture
supprime évidemment les problèmes dûs aux différences entre la réalité, d’une part,
et le modèle de l’environnement du robot, d’autre part, mais limite clairement les tâches que peut
effectuer le robot (cf. [77] pour une critique). En effet, sans représentation interne de l’état de
l’environnement, il est très difficile de planifier une suite d’actions en fonction d’un but à atteindre.
Les robots utilisant cette architecture sont donc en général efficaces pour la tâche précise pour
laquelle ils ont été conçus, dans l’environnement pour lequel ils ont été prévus, mais sont souvent
difficiles à adapter à une tâche différente.
Les réussites de ces architectures sont liées au couplage direct entre la perception et l’action
qui permet une prise en compte très rapide des phénomènes dynamiques de l’environnement.
En donc une bonne robustesse dans des environnements complexes.
Comme nous l’avons mentionné, ces architectures sont en général basées sur plusieurs comportements
: évitement d’obstacles, déplacement aléatoire, déplacement vers un but, fuite d’un
point... Pour guider le robot, il faut donc choisir à chaque instant lequel de ces comportements
activer. Ce problème est connu dans la litérature scientifique sous le nom de sélection de l’action.
La solution proposée par Brooks, l’architecture de subsomption [21] est devenue un classique et
utilise une hiérarchie des comportements qui se déclenchent donc selon un ordre de priorité en
fonction des perceptions du robot.
1. L’hypothèse de monde clos dit que la représentation symbolique d’un problème va être suffisante pour pouvoir
représenter toutes les conséquences des actions réalisées dans ce monde. Cela s’avère impossible en pratique pour
des problèmes autre que des problèmes jouets (par exemple un monde de cubes posés sur une table).
Robotique Mobile - david.filliat@ensta-paristech.fr 24CHAPITRE 2. LES DIFFÉRENTS TYPES DE NAVIGATION
2.2.3 Contrôleurs hybrides
La plupart des contrôleurs actuellement utilisés choisissent une solution intermédiaire entre
ces deux approches sous la forme d’une architecture hybride [104, 3] (cf. figure 2.4 C). Cette
architecture se compose de deux niveaux. Le premier est chargé des tâches de navigation de
haut niveau, telles que la localisation, la cartographie et la planification. Pour cela, il s’appuie sur
un second niveau réactif qui est chargé d’exécuter les commandes avec le plus de précision possible
et de gérer les éléments non modélisés de l’environnement tels que les obstacles inconnus
ou dynamiques. L’action conjointe de ces deux niveaux permet de réagir rapidement face aux
variations imprévues de l’environnement, tout en permettant la réalisation d’actions planifiées à
plus long terme.
Le bas niveau de ces architectures peut être réalisé sous forme de comportements, tels que
ceux utilisés dans les architectures réactives. Ces comportements sont des boucles sensorimotrices
qui relient les action aux perceptions avec un phase de décision très courte, qui assure la
réactivité. Dans le même temps, les informations sensorielles sont utilisées par le haut niveau
dans une boucle sensorimotrice à une échelle de temps beaucoup plus longue. C’est la mise en
parallèles de ces deux échelles de temps qui fait la force de ces architectures.
Les exemples d’architectures hybrides foisonnent (4D/RCS, 3T, Harpic...) car de très nombreux
laboratoires et organismes travaillant sur la robotique ont développé leur architecture de ce
type.
2.2.4 Pour aller plus loin
Deux livres intéressants sur le sujet :
– Introduction to AI Robotics de Robin Murphy, MIT Press
– Behavior based robotics de Ronald C. Arkin, MIT Press
25 Robotique Mobile - david.filliat@ensta-paristech.fr2.2. LES ARCHITECTURES DE CONTRÔLE
Robotique Mobile - david.filliat@ensta-paristech.fr 26CHAPITRE 3. LES SOURCES D’INFORMATION
Chapitre 3
Les sources d’information
Tous les capteurs utilisés en robotique mobile fournissent des informations appartenant à l’une
de deux grandes catégories d’informations : les informations proprioceptives et les informations
extéroceptives.
– Les informations proprioceptives sont des informations internes au robot qui le renseignent,
dans le cas de la navigation, sur son déplacement dans l’espace. Ces informations peuvent
provenir de la mesure de la rotation de ses roues ou de la mesure de l’accélération grâce
à une centrale inertielle. Un processus d’intégration permet alors, en accumulant ces informations
au cours du temps, d’estimer la position relative de deux points par lesquels le
robot est passé.
– Les informations extéroceptives ou plus simplement les perceptions, sont des informations
caractéristiques d’une position que le robot peut acquérir dans son environnement. Ces
informations peuvent être de nature très variée. Par exemple, un robot peut mesurer la
distance des obstacles avec des capteurs infrarouges ou utiliser une caméra.
Ces deux sources d’information ont des propriétés opposées que nous détaillons dans les
deux sections suivantes.
3.1 Informations proprioceptives
Les informations proprioceptives renseignent sur le déplacement du robot dans l’espace. Elles
constituent donc une source d’information très importante pour la navigation. Cependant, la pré-
cision de cette information se dégrade continuellement au cours du temps, la rendant inutilisable
comme seule référence à long terme. Cette dégradation continuelle provient de l’intégration temporelle
des mesures effectuées par les capteurs internes. En effet, chaque capteur produit une
mesure bruitée du déplacement instantané, de la vitesse ou de l’accélération du robot. Ce bruit,
via le processus d’intégration qui a pour but d’estimer le déplacement, conduit inévitablement à
une erreur croissante.
Malgré ce défaut important, les informations proprioceptives ont l’avantage de dépendre assez
peu des conditions environnementales qui perturbent fortement les informations perceptives. La
vision, par exemple sera fortement perturbée si l’environnement est plongé dans le noir, mais
27 Robotique Mobile - david.filliat@ensta-paristech.fr3.2. INFORMATIONS EXTÉROCEPTIVES
les informations proprioceptives fourniront une information identique, que l’environnement soit
éclairé ou non. De plus, comme nous le verrons dans la section suivante, si deux lieux identiques
du point de vue des perceptions se trouvent dans l’environnement, les informations perceptives
ne permettent pas de les différencier. Les informations proprioceptives sont alors le seul moyen
de les distinguer.
En robotique, cette information a de plus l’avantage de la simplicité de manipulation. En effet,
le processus d’intégration fournit directement une estimation de la position du robot dans un
espace euclidien doté d’un repère cartésien. Dans ce type de repère, tous les outils de la géomé-
trie mathématique sont utilisables. Ils permettent, par exemple, d’effectuer des calculs de chemin
relativement simples lorsque l’on connaît la position du but et des obstacles.
3.2 Informations extéroceptives
Les informations extéroceptives, ou plus simplement les perceptions , fournissent un lien
beaucoup plus fort entre le robot et son environnement. En effet, les informations proprioceptives
fournissent des informations sur le déplacement du robot, alors que les informations perceptives
fournissent des informations directement sur la position du robot dans l’environnement. Ces
informations assurent un ancrage dans l’environnement, en permettant de choisir des perceptions
qui peuvent être utilisées comme points de repère. Ces points de repère sont indépendants
des déplacements du robot et pourront être reconnus quelle que soit l’erreur accumulée par les
données proprioceptives. La reconnaissance de ces points est évidemment soumise à une incertitude,
mais pas à une erreur cumulative, ce qui les rend utilisables comme référence à long
terme.
3.2.1 Variabilité perceptuelle
Pour être utile, un système de perception doit donc permettre de distinguer le plus de lieux
possible. Pour cela, il doit être capable de distinguer le plus de détails possibles, afin de faire la
différence entre deux lieux différents mais d’apparences similaires. Or l’augmentation de cette
capacité à distinguer de petites variations dans l’environnement rend le système sensible au
problème de la variabilité perceptuelle , c’est à dire au changement de perception au cours du
temps pour un lieu donné. Cette variabilité peut être due au bruit inhérent au processus de mesure
où à des variations de l’environnement non significatives pour le problème de navigation qui nous
concerne, par exemple le changement de luminosité. Pour s’affranchir de ce problème, il faut en
général mettre en place des processus de traitement des perceptions qui permettront de ne pas
dépendre de ces variations et de correctement identifier un lieu donné.
3.2.2 Perceptual aliasing
En cherchant à limiter la dépendance aux variations de l’environnement, le concepteur de
robot aboutit en général au problème du perceptual aliasing ou d’Ambiguïté des perceptions. Ce
problème désigne l’incapacité d’un système de perception à distinguer de manière unique tous
Robotique Mobile - david.filliat@ensta-paristech.fr 28CHAPITRE 3. LES SOURCES D’INFORMATION
les lieux d’un environnement. Cette situation est très courante lorsque les robots utilisent des
capteurs de distance aux obstacles tels que les capteurs à ultrasons. Dans un environnement
intérieur de tels capteurs sont, par exemple, capables de mesurer la position du robot par rapport
à un coin, mais ne fournissent aucune information sur la position le long d’un couloir rectiligne.
Toutes les positions le long d’un couloir correspondent alors à des perceptions identiques.
Il est possible d’utiliser des capteurs qui fournissent des données plus précises ou plus discriminantes.
Dans le cas des capteurs de distance, il est, par exemple, possible d’utiliser un
télémètre laser qui pourra distinguer les renfoncements des portes et sera ainsi plus précis. Mais
même en utilisant des capteurs plus informatifs, comme une caméra, ce problème finit par apparaitre
lorsque la taille de l’environnement augmente. Il existe toujours une limite matérielle ou
logicielle au delà de laquelle l’identification unique de toutes les positions d’un environnement
est impossible. Il n’est donc pas possible, en général, de régler complètement le problème du
perceptual aliasing, mais seulement d’en repousser l’apparition. Il faut donc bien étudier les capteurs
nécessaires en fonction des traitements réalisables et de l’environnement visé pour limiter
ce problème.
3.2.3 Utilisation directe
Les capteurs sur un robot mobile peuvent être de nature très variée et être utilisés de nombreuses
façons différentes. Il est toutefois possible de distinguer deux utilisations distinctes de
leurs données pour la navigation. Ces deux utilisations dépendent de l’utilisation ou non d’un modèle
métrique associé au capteur, modèle qui permet de traduire les valeurs brutes du capteur
en informations sur la géométrie de l’environnement. Ce modèle permet notamment de prévoir la
variation des mesures renvoyées par ce capteur en fonction du déplacement du robot.
Les perceptions peuvent être utilisées de manière directe, sans aucun modèle métrique, pour
comparer directement deux positions en examinant les perceptions recueillies en ces lieux. Cette
méthode ne permet cependant que de reconnaître des lieux de l’environnement préalablement
explorés par le robot. Sans modèle de la variation des capteurs, il est en effet impossible de
prévoir les valeurs que les capteurs relèveront dans un lieu inexploré, même s’il est proche ou
entouré de lieux connus.
Pour une telle utilisation directe, seules deux procédures permettant, d’une part, de mémoriser
une perception et, d’autre part, de comparer deux perceptions, sont alors nécessaires. Ces procédures
peuvent être mises en œuvre à partir de tous les types de capteurs existants. Il est, par
exemple, possible d’utiliser la couleur dominante de l’environnement autour du robot, la température
(en supposant qu’elle caractérise une zone de l’environnement, comme pour une chambre
froide), la force du signal wifi ou le temps de retour d’une onde sonore quand elle est envoyée
dans une direction donnée. La seule propriété utilisée est la constance des valeurs mesurées
par un capteur pour un lieu donné. Cette constance permet de reconnaître un lieu déjà visité ou
d’identifier un lieu nouveau dans l’environnement.
29 Robotique Mobile - david.filliat@ensta-paristech.fr3.2. INFORMATIONS EXTÉROCEPTIVES
3.2.4 Utilisation d’un modèle métrique
La seconde méthode d’utilisation d’un capteur consiste à utiliser un modèle métrique associé
. Un tel modèle permet de traduire les informations données par le capteur dans un espace
métrique qui est en général le même que celui utilisé pour estimer la position du robot grâce à
l’odométrie. Il est ainsi possible d’estimer la position d’objets de l’environnement par rapport au
robot, et ainsi de prévoir les données que ce capteur relèvera pour des positions différentes du
robot. L’utilisation d’un tel modèle n’est toutefois possible que pour certains capteurs. Il est, par
exemple, possible d’utiliser un tel modèle associé à un capteur à ultrasons, à un télémètre laser
ou à une paire de caméras stéréoscopique, mais pas à un capteur d’odeur.
a b
FIGURE 3.1 – Un modèle métrique pour un capteur permet deux utilisations de ses données.
La première est similaire à celle qui traite de telles données sans modèle métrique et requiert
la simple mémorisation de ce qui est perçu en un lieu donné (Partie a). La seconde utilise ces
données pour reconstituer les objets rencontrés dans l’environnement, objets qui pourront
tous être mémorisés dans un cadre de référence commun, indépendamment de la position
depuis laquelle ils ont été perçus (Partie b).
Avec un tel modèle, les valeurs des capteurs peuvent être utilisées simplement pour caractériser
chaque lieu atteint par le robot (cf. figure 3.1a). La méthode est alors la même que celle mise
en place quand les capteurs sont utilisés sans modèle métrique. L’utilisation d’un modèle mé-
trique présente toutefois l’avantage que les informations recueillies ont une sémantique plus forte
et une certaine indépendance au point de vue du robot. En effet, ces informations caractérisent la
structure spatiale locale de l’environnement, en plus de la simple apparence de l’environnement
depuis la position du robot. Cette structure spatiale peut alors être utilisée lors de la comparaison
de différents lieux. Il est par exemple possible de reconnaître un couloir en fonction de sa largeur,
indépendamment de la position du robot dans ce couloir. En effet, sans utilisation de modèles
métriques, deux perceptions recueillies en des positions différentes du couloir seront simplement
différentes. En utilisant un modèle métrique, il est possible de calculer la largeur du couloir, par
exemple, à partir des données recueillies et ainsi de déterminer si ces deux positions peuvent
correspondre au même couloir.
Cependant, grâce à un modèle métrique, les perceptions peuvent être utilisées de manière
différente. En effet, dans l’utilisation précédente, sans modèle métrique, elles sont utilisées pour
Robotique Mobile - david.filliat@ensta-paristech.fr 30CHAPITRE 3. LES SOURCES D’INFORMATION
y
x
a b c
A1
I1
A2
A3 ?
I2
A3 ?
A3
I1
A1 A2
I2
?
?
Environnement
Odométrie
Modèle métrique
Pas de modèle métrique
Odométrie
Mémorisation directe
Modèle métrique
Cadre de référence commun
FIGURE 3.2 – Un modèle métrique des perceptions permettent d’inférer les valeurs qui devraient
être perçues pour des positions encore non visitées. Dans cet exemple, les données
A1 et A2 sont perçues en deux positions reliées par des données proprioceptives I1 (partie
a). L’utilisation d’un modèle métrique permet de fusionner ces informations dans un cadre de
référence commun où des objets sont représentés, ici deux murs orthogonaux (partie b, haut).
Sans modèle métrique, ces données peuvent seulement être mémorisées de manière séparée
(partie b, bas). Dans le cas de l’utilisation d’un modèle métrique, les données peuvent
ensuite être utilisées pour estimer la perception A3 pour une nouvelle position reliée à la pré-
cédente par les données proprioceptives I2. Ici, le modèle permet d’inférer que les données
A3 correspondent à un coin de murs (partie c, haut). Sans un tel modèle, seules les positions
visitées peuvent être reconnues, et aucune inférence ne peut être faite pour les positions non
visitées (partie c, bas).
caractériser l’apparence de l’environnement depuis un lieu. Cette caractérisation ne permet pas
d’identifier individuellement des objets distants du robot qui pourraient servir de points de repères,
les amers. L’utilisation d’un modèle métrique permet l’identification de tels points (cf. figure 3.1b).
La perception de ces amers permet alors, en retour, d’obtenir des informations sur la position
du robot. Cette utilisation des perceptions offre l’avantage supplémentaire de permettre au robot
d’inférer les valeurs que mesureront les capteurs dans des positions différentes, mais voisines de
sa position courante (cf. figure 3.2). Par exemple, si un robot perçoit un mur à cinq mètres devant
lui, il peut prédire qu’en avançant d’un mètre, il percevra le mur à quatre mètres. Un autre moyen
de présenter cette propriété est de dire que les perceptions seules permettent d’estimer la position
métrique relative de deux lieux (cf. figure 3.3). Ainsi, si un robot perçoit deux fois un mur devant
lui, d’abord à cinq mètres puis à quatre mètres, il pourra en déduire qu’il a avancé d’un mètre.
Cette propriété permet au robot d’estimer sa position avec précision sur une part plus importante
de son environnement et ne limite plus la localisation aux lieux déjà visités. Cet avantage est une
conséquence directe de la fusion des informations proprioceptives et des perceptions au sein
31 Robotique Mobile - david.filliat@ensta-paristech.fr3.2. INFORMATIONS EXTÉROCEPTIVES
d’une même représentation, qui permet le passage d’un type d’information à l’autre.
A1
A2
I1 = 0
A1 A2 I1?
A2
A1
a b c
Environnement
Modèle métrique
Pas de modèle métrique
Correspondance
Correspondance
DIFFERENT
I1 I1
FIGURE 3.3 – Un modèle métrique des capteurs permet d’inférer la position relative I1 de deux
lieux depuis lesquelles des perceptions A1 et A2 ont été réalisées (partie a). Cette estimation
requiert d’abord la recherche d’un objet de l’environnement commun aux deux perceptions
(partie b, haut). L’utilisation de cet objet commun rend alors possible l’estimation de la position
relative I1 des deux lieux (partie c, haut). Sans modèle métrique, seule la similarité de deux
perceptions peut être mesurée (partie b, bas). Il est alors seulement possible d’estimer si ces
deux situations peuvent correspondre au même lieu ou non, c’est-à-dire si I1 est nulle ou non
(partie c, bas).
Toutefois, la mise au point d’un tel modèle métrique peut être difficile. La relation qui lie la
valeur mesurée par un capteur à la position des objets du monde réel peut être, en effet, très
complexe. Dans le cas des capteurs à ultrasons, par exemple, si un mur se trouve juste dans l’axe
du capteur, sa distance est simplement mesurée par le temps mis par l’onde sonore pour revenir
au capteur. Mais, dans le cas où le mur est fortement incliné par rapport au capteur, l’écho peut ne
pas revenir en direction du capteur qui ne détectera alors aucun obstacle. Un autre problème vient
de la texture des murs. Un mur recouvert de textile ou d’un matériau souple renverra les échos
très différemment d’un mur de béton. En conséquence, pour une distance donnée, le capteur
percevra des distances différentes suivant le matériau des murs. Ces deux exemples montrent
que le modèle métrique associé à un capteur ne dépend pas que du capteur. Il dépend aussi
fortement de propriétés locales de l’environnement qui sont difficiles ou impossibles à prendre en
compte dans un modèle du capteur seul.
Robotique Mobile - david.filliat@ensta-paristech.fr 32CHAPITRE 3. LES SOURCES D’INFORMATION
3.3 Fusion d’informations
En résumé, les informations proprioceptives sont simples à utiliser, mais dérivent au cours du
temps, tandis que les perceptions ne dérivent pas, mais souffrent des problèmes de variabilité
perceptuelle et d’Ambiguïté.
La solution pour résoudre ces problèmes est de fusionner ces deux types d’information. Il est
par exemple possible d’utiliser les informations proprioceptives afin de distinguer deux positions
physiquement différentes mais similaires pour le système perceptif. Ainsi deux lieux, dont la position
relative mesurée par les données proprioceptives est non nulle, ne seront pas confondus.
Cette solution est celle qui est mise en œuvre dans la majorité des systèmes de navigation, car
elle permet d’utiliser les deux sources d’informations en limitant les défauts inhérents à chacune.
Ainsi la dégradation progressive des informations proprioceptives est compensée par la reconnaissance
de positions de l’environnement grâce aux perceptions. Inversement, le problème de
perceptual aliasing est réglé par l’utilisation des données proprioceptives.
Comme nous le verrons dans ce cours, il existe de nombreuses méthodes pour utiliser conjointement
les deux sources d’informations. Ces méthodes diffèrent par leur capacité à utiliser de
manière plus ou moins efficace les avantages des deux types d’informations. D’une manière gé-
nérale, la qualité d’un système de navigation dépend fortement de cette capacité.
33 Robotique Mobile - david.filliat@ensta-paristech.fr3.3. FUSION D’INFORMATIONS
Robotique Mobile - david.filliat@ensta-paristech.fr 34CHAPITRE 4. MATÉRIELS COURANTS EN ROBOTIQUE MOBILE
Chapitre 4
Matériels courants en robotique mobile
4.1 Les bases mobiles
Nous présentons rapidement les différents types de bases mobiles utilisées en robotique,
en nous focalisant sur les plateformes mobiles terrestres pour le milieu intérieur. Ce cours ne
portant pas sur les méthodes de commande, nous ne rentrerons pas en détails dans les modèles
cinématiques ou dynamiques associés. Nous ne parlerons pas non plus des effecteurs permettant
au robot d’agir sur son environnement, tels que les bras articulés.
4.1.1 Holonomie
En robotique, une plateforme est dite holonome lorsque que le nombre de degrés de libertés
contrôlables est égal au nombre total de degrés de liberté.
Pour un robot se déplaçant sur un plan, il y a 3 degrés de liberté (deux translations et une rotation).
A partir d’une position donnée, une plateforme holonome devra donc pouvoir se déplacer
en avant, sur le coté et tourner sur elle-même. Cette capacité permet de contrôler très simplement
le robot car tous les déplacements imaginables sont réalisables, ce qui simplifie le problème de
planification de trajectoire.
De nombreuses plateformes simples ne sont pas holonomes. C’est par exemple le cas des
voitures, ce qui oblige à manœuvrer pour réaliser certaines trajectoires. Par exemple, il est né-
cessaire de faire un créneau pour réaliser un déplacement latéral. Ces contraintes devront donc
être prises en compte lors de la planification de trajectoires. Nous allons cependant voir quelques
mécanismes permettant d’obtenir des plateformes holonomes, ou s’en approchant.
4.1.2 Les plates-formes différentielles
Une des configurations les plus utilisées pour les robots mobiles d’intérieur est la configuration
différentielle qui comporte deux roues commandées indépendamment. Une ou plusieurs roues
folles sont ajoutées à l’avant ou à l’arrière du robot pour assurer sa stabilité (Figure 4.1). Cette
plate-forme est très simple à commander, puisqu’il suffit de spécifier les vitesses des deux roues,
35 Robotique Mobile - david.filliat@ensta-paristech.fr4.1. LES BASES MOBILES
et permet de plus au robot de tourner sur place. Cette possibilité permet de traiter dans certains
cas le robot comme un robot holonome, ce qui va simplifier la planification de déplacement et la
commande du robot.
r
l
v
ω ω1
FIGURE 4.1 – Exemple de plate-forme différentielle. Pioneer 2 DX de la société MobileRobots.
Urban Robot de la société iRobot.
L’estimation du déplacement par odométrie est également très simple à partir de la mesure
des vitesses de rotation des deux roues ω1 et ω2. Les vitesses de translation v et de rotation ω
sont en effet données par :
v =
ω1r +ω2r
2
ω =
ω1r −ω2r
2l
Ce type de plate-forme peut également être utilisé avec des chenilles ce qui fournit une capacité
de franchissement de petits obstacles intéressante (Figure 4.1). Ces plates-formes peuvent
ainsi être utilisées en extérieur ou dans des décombres. L’utilisation de chenilles conduit cependant
à une odométrie très bruitée à cause du contact mal défini entre les chenilles et le sol qui
glissent beaucoup, notamment lors des rotations. L’estimation de la direction par l’odométrie sur
ce type de plates-formes est donc en général rapidement inutilisable.
4.1.3 Les plates-formes omnidirectionnelles
Les plates-formes omnidirectionnelles permettent de découpler de manière plus nette le contrôle
de la rotation et de la translation d’un robot et sont donc quasiment holonomes.
Il existe différents types de plateformes omnidirectionnelles. Le premier utilise trois ou quatre
roues qui tournent à la même vitesse pour fournir une translation et un mécanisme qui permet
d’orienter simultanément ces roues dans la direction du déplacement souhaitée (Figure 4.2).
Le corps du robot lui-même n’effectue pas de rotation mais uniquement des translations. Ce
système permet un contrôle très simple et relativement rapide car les changement de direction
ne concernent que les roues et peuvent donc se faire très vite. Par contre ces plates-formes sont
relativement limitées en capacité de franchissement et requièrent un sol très plan.
Une deuxième catégorie de plateformes utilise des roues dites "suédoises", qui n’offrent pas
de résistance au déplacement latéral (Figure 4.3). La plateforme comporte trois roues dont les
axes sont fixes. Les déplacements dans toutes les directions et en rotation sont obtenus en faisant
varier individuellement les vitesses des roues. La plateforme tourne sur place lorsque les trois
Robotique Mobile - david.filliat@ensta-paristech.fr 36CHAPITRE 4. MATÉRIELS COURANTS EN ROBOTIQUE MOBILE
FIGURE 4.2 – Exemple de plate-forme omnidirectionnelle à roues orientables.
FIGURE 4.3 – Exemple de plate-forme omnidirectionnelle à roues suédoises.
roues tournent dans le même sens, à la même vitesse. Lorsque une roue est fixe, et que les deux
autres tournent en sens opposé, la plateforme avance en direction de la roue fixe. Différentes
combinaisons de vitesses permettent d’obtenir des déplacements quelconques.
4.1.4 Les plates-formes non holonomes
Des plates-formes non holonomes, telles que les voitures, sont également utilisées en robotique
mobile (Figure 4.4). C’est plus particulièrement le cas dans le domaine des véhicules
intelligents. Ces plates-formes sont toutefois plus difficile à commander car elle ne peuvent pas
tourner sur place et doivent manœuvrer, ce qui peut être difficile dans des environnements encombrés.
La commande de ces plates-formes pour réaliser un déplacement particulier est un
problème à part entière que nous n’aborderons pas dans ce cours. Par contre, il est possible
de prendre en compte ces contraintes de manière relativement simple dans la planification (voir
chapitre III).
37 Robotique Mobile - david.filliat@ensta-paristech.fr4.1. LES BASES MOBILES
FIGURE 4.4 – Exemple de plate-forme non holonome de type Ackerman.
4.1.5 Les plates-formes à pattes
FIGURE 4.5 – Exemples de robots à pattes. Hexapode de AAI Canada, Aibo de Sony, Nao de
Aldebarran Robotics.
Des plates-formes à deux, quatre ou six pattes peuvent également être utilisée. Elle ont l’avantage
théorique de pouvoir se déplacer sur des terrains assez complexes, même si en pratique la
plupart de ces plates-formes ne fonctionnent que sur des sols plans.
Les plates-formes à six pattes sont relativement pratiques car le robot peut être en équilibre
permanent sur au moins 3 pattes, ce qui facilite le contrôle. Les plates-formes à deux ou quatre
pattes sont plus complexes à commander et le simple contrôle de la stabilité et d’une allure de
marche correcte reste aujourd’hui difficile, ce qui les rend en général relativement lentes. L’odométrie
de ce type de plates-formes est de plus généralement d’assez faible qualité. Ces différents
facteurs font que ces plates-formes sont rarement utilisées quand l’application visée a un besoin
précis de positionnement et de navigation. De telles plates-formes commencent cependant à
apparaître à relativement grande échelle (par exemple le robot Nao de Aldebarran Robotics).
Robotique Mobile - david.filliat@ensta-paristech.fr 38CHAPITRE 4. MATÉRIELS COURANTS EN ROBOTIQUE MOBILE
4.2 Les capteurs
Nous présentons dans cette section les capteurs les plus couramment utilisés en robotique
mobile pour les besoins de la navigation ainsi que des modèles probabilistes associés qui seront
utilisés dans plusieurs méthodes de navigation.
4.2.1 Les capteurs proprioceptifs
Les capteurs proprioceptifs permettent une mesure du déplacement du robot. Ce sont les
capteurs que l’on peut utiliser le plus directement pour la localisation, mais ils souffrent d’une
dérive au cours du temps qui ne permet pas en général de les utiliser seuls.
Odométrie
L’odométrie permet d’estimer le déplacement de la plateforme à partir de la mesure de rotation
des roues (ou du déplacement des pattes). La mesure de rotation est en général effectuée par
un codeur optique disposé sur l’axe de la roue, ou sur le système de transmission (par exemple
sur la sortie de la boite de vitesse pour une voiture). Le problème majeur de cette mesure est
que l’estimation du déplacement fournie dépend très fortement de la qualité du contact entre la
roue (ou la patte) et le sol. Elle peut être relativement correcte pour une plate-forme à deux roues
motrices sur un sol plan de qualité uniforme, mais est en général quasiment inutilisable seule pour
un robot à chenille par exemple. Pour limiter ce problème, il peut être intéressant de positionner
le codeur optique sur une roue non motrice qui glissera moins. Notons cependant que l’erreur
de ces méthodes se retrouve en général principalement sur l’estimation de la direction du robot,
tandis que la mesure de la distance parcourue est souvent de meilleure qualité.
Modèle probabiliste
La majorité des modèles de localisation et de cartographie présentés dans ce cours (voir
chapitre III) vont faire appel à un modèle probabiliste de cette mesure. Il existe deux types de modèles
: les modèles directs (donnant la probabilité de la mesure en fonction du déplacement réel)
et les modèles inverses (donnant la probabilité du déplacement réel en fonction de la mesure).
Dans le cas de l’odométrie, la plupart des méthodes utilisent un modèle inverse afin d’interpréter
les mesures réalisées.
Il existe divers types de modèles, mais les plus simples et les plus utilisés sont des modèles
supposant que les paramètres du mouvement (direction θ et longueur d du déplacement, changement
de direction φ du robot, cf Figure 4.6, gauche) sont statistiquement indépendants et soumis
à un bruit Gaussien :
P(d,θ,φ|do,θo,φo) = e
−
d−do
σd
2
×e
−
θ−θo
σθ
2
×e
−
φ−φo
σφ
2
où d,θ,φ sont les valeurs réelles et do,θo,φo les valeurs observées.
39 Robotique Mobile - david.filliat@ensta-paristech.fr4.2. LES CAPTEURS
FIGURE 4.6 – Modèle probabiliste de l’odométrie. Paramètres du déplacement à gauche.
Exemple de densité de probabilité après un déplacement rectiligne à droite.
En général, les écarts types de ces différentes gaussiennes (σd,σθ,σφ) dépendent de la
valeur de la mesure : l’erreur sur la longueur du déplacement pourra par exemple être proportionnelle
à cette longueur :
σd = γ×d
Il est possible d’utiliser des modèles beaucoup plus fins de l’odométrie reposant sur le processus
physique utilisé pour la mesure du déplacement. Il est par exemple possible de faire une
hypothèse de bruit gaussien sur le capteur réalisant la mesure de rotation de chaque roue puis,
par calcul, d’en déduire l’erreur sur l’estimation du déplacement du robot. Cependant, une telle
précision n’est souvent pas nécessaire dans de nombreux algorithmes.
Comme nous le verrons au chapitre sur la localisation, ces modèles probabilistes peuvent être
utilisés pour générer des positions possibles du robot selon la distribution de probabilité déduite
de la mesure de l’odométrie.
Les systèmes radar doppler et optiques
Au lieu de mesurer le déplacement par des mesures sur les roues, il est possible d’utiliser
un radar pointé vers le sol qui permet de mesurer la vitesse du véhicule par effet Doppler. Il
existe aussi des systèmes optiques, basés sur le même principe que les souris d’ordinateur,
qui mesurent le déplacement du véhicule en analysant le mouvement relatif du sol (figure 4.7).
Ces systèmes présentent l’avantage d’être plus précis que la mesure passant par les roues,
notamment car ils sont indépendants des dérapages possible de ces roues. Il sont cependant en
général relativement chers et encombrants et sont assez rares sur les petites plates-formes.
Robotique Mobile - david.filliat@ensta-paristech.fr 40CHAPITRE 4. MATÉRIELS COURANTS EN ROBOTIQUE MOBILE
FIGURE 4.7 – Exemple d’odomètre optique Correvit L-CE de CORRSYS- DARTON Sensorsysteme
GmbH.
Les systèmes inertiels
La mesure de déplacement potentiellement la plus fiable provient de la mesure des accélé-
rations de la plate-forme par des capteurs inertiels. Cette mesure est potentiellement fiable car
elle ne dépend pas de la nature locale de l’environnement, cependant les capteurs inertiels sont
tous entachés de bruit de mesure qui produit une dérive de l’estimation de la position au cours du
temps.
La qualité des mesures inertielles dépend très fortement du type de capteurs utilisées. Historiquement,
les premiers capteurs ont été réalisés à base de systèmes mécaniques et peuvent
fournir des mesures extrêmement précise, au prix d’un coût et d’une masse très élevés. Ces dernières
années ont vu apparaître de nouvelles technologies de capteurs, notamment basés sur
les techniques de micro-électronique, qui ont permis la réalisation de capteurs inertiels “bas coût”
et l’apparition de ces capteurs dans des produits grand public. La précision de ces capteurs est
toutefois de quelques ordres de grandeur plus faible, ce qui rend leur utilisation isolée quasiment
impossible. Ces capteurs fournissent toutefois un très bon complément à l’odométrie, notamment
pour l’estimation de la direction.
L’accélération en translation de la plate-forme est mesurée par des accéléromètres. On dispose
en général deux accéléromètres pour prendre des mesures dans deux directions perpendiculaires
du plan de déplacement du robot. Un troisième peut être disposé verticalement afin de
mesurer l’accélération en trois dimensions.
L’accélération angulaire est mesurée par des gyromètres. On dispose en général un gyromètre
selon l’axe vertical, qui permet ainsi de mesurer l’angle de lacet du robot. Deux autres
gyromètres peuvent être positionnés selon deux axes du plan de déplacement afin d’estimer la
direction en trois dimensions.
Il est également possible de mesurer la rotation du robot par rapport à un axe de référence en
utilisant un gyroscope. Cette mesure s’effectue en général par rapport à un axe de référence mis
en rotation et isolé mécaniquement le plus possible du robot, ce qui rend sa direction indépendante
de la direction du robot. Cette mesure peut être moins bruitée que l’intégration du signal
d’accélération mais dépend très fortement de la qualité de la réalisation mécanique du système,
41 Robotique Mobile - david.filliat@ensta-paristech.fr4.2. LES CAPTEURS
qui dépend très directement du prix du gyroscope.
Enfin, les magnétomètres permettent, par la mesure du champ magnétique terrestre, de dé-
duire la direction du nord. Ces capteurs peuvent utiliser différentes technologies et ont l’avantage
de fournir une direction de référence stable au cours du temps (au contraire des gyroscopes qui
dérivent). Ces capteurs sont toutefois très délicats à utiliser en intérieur car ils sont très sensibles
aux masses métalliques présentes dans les bâtiments et leur structure. En pratique, on les utilise
donc principalement en extérieur en apportant le plus grand soin à leur positionnement sur le
robot pour éviter les influences des composants du robot, notamment les moteurs électriques.
FIGURE 4.8 – Centrale intertielle Crista de Cloud Cap Technology.
L’ensemble de ces éléments (accéléromètres, gyromètres, magnétomètres) peut être réuni
pour former une centrale inertielle qui permet d’estimer complètement les six degrés de libertés
de la position dans un espace à 3 dimensions. Les centrales inertielles “bas coût” sont cependant
aujourd’hui de qualité insuffisante pour une utilisation isolée, tandis que les centrales de qualité
correcte restent très chères. Ce domaine est cependant en évolution rapide avec l’arrivée de
nouvelles technologies et l’apparition de centrales “bas coût” de bonne qualité devrait se faire
dans les prochaines années.
L’utilisation des données fournies par ce type de senseurs passe aussi en général par un modèle
probabiliste, qui peut être du type de celui présenté pour l’odométrie. Cependant, la gestion
du bruit interne de ces capteurs demande en général des modèles beaucoup plus précis, qui
estiment explicitement la dérive des capteurs afin de la corriger. Ceci permet de bénéficier de
modèles plus précis en sortie également.
4.2.2 Les télémètres
Il existe différents types de télémètres, qui permettent de mesurer la distance aux éléments
de l’environnement, utilisant divers principes physiques.
Télémètres à ultrason
Les télémètres à ultrason sont historiquement les premiers à avoir été utilisés. Il utilisent la
mesure du temps de vol d’une onde sonore réfléchie par les obstacles pour estimer la distance
Robotique Mobile - david.filliat@ensta-paristech.fr 42CHAPITRE 4. MATÉRIELS COURANTS EN ROBOTIQUE MOBILE
Zone aveugle
Obstacle Télémètre
Distance mesurée
cone de diffusion de l’onde sonore
FIGURE 4.9 – Principe du télémètre à ultrasons et exemple de télémètre réel.
(Figure 4.9). Ces télémètres sont très simple et peu cher, et sont donc très répandus, mais possèdent
de nombreux inconvénients.
En premier lieu, deux télémètres voisins ne peuvent être utilisés simultanément, car il est
impossible de savoir par lequel des deux télémètres une onde réfléchie a été émise (phénomène
de “crosstalk”). Un robot possédant plusieurs télémètres doit donc les activer l’un après l’autre,
ce qui entraîne un taux de rafraîchissement global des mesures relativement faible.
Ces télémètres possèdent une “zone aveugle”, de quelques centimètres, en dessous de laquelle
ils ne peuvent détecter les obstacles. Cette zone est due a une temporisation entre l’émission
de l’onde sonore et le début de la détection de l’onde réfléchie qui est nécessaire pour ne
pas perturber cette mesure.
De plus, l’onde réfléchie est très sensible aux conditions environnementales locales. Ainsi, si
l’angle entre l’obstacle et la direction de l’onde sonore est trop faible, il n’y aura pas de retour de
l’onde sonore et l’obstacle ne sera pas perçu. L’onde de retour dépend également de la texture
de l’obstacle. Un mur couvert de moquette pourra par exemple ne pas être détecté.
Les télémètres ultrason détectent les obstacles se situant dans un cône relativement large
(d’angle au sommet d’environ 30 degrés). Cette caractéristique peut être à la fois un avantage
et un inconvénient. C’est un inconvénient car un obstacle détecté n’est pas localisé en angle
à l’intérieur du cône de détection, et on obtient donc une mesure de la position relativement
imprécise. C’est par contre un avantage car des éléments relativement fins (les pieds de table ou
de chaise par exemple) sont détectés dans ce cône, alors qu’il pourraient ne pas être détectés
par des télémètres ayant un angle d’ouverture très fin.
Télémètres à infrarouge
Les télémètres infrarouges possèdent l’avantage d’avoir un cône de détection beaucoup plus
restreint. Il utilisent une lumière infrarouge au lieu d’une onde sonore pour la détection et peuvent
être basés sur différentes techniques qui permettent de recueillir plus ou moins d’information.
Il est possible de mesurer simplement le retour ou le non-retour d’une impulsion codée, ce
43 Robotique Mobile - david.filliat@ensta-paristech.fr4.2. LES CAPTEURS
FIGURE 4.10 – Principe du télémètre infrarouge à triangulation et exemple de télémètre réel
(Sharp).
qui permet de détecter la présence ou l’absence d’un obstacle dans une certaine portion de
l’espace. Il est également possible de réaliser une triangulation sur le faisceau de retour de l’onde
lumineuse, ce qui permet d’avoir une mesure de la distance de l’obstacle (figure 4.10).
Les inconvénients de ces télémètres sont liés à leur portée, en général relativement restreinte,
et à leur sensibilité aux sources de lumières qui contiennent un fort rayonnement infrarouge. Un
projecteur du type de ceux utilisés pour la télévision pointé sur le robot, par exemple, sature en
général complètement le récepteur et empêche toute détection d’obstacle. Ils sont également
très sensibles à la couleur et à la nature de la surface de l’obstacle (par exemple, ils détectent
difficilement les vitres et les obstacles noir mats).
Télémètres laser
Les télémètres les plus utilisés à l’heure actuelle pour des applications de cartographie et de
localisation sont les télémètres laser à balayage. Ils utilisent un faisceau laser mis en rotation afin
de balayer un plan, en général horizontal, et qui permet de mesurer la distance des objets qui
coupent ce plan (Figure 4.11, 4.11). Cette mesure peut être réalisée selon différentes techniques
soit en mesurant le temps de vol d’une impulsion laser, soit par triangulation.
Les télémètres courants ont une bonne résolution angulaire car ils permettent d’obtenir une
mesure de distance tout les demi degrés, sur une zone de 180 ou 360 degrés selon les modèles.
La mesure est de plus relativement précise (avec un bruit de l’ordre de quelques centimètres) à
une distance relativement grande (plusieurs dizaines de mètres). La fréquence d’acquisition est
en général de l’ordre de la dizaine de Hertz, voire proche de la centaine pour certains modèles.
Ces télémètres sont très utilisés en environnement intérieur car il fournissent des données
abondantes et précises sur la position des objets caractéristiques de l’environnement tels que
les murs. Ils possèdent toutefois un certain nombre d’inconvénients. En premier lieu, leur zone
de perception est restreinte à un plan et ne permet donc pas de détecter les obstacles situés
hors de ce plan (un petit objet posé au sol par exemple). Ils ne peuvent pas non plus détecter les
objets ne réfléchissant pas correctement la lumière du laser (en premier lieu les vitres, mais aussi
certains objets très réfléchissants, tels que les objets chromés). Pour limiter ces inconvénients,
il est possible de les utiliser en conjonction avec des capteurs à ultrason qui ont un cône de
Robotique Mobile - david.filliat@ensta-paristech.fr 44CHAPITRE 4. MATÉRIELS COURANTS EN ROBOTIQUE MOBILE
Télémètre
Mesure obtenue
FIGURE 4.11 – Illustration du principe de fonctionnement d’un télémètre Laser et un exemple
de Télémètre Laser à balayage, fournissant 720 mesure réparties sur 360 degrés, à 5 Hz
(marque Ibeo).
détection plus large et qui peuvent détecter les vitres.
Enfin, la plupart des algorithmes de cartographie et de localisation existants supposent que
le plan de mesure du télémètre laser reste horizontal et à hauteur constante, ce qui n’est plus
vrai en cas de sol irrégulier ou, dans la majorité des cas, en extérieur. Il est alors nécessaire de
passer à une localisation et une cartographie en 3D.
FIGURE 4.12 – Un exemple de télémètre laser à balayage selon 2 axes (à gauche) et de
camera permettant d’obtenir une image de profondeur de 320x240 pixels (à droite).
Il existe des télémètres laser balayant l’espace selon deux axes 4.12. Ils permettent ainsi
d’obtenir une image de distance selon un angle solide de l’ordre de quelques dizaines de degrés
dans les deux dimensions. Ces télémètres restent toutefois cher et fragile du fait de la mécanique
nécessaire au balayage. De plus, la fréquence d’acquisition est relativement faible (de l’ordre de
45 Robotique Mobile - david.filliat@ensta-paristech.fr4.2. LES CAPTEURS
quelques Hertz), ce qui pose problème lorsque le robot est en mouvement. Ces télémètres sont
donc plutôt destinés à des applications relativement statiques comme la création de modèles 3D.
Il existe également des systèmes sans balayage permettant d’obtenir une image de profondeur
de la même manière qu’une caméra couleur standard. Plusieurs technologies sont utilisées,
soit par mesure de temps de vol d’une impulsion laser ou infrarouge, soit par triangulation à partir
de projecteurs infrarouges. Ces capteurs sont récents, mais sont très intéressants pour la robotique
mobile car ils permettent d’obtenir une information dense à une fréquence assez élevée
(image de profondeur de 320x240 à 30 Hz pour la caméra Kinect par exemple, figure 4.12). Ces
informations peuvent être couplées à une image couleur, on parle alors de caméra RGBD (D pour
Depth). Il reste cependant certaines limitations, notamment pour l’emploi en extérieur où l’information
de profondeur peut être perdue à cause de la lumière du soleil qui masque la lumière
infrarouge.
FIGURE 4.13 – Un exemple de télémètre laser à balayage a 64 nappes conçu par Velodyne.
Enfin, principalement pour les véhicules intelligents, il existe un compromis qui consiste à
utiliser plusieurs nappes laser avec différentes inclinaisons afin d’avoir des modèles assez précis
de l’environnement sur 360 degrés (figure 4.13). Ces capteurs restent assez lourds et chers, mais
permettent de réaliser quasiment l’ensemble des tâches nécessaires pour un véhicule comme la
localisation, la cartographie et la détection de piétons ou de véhicules.
Modèle probabiliste
Les modèles probabilistes associés aux télémètres permettent de donner la probabilité de la
mesure en fonction de la distance réelle de l’obstacle. Pour les capteurs réalisant plusieurs mesures,
les probabilités sont en général estimées pour chacune des mesures individuelles prises
depuis une position, puis agglomérées par produit en supposant les mesures indépendantes :
P(Scan|Obstacles) =
M
∏
i=1
P(mesurei
|Obstacles)
Robotique Mobile - david.filliat@ensta-paristech.fr 46CHAPITRE 4. MATÉRIELS COURANTS EN ROBOTIQUE MOBILE
FIGURE 4.14 – Modèle probabiliste de télémètre par composition d’évènements élémentaires
et exemple d’application sur des données réelles de sonars ou de télémètres laser (tiré de
[135]).
Pour estimer la probabilité d’une mesure individuelle, il est possible d’utiliser une simple loi
gaussienne autour de la distance réelle comme modèle probabiliste, mais les modèles sont en
général un peu plus évolués et utilisent une combinaison de lois qui modélisent plusieurs phénomènes
qui peuvent être responsables de la mesure (Figure 4.14) :
– la mesure effective de l’obstacle visé, modélisé par une gaussienne en général
– la perception d’un obstacle imprévu, par exemple une personne ou un objet dynamique non
présent dans la représentation du monde, modélisé par une loi décroissante telle qu’une
exponentielle
– la non détection d’un écho, qui donne une mesure à la distance maximale du télémètre,
modélisé par un pic.
Les paramètres de cette combinaison de lois peuvent être réglés manuellement ou estimés
à partir d’un ensemble de mesures, par exemple en utilisant un algorithme de maximisation de
l’espérance. Ces modèles peuvent être adaptés à tout les types de télémètres (figure 4.14).
47 Robotique Mobile - david.filliat@ensta-paristech.fr4.2. LES CAPTEURS
4.2.3 Les caméras
L’utilisation d’une caméra pour percevoir l’environnement est une méthode attractive car elle
semble proche des méthodes utilisées par les humains et fournit un grande quantité d’information
sur l’environnement. Le traitement des données volumineuses et complexes fournies par
ces capteurs est cependant souvent difficile, mais c’est une voie de recherche très explorée et
prometteuse pour la robotique.
Caméras simples
Une caméra standard peut être utilisée de différentes manières pour la navigation d’un robot
mobile. Elle peut être utilisée pour détecter des amers visuels (des points particuliers qui servent
de repère, tels que des portes ou des affiches) à partir desquels il sera possible de calculer la
position du robot. Si ces amers sont simplement ponctuels, ou de petite taille, il sera en général
simplement possible d’estimer leur direction. Dans le cas ou les amers sont des objets connus
en 2 ou 3 dimensions, il sera en général possible d’estimer complètement la position du robot par
rapport à la leur. Elle peut également être utilisée pour détecter des “guides” de navigation pour
le robot, tels que des routes ou des couloirs.
FIGURE 4.15 – Illustration du principe de base du flot optique.
Il est également possible d’utiliser globalement une image pour caractériser une position ou
un point de vue dans l’environnement. Il faudra alors comparer cette image aux nouvelles images
acquises par le robot pour savoir si le robot est revenu à cette position. Cette comparaison peut
faire appel à différentes techniques, notamment celles utilisées dans le domaine de l’indexation
d’image.
Lorsque le robot est en mouvement, il est également possible de tirer parti du flot optique
(le mouvement apparent des objets dans l’image, voir figure 4.15), afin d’avoir une estimation de
la distance des objets. En effet, les objets les plus proches ont un déplacement apparent plus
important que les objets lointains. Cette méthode permet notamment de réaliser un évitement
d’obstacles ou de réaliser une reconstruction tridimensionnelle de l’environnement (par des techniques
connues sous le nom de structure from motion, voir section 4.2.3).
Robotique Mobile - david.filliat@ensta-paristech.fr 48CHAPITRE 4. MATÉRIELS COURANTS EN ROBOTIQUE MOBILE
Caméras stéréoscopiques
FIGURE 4.16 – Exemple de données fournies par des caméras stéréoscopiques.
Lorsque l’on dispose de deux caméras observant la même partie de l’environnement à partir
de deux points de vue différents, il est possible d’estimer la distance des objets et d’avoir ainsi
une image de profondeur (Figure 4.16), qui peut être utilisée pour l’évitement d’obstacles ou la
cartographie. Cette méthode suppose toutefois un minimum d’éléments saillants dans l’environnement
(ou un minimum de texture) et peut être limitée, par exemple dans un environnement dont
les murs sont peint de couleurs uniformes. La qualité de la reconstruction risque également de
dépendre fortement des conditions de luminosité. La résolution et l’écartement des deux caméras
impose également les profondeurs minimum et maximum qui peuvent être perçues, ce qui peut
être limitatif pour la vitesse de déplacement du robot.
Des techniques similaires peuvent également être utilisées pour estimer la profondeur à partir
d’une caméra en mouvement (méthodes de structure from motion, voir par exemple [67]), la
difficulté étant alors d’estimer à la fois la profondeur et les positions relatives de la caméra lors de
la prise des deux images.
Caméras panoramiques
Les caméras panoramiques (catadioptriques) sont constituées d’une caméra standard pointant
vers un miroir de révolution (par exemple un simple cône, ou un profil plus complexe qui
peut s’adapter à la résolution exacte que l’on veut obtenir sur le panorama) (figure 4.17). L’image
recueillie permet d’avoir une vision de l’environnement sur 360 degrés autour de la camera. Le
secteur angulaire vertical observé dépend de la forme du miroir et peut être adapté aux besoins
de chaque application (Figure 4.17).
Ce type de caméra est très pratique pour la navigation car une image prise par une camera
panoramique orientée verticalement permet de caractériser une position, indépendamment de la
direction du robot. En effet, pour une position donnée et pour deux orientations différentes, la
même image sera formée par la caméra, à une rotation autour du centre près, tandis que pour
une caméra standard, orientée horizontalement, la scène serait différente.
Ces caméras sont donc très pratiques lorsque l’on caractérise une position de manière globale,
mais peuvent aussi être utilisées pour détecter des amers ou pour estimer le flux optique.
Dans ce cas, toutefois, comme la géométrie de l’image formée est relativement complexe et
49 Robotique Mobile - david.filliat@ensta-paristech.fr4.2. LES CAPTEURS
FIGURE 4.17 – Principe des caméras panoramiques catadioptriques, exemple d’image obtenue
et illustration du flux optique.
comme la résolution obtenue varie énormément selon la direction observée, les algorithmes
doivent être adaptés, ce qui pose un certain nombre de problèmes.
Concernant le flux optique, cependant, les caméras panoramiques possèdent l’avantage de
contenir toujours le point d’expansion et le point de contraction dans l’image, ce qui rend l’estimation
du mouvement beaucoup plus aisée (figure 4.17).
4.2.4 Autres capteurs
Les capteurs tactiles
Les robots peuvent être équipés de capteurs tactiles, qui sont le plus souvent utilisés pour
des arrêts d’urgence lorsqu’il rencontre un obstacle qui n’avait pas été détecté par le reste du
système de perception.
Ces capteurs peuvent être de simples contacteurs répartis sur le pourtour du robot. Il ne
détectent alors le contact qu’au dernier moment. Il est également possible d’utiliser des petites
tiges arquées autour du robot pour servir d’intermédiaire à ces contacteurs, ce qui permet une
Robotique Mobile - david.filliat@ensta-paristech.fr 50CHAPITRE 4. MATÉRIELS COURANTS EN ROBOTIQUE MOBILE
détection un peu plus précoce et donne ainsi plus de marge pour arrêter le robot.
Les balises
Dans certaines applications, il est également possible d’utiliser des balises dont on connaît la
position, et qui pourront être facilement détectées par le robot, afin de faciliter sa localisation.
Des techniques très diverses peuvent être utilisées pour ces balises. On peut par exemple
utiliser un signal radio, émis de manière omnidirectionnel par la balise. Le robot sera alors équipé
d’une antenne directionnelle qui lui permettra de détecter la direction des différentes balises, afin
de déduire sa position par triangulation.
On peut également utiliser des codes couleurs ou des codes barres qui pourront être détectés
par une caméra.
Le GPS
Les besoins de localisation étant omniprésents dans de très nombreux secteurs de la vie
actuelle, l’idée d’avoir un système de localisation le plus universel possible à donné lieu à l’apparition
du Global Positionning System (GPS). C’est un système de balises dont on a placé les
balises sur des satellites en orbite terrestre et qui est par conséquent accessible de quasiment
partout à la surface du globe. Ce système permet donc d’avoir une mesure de sa position dans
un repère global couvrant la terre avec une précision variant de quelques dizaines de mètres à
quelques centimètres suivant les équipements.
Ce système est cependant loin de résoudre tous les problèmes de localisation des robots mobiles.
Il fonctionne en effet difficilement dans des environnements urbains, et n’est pas utilisable
à l’intérieur des bâtiments. Sa précision est de plus souvent trop faible pour qu’un robot terrestre
puissent utiliser ces informations seules. En pratique, il est souvent couplé à un système inertiel
qui permet de palier aux pertes du signal GPS et il ne remplace de toute façon pas les capteurs
du robot qui lui permettent de percevoir son environnement immédiat, qui constitue la source
d’information principale pour la navigation à court terme (par exemple l’évitement d’obstacles, par
opposition à la navigation à long terme qui consiste à rejoindre un but distant).
4.3 Pour aller plus loin
Sensors for Mobile Robots : Theory and Application, Everett
Une version en ligne est disponible :
http://www-personal.engin.umich.edu/~johannb/my_book.htm
51 Robotique Mobile - david.filliat@ensta-paristech.fr4.3. POUR ALLER PLUS LOIN
Robotique Mobile - david.filliat@ensta-paristech.fr 52Deuxième partie
Navigation réactive
53 Robotique Mobile - david.filliat@ensta-paristech.frDans cette partie, nous présentons différentes stratégies de navigation réactive. Ces stratégies
peuvent être utilisées dans des architectures de contrôle purement réactives, mais aussi
comme modules de bas-niveau dans une architecture hybride. Par définition, les stratégies de
navigation réactives n’utilisent que les valeurs courantes des capteurs (ou des valeurs sur une
petite fenêtre temporelle), et non des données provenant d’un modèle interne, pour décider de
l’action à effectuer.
55 Robotique Mobile - david.filliat@ensta-paristech.frRobotique Mobile - david.filliat@ensta-paristech.fr 56CHAPITRE 5. NAVIGATION VERS UN BUT
Chapitre 5
Navigation vers un but
Nous commençons ici par des méthodes de navigation correspondant aux deux premières
catégories de stratégies de navigation définies dans le chapitre 2, c’est à dire l’approche d’un but
défini par un objet ou une configuration d’amers.
5.1 Véhicules de Braitenberg
Dans son livre “Vehicles : Experiments in Synthetic Psychology”, Valentino Braitenberg [19]
décrit une série d’expériences dans lesquelles des robots extrêmement simples peuvent montrer
des comportements complexes, qu’un observateur humain associe en général à différents types
d’émotions telles que la peur ou l’agression. Nous nous intéressons ici simplement à la structure
de ces robots, qui permet de réaliser simplement des comportements pour rejoindre un but visible.
Cette structure est devenue l’archétype des méthodes réactives simples.
But
M1
M2
C1
C2
FIGURE 5.1 – Dans les véhicules de Braitenberg, la vitesse de chacun des deux moteurs du
robot dépend de la valeurs de deux capteurs qui détectent la lumière émise par le but.
Dans le livre de Braitenberg, le but est matérialisé par une lumière, visible depuis tout l’environnement.
Le robot est simplement une plate-forme différentielle, constituée de deux roues dont
57 Robotique Mobile - david.filliat@ensta-paristech.fr5.2. MODÈLE DE CARTWRIGHT ET COLLET
on commande les vitesses de rotation et munie de deux capteurs de lumière situés de part et
d’autre de l’avant du robot (Figure 5.1). L’architecture interne du robot est simplement constituée
de liens entre ces capteurs et les moteurs qui permettent de calculer la vitesse des moteurs en
fonction des valeurs des capteurs.
En faisant varier les paramètres des connexions, il est alors possible de définir différents
comportements du robot. Si la vitesse de chaque moteur est reliée à la valeur du capteur du coté
opposé avec un coefficient positif, le robot se dirigera naturellement vers le but. Si, par contre,
la vitesse de chaque moteur est reliée à la valeur du capteur du même coté avec un coefficient
positif, le robot fuira le but.
Ces véhicules réalisent simplement une remontée ou une descente de gradient sur l’intensité
de la lumière. Ils correspondent à un simple contrôleur proportionnel en automatique et sont donc
relativement sujets à des oscillations dans le comportement du robot. Ils supposent de plus que
le but est visible depuis tout l’environnement, ce qui est rarement le cas en pratique. Ce modèle
est donc intéressant car c’est la méthode la plus simple possible pour réaliser un déplacement
vers un but, mais est difficile à utiliser dans une application réelle.
5.2 Modèle de Cartwright et Collet
Le “snapshot model” a été conçu pour expliquer comment des abeilles peuvent utiliser des
informations visuelles pour rejoindre un point donné de l’environnement. Il permet à un robot de
rejoindre un but dont la position est définie par la configuration d’amers de l’environnement autour
de ce but.
Amer
Amer
Amer
FIGURE 5.2 – Exemple de snapshot caractérisant la position du but. Le robot mémorise un
panorama contenant la position et la taille apparente des amers.
Le système perceptif du robot doit lui permettre de détecter la direction et la taille des amers
autour de lui. Le robot commence par mémoriser le but en enregistrant la configuration des amers
vus depuis la position de ce but (un snapshot, Figure 5.2).
Robotique Mobile - david.filliat@ensta-paristech.fr 58CHAPITRE 5. NAVIGATION VERS UN BUT
Perception courantes
Perceptions depuis le but
FIGURE 5.3 – Pour atteindre le but, chaque amer perçu est associé à un des amers mémorisés.
Pour chaque appariement, on déduit un vecteur tangentiel dont la norme augmente
avec l’écart entre amer perçus et mémorisés. La somme de ces vecteurs donne la direction à
prendre pour atteindre le but.
Lorsque, par la suite, le robot veut rejoindre ce but, il prend une nouvelle image des amers
et, par comparaison entre la configuration courante et la configuration mémorisée au but, il peut
déduire de manière très simple la direction dans laquelle se déplacer pour atteindre le but. Cette
comparaison est basée sur un appariement entre les amers perçus et les amers mémorisés,
chaque appariement permettant de calculer un vecteur dont la somme, pour tous les appariements
d’amers, donne la direction à prendre pour rejoindre le but (Figure 5.3). Le robot effectue
alors un déplacement de longueur fixée dans cette direction puis recommence le processus tant
que le but n’est pas atteint.
Là encore, le système est très simple et réalise une descente de gradient sur la configuration
des amers afin d’atteindre le but. Il ne fonctionne cependant pas sur l’ensemble de l’environnement
et la qualité du comportement obtenu dépend beaucoup de la configuration des amers
qui sont utilisés, un ensemble d’amers lointains et bien répartis tout autour du robot donnant les
meilleurs résultats. La qualité de l’appariement entre les amers est également primordiale, en
effet, si un amer perçu est associé au mauvais amer mémorisé, le vecteur de déplacement déduit
sera faux. Le modèle original supposait des amers noirs sur fond blanc, sans identité particulière,
pour lequel l’appariement est relativement hasardeux. Il n’est donc pas applicable en pratique.
D’autres travaux ont utilisé des amers colorés et différentes contraintes sur l’appariement qui
permettent une meilleur robustesse et sont donc applicables à des robots réels [58].
La plupart des implantations de ce modèles supposent de plus que la direction du robot est
connue afin de faciliter l’appariement. Avoir une estimation correcte de cette direction peut se
révéler difficile en pratique.
59 Robotique Mobile - david.filliat@ensta-paristech.fr5.3. ASSERVISSEMENT VISUEL
5.3 Asservissement visuel
L’asservissement visuel [30] (document disponible en ligne 1
) est une technique d’asservissement
de la position d’un robot qui est basée directement sur l’information extraite d’une image,
sans modélisation intermédiaire de l’environnement. Développées à l’origine pour la commande
des robots manipulateurs, ces techniques permettent également la commande de robots mobiles.
FIGURE 5.4 – Illustration du principe de l’asservissement visuel : l’erreur entre une image
courante et une image but (écart entre les croix rouges et vertes ici) est utilisée pour calculer
une commande qui permettra au robot d’atteindre la position correspondant à l’image but.
Dans ces approches, le but à atteindre est spécifié par l’image que le robot devra percevoir
depuis cette position. Différentes mesures sont réalisées sur cette image (par exemple la détection
de points d’intérêts) et la commande du robot est conçue pour amener à 0 l’écart entre la
mesure réalisée sur l’image courante et la mesure réalisée sur l’image cible (figure 5.4). Les choix
de mesures dans l’image et de la loi de commande peuvent être très variés, et vont conditionner
les trajectoires obtenues par le robot, leur stabilité, leur robustesse aux mauvaises perceptions
ou aux mauvaises modélisations du système, etc...
Nous ne détaillerons pas ici ces approches, mais il existe plusieurs applications intéressantes
en robotique mobile [15, 123, 34]. Notons que ces modèles sont souvent étendus pour fournir une
navigation à long terme en enchainant des tâches de contrôle local sur des séquences d’images.
Par exemple, [15] présente un système permettant de guider un robot en environnement intérieur
à partir du suivi de motifs détectés sur le plafond par une caméra pointée à la verticale. En
enchaînant des asservissements sur une séquence d’images, ce système permet au robot de
refaire une trajectoire qui a été montrée au préalable par un opérateur. De même, [123] et [34]
réalisent le guidage d’un véhicule en extérieur à l’aide d’une caméra pointée vers l’avant.
1. http://www.irisa.fr/lagadic/pdf/2002_hermes_chaumette.pdf
Robotique Mobile - david.filliat@ensta-paristech.fr 60CHAPITRE 6. ÉVITEMENT D’OBSTACLES
Chapitre 6
Évitement d’obstacles
L’évitement d’obstacles est un comportement de base présent dans quasiment tous les robots
mobiles. Il est indispensable pour permettre au robot de fonctionner dans un environnement
dynamique et pour gérer les écarts entre le modèle interne et le monde réel.
Les méthodes que nous présentons sont efficaces à condition d’avoir une perception correcte
de l’environnement. Elles seront par exemple très efficaces avec un télémètre laser, mais donneront
des résultats plus bruités avec des sonars. Pour limiter ce problème, il est possible d’appliquer
ces méthodes sur une représentation locale (c’est-à-dire de l’environnement proche du robot et
centrée sur le robot) de l’environnement qui sera construite en fonction des données de quelques
instants précédents. Cette représentation intermédiaire permettra de filtrer une grande partie du
bruit des données individuelles (en particulier pour les sonars).
Il faut également faire attention à ce que les capteurs détectent tous les obstacles. Par
exemple un laser à balayage ne verra pas les objets au dessous ou au dessus de son plan
de balayage, et pourra voir du mal à percevoir les vitres. Pour cette raison, on utilise souvent une
nappe laser couplée à des sonars, ou un système de plusieurs nappes laser inclinées.
6.1 Méthode des champs de potentiel
Dans la méthode d’évitement d’obstacles par champs de potentiels, on assimile le robot à une
particule se déplaçant suivant les lignes de courant d’un potentiel créé en fonction de l’environnement
perçu par le robot. Ce potentiel traduit différents objectifs tels que l’évitement d’obstacles ou
une direction de déplacement préférée. Il est calculé par sommation de différentes primitives de
potentiels traduisant chacun de ces objectifs (Figure 6.1). Ces différents potentiels peuvent avoir
une étendue spatiale limitée ou non (par exemple, n’avoir une influence que près des obstacles)
et leur intensité peut dépendre ou non de la distance.
Le gradient de ce potentiel donne, en chaque point de l’espace, la direction de déplacement
du robot (Figure 6.1). Comme c’est ce gradient, et non la valeur absolue du potentiel, qui nous
intéresse, il est possible de calculer directement en chaque point sa valeur par une simple somme
vectorielle en ajoutant les valeurs issues des différents potentiels primitifs. Ainsi, pour un robot
se déplaçant en ligne droite en espace ouvert et évitant les obstacles qu’il peut rencontrer, nous
61 Robotique Mobile - david.filliat@ensta-paristech.fr6.1. MÉTHODE DES CHAMPS DE POTENTIEL
Déplacement selon
une direction
Eloignement d’une
paroi
Répulsion
d’un point
Attraction
vers un point
Potentiel
Ligne de
courant
FIGURE 6.1 – Illustration de potentiels primitifs dont la combinaison guide les déplacements
du robot. Le robot se déplacera selon les lignes de courant.
FIGURE 6.2 – Illustration de la combinaison de différents potentiels primitifs.
obtenons par exemple les lignes de courant illustrées figure 6.2.
De plus, dans la pratique, pour l’évitement d’obstacles, le potentiel est en général calculé dans
l’espace relatif au robot et ne sert qu’a décider de la vitesse et de la direction courante. Il n’est
donc nécessaire de l’estimer que pour la position courante du robot, en sommant simplement la
contribution des différents éléments perçus (Figure 6.3).
Le principal inconvénient de cette méthode d’évitement d’obstacles est l’existence, pour certaines
configurations d’obstacles (relativement courantes) de minimum locaux du potentiel qui ne
permettent pas de décider de la direction à prendre (Figure 6.3). Ce problème peut être traité de
différentes façons. Il est par exemple possible de déclencher un comportement particulier lorsque
l’on rencontre un tel minimum (déplacement aléatoire, suivi de murs ....). Il est aussi possible
d’imposer que le potentiel calculé soit une fonction harmonique, ce qui garanti qu’il n’ait pas de
minima, mais rend son estimation beaucoup plus lourde en calcul.
Le principe de ces champs de potentiels est formalisé sous le nom de schéma moteur par R.
Arkin [4]. Pour lui, un schéma moteur est une action définie sous forme de potentiel en fonction
des perceptions du robot. Ces schémas sont utilisés comme contrôleur de bas niveau dans une
architecture hybride.
Robotique Mobile - david.filliat@ensta-paristech.fr 62CHAPITRE 6. ÉVITEMENT D’OBSTACLES
FIGURE 6.3 – Gauche : Illustration de la combinaison de différents potentiels primitifs dans
l’espace relatif au robot. Droite : Exemple de minimum local dans un champ de potentiel.
6.2 Méthode Vector Field Histogram
La méthode "Vector Field Histogram" [17] a été conçue spécifiquement pour utiliser une grille
d’occupation locale construite a partir de capteurs à ultrasons. Cette grille est construite de manière
très rapide par la méthode "Histogrammic in motion mapping" (voir section 11.2.3) qui produit
une grille dont chaque cellule contient un nombre d’autant plus élevé qu’elle a souvent été
perçue comme contenant un obstacle (Figure 6.4 haut).
Un histogramme représentant l’occupation de l’environnement autour du robot est ensuite
construit à partir de cette grille d’occupation locale. Pour cela, l’environnement est discrétisé en
secteurs angulaires pour lesquels la somme des valeurs des cellules est calculée (figure 6.4 bas).
Un seuil permettant de tolérer un certain bruit est ensuite utilisé pour déterminer les directions
possibles pour le robot : toutes les directions dont la valeur est inférieure au seuil sont considé-
rées. Le choix de la direction est finalement réalisé parmi les directions possibles en fonction de
contraintes externes (par exemple la direction la plus proche de la direction du but).
Cette méthode est extrêmement rapide (elle fonctionne sur un PC 386 à 20MHz !) et a permis
historiquement un déplacement réactif à des vitesses assez élevées (environ 1 m/s). Diverses
améliorations pour permettre le réglage de la vitesse du robot en fonction de la densité des
obstacles ou de la largeur de l’espace angulaire libre sont possibles.
6.3 Méthode de la fenêtre dynamique
La méthode de la fenêtre dynamique [47] permet de sélectionner une trajectoire locale du robot
qui va éviter les obstacles et dont les variations dans le temps vont respecter des contraintes
telles que les capacités de freinage maximales du robot. Pour appliquer l’algorithme, les trajectoires
locales sont paramétrées et peuvent prendre des formes différentes en fonction des
contraintes d’holonomie du robot par exemple. Une méthode simple applicable à de nombreuses
plateformes est d’utiliser les vitesses de translation et de rotation du robot.
La méthode de la fenêtre dynamique permet donc, à partir de la perception locale de l’environnement,
de sélectionner un couple (v,ω) de vitesses de translation et de rotation du robot
qui répond à différentes contraintes, dont celle d’éviter les obstacles. Un tel couple de vitesses,
63 Robotique Mobile - david.filliat@ensta-paristech.fr6.3. MÉTHODE DE LA FENÊTRE DYNAMIQUE
Obstacle
+1
+1
2
6 5
5 3 8
5 3
6 8
1
1
2
6 5
5 3 8
5 3
6 8
1
1
0
1
...
11
...
0 11
Seuil
Secteur
Somme des cellules
FIGURE 6.4 – Partie supérieure : Grille d’occupation locale construite par la méthode "Histogrammic
in motion mapping". La grille est construite dans le référentiel du robot : un compteur
est incrémenté pour chaque cellule appartenant au secteur angulaire dans lequel un obstacle
a été détecté et les valeurs sont déplacées d’une cellule à l’autre en fonction des déplacements
du robot. Partie Inférieure : Utilisation de l’histogramme des obstacles pour déterminer
la direction de déplacement du robot.
Robotique Mobile - david.filliat@ensta-paristech.fr 64CHAPITRE 6. ÉVITEMENT D’OBSTACLES
lorsqu’il est appliqué au robot, produit une trajectoire circulaire, pour laquelle la satisfaction des
différentes contraintes peut être évaluée. A l’issu de l’évaluation de toutes les contraintes pour
tous les couples de vitesses possibles, la méthode de la fenêtre dynamique permet de sélectionner
le couple le plus pertinent (qui répond le mieux aux contraintes).
v2,ω2 = succès
v1,ω1 = échec
Environnement réel Perceptions du robot
v2,ω2
v1,ω1
FIGURE 6.5 – Contrainte d’évitement d’obstacles pour la méthode de la fenêtre dynamique.
La première contrainte est la contrainte d’évitement d’obstacles. C’est une contrainte dure au
sens ou elle est binaire (succès / échec) et doit obligatoirement être satisfaite. Elle est évaluée
pour chacune des trajectoires possibles à partir de la perception locale de l’environnement à
un instant donné et de la position estimée du robot à un pas de temps fixé dans le futur pour
la trajectoire courante. Si le robot n’a pas rencontré d’obstacles à cet horizon, la contrainte est
respectée ; dans le cas contraire, elle ne l’est pas (Figure 6.5).
ω
v
ωmin ωmax
vmax
Vitesses conduisant
à percuter un obstacle
Vitesses conduisant
à un déplacement sur
Vitesses courantes Vitesses accessibles au
prochain pas de temps
FIGURE 6.6 – Fenêtre de sélection des vitesses tenant compte de la dynamique du robot.
Le respect ou le non respect de cette contrainte est reporté dans un graphe des vitesses qui
indique, pour chaque couple de vitesses possible (donc chaque trajectoire), si le robot va ou ne va
pas rencontrer un obstacle (Figure 6.6). Dans ce graphe, il est alors possible de tracer la fenêtre
des vitesses accessibles au prochain pas de temps à partir des vitesses courantes du robot et
65 Robotique Mobile - david.filliat@ensta-paristech.fr6.3. MÉTHODE DE LA FENÊTRE DYNAMIQUE
des valeurs d’accélération et décélération maximales. C’est cette fenêtre qui donne son nom à la
méthode car elle permet de prendre en compte la dynamique du robot (à travers la capacité de
freinage et d’accélération). Il reste alors à choisir, au sein de cette fenêtre, un couple de vitesses
qui ne conduise pas à percuter un obstacle pour garantir un déplacement sûr du robot.
ω
v
ωmin ωmax
vmax
Direction préférentielle
FIGURE 6.7 – Contrainte “souple” exprimant une préférence sur la direction à prendre.
Pour faire le choix parmi toutes les vitesses possibles au sein de cette fenêtre, il est possible
d’utiliser des contraintes “souples” supplémentaires pour exprimer des préférences au sein de cet
espace des vitesses accessibles. Ces contraintes s’expriment par une fonction de coût G(v,ω)
qui est en général la somme de plusieurs termes. Ces termes peuvent exprimer une préférence
a priori sur les vitesses, une préférence pour les trajectoires s’éloignant le plus des obstacles, ou
une préférence de direction si l’on dispose par exemple d’une estimation de la direction d’un but
à long terme (Figure 6.7). Le couple de vitesses minimisant ce coût au sein de la fenêtre est alors
sélectionné. Il garantit un déplacement sans rencontrer d’obstacles et le meilleur respect possible
des contraintes souples dans ce cadre.
Dans la pratique, les valeurs des différentes contraintes sont évaluées en différents points du
graphe des vitesses, le nombre de points dépendant notamment de la puissance de calcul disponible
et de la complexité de l’évaluation de chaque contrainte. L’utilisation de la fenêtre dynamique
est très intéressante pour un robot se déplaçant rapidement, ou pour un robot ayant des capacités
d’accélération et de ralentissement limitées. Elle permet alors de produire un déplacement du
robot sûr et régulier. Pour des robots qui ont une forte capacité d’accélération et de décélération
(par exemple un robot léger avec de bons moteurs électriques), on peut considérer que toutes les
vitesses sont accessibles presque instantanément. Il peut alors être suffisant de ne considérer
que la cinématique, et non la dynamique, ce qui se traduit par la prise en compte d’un seul point
du graphe, et non d’une fenêtre. La recherche du couple de vitesse est ainsi simplifiée.
Robotique Mobile - david.filliat@ensta-paristech.fr 66CHAPITRE 7. APPRENTISSAGE PAR RENFORCEMENT
Chapitre 7
Apprentissage par renforcement
Les méthodes que nous avons vu jusqu’à présent sont des associations entre perceptions
et actions conçues par des ingénieurs. Or il existe des techniques d’apprentissage (notamment
l’apprentissage par renforcement) permettant de créer des associations de ce type à partir d’informations
d’assez haut niveau sur la tâche à réaliser.
L’apprentissage par renforcement est une méthode qui permet de trouver, par un processus
d’essais et d’erreurs, l’action optimale à effectuer pour chacune des situations que le robot va
percevoir afin de maximiser une récompense. C’est une méthode d’apprentissage orientée objectif
qui va conduire à un contrôleur optimal pour la tâche spécifiée par les récompenses. Cette
méthode est de plus non supervisée car la récompense ne donne pas l’action optimale à réaliser
mais simplement une évaluation de la qualité de l’action choisie. Elle permet enfin de résoudre les
problèmes de récompense retardée pour lesquels il faut apprendre a sacrifier une récompense à
court terme pour obtenir une plus forte récompense à long terme et donc apprendre de bonnes
séquences d’actions qui permettront de maximiser la récompense à long terme.
Du fait de toutes ces caractéristiques, l’apprentissage par renforcement est une méthode
particulièrement adaptée à la robotique.
7.1 Formalisation
Le problème de l’apprentissage par renforcement pour un agent se formalise à partir des
éléments suivants :
– Un ensemble d’états S correspondant à la perception que l’agent a de l’environnement,
– Un ensemble d’actions possibles A ,
– Une fonction de récompense R : {S,A} → R.
L’agent va interagir avec son environnement par pas de temps discrets, en percevant l’état
de l’environnement st
, en choisissant une action at en fonction de cet état et en recevant la
récompense rt+1 associée (Figure 7.1).
L’évolution du robot dans son environnement est régi par un Processus de Décision Markovien
(MDP en anglais) qui décrit l’évolution de l’état et de la récompense en fonction des actions du
robot. Ce MDP (7.2), qui spécifie complètement la tâche du robot par le jeu des récompenses, se
67 Robotique Mobile - david.filliat@ensta-paristech.fr7.1. FORMALISATION
Environnement
état S
récompense R
action A
FIGURE 7.1 – Formalisation du problème d’apprentissage par renforcement.
décrit simplement à l’aide de deux fonctions :
– Une fonction de transition P
a
ss0 = P(st+1 = s
0
|st = s,at = a) qui donne la probabilité de
passer dans l’état s
0
lorsque l’agent effectue l’action a dans l’état s,
– Une fonction de récompense R
a
ss0 = E(rt+1|st = s,at = a,st+1 = s
0
) qui donne la récompense
moyenne lorsque l’agent passe de l’état s à s
0 en faisant l’action a.
FIGURE 7.2 – Exemple de MDP très simple. Chaque case correspond à un état et, pour
chaque état, 4 actions sont possibles qui conduisent aux cases voisines. La récompense est
nulle partout, sauf pour les actions qui mènent à la case "S", pour lesquelles la récompense
est 1.
Le comportement de l’agent est défini par une politique π : {S,A} → [0,1], qui guide l’agent
de manière probabiliste en spécifiant, pour chaque état s la probabilité de réaliser l’action a (et
donc ∑a π(s,a) = 1). Le but de l’apprentissage par renforcement va être de trouver la politique
optimale π
∗ maximisant la récompense à long terme 1
.
1. L’apprentissage par renforcement n’utilise que l’état courant pour prendre une décision, il suppose donc que
toute l’information nécessaire est contenue dans cet état. Le problème est donc considéré comme étant Markovien,
ce qui est rarement le cas en pratique en robotique. Si le problème est non markovien, c’est a dire si pour un
même état deux actions différentes sont optimales en fonction d’une variable inconnue au robot, l’apprentissage par
Robotique Mobile - david.filliat@ensta-paristech.fr 68CHAPITRE 7. APPRENTISSAGE PAR RENFORCEMENT
La récompense à long terme, que nous appellerons revenu Rt
, peut être définie de différentes
manières en fonction de la tâche considérée. Si la tâche consiste à répéter des épisodes qui
durent un nombre de pas de temps fixe, le revenu pourra être la somme des récompenses instantanées
pendant un épisode. Si au contraire la tâche se déroule de manière continue, le revenu
pourra se définir comme la somme des récompenses futures pondérées par une exponentielle
décroissante :
Rt =
∞
∑
k=0
γ
k
rt+k+1
où γ ∈ [0,1] est un facteur indiquant l’importance que l’on accorde aux récompenses futures.
Les algorithmes d’apprentissage par renforcement que nous verrons plus loin utilisent quasiment
tous une fonction de valeur V
π
(Figure 7.3) qui permet, pour une politique π donnée,
d’estimer le revenu moyen (les récompenses futures) pour un état donné si l’on suit la politique
considérée :
V
π
(s) = Eπ(Rt
|st = s)
FIGURE 7.3 – La fonction de valeur optimale dans notre exemple : pour chaque état, le niveau
de gris indique la récompense à long terme qui sera obtenue en prenant le chemin le plus
court vers le but.
Ces fonctions de valeurs peuvent aussi se définir non pas pour un état mais pour un état et
une action réalisée dans cet état :
Q
π
(s,a) = Eπ(Rt
|st = s,at = a)
La fonction de valeur pour un état s étant la moyenne des Q
π
(s,a), pondérées par la probabilité
de chaque action :
V
π
(s) = ∑a
π(s,a)Q
π
(s,a)
renforcement fournira la politique optimale, mais seulement dans l’ensemble des politiques “myopes”, n’ayant pas
toutes les informations pour une décision optimale.
69 Robotique Mobile - david.filliat@ensta-paristech.fr7.1. FORMALISATION
Une propriété essentielle de ces fonctions de valeur va permettre de créer les différents algorithmes
d’apprentissage, il s’agit de la relation de récurrence connue sous le nom d’équation de
Bellman :
V
π
(s) = ∑a
π(s,a)∑
s
0
P
a
ss0
R
a
ss0 +γV
π
(s
0
)
Cette équation traduit une cohérence de la fonction de valeur en reliant la valeur d’un état à
la valeur de tous les état qui peuvent lui succéder . Elle se déduit simplement de la définition de
v
π de la manière suivante :
V
π
(s) = Eπ(Rt
|st = s)
= Eπ(
∞
∑
k=0
γ
k
rt+k+1|st = s)
= Eπ(rt+1 +γ
∞
∑
k=0
γ
k
rt+k+2|st = s)
= ∑a
π(s,a)∑
s
0
P
a
ss0
"
R
a
ss0 +γEπ
∞
∑
k=0
γ
k
rt+k+2|st+1 = s
0
!#
= ∑a
π(s,a)∑
s
0
P
a
ss0
R
a
ss0 +γV
π
(s
0
)
La fonction de valeur permet de caractériser la qualité d’une politique, elle donne, pour chaque
état, le revenu futur si l’on suit cette politique. Elle permet également de comparer les politiques
en définissant un ordre partiel :
π ≥ π
0 ⇔ ∀s,V
π
(s) ≥ V
π
0
(s)
Cet ordre permet de définir la fonction de valeur de la politique optimale (Figure 7.3) que
l’apprentissage par renforcement va chercher à estimer :
V
?
(s) = max
π
V
π
(s)
fonction qui peut aussi s’exprimer pour un couple état-action :
Q
?
(s,a) = max
π
Q
π
(s,a)
avec la relation suivante :
Q
?
(s,a) = E(rt+1 +γV
?
(st+1)|st = a,at = a)
Il est également possible d’écrire une relation de récurrence pour la fonction de valeur optimale
qui sera légèrement différente de l’équation de Bellman. On parle alors d’équation d’optimalité
de Bellman, qui peut s’écrire :
V
∗
(s) = max
a
E (rt+1 +γV
∗
(st+1)|st = s,at = a)
= max
a ∑
s
0
P
a
ss0
R
a
ss0 +γV
∗
(s
0
)
Robotique Mobile - david.filliat@ensta-paristech.fr 70
Intelligence Artificielle et Syst`emes Multi-Agents
Badr Benmammar
To cite this version:
Badr Benmammar. Intelligence Artificielle et Syst`emes Multi-Agents. Ecole d’ing´enieur. 2009. ´
HAL Id: cel-00660507
https://cel.archives-ouvertes.fr/cel-00660507
Submitted on 16 Jan 2012
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Intelligence Artificielle
et
Systèmes Multi-Agents
Badr Benmammar
bbm@badr-benmammar.comPlan
La première partie : L’intelligence artificielle (IA)
Définition de l’intelligence artificielle (IA)
Domaines d’application de l’IA
La reconnaissance de formes
Le traitement automatique des langues
Les systèmes experts
L’apprentissage automatique
L’intelligence artificielle distribuée (IAD)Plan
La deuxième partie : La technologie Agent
Définition d’un agent
Les agents intelligents et les agents mobiles
Les caractéristiques multidimensionnelles d’un agent
Architecture concrète pour un agent
Les agents logiques
Les agents réactifs
Les agents BDI
Les agents multi-niveaux
Modèle type d’un agentLa première partie :
L’intelligence artificielle (IA)Définition de l’intelligence artificielle (IA)
L’IA Désigne la simulation des mécanismes de la pensée par un
ordinateur
La faculté de reproduire un raisonnement par des moyens informatiques
Un ensemble de réalisations et de recherches qui essaient d'imiter
artificiellement les performances humaines
L'émergence des systèmes ''adaptatifs''Domaines d’application de l’IA
Systèmes
experts
Apprentissage
automatique
Traitement
automatique des
langues
Reconnaissance des
formes, des visages et la
vision en généralLa reconnaissance de formesLa reconnaissance de formes RdF
La reconnaissance de formes (ou parfois reconnaissance de
motifs) est un ensemble de techniques et méthodes visant à
identifier des motifs à partir de données brutes afin de prendre
une décision dépendant de la catégorie attribuée à ce motif.Définition
L’homme est le plus parfait des systèmes de RdF.
Reconstitution sur «machine» des fonctions typiquement
humaines:
Perception ;
Analyse et représentation ;
Interprétation.Analogies Système de RdF
Composantes d’un système de RdF :
Mécanique (satellite, bras d’un robot, …)
Saisie (caméra, scanner, micro, …)
Electronique (carte mémoire, CPU, …)
ALGORITHMIQUEProcessus de RdF
Les informations issues du monde réel sont généralement :
trop volumineuses
peu pertinentes
Le processus de RdF est un processus de réduction progressive et sélective
de l’informationProcessus de RdF
Etapes de traitement d’un processus de RdF:
Prétraitements
binarisation, segmentation, élimination du bruit, normalisation, …
Extraction des informations pertinentes
parole: fréquence, …
image: contours, …
Représentation de ces informations en vue de leur classification
vecteur, graphe,
Classification de la forme
apprentissage/décision,
+_ Quantité d’informationsLe traitement automatique des
languesLe traitement automatique des langues
Le Traitement automatique des langues est une discipline à
la frontière de :
La linguistique ;
L’informatique ;
L’intelligence artificielle.
Concerne l’application de programmes et techniques
informatiques à tous les aspects du langage humain. Applications
La traduction automatique ;
La correction orthographique ;
La recherche d'information et la fouille de textes ;
Le résumé automatique de texte ;
La génération automatique de textes ; Fouille de Texte (Text Mining)Qu’est-ce que le Text Mining ?
Le Text Mining est l’ensemble des :
Technologies et méthodes
… destinées au traitement automatique
… de données textuelles
… disponibles sous forme informatique,
… en assez grande quantité
… en vue d’en dégager et structurer le contenu, les thèmes dans une
perspective d’analyse rapide de découverte d’informations cachées ou de
prise automatique de décisionDéfinition
Text Mining
Procédé consistant à synthétiser (classer, structurer, résumer, …) les
textes en analysant les relations et les règles entre unités textuelles
(mots, groupes, phrases, documents) Processus de Text Mining: Vue simplifiée
Produit des vecteurs de fréquence
des mots importantsAnalyse et Préparation
Corriger l'orthographe
Eliminer les mots vides
Découper les textes en unités
Associer des termes à une catégorie
grammaticale ou sémantique
Réduire le nombre de termes à traiterCalculs de fréquence des termesRéduction des dimensions
Réduire les dimensions de la table de fréquences
En déterminant les termes les plus significatifs
En groupant les termes par affinité (profile)Domaines d’application
Exploration du contenu des documents
Questions ouvertes dans une enquête
Commentaires et plaintes des clients
Analyse des réclamations de garantie
Affectation de documents à des thèmes prédéfinis
Traitement des e-mails (redirection, filtrage)
Recherche d’information
Interrogation de textes par concepts, mots-clés, sujets, phrases visant à
obtenir des résultats triés par ordre de pertinence, à la GoogleEtapes de la fouille de textes
Sélection de textes
Extraction des termes
Analyse grammaticale
Filtrage des termes extraits
Transformation
Réduction des dimensions
Classification
Visualisation des résultats
Interprétation des résultatsLes systèmes expertsLes systèmes experts
Un système expert est un logiciel capable de répondre à
des questions, en effectuant un raisonnement à partir de
faits et de règles connus. Il peut servir notamment
comme outil d’aide à la décision. Les systèmes experts
Un système expert se compose de 3 parties :
Une base de faits ;
Une base de règles ;
Un moteur d’inférence.Faits et règles
Faits
Ensemble de vérités connues
Règles
Partie condition : prémisses
Partie action : conclusion, calcul, affichage ...
Éventuellement : coefficient de confiance
SI condition ALORS action [coefficient]Les systèmes experts
Pour l’essentiel, ils utilisent la règle d'inférence suivante :
Si P est vrai
(fait ou prémisse) et si on sait que P implique Q
(règle) alors, Q est vrai
(nouveau fait ou conclusion). Le moteur d’inférence
Le moteur d’inférence est capable d’utiliser faits et règles pour produire de
nouveaux faits, jusqu’à parvenir à la réponse à la question experte posée.
La plupart des systèmes experts existants reposent sur des mécanismes de
logique formelle et utilisent le raisonnement déductif. Pourquoi un SE ?
Problèmes mal formalisés ou dont la formulation évolue
Médecine : nouveaux examens, nouvelles connaissances, nouvelles
thérapies
Pas d’algorithme connu (ou algorithme trop complexe)
Reconnaissance de l’écriture
Jeu d’échecs
Affectation des ressources, ordonnancementLes systèmes expertsArchitecture
Base
de faits
Moteur d’inférence
Filtrage
Sélection
Assertion Exécution
Base de
règlesMode de raisonnements
Il existe de nombreux types de moteurs, capables de traiter différentes
formes de règles logiques pour déduire de nouveaux faits à partir de la base
de connaissance.
On distingue souvent trois catégories, basées sur la manière dont les
problèmes sont résolus :
Les moteurs - dit à
« chaînage avant
» - qui partent des faits et règles
de la base de connaissance, et tentent de s’approcher des faits
recherchés par le problème.
Les moteurs - dits à
« chaînage arrière
» - qui partent des faits
recherchés par le problème, et tentent par l’intermédiaire des règles, de
« remonter » à des faits connus,
Les moteurs - dits à
« chaînage mixte
» - qui utilisent une combinaison
de ces deux approches chaînage avant et chaînage arrière. Chaînage avant
Raisonnement guidé par les données :
Détecter les règles dont les prémisses sont vérifiées (filtrage)
Sélectionner la règle à appliquer
Appliquer la règle
Recommencer jusqu'à ce qu'il n'y ait plus de règle applicableChaînage arrière
But initial placé au sommet d’une pile
Détection des règles qui concluent à ce but
Résolution de conflits
Application de la règles, i.e, les éléments des prémisses deviennent de
nouveau sous- buts à atteindre.
Arrêt : pile vide ou aucune règle applicableExercice
Exercice 1
Soit la base de règles suivantes :
R1 : (┐A B) P
R2 : (P et Q) F
R3 : (C A) Q
R4 : F (D K)
R5 : K (M et L)
La base initiale de faits est : (A, D).
Prouvez le fait M par chaînage avant.
Projet IP-SIG : Signalisation g´en´erique du monde IP
Badr Benmammar
To cite this version:
Badr Benmammar. Projet IP-SIG : Signalisation g´en´erique du monde IP. 3`eme cycle. 2005.
HAL Id: cel-00682308
https://cel.archives-ouvertes.fr/cel-00682308
Submitted on 26 Mar 2012
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Projet IP-SIG
Signalisation générique du monde IP
21 Juillet 2005
Badr BENMAMMAR
Université Bordeaux 12
PLAN
• Présentation du projet
– Objectif du projet et motivations
– Organisation du projet
• Partenaires et durée
• Les sous-projets • Échéances et livrables
– Rappels sur la signalisation IPSIG
• Présentation des travaux
– Sous-projet 3
• Réalisation du protocole GiSP
• Tests du protocole GiSP
• Démonstration – Sous-projet 4
• Définition d’un SLS dynamique
• Réalisation de l’environnement dynamique
• Démonstration
– Etude des travaux en cours à l’IETF
• Démonstration 3
Motivations et Objectif
• Motivations
– Plusieurs protocoles de signalisation existants
• RSVP, RSVP-TE, CR-LDP, Radius, Diameter
– Support des besoins de QoS, sécurité et mobilité
• Objectif
– Définition d’une signalisation Universelle
• Unifier le processus de signalisation
• Définition de SLS et de SLS dynamique 4
Organisation du projet
• Projet Exploratoire – 24 mois + 6 mois
• Partenaires :
• ALCATEL, ENST, ISEP, LIP6, LIPN, UTT et THALES
• Quatre sous-projets
– SP1 : SLS et protocoles de signalisation
• Livrable 1.1 : Définition d'un SLS
• Livrable 1.2 : Comparaison des protocoles de signalisation
– SP2 : Les briques de base et l'architecture globale
• Livrable 2.1 : Architecture du système de signalisation
• Livrable 2.2 : Spécification des briques de base
– SP3 : Le protocole GiSP (Generic Signaling Protocol)
• Livrable 3.1 : Réalisation du démonstrateur
• Livrable 3.2 : Tests du démonstrateur
– SP4 : Dynamique de l’environnement
• Livrable 4.1 : Définition d’un SLS dynamique
• Livrable 4.2 : Maquette de l'environnement dynamique5
Livrables et échéances
Livrable 3.1
Réalisation
T0+20
Septembre 04
Livrable 4.2
Maquette
Livrable 3.2
Tests
T0+24
Janvier 05
Livrable 4.1
Déf. d’un SLS
dynamique
Livrable 2.2
Spec des briques
de base
T0+18
Juillet 04
Livrable 2.1
Arch. du système
de signalisation
Livrable 1.2
Étude des
protocoles
T0+12
Livrable 1.1
déf. D’un SLS
T0+9
SP4
Dynamique de
l’environnement
SP3
Le protocole
GSP
SP2
Architecture
globale
SP1
Définition d’un
SLS et
protocoles de
signalisation6
Livrables et échéances - Nouvelle planification
Livrable 3.1.1 :
Réalisation
Livrable 3.1.3 : QoS NSLP
(NSIS WG)
T0+26
Mars 05
Livrable 4.2 :
Maquette
Livrable 3.1.2 : Emulation
GIMPS (NSIS WG)
Livrable 3.2 :Tests
T0+30
Juillet 05
Livrable 4.1
Déf. d’un SLS
dynamique
Livrable 2.2
Spec des
briques de
base
T0+18
Juillet 04
Livrable 2.1
Arch. du
système de
signalisation
Livrable 1.2
Étude des
protocoles
T0+12
Livrable 1.1
déf. D’un SLS
T0+9
SP4
Dynamique de
l’environnement
SP3
Le protocole GSP
SP2
Architecture
globale
SP1
Définition
d’un SLS et
protocoles de
signalisation7
Rappels - Architecture protocolaire
• Architecture protocolaire de NSIS
NSIS Signaling
Layer Protocol
“NSLP”
NSIS Transport
Layer Protocol
“NTLP”
NSLP pour QoS
NSLP pour
middlebox
NSLP pour …
IP layer
NSIS Transport
Layer Protocol
“NTLP”
Signalisation IPSIG
(GiSP : Generic Service Signaling Protocol)8
Rappels - Besoins du protocole GiSP
• Fonctionnalités de signalisation
• Deux modes de fonctionnement
– Path coupled
– Path decoupled
• Gestion des états
– Installer/modifier/supprimer un état
• Sensibilité au changement de routage
• Sensibilité à la mobilité
• Fonctionnalités de transport
• Transport fiable et non fiable
• Transport sécurisé
• Contrôle de congestion
• Fragmentation
• Bundling9
Rappels – Le protocole GiSP (Rappels)
• Définition d’un format de message
– ::=
• Définition de l’en-tête
– SM Flag : Mode de fonctionnement
– M_Type : Type de message
– New
• Permet d’installer une nouvelle session (rapidement sans vérifier si la session est déjà établie)
– Mod
• Établit une session dans le sens inverse du flux de données (de New)
• Modifier une session établie (sens forward et Backward) • Établit une session dans un nouveau chemin suite à un changement de route
– Info
• Échange de l’information entre éléments de signalisation
– Notification des erreurs
• Supporter le management d’état
– Rafraîchissement des états
– Suppression des états
• Définition d’un ensemble d’objets
– Transportant les informations nécessaires pour réaliser les fonctionnalités
du protocole GiSP10
Rappels
– Le protocole GiSP (Rappels)
• Caractéristiques
– Etablissement rapide d’un état dans un nœud en ½ RTT:
• Un message New (ou Mod) contient toute l’information pour établir un état
– Réduction du trafic de détection du changement de routage
• Au lieu d’envoyer un message complet, GISP envoie seulement l’identification de
session
– Mobilité: changement de la CoA (Care of Address)
• Utiliser l’identification de session et non l’identification de flux pour identifier une session de bout en bout
• Mécanismes développés
– Proposition d’un mécanisme de rafraîchissement performant
• Réduction du trafic de rafraîchissement
• Optimisation la gestion des timers
– Mise en place d’un transport fiable et non fiable
• Les messages sont explicitement acquittés ou non selon le besoin
– Mise en place d’un contrôle de congestion
• Dans le cas où GISP ne connaît pas le nœud suivant (mode non-connecté) GISP limite le trafic de signalisation traversant une interface
• Dans le cas où GISP connaît le nœud suivant (mode connecté) GISP applique un mécanisme de contrôle de congestion qui s’inspire des mécanismes de TCP, SCTP et DDCP (contrôle de congestion par fenêtre en supportant le mode fiable et non fiable).Le projet IPSIG
Dynamique de l’environnement12
Dynamique de l’environnement
Deux Aspects :
I. Négociation dynamique de SLA/SLS
II. Impact de la mobilité du terminal sur la
QoS13
Introduction
I. Négociation dynamique de SLA/SLS
– Identification des besoins de l’utilisateur
– Agents pour la négociation de SLA/SLS
– Protocole de négociation de paramètres de SLS14
Protocole SLN NSLP
• Protocole de négociation de paramètres de
SLS
– Environnement NSIS
NSIS Signaling
Layer Protocol
“NSLP”
NSIS Transport Layer
Protocol “NTLP”
NSLP pour QoS
NSLP pour
middlebox
NSIS Transport Layer
Protocol “NTLP”
NSLP pour la négociation15
Protocole SLN NSLP
- Négociation intra ou inter domaines.
• Entités de négociation16
Protocole SLN NSLP
• Architecture globale17
Protocole SLN NSLP - Temps de service : période de garantie du niveau de service - Scope : point d’entrée et de sortie d’un domaine - Identification du trafic : @IP, Port source/destination... - Garantie de performance : délai, gigue, taux de perte, bande
passante - Description et conformité du trafic : taille des paquets, débit
crête, paramètres du Token Bucket. - Traitement d’excès : lissage, marquage, élimination - Mode de négociation : SLS prédéfini ou non - Intervalle de renégociation : dépend du type de négociation. - Priorité et fiabilité : MDT, MTTR
• Paramètres du SLS de QoS18
Protocole Messages SLN NSLP
- Negotiate : Emis du SNI vers le SNR, permet de spécifier les
attributs sur lesquels on veut négocier ainsi que leurs valeurs.
- Revision : Emis par le SNR vers le SNI pour proposer une
alternative aux attributs et valeurs reçus dans le message
Negotiate.
- Response : Emis par le SNR ou SNI suite a un message
précèdent contenant un objet Response Request.
- Modify : Emis par le SNI vers le SNR en spécifiant le SLS ID
sur le quel la modification va porter
- Notify : Emis par le SNR (ou SNF) pour demander au SNI de
dégrader ou rétablir un niveau de service qui a été déjà
négocié.
- Release : Emis par le SNI vers le SNR pour résilier un SLS déjà
négocié.
• Messages SLN NSLP19
Protocole SLN NSLP
00 /
30 ms
D=100ms ; G=20ms ;
P=0,1% ; D= 704
Kbit/s
9h17h
LundiJeudi
@IP SNI
@IP SNR
@IP Host A
@IP Host B
Mode /interv
alle
Temps de Garantie de Performance
Service
Identification du Scope
trafic
00 /
30 ms
D<150ms ; G<30ms ;
P<1% ; D= 696 Kbit/s
9h17h
LundiJeudi
@IP SNI
@IP SNR
@IP Host A
@IP Host B
Mode /
intervalle
Temps de Garantie de Performance
Service
Identification du Scope
trafic
SLS Demandé pour la visioconférence
SLS accepté par le SNR
• Exemples de négociation20
Cas d’une Visioconférence
SNI / SIP
PROXY SNF SNR Host
Negotiate
B
Communication
Host
A
Negotiate
Revision
Revision
Response {Ack}
Response {Ack}
Reserve {Qspec}
Reserve {Qspec}
Reserve {Qspec}
Reserve {Qspec}
Invite
Invite
180 Ringing
180 Ringing
ACK
200 OK
200 OK
SLN NSLP QoS NSLP SIP21
Cas de la téléphonie IP
SNI / SIP
PROXY SNF Host B SNR
Negotiate
Communication
Host A
Negotiate
Response {Ack}
Response {Ack}
Reserve {Qspec}
Reserve {Qspec}
Reserve {Qspec}
Reserve {Qspec}
Invite
Invite
180 Ringing
180 Ringing
ACK
200 OK
200 OK
SLN NSLP QoS NSLP SIP
183 Progress
Bye
OK
Release {SLS ID}
Release {SLS ID} 22
Conclusion
• SLN NSLP est une proposition de protocole de
signalisation dans la bande pour la négociation de
niveau de service.
• SLN NSLP est indépendant du modèle de QoS grâce a
l’architecture de signalisation générique définie dans
NSIS.
• SLN NSLP est indépendant des objets de négociation
donc il est réutilisable.23
Dynamique de l’environnement
2. Impact de la mobilité du terminal sur QoS
– Réservation de ressources à l’avance
• Messages de QoS NSLP
• Profil de mobilité fourni par l’interface utilisateur
MSpec =
» : the MSpec identifier
» : ,
» : ,, etc.
– Procédure de handover
• Protocole CTP (Context Transfer Protocol)24
∑ Pij = 1
=
n
j 1
∑
=
n
i 1
Pi (tr) * Pij Pj (tr+1) =
Cj
Cn
Cn-1
Ci
C2
C1
tr+1
tr
P1j
P2j
Pij
Pnj
Pn-1j
P1
Pn
Pn-1
Pi
P2
Détermination du MSpec
• Basée sur les chaînes de Markov en temps continu
• Le système est dans l’état i si le terminal mobile est dans la
cellule Ci
Pij : probabilité de transition
de la cellule Ci vers la cellule Cj
Pi (tr) : probabilité de localisation
du terminal mobile dans la
cellule Ci à l’instant tr 25
∑
=
m
d 1
Pij Pij = (d) /m
Profil de mobilité du terminal - La matrice de transition contenant les Pij
M = [Pij] [N*N]
Pij(d): probabilité de transition de la cellule i vers la cellule j
durant d associations
m: nombre d’associations
-Le vecteur contenant les Pi (to)
V = [Pi(to)] [N]
Pi (to): probabilité de localisation du terminal mobile dans la
cellule Ci à l’instant to26
{ 0: no handover 1: vertical handover UMTS HD [Cell ID, App ID] =
Profil de mobilité du terminal - Les futures localisations du terminal mobile
MSpec (tr) = {Cj / Pj (tr+1) ≥ x }
x : un seuil fixe ou variable utilisé pour sélectionner
les cellules
- La décision de handover27
• Procédure de réservation de ressources à
l’avance
- Extension de QoS NSLP
• Différents scénarios (environnement HMIPv6) - Réservation à l’initiative du demandeur ou du
récepteur - Entre un terminal fixe et un terminal mobile - Entre terminaux mobiles
• Procédure de handover - Horizontal - Vertical
Protocole MQoS NSLP28
• Impact du seuil x
Simulations29
• Protocole de réservation de ressources à l’avance - Dans un environnement NSIS - Extension de QoS NSLP
• Réservations basées sur l’objet MSpec - Déterminé par le terminal mobile - Utilisation des chaînes de Markov en continu
• Méthode hybride
• Validation
Conclusion30
Maquette
Utilisateur Fournisseur
Jade
Négociation
Gold | prix
Silver | prix
Bronze | prix
Best effort | prix
• (Re)négociation à l’initiative de l’utilisateur31
Maquette
• (Re)négociation à l’initiative du fournisseur
Réseau
DiffServ
EndUserGenerator
New EndUser
Utilisateur Fournisseur
data Traffic Sender
Jade
J-Sim
Négociation
Nouveau
Prix fonction
de la charge
du réseau
Decision
finale
Gold | prix
Silver | prix
Bronze | prix
Best effort | prix32
Architecture de l’interface proposée
Fournisseur Réseau
Terminal Utilisateur
Interface graphique/Messages/Capteurs
Couche Gestion de profil
Apprentissage (SOM)
Couche de Contrôle
Couche de négociation Couche protocolaire
Profils Propriétés
Paramètres de
performance SLS33
Identité des personnes : rôles, préférences, permissions, etc.
Localisation des personnes : domicile, gare, travail, etc.
Période : l’heure, le jour, le mois, etc.
Contraintes : des utilisateurs, des applications, etc.
Active device : Laptop, PC, cellular
Connectivité : LAN, WLAN, cellular network
Informations contextuelles
Les r´eseaux sans fil et la nouvelle signalisation IP
Badr Benmammar
To cite this version:
Badr Benmammar. Les r´eseaux sans fil et la nouvelle signalisation IP. 3`eme cycle. 2004.
HAL Id: cel-00660842
https://cel.archives-ouvertes.fr/cel-00660842
Submitted on 17 Jan 2012
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Les réseaux sans fil et la nouvelle
signalisation IP
Badr BENMAMMAR
Université Bordeaux 1
1
École DNAC d'hiver
Sur le Nil, Égypte,
du 11 au 18 décembre 20041
PLAN
• Introduction
• QoS NSLP
• Réservation de ressources à l’avance
• Format du MSpec
• Réservation de ressources à l’avance avec QoS NSLP
• Le transfert de contexte
• La procédure de handover
• Méthodes de prédiction
• Conclusion
22
IP-SIG (1/2)
Les objectifs de ce projet sont :
La définition d'une architecture de signalisation universelle (les besoins de QoS, de
mobilité et de sécurité)
La définition d'un SLS standard
Une étude prospective sur la dynamisation du SLS
1. ENST
2. ALCATEL
3. UTT
4. Université de Paris 13
5. ISEP
6. LIP6
7. THALES
Partenaires du projet
33
Quatre sous-projets:
Sous-projet 1 – SLA-SLS et protocoles de signalisation (Responsable ALCATEL)
Sous-projet 2 – Les briques de base et l'architecture globale (Responsable LIP6)
Sous-projet 3 – Le protocole GSP (Generic Signaling Protocol) (Responsable ISEP)
Sous-projet 4 – Dynamique de l’environnement (Responsable LIPN)
IP-SIG (2/2)
Négociation dynamique
de SLA/SLS
Impact de la mobilité
sur la signalisation
44
NSIS (Next Steps In Signaling)
• Standardiser une architecture comprenant deux couches:
- NTLP : NSIS Transport Layer Protocol
- NSLP : NSIS signaling Layer Protocol
IP
IP Layer Security
UDP TCP SCTP DCCP
Transport Layer Security
GIMPS: Messaging Layer
GIMPS Encapsulation GIMPS State Maintenance
NTLP
Signaling Application 1
Signaling Application 2
Signaling Application 3
NSLP
55
QoS NSLP
• QoS NSLP permet de générer une signalisation pour
fournir un certain niveau de QoS indépendamment du modèle
de QoS (Diffserv, Intserv,...)
• QoS NSLP + NTLP RSVP
6
• La création d’un état
• Le rafraîchissement d’un état
• La modification d’un état
• L’élimination d’un état6
Les messages de QoS NSLP
• Reserve : le seul à manipuler l’état de la réservation (rafraîchir,
créer, supprimer).
• Query : demande des informations aux nœuds QNE (les ressources
disponibles)
• Response : permet d’envoyer un résultat associé à un message
antérieur
• Notify : permet d’informer un nœud sans demande préalable
77
• Sender Initiated Reservation
Réservation de ressources avec QoS NSLP (1/2)
RESPONSE
NI NF NF NR
RESERVE
RESERVE
RESERVE
RESPONSE
RESPONSE
88
Réservation de ressources avec QoS NSLP (2/2)
• Receiver Initiated Reservation
NR NF NF NI
RESERVE
RESERVE
RESERVE
RESPONSE
RESPONSE
RESPONSE
QUERY
QUERY
QUERY
99
• NSIS (Next Steps In Signaling): fournir une signalisation
universelle
• Objectif: étudier l’impact de la mobilité sur la signalisation
NSIS
• Proposition : utiliser les messages de QoS NSLP afin de faire
des réservations à l’avance
• La QoS
• La sécurité
• La mobilité
10
Proposition10
Réservation de ressources à l’avance
• Réservation à l'avance dans tous les endroits que l'utilisateur
peut visiter
• Un profil de mobilité est déterminée soit par le réseau, soit par
le terminal mobile
• L’objet MSpec (Mobility Specification) détermine les futures
localisations du MH (Mobile Host)
• L’objet MSpec est inclus dans les messages de QoS NSLP
1111
Travaux réalisés dans les réseaux mobiles (1/2)
• Anup Kumar Talukdar, B. R. Badrinath, Arup Acharya. MRSVP: a
resource reservation protocol for an integrated services network
with mobile hosts, ACM Journal of Wireless Networks, vol. 7, 2001
12
• MSPEC (Mobility Specification): pas de format, les futures localisations
• La réservation active: si les paquets de ce flux passent par ce lien afin d’arriver au récepteur
• La réservation passive: si les ressources sont réservées pour ce flux sur le lien, mais les
paquets actuels pour ce flux ne sont pas transmis sur ce lien12
• Min-Sun Kim, Young-Joo Suh, Young-Jae Kim, Young Choi. A
Resource Reservation Protocol in Wireless Mobile Networks.
ICPP Workshops, Valencia, Spain September 03 - 07, 2001
Travaux réalisés dans les réseaux mobiles (2/2)
• La classe Free : elle représente les ressources utilisées en BE
• La classe Reserved : elle représente les ressources réservées et actuellement
utilisées, pour un flux spécifique
• La classe Prepared : elle représente les ressources réservées pour un flux spécifique
et qui ne sont pas actuellement utilisées
1313
Inconvénients
• Le nombre de flux qui peut être supporté par le routeur est
réduit
• Le MSPEC est très difficile à déterminer à l’avance
Avantages
• Meilleure QoS (délai et pertes de paquets)
• Application en temps réel.
1414
Format du MSpec
MSpec =
• : identificateur unique du MSpec
• : ,
• : ,,, etc.
1515
Procédure de réservation de ressources à l’avance
avec QoS NSLP (fixe,mobile)
-1 : Router Advertissement, un bit Q
0 : Registration Request, bit Q, QSpec et MSpec
1 : NOTIFY: QSpec et MSpec
2 : RESERVE: QSpec
3 : RESERVE
4 : RESPONSE
5 : RESPONSE
Réservation de ressources à l’avance avec
QoS NSLP
CN
HA Internet
HN
MAP
AR AR AR
MH
FN
2
4
5
5
0 -1
3 1 3
NI
NF NF NF
NF
NR
1616
Le Protocole CTP Context Transfer Protocol
(WG Seamoby)
17
• Contexte: l'information nécessaire sur l'état actuel d'un service afin de le
rétablir sur un nouveau sous-réseau
• les services candidats:
• Authentication, Authorization et Accounting (AAA)
• Header Compression
• Quality de Service (QoS)
• Point to point protocol (PPP)
• Politiques17
Le déclenchement de transfert
de contexte (1/3)
• Déclenché à l’initiative du :
– nœud mobile (mobile controlled).
– pAR ou nAR (network controlled).
• Exemple : mobile controlled, initié par le nœud mobile
MN nAR pAR
CT trigger
CTAR
CT Request
CTD
1818
Le déclenchement de transfert
de contexte (2/3)
MN nAR pAR
CT trigger
CTAR
CTD
CTDR
• Exemple : network controlled, initié par le pAR
1919
Le déclenchement de transfert
de contexte (3/3)
MN nAR pAR
CT trigger
CT Request
CTAR
CTD
CTDR
• Exemple : network controlled, initié par le nAR
2020
La procédure de handover
21
La procédure de handover
CN
HA Internet
HN
MAP
AR AR AR
MH
FN
MH
MIPv6
NOTIFY : en incluant le nouveau MSpec
RESERVE
1
2 CTD
CT Request
Analyse le nouveau MSpec21
Exemple
22
AR1
MAP
AR2 AR3 AR4
Cell1 Cell2 Cell3 Cell4
MH
MSpec1 = {Cell1, Cell3}22
Exemple
23
AR1
MAP
AR2 AR3 AR4
Cell1 Cell2 Cell3 Cell4
MSpec1 = {Cell1, Cell3}
MH
MSpec2 = {Cell2, Cell4}23
Exemple
24
AR1
MAP
AR2 AR3 AR4
Cell1 Cell2 Cell3 Cell4
MSpec1 = {Cell1, Cell3}
MH
MSpec2 = {Cell2, Cell4}24
Exemple
25
AR1
MAP
AR2 AR3 AR4
Cell1 Cell2 Cell3 Cell4
MSpec1 = {Cell1, Cell3}
MH
MSpec2 = {Cell2, Cell4}25
26
i = 1
Ci : cellule courante
MSpeci
i = 1
∀ C ∈ MSpec1 : créer une
réservation passive pour la
cellule C
Oui
handover après une période
t1 passée dans la cellule C1
i = i+1
Non
La réservation dans la cellule Ci devient
active
∀C∈{MSpeci-MSpeci-1-Ci-1} : créer une
nouvelle réservation pour la cellule C
∀C∈{ MSpeci-1- MSpeci-Ci}: supprimer
la réservation pour la cellule C
Oui
La réservation devient
passive pour la cellule Ci-1
Supprimer la
réservation pour la
cellule Ci-1
handover après une période
ti passée dans la cellule Ci
Non Ci-1∈ MSpeci
Les actions réalisées par le MAP dans le cas d’une communication
fixe-mobile26
Procédure de réservation de ressources à l’avance avec
QoS NSLP (mobile-mobile)
27
Internet
HA
HN
AR
AR
MAP2
AR
AR AR
MH1
MAP1
0
MH2
2
AR
1
3
4
5
6
7
7
8
8
9
9
Réservation de ressources à l’avance avec
QoS NSLP
0 : Router Advertissement , le bit Q.
1 : Registration Request, QSpec et MSpec2
2 : NOTIFY, QSpec et MSpec2
3 : Router Advertissement, le bit Q
4 : Registration Request, QSpec et MSpec1
5 : NOTIFY, QSpec et MSpec1
6 : RESERVE, QSpec
7 : NOTIFY
8 : RESERVE
9 : RESERVE27
La procédure de handover
28
Internet
HA
HN
AR
MAP2
AR
MH1
MAP1
4
5
5
6
6
AR AR
MH1
MH2
AR
3
CT Request
CTD
2
MH2
1
AR
MIPv6
MIPv6
La procédure de handover
1 : RESERVE
2 : RESPONSE
3 : NOTIFY
4 : RESERVE
5: NOTIFY, l’ancien MSpec1 et le
nouveau MSpec1
6 : RESERVE
Analyse le nouveau
MSpec228
Modélisation par les chaînes de Markov
• Le système est un modèle pouvant évoluer entre n états définis par
l’ensemble: C = (C1, C
2, ........Ci........
Cn)
• Le système est à l’état i = le terminal mobile se trouve dans la cellule Ci
• Pij : la probabilité de transition de la cellule Ci vers la cellule Cj
• Pi (t) : la probabilité pour que le terminal mobile se trouve dans la cellule
Ci à l’instant t
∑
Pij = 1, i = 1 à n et 0 ≤ Pij ≤ 1
=
n
j 1
∑=
n
i 1
Pi (t) * Pij
Pj (t+1) =
Cj
Cn
Cn-1
Ci
C
2
C1
t+1
t
P1j
P2j
Pij
Pnj
Pn-1j
P1
Pn
Pn-1
Pi
P
2
2929
Le profil de mobilité (1/2)
• Construire un modèle comportemental pour l’utilisateur
• il contient les informations suivantes :
- Un identificateur unique de l’utilisateur : user_id
- Les informations personnelles de l’utilisateur
- nom
- prénom
- age
- adresse
- ...
- Les préférences de l’utilisateur
Exemple : quand l’utilisateur se déplace vers la cellule1, qui couvre le Forum,
il commence toujours par le lancement d’un jeu vidéo durant 1h.
3030
Le profil de mobilité (2/2)
- M = [Pij] [N*N] : une matrice de transition qui contient les Pij
- V = [Pi(0)] [N] : un vecteur qui contient les Pi(0). (Pi (0): la probabilité
pour que le terminal mobile se trouve dans la cellule Ci à l’instant 0)
- Le MSpec (Mobility Specification): un ensemble dynamique, il est
modifié après chaque handover
3131
Calculer la matrice M et le vecteur V (1/2)
• Besoin de m connexions afin de déterminer les Pi(0) et les Pij
• l(d) : le nombre de transitions dans le système pour la dème connexion (1≤ d ≤ m)
• tij(d) : le nombre de transition de la cellule i à la cellule j pendant la dème connexion
• li(d) : le nombre de transitions sortantes de la cellule i pendant la dème connexion
32
• M = [Pij] [N*N]
• On le calcule de la manière suivante : l
i(d) =
∑=
n
j 1
tij(d)
∑=
n
i 1
li(d) = l(d)32
Calculer la matrice M et le vecteur V (2/2)
33
• La probabilité de transition de la cellule i à la cellule j pendant la dème connexion
(Pij(d)) est calculée de la manière suivante :
Pij(d) = tij(d)/l
i(d)
• Après m connexions, la probabilité de transition de la cellule i à la cellule j
est calculée de la manière suivante :
∑=
m
d 1
Pij Pij = (d) /m. i,j = 1,n
• Si à l’instant t = 0, l’utilisateur se connecte k fois dans la cellule i durant les m
•connexions alors :
Pi(0) = k/m ou (k*100/m)%
• V = [Pi(0)] [N]33
Prédire le MSpec à l’aide des chaînes de Markov
•Le MSpec est un sous ensemble de C
MSpec = {a1 C1, a2 C2,..........., ai Ci,.........., an Cn} / ai = {0, 1}
∑=
n
i 1
ai Ci / ai MSpec = = {0,1}
• On définit
θ (0 ≤
θ ≤ 1) : un seuil fixe ou variable, pour sélectionner les
cellules de plus grandes probabilités.
Le MSpec est défini comme suit : MSpec = {Cj / Pj (t+1) ≥
θ
}
3434
Non
Fin
Consulter le profil de
mobilité de l’utilisateur
Début
Identifier l’utilisateur
t = 0, MSpec = { }
C = (C1, C2, ........Ci........Cn)
Non Utilisateur Oui
= ancien
Initier la matrice de transition: M = [Pij], {i, j} =1, 2, ..... n
Initier Pi (0) i =1, 2, ….. n
J=1 ; 0 ≤ θ ≤ 1
MSpec = MSpec ∪ Cj
j = j+1
Oui
Non Oui j ≤ N
Pj (t+1) ≥ θ
∑
=
n
i 1
Pj (t+1) = Pi (t) * Pij
Prédiction du MSpec à l’aide des chaînes de Markov 3535
t0 t1 s0 s1 f1 f0
Temps du handover de la
cellule Ci-1 à la cellule Ci Temps du handover de la cellule Ci à la cellule Ci+1
Le temps passé dans la cellule Ci
Temps du lancement de la
méthode de prédiction
Temps de la
détermination du
MSpec
Temps de la détermination du MSpec
Temps de la procédure de réservation
de ressources à l’avance
temps
La cellule Ci-1 La cellule Ci La cellule Ci+1
Le temps d’attente dans la cellule Ci ≥ le temps de la détermination du MSpec +
le temps de la réservation de ressources à l’avance
Simulation
36
Systeme informatique de commande du robot V 80
V. Dupourque
To cite this version:
V. Dupourque. Systeme informatique de commande du robot V 80. RT-0035, 1984, pp.93.
HAL Id: inria-00070123
https://hal.inria.fr/inria-00070123
Submitted on 19 May 2006
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.
Lecture 10: Robust outlier detection with L0-SVDD
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
February 28, 2014Roadmap
1 Robust outlier detection with L0-SVDD
L0 SVDD
4 iterations of Adaptive L0 SVDDRecall SVDD
min
R,c,ξ
R + C
Xn
i=1
ξi
with kxi − ck
2 ≤ R + ξi
, i = 1, . . . , n
and ξi ≥ 0, i = 1, . . . , n
(1)
Stéphane Canu (INSA Rouen - LITIS) February 28, 2014 3 / 11SVDD + outlier
C =1/16 C =1/8 C =1/4 C = 1/2 (¾')
Figure: Example of SVDD solutions with different C values, m = 0 (red) and
m = 5 (magenta). The circled data points represent support vectors for both m.
Stéphane Canu (INSA Rouen - LITIS) February 28, 2014 4 / 11The L0 norm
kξk0 ≤ t
min
c∈IRp
,R∈IR,ξ∈IRn
R + Ckξk0
with kxi − ck
2 ≤ R+ξi
ξi ≥ 0 i = 1, n
Stéphane Canu (INSA Rouen - LITIS) February 28, 2014 5 / 11L0 relaxations
p norm
exponenetial
piecewise linear
log
min
c∈IRp
,R∈IR,ξ∈IRn
R + C
Xn
i=1
log(γ + ξi)
with kxi − ck
2 ≤ R+ξi
ξi ≥ 0 i = 1, n .
Stéphane Canu (INSA Rouen - LITIS) February 28, 2014 6 / 11DC programing
log(γ + t) = f (t) − g(t) with f (t) = t and g(t) = t − log(γ + t),
both functions f and g being convex. The DC framework consists in
minimizing iteratively (R plus a sum of) the following convex term:
f (ξ) − g
′
(ξ)ξ = ξ −
1 −
1
γ + ξ
old
ξ =
ξ
γ + ξ
old ,
where ξ
old
i
denotes the solution at the previous iteration.
Stéphane Canu (INSA Rouen - LITIS) February 28, 2014 7 / 11The DC idea applied to our L0 SVDD approximation consists in building a
sequence of solutions of the following adaptive SVDD:
min
c∈IRp
,R∈IR,ξ∈IRn
R + C
Xn
i=1
wi ξi
with kxi − ck
2 ≤ R+ξi
ξi ≥ 0 i = 1, n
with wi =
1
γ + ξ
old
i
.
Stéphane Canu (INSA Rouen - LITIS) February 28, 2014 8 / 11Stationary conditions of the KKT give: c =
Pn
i=1 αi xi and Pn
i=1 αi = 1
where the αi are the Lagrange multipliers associated with the inequality
constraints kxi − ck
2 ≤ R+ξi
. The dual of this problem is
(
min
α∈IRn
α
⊤XX ⊤α − α
⊤diag(XX ⊤)
with Pn
i=1 αi = 1 0 ≤ αi ≤ Cwi
i = 1, n
(2)
Stéphane Canu (INSA Rouen - LITIS) February 28, 2014 9 / 11Algorithm 1 L0 SVDD for the linear kernel
Data: X, y, C , γ
Result: R , c, ξ , α
wi = 1; i = 1, n
while not converged do
(α, λ) ← solve_QP(X, C,w) % solve problem (2)
c ← X
⊤α
R ← λ + c
⊤c
ξi ← max(0, kxi − ck
2 − R) i = 1, n
wi ← 1/(γ + ξi) i = 1, n
end
Stéphane Canu (INSA Rouen - LITIS) February 28, 2014 10 / 11Bibliography
Stéphane Canu (INSA Rouen - LITIS) February 28, 2014 11 / 11
Lecture 9: Multi Kernel SVM
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
April 16, 2014Roadmap
1 Tuning the kernel: MKL
The multiple kernel problem
Sparse kernel machines for regression: SVR
SimpleMKL: the multiple kernel solutionStandard Learning with Kernels
User
Learning Machine
kernel k data
f
http://www.cs.nyu.edu/~mohri/icml2011-tutorial/tutorial-icml2011-2.pdf
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 3 / 21Learning Kernel framework
User
Learning Machine
kernel
family
km
data
f , k(., .)
http://www.cs.nyu.edu/~mohri/icml2011-tutorial/tutorial-icml2011-2.pdf
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 3 / 21from SVM
SVM: single kernel k
f (x) = Xn
i=1
αi k (x, xi) + b
=
http://www.nowozin.net/sebastian/talks/ICCV-2009-LPbeta.pdf
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 4 / 21from SVM → to Multiple Kernel Learning (MKL)
SVM: single kernel k
MKL: set of M kernels k1, . . . , km, . . . , kM
◮ learn classier and combination weights
◮ can be cast as a convex optimization problem
f (x) = Xn
i=1
αi
X
M
m=1
dm km(x, xi) + b
X
M
m=1
dm = 1 and 0 ≤ dm
=
http://www.nowozin.net/sebastian/talks/ICCV-2009-LPbeta.pdf
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 4 / 21from SVM → to Multiple Kernel Learning (MKL)
SVM: single kernel k
MKL: set of M kernels k1, . . . , km, . . . , kM
◮ learn classier and combination weights
◮ can be cast as a convex optimization problem
f (x) = Xn
i=1
αi
X
M
m=1
dm km(x, xi) + b
X
M
m=1
dm = 1 and 0 ≤ dm
=
Xn
i=1
αiK(x, xi) + b with K(x, xi) = X
M
m=1
dm km(x, xi)
http://www.nowozin.net/sebastian/talks/ICCV-2009-LPbeta.pdf
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 4 / 21Multiple Kernel
The model
f (x) = Xn
i=1
αi
X
M
m=1
dmkm(x, xi) + b,
X
M
m=1
dm = 1 and 0 ≤ dm
Given M kernel functions k1, . . . , kM that are potentially well suited for a
given problem, find a positive linear combination of these kernels such that
the resulting kernel k is “optimal”
k(x, x
′
) = X
M
m=1
dmkm(x, x
′
), with dm ≥ 0,
X
m
dm = 1
Learning together
The kernel coefficients dm and the SVM parameters αi
, b.
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 5 / 21Multiple Kernel: illustration
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 6 / 21Multiple Kernel Strategies
Wrapper method (Weston et al., 2000; Chapelle et al., 2002)
◮ solve SVM
◮ gradient descent on dm on criterion:
⋆ margin criterion
⋆ span criterion
Kernel Learning & Feature Selection
◮ use Kernels as dictionary
Embedded Multi Kernel Learning (MKL)
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 7 / 21Multiple Kernel functional Learning
The problem (for given C)
min
f ∈H,b,ξ,d
1
2
kf k
2
H + C
X
i
ξi
with yi
f (xi) + b
≥ 1 + ξi
; ξi ≥ 0 ∀i
X
M
m=1
dm = 1 , dm ≥ 0 ∀m ,
f =
X
m
fm and k(x, x
′
) = X
M
m=1
dmkm(x, x
′
), with dm ≥ 0
The functional framework
H =
M
M
m=1
H′
m hf , giH′
m =
1
dm
hf , giHm
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 8 / 21Multiple Kernel functional Learning
The problem (for given C)
min
{fm},b,ξ,d
1
2
X
m
1
dm
kfmk
2
Hm + C
X
i
ξi
with yi
X
m
fm(xi) + b
≥ 1 + ξi
; ξi ≥ 0 ∀i
X
m
dm = 1 , dm ≥ 0 ∀m ,
Treated as a bi-level optimization task
min
d∈IRM
min
{fm},b,ξ
1
2
X
m
1
dm
kfmk
2
Hm + C
X
i
ξi
with yi
X
m
fm(xi) + b
≥ 1 + ξi
; ξi ≥ 0 ∀i
s.t. X
m
dm = 1 , dm ≥ 0 ∀m ,
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 9 / 21Multiple Kernel representer theorem and dual
The Lagrangian:
L =
1
2
X
m
1
dm
kfmk
2
Hm + C
X
i
ξi −
X
i
αi
yi
X
m
fm(xi) + b
− 1 − ξi
−
X
i
βi ξi
Associated KKT stationarity conditions:
∇mL = 0 ⇔
1
dm
fm(•) = Xn
i=1
αi yikm(•, xi) m = 1, M
Representer theorem
f (•) = X
m
fm(•) = Xn
i=1
αi yi
X
m
dmkm(•, xi)
| {z }
K(•,xi )
We have a standard SVM problem with respect to function f and kernel K.
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 10 / 21Multiple Kernel Algorithm
Use a Reduced Gradient Algorithm1
min
d∈IRM
J(d)
s.t. X
m
dm = 1 , dm ≥ 0 ∀m ,
SimpleMKL algorithm
set dm =
1
M
for m = 1, . . . , M
while stopping criterion not met do
compute J(d) using an QP solver with K =
P
m dmKm
compute ∂J
∂dm
, and projected gradient as a descent direction D
γ ← compute optimal stepsize
d ← d + γD
end while
−→ Improvement reported using the Hessian
1Rakotomamonjy et al. JMLR 08
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 11 / 21Computing the reduced gradient
At the optimal the primal cost = dual cost
1
2
X
m
1
dm
kfmk
2
Hm + C
X
i
ξi
| {z }
primal cost
=
1
2
α
⊤Gα − e
⊤α
| {z }
dual cost
with G =
P
m dmGm where Gm,ij = km(xi
, xj)
Dual cost is easier for the gradient
∇dm J(d) = 1
2
α
⊤Gmα
Reduce (or project) to check the constraints P
m dm = 1 →
P
m Dm = 0
Dm = ∇dm J(d) − ∇d1
J(d) and D1 = −
X
M
m=2
Dm
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 12 / 21Complexity
For each iteration:
SVM training: O(nnsv + n
3
sv).
Inverting Ksv,sv is O(n
3
sv), but might already be available as a
by-product of the SVM training.
Computing H: O(Mn2
sv)
Finding d: O(M3
).
The number of iterations is usually less than 10.
−→ When M < nsv, computing d is not more expensive than QP.
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 13 / 21MKL on the 101-caltech dataset
http://www.robots.ox.ac.uk/~vgg/software/MKL/
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 14 / 21Support vector regression (SVR)
the t-insensitive loss
(
min
f ∈H
1
2
kf k
2
H
with |f (xi) − yi
| ≤ t, i = 1, n
The support vector regression introduce slack variables
(SVR)
(
min
f ∈H
1
2
kf k
2
H + C
P|ξi
|
with |f (xi) − yi
| ≤ t + ξi 0 ≤ ξi
i = 1, n
a typical multi parametric quadratic program (mpQP)
piecewise linear regularization path
α(C,t) = α(C0,t0) + ( 1
C
−
1
C0
)u +
1
C0
(t − t0)v
2d Pareto’s front (the tube width and the regularity)Support vector regression illustration
0 1 2 3 4 5 6 7 8
−1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Support Vector Machine Regression
x
y
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
−1.5
−1
−0.5
0
0.5
1
1.5
Support Vector Machine Regression
x
y
C large C small
there exists other formulations such as LP SVR...Multiple Kernel Learning for regression
The problem (for given C and t)
min
{fm},b,ξ,d
1
2
X
m
1
dm
kfmk
2
Hm + C
X
i
ξi
s.t.
X
m
fm(xi) + b − yi
≤ t + ξi ∀iξi ≥ 0 ∀i
X
m
dm = 1 , dm ≥ 0 ∀m ,
regularization formulation
min
{fm},b,d
1
2
X
m
1
dm
kfmk
2
Hm + C
X
i
max(
X
m
fm(xi) + b − yi
− t, 0)
X
m
dm = 1 , dm ≥ 0 ∀m ,
Equivalently
min
fm},b,ξ,d
X
i
max
X
m
fm(xi) + b − yi
− t, 0
+
1
2C
X
m
1
dm
kfmk
2
Hm + µ
X
m
|dm|
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 17 / 21Multiple Kernel functional Learning
The problem (for given C and t)
min
{fm},b,ξ,d
1
2
X
m
1
dm
kfmk
2
Hm + C
X
i
ξi
s.t.
X
m
fm(xi) + b − yi
≤ t + ξi ∀iξi ≥ 0 ∀i
X
m
dm = 1 , dm ≥ 0 ∀m ,
Treated as a bi-level optimization task
min
d∈IRM
min
{fm},b,ξ
1
2
X
m
1
dm
kfmk
2
Hm + C
X
i
ξi
s.t.
X
m
fm(xi) + b − yi
≥ t + ξi ∀i
ξi ≥ 0 ∀i
s.t. X
m
dm = 1 , dm ≥ 0 ∀m ,
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 18 / 21Multiple Kernel experiments
0 0.2 0.4 0.6 0.8 1
−1
−0.5
0
0.5
1
LinChirp
0 0.2 0.4 0.6 0.8 1
−2
−1
0
1
2
x
0 0.2 0.4 0.6 0.8 1
0.2
0.4
0.6
0.8
1
Wave
0 0.2 0.4 0.6 0.8 1
0
0.5
1
x
0 0.2 0.4 0.6 0.8 1
0.2
0.4
0.6
0.8
1
Blocks
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
x
0 0.2 0.4 0.6 0.8 1
0.2
0.4
0.6
0.8
1
Spikes
0 0.2 0.4 0.6 0.8 1
0
0.5
1
x
Single Kernel Kernel Dil Kernel Dil-Trans
Data Set Norm. MSE (%) #Kernel Norm. MSE #Kernel Norm. MSE
LinChirp 1.46 ± 0.28 7.0 1.00 ± 0.15 21.5 0.92 ± 0.20
Wave 0.98 ± 0.06 5.5 0.73 ± 0.10 20.6 0.79 ± 0.07
Blocks 1.96 ± 0.14 6.0 2.11 ± 0.12 19.4 1.94 ± 0.13
Spike 6.85 ± 0.68 6.1 6.97 ± 0.84 12.8 5.58 ± 0.84
Table: Normalized Mean Square error averaged over 20 runs.
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 19 / 21Conclusion on multiple kernel (MKL)
MKL: Kernel tuning, variable selection. . .
◮ extention to classification and one class SVM
SVM KM: an efficient Matlab toolbox (available at MLOSS)2
Multiple Kernels for Image Classification: Software and Experiments
on Caltech-1013
new trend: Multi kernel, Multi task and ∞ number of kernels
2
http://mloss.org/software/view/33/
3
http://www.robots.ox.ac.uk/~vgg/software/MKL/Bibliography
A. Rakotomamonjy, F. Bach, S. Canu & Y. Grandvalet. SimpleMKL. J.
Mach. Learn. Res. 2008, 9:2491–2521.
M. Gönen & E. Alpaydin Multiple kernel learning algorithms. J. Mach.
Learn. Res. 2008;12:2211-2268.
http://www.cs.nyu.edu/~mohri/icml2011-tutorial/tutorial-icml2011-2.pdf
http://www.robots.ox.ac.uk/~vgg/software/MKL/
http://www.nowozin.net/sebastian/talks/ICCV-2009-LPbeta.pdf
Stéphane Canu (INSA Rouen - LITIS) April 16, 2014 21 / 21
Lecture 7: Tuning hyperparameters using cross validation
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
April 4, 2014Roadmap
1 Tuning hyperparameters
Motivation
Machine learning without data
Assessing the quality of a trained SVM
Model selection
log of the bandwith
log of C
1.5 2 2.5 3 3.5 4 4.5
ï1
0
1
2
3
4
“Evaluation is the key to making real progress in data mining”, [Witten &
Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)Motivation: the influence of C on SVM
0 0.5 1 1.5 2 2.5 3 3.5 4
0.22
0.24
0.26
0.28
0.3
error
C (log. scale)
0
0
1
−1
C too small
0
0
0
1
1
1
−1 −1
−1
−1
−1
nice C
0
0
0
0
0
1
1
1
1
1
1
−1
−1
−1
−1
−1
C too largeMotivation:
Need for model selection (tuning the hyper parameters)
Require a good estimation of the performance on future data Choose a
relevant performance measureRoadmap
1 Tuning hyperparameters
Motivation
Machine learning without data
Assessing the quality of a trained SVM
Model selection
log of the bandwith
log of C
1.5 2 2.5 3 3.5 4 4.5
ï1
0
1
2
3
4
“Evaluation is the key to making real progress in data mining”, [Witten &
Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)Machine learning without data
minimizing IP(error)Roadmap
1 Tuning hyperparameters
Motivation
Machine learning without data
Assessing the quality of a trained SVM
Model selection
log of the bandwith
log of C
1.5 2 2.5 3 3.5 4 4.5
ï1
0
1
2
3
4
“Evaluation is the key to making real progress in data mining”, [Witten &
Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)Training and test data
Split dataset into two groups randomly picked (hold out strategy)
Training set: used to train the classifier
Test set: used to estimate the error rate of the trained classifier
(X,y) total available data
(Xa,ya) training data (Xt,yt) test data
(Xa, ya, Xt, yt) ← split(X, y, option =
1
3
)
Generally, the larger the training data the better the classifier
The larger the test data the more accurate the error estimateAssessing the quality of a trained SVM: minimum error rate
Definition (The confusion matrix)
A matrix showing the predicted and actual classifications. A confusion
matrix is of size L × L, where L is the number of different classes.
Observed / predicted Positive Negative
positive a b
negative c d
Error rate = 1 - Accuracy =
b + c
a + b + c + d
=
b + c
n
= 1 −
a + d
n
True positive rate (Recall, Sensitivity) d/(c+d).
True negative rate (Specificity) a/(a+b).
Precision, False positive rate, False negative rate...Other performances measures
N. Japkowicz & M. Shah, "Evaluating Learning Algorithms: A Classification Perspective", Cambridge University Press, 2011The learning equation
Learning = training + testing + tuning
Table: my experimental error rates
State of the art my new method Bayes error
problem 1 10% ± 1.25 8.5% ± .5
problem 2 5 % (.25) 4 % (.5)
is my new method good for problem 1?The learning equation
Learning = training + testing + tuning
Table: my experimental error rates
State of the art my new method Bayes error
problem 1 10% ± 1.25 8.5% ± .5 11 %
problem 2 5 % (.25) 4 % (.5) 2 %
is my new method good for problem 1?Error bars on Bernouilli trials
Error rate = bp B(p)
with confidence α: (Normal approximation interval)
p = IP(error) in bp ± u1−α/2
s
bp (1 − bp)
nt
with confidence α: (improved approximation)
p = IP(error) in 1
1 +
1
K
u
2
1−α/2
bp ± u1−α/2
s
bp (1 − bp)
nt
what if bp = 0?
http://en.wikipedia.org/wiki/Binomial_proportion_confidence_intervalTo improve the estimate
Random Subsampling (The repeated holdout method)
K-Fold Cross-Validation (K = 10 or K = 2 or k = n)
Leave-one-out Cross-Validation (k = 1)
BootstrapError bars: the gaussian approximation
... and to stabilize: iterate K times - do it say K = 10 times
The repeated holdout method
Holdout estimate can be made more reliable by repeating the process
with different subsamples
In each iteration, use a different random splitting
Average the error rates on the different iterations
mean error rate e =
1
K
X
K
k=1
ek variance σb
2 =
1
K − 1
X
K
k=1
(ek − e)
2
.
e + tα/2,K−1
r
σb
2
K
t0.025,9 = 2.262Cross validation
Definition (Cross-validation)
A method for estimating the accuracy of an inducer by dividing the data
into K mutually exclusive subsets (the “folds”) of approximately equal size.
Exemple of K = 3-Fold Cross-Validation
training data
test data
How many folds are needed (K =?)
large: small bias, large variance as well as computational time
small: computation time reduced, small variance, large bias
A common choice for K-Fold Cross Validation is K=5Leave one out cross validation
Theoretical guaranteesThe bootstrapComparing results
Two different issues
what is the best method for my problem?
how good is my learning algorithm?Comparing two algorithms: Mc Nemar’s test
build the confusion matrix of the two algorithms
Algo 1 / Algo 2 right wrong
right number of examples well
classified by both
e01 number of examples
well classified by 1 but not
by 2
wrong e10 number of examples
missclassified by 1 but not
by 2
number of examples missclassified
by both
H0: if the two algorithms are the same (we expect e10 = e01 =
e10+e01
2
)
(|e10 − e01| − 1)
2
e10 + e01
∼ χ
2
1
Beware: if e10 + e01 < 20 better use the sign test
Matlab function:
http://www.mathworks.com/matlabcentral/fileexchange/189-discrim/content/discrim/
mcnemar.m
J. L. Fleiss (1981) Statistical Methods for Rates and Proportions. Second Edition. Wiley.Roadmap
1 Tuning hyperparameters
Motivation
Machine learning without data
Assessing the quality of a trained SVM
Model selection
log of the bandwith
log of C
1.5 2 2.5 3 3.5 4 4.5
ï1
0
1
2
3
4
“Evaluation is the key to making real progress in data mining”, [Witten &
Frank, 2005], p.143 (from N. Japkowicz & M. Shah ICML 2012 tutorial)Model selection strategy
Model selection criteria attempt to find a good compromise between
The complexity of a model
Its prediction accuracy on the training data
1 (Xa, ya, Xt, yt) ← split(X, y, options)
2 (C, b) ← tune(Xa, ya, options)
3 model ← train(Xa, ya, C, b, options)
4 error ← test(Xt, yt, C, b, options)
Occam’s Razor:
the best theory is the smallest one that describes all the factsModel selection: the tuning function
function (C, b) ← tune(Xa, ya, options)
1 (Xℓ, yℓ, Xv, yv) ← split(Xa, ya, options)
2 loop on a grid for C
3 loop on a grid for b
1 model ← train(Xℓ, yℓ, C, b, options)
2 error ← test(Xv, yv, C, b, options)
The three sets
Training set: a set of examples used for learning: to fit the parameters
Validation set: a set of examples used to tune the hyper parameters
Test set: independent instances that have played no part in formation
of classifierhow to design the grids
A grid on b
A much simpler trick is to pick, say 1000 pairs (x,x’) at random from your
dataset, compute the distance of all such pairs and take the median, the
0.1 and the 0.9 quantile. Now pick b to be the inverse any of these three
numbers.
http://blog.smola.org/post/940859888/easy-kernel-width-choice
A grid on C
from Cmin to ∞
to much!The coarse to fine strategy
1 use a large coarse grid on a few data to localize interesting values
2 fine tuning on all data in this zone
1 (Xa, ya, Xt, yt) ← split(X, y)
2 (C, b) ← tune(Xa, ya, coarsegrids,smalltrainingset)
3 finegrids ← fit_grid(C, b)
4 (C, b) ← tune(Xa, ya, finegrids, largetrainingset)
5 model ← train(Xa, ya, C, b, options)
6 error ← test(Xt, yt, C, b, options)
The computing time is the key issueEvaluation measures
the span boundBibliography
http://research.cs.tamu.edu/prism/lectures/iss/iss_l13.pdf
http://www.cs.odu.edu/~mukka/cs795sum13dm/Lecturenotes/Day3/Chapter5.pdf
http://www.cs.cmu.edu/~epxing/Class/10701-10s/Lecture/lecture8.pdf
http://www.mohakshah.com/tutorials/icml2012/Tutorial-ICML2012/Tutorial_at_ICML_
2012_files/ICML2012-Tutorial.pdf
Stéphane Canu (INSA Rouen - LITIS) April 4, 2014 26 / 26
Lecture 6: Minimum encoding ball and Support vector
data description (SVDD)
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
May 12, 2014Plan
1 Support Vector Data Description (SVDD)
SVDD, the smallest enclosing ball problem
The minimum enclosing ball problem with errors
The minimum enclosing ball problem in a RKHS
The two class Support vector data description (SVDD)The minimum enclosing ball problem [Tax and Duin, 2004]
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 3 / 35The minimum enclosing ball problem [Tax and Duin, 2004]
the center
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 3 / 35The minimum enclosing ball problem [Tax and Duin, 2004]
the radius
Given n points, {xi
, i = 1, n} .
(
min
R∈IR,c∈IRd
R
2
with kxi − ck
2 ≤ R
2
, i = 1, . . . , n
What is that in the convex programming hierarchy?
LP, QP, QCQP, SOCP and SDP
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 3 / 35The convex programming hierarchy (part of)
LP
min
x
f
⊤x
with Ax ≤ d
and 0 ≤ x
QP
(
min
x
1
2
x
⊤Gx + f
⊤x
with Ax ≤ d
QCQP
min
x
1
2
x
⊤Gx + f
⊤x
with x
⊤Bix + a
⊤
i
x ≤ di
i = 1, n
SOCP
min
x
f
⊤x
with kx − aik ≤ b
⊤
i
x + di
i = 1, n
The convex programming hierarchy?
Model generality: LP < QP < QCQP < SOCP < SDP
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 4 / 35MEB as a QP in the primal
Theorem (MEB as a QP)
The two following problems are equivalent,
(
min
R∈IR,c∈IRd
R
2
with kxi − ck
2 ≤ R
2
, i = 1, . . . , n
(
min
w,ρ
1
2
kwk
2 − ρ
with w⊤xi ≥ ρ +
1
2
kxik
2
with ρ =
1
2
(kck
2 − R
2
) and w = c.
Proof:
kxi − ck
2 ≤ R
2
kxik
2 − 2x
⊤
i
c + kck
2 ≤ R
2
−2x
⊤
i
c ≤ R
2 − kxik
2 − kck
2
2x
⊤
i
c ≥ −R
2 + kxik
2 + kck
2
x
⊤
i
c ≥
1
2
(kck
2 − R
2
)
| {z }
ρ
+
1
2
kxik
2
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 5 / 35MEB and the one class SVM
SVDD: (
min
w,ρ
1
2
kwk
2 − ρ
with w⊤xi ≥ ρ +
1
2
kxik
2
SVDD and linear OCSVM (Supporting Hyperplane)
if ∀i = 1, n, kxik
2 = constant, it is the the linear one class SVM (OC SVM)
The linear one class SVM [Schölkopf and Smola, 2002]
(
min
w,ρ′
1
2
kwk
2 − ρ
′
with w⊤xi ≥ ρ
′
with ρ
′ = ρ +
1
2
kxik
2 ⇒ OC SVM is a particular case of SVDD
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 6 / 35When ∀i = 1, n, kxik
2 = 1
0
c
kxi − ck
2 ≤ R
2 ⇔ w
⊤xi ≥ ρ
with
ρ =
1
2
(kck
2 − R + 1)
SVDD and OCSVM
"Belonging to the ball" is also "being above" an hyperplane
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 7 / 35MEB: KKT
L(c, R, α) = R
2 +
Xn
i=1
αi
kxi − ck
2 − R
2
KKT conditionns :
stationarty ◮ 2c
Pn
i=1
αi − 2
Pn
i=1
αixi = 0 ← The representer theorem
◮ 1 −
Pn
i=1
αi = 0
primal admiss. kxi − ck
2 ≤ R
2
dual admiss. αi ≥ 0 i = 1, n
complementarity αi
kxi − ck
2 − R
2
= 0 i = 1, n
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 8 / 35MEB: KKT
the radius L(c, R, α) = R
2 +
Xn
i=1
αi
kxi − ck
2 − R
2
KKT conditionns :
stationarty ◮ 2c
Pn
i=1
αi − 2
Pn
i=1
αixi = 0 ← The representer theorem
◮ 1 −
Pn
i=1
αi = 0
primal admiss. kxi − ck
2 ≤ R
2
dual admiss. αi ≥ 0 i = 1, n
complementarity αi
kxi − ck
2 − R
2
= 0 i = 1, n
Complementarity tells us: two groups of points
the support vectors kxi − ck
2 = R
2 and the insiders αi = 0
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 8 / 35MEB: Dual
The representer theorem:
c =
Pn
i=1
αixi
Pn
i=1
αi
=
Xn
i=1
αixi
L(α) = Xn
i=1
αi
kxi −
Xn
j=1
αjxjk
2
Xn
i=1
Xn
j=1
αiαjx
⊤
i
xj = α
⊤Gα and Xn
i=1
αi x
⊤
i
xi = α
⊤diag(G)
with G = XX⊤ the Gram matrix: Gij = x
⊤
i
xj ,
min
α∈IRn
α
⊤Gα − α
⊤diag(G)
with e
⊤α = 1
and 0 ≤ αi
, i = 1 . . . n
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 9 / 35SVDD primal vs. dual
Primal
min
R∈IR,c∈IRd
R
2
with kxi − ck
2 ≤ R
2
,
i = 1, . . . , n
d + 1 unknown
n constraints
can be recast as a QP
perfect when d << n
Dual
min
α
α
⊤Gα − α
⊤diag(G)
with e
⊤α = 1
and 0 ≤ αi
,
i = 1 . . . n
n unknown with G the pairwise
influence Gram matrix
n box constraints
easy to solve
to be used when d > nSVDD primal vs. dual
Primal
min
R∈IR,c∈IRd
R
2
with kxi − ck
2 ≤ R
2
,
i = 1, . . . , n
d + 1 unknown
n constraints
can be recast as a QP
perfect when d << n
Dual
min
α
α
⊤Gα − α
⊤diag(G)
with e
⊤α = 1
and 0 ≤ αi
,
i = 1 . . . n
n unknown with G the pairwise
influence Gram matrix
n box constraints
easy to solve
to be used when d > n
But where is R
2
?Looking for R
2
(
min
α
α
⊤Gα − α
⊤diag(G)
with e
⊤α = 1, 0 ≤ αi
, i = 1, n
The Lagrangian: L(α, µ, β) = α
⊤Gα − α
⊤diag(G) + µ(e
⊤α − 1) − β
⊤α
Stationarity cond.: ∇αL(α, µ, β) = 2Gα − diag(G) + µe − β = 0
The bi dual
(
min
α
α
⊤Gα + µ
with −2Gα + diag(G) ≤ µe
by identification
R
2 = µ + α
⊤Gα = µ + kck
2
µ is the Lagrange multiplier associated with the equality constraint Xn
i=1
αi = 1
Also, because of the complementarity condition, if xi
is a support vector, then
βi = 0 implies αi > 0 and R
2 = kxi − ck
2
.Plan
1 Support Vector Data Description (SVDD)
SVDD, the smallest enclosing ball problem
The minimum enclosing ball problem with errors
The minimum enclosing ball problem in a RKHS
The two class Support vector data description (SVDD)
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 12 / 35The minimum enclosing ball problem with errors
the slack
The same road map:
initial formuation
reformulation (as a QP)
Lagrangian, KKT
dual formulation
bi dual
Initial formulation: for a given C
min
R,a,ξ
R
2 + C
Xn
i=1
ξi
with kxi − ck
2 ≤ R
2 + ξi
, i = 1, . . . , n
and ξi ≥ 0, i = 1, . . . , n
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 13 / 35The MEB with slack: QP, KKT, dual and R
2
SVDD as a QP:
min
w,ρ
1
2
kwk
2 − ρ +
C
2
Xn
i=1
ξi
with w⊤xi ≥ ρ +
1
2
kxik
2 −
1
2
ξi
and ξi ≥ 0,
i = 1, n
again with OC SVM as a particular case.
With G = XX ⊤
Dual SVDD:
min
α
α
⊤Gα − α
⊤diag(G)
with e
⊤α = 1
and 0 ≤ αi ≤ C,
i = 1, n
for a given C ≤ 1. If C is larger than one it is useless (it’s the no slack case)
R
2 = µ + c
⊤c
with µ denoting the Lagrange multiplier associated with the equality
constraint Pn
i=1 αi = 1.Variations over SVDD
Adaptive SVDD: the weighted error case for given wi
, i = 1, n
min
c∈IRp,R∈IR,ξ∈IRn
R + C
Xn
i=1
wi ξi
with kxi − ck
2 ≤ R+ξi
ξi ≥ 0 i = 1, n
The dual of this problem is a QP [see for instance Liu et al., 2013]
(
min
α∈IRn
α
⊤XX ⊤α − α
⊤diag(XX ⊤)
with Pn
i=1 αi = 1 0 ≤ αi ≤ Cwi
i = 1, n
Density induced SVDD (D-SVDD):
min
c∈IRp,R∈IR,ξ∈IRn
R + C
Xn
i=1
ξi
with wikxi − ck
2 ≤ R+ξi
ξi ≥ 0 i = 1, nPlan
1 Support Vector Data Description (SVDD)
SVDD, the smallest enclosing ball problem
The minimum enclosing ball problem with errors
The minimum enclosing ball problem in a RKHS
The two class Support vector data description (SVDD)
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 16 / 35SVDD in a RKHS
The feature map: IRp −→ H
c −→ f (•)
xi −→ k(xi
, •)
kxi − ckIRp ≤ R
2 −→ kk(xi
, •) − f (•)k
2
H ≤ R
2
Kernelized SVDD (in a RKHS) is also a QP
min
f ∈H,R∈IR,ξ∈IRn
R
2 + C
Xn
i=1
ξi
with kk(xi
, •) − f (•)k
2
H ≤ R
2+ξi
i = 1, n
ξi ≥ 0 i = 1, nSVDD in a RKHS: KKT, Dual and R
2
L = R
2 + C
Xn
i=1
ξi +
Xn
i=1
αi
kk(xi
, .) − f (.)k
2
H − R
2−ξi
−
Xn
i=1
βi ξi
= R
2 + C
Xn
i=1
ξi +
Xn
i=1
αi
k(xi
, xi) − 2f (xi) + kf k
2
H − R
2−ξi
−
Xn
i=1
βi ξi
KKT conditions
Stationarity
◮ 2f (.)
Pn
i=1 αi − 2
Pn
i=1 αik(., xi) = 0 ← The representer theorem
◮ 1 −
Pn
i=1 αi = 0
◮ C − αi − βi = 0
Primal admissibility: kk(xi
, .) − f (.)k
2 ≤ R
2 + ξi
, ξi ≥ 0
Dual admissibility: αi ≥ 0 , βi ≥ 0
Complementarity
◮ αi
kk(xi
, .) − f (.)k
2 − R
2 − ξi
= 0
◮ βi ξi = 0SVDD in a RKHS: Dual and R
2
L(α) = Xn
i=1
αik(xi
, xi) − 2
Xn
i=1
f (xi) + kf k
2
H with f (.) = Xn
j=1
αjk(., xj)
=
Xn
i=1
αik(xi
, xi) −
Xn
i=1
Xn
j=1
αiαj k(xi
, xj)
| {z }
Gij
Gij = k(xi
, xj)
min
α
α
⊤Gα − α
⊤diag(G)
with e
⊤α = 1
and 0 ≤ αi≤ C, i = 1 . . . n
As it is in the linear case:
R
2 = µ + kf k
2
H
with µ denoting the Lagrange multiplier associated with the equality
constraint Pn
i=1 αi = 1.SVDD train and val in a RKHS
Train using the dual form (in: G, C; out: α, µ)
min
α
α
⊤Gα − α
⊤diag(G)
with e
⊤α = 1
and 0 ≤ αi≤ C, i = 1 . . . n
Val with the center in the RKHS: f (.) = Pn
i=1 αik(., xi)
φ(x) = kk(x, .) − f (.)k
2
H − R
2
= kk(x, .)k
2
H − 2hk(x, .), f (.)iH + kf (.)k
2
H − R
2
= k(x, x) − 2f (x) + R
2 − µ − R
2
= −2f (x) + k(x, x) − µ
= −2
Xn
i=1
αik(x, xi) + k(x, x) − µ
φ(x) = 0 is the decision border
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 20 / 35An important theoretical result
For a well-calibrated bandwidth,
The SVDD estimates the underlying distribution level set [Vert and Vert,
2006]
The level sets of a probability density function IP(x) are the set
Cp = {x ∈ IRd
| IP(x) ≥ p}
It is well estimated by the empirical minimum volume set
Vp = {x ∈ IRd
| kk(x, .) − f (.)k
2
H − R
2 ≥ 0}
The frontiers coincidesSVDD: the generalization error
For a well-calibrated bandwidth,
(x1, . . . , xn) i.i.d. from some fixed but unknown IP(x)
Then [Shawe-Taylor and Cristianini, 2004] with probability at least 1 − δ,
(∀δ ∈]0, 1[), for any margin m > 0
IP
kk(x, .) − f (.)k
2
H ≥ R
2 + m
≤
1
mn
Xn
i=1
ξi +
6R
2
m
√
n
+ 3
r
ln(2/δ)
2nEquivalence between SVDD and OCSVM for translation
invariant kernels (diagonal constant kernels)
Theorem
Let H be a RKHS on some domain X endowed with kernel k. If there
exists some constant c such that ∀x ∈ X , k(x, x) = c, then the two
following problems are equivalent,
min
f ,R,ξ
R + C
Xn
i=1
ξi
with kk(xi
, .) − f (.)k
2
H ≤ R+ξi
ξi ≥ 0 i = 1, n
min
f ,ρ,ξ
1
2
kf k
2
H − ρ + C
Xn
i=1
εi
with f (xi) ≥ ρ − εi
εi ≥ 0 i = 1, n
with ρ =
1
2
(c + kf k
2
H − R) and εi =
1
2
ξi
.Proof of the Equivalence between SVDD and OCSVM
min
f ∈H,R∈IR,ξ∈IRn
R + C
Xn
i=1
ξi
with kk(xi
, .) − f (.)k
2
H ≤ R+ξi
, ξi ≥ 0 i = 1, n
since kk(xi
, .) − f (.)k
2
H = k(xi
, xi) + kf k
2
H − 2f (xi)
min
f ∈H,R∈IR,ξ∈IRn
R + C
Xn
i=1
ξi
with 2f (xi) ≥ k(xi
, xi) + kf k
2
H − R−ξi
, ξi ≥ 0 i = 1, n.
Introducing ρ =
1
2
(c + kf k
2
H − R) that is R = c + kf k
2
H − 2ρ, and since k(xi
, xi)
is constant and equals to c the SVDD problem becomes
min
f ∈H,ρ∈IR,ξ∈IRn
1
2
kf k
2
H − ρ +
C
2
Xn
i=1
ξi
with f (xi) ≥ ρ−
1
2
ξi
, ξi ≥ 0 i = 1, nleading to the classical one class SVM formulation (OCSVM)
min
f ∈H,ρ∈IR,ξ∈IRn
1
2
kf k
2
H − ρ + C
Xn
i=1
εi
with f (xi) ≥ ρ − εi
, εi ≥ 0 i = 1, n
with εi =
1
2
ξi
. Note that by putting ν =
1
nC we can get the so called ν
formulation of the OCSVM
min
f
′∈H,ρ′∈IR,ξ′∈IRn
1
2
kf
′k
2
H − nνρ′ +
Xn
i=1
ξ
′
i
with f
′
(xi) ≥ ρ
′ − ξ
′
i
, ξ′
i ≥ 0 i = 1, n
with f
′ = Cf , ρ
′ = Cρ, and ξ
′ = Cξ.Duality
Note that the dual of the SVDD is
(
min
α∈IRn
α
⊤Gα − α
⊤g
with Pn
i=1 αi = 1 0 ≤ αi ≤ C i = 1, n
where G is the kernel matrix of general term Gi,j = k(xi
, xj) and g the
diagonal vector such that gi = k(xi
, xi) = c. The dual of the OCSVM is
the following equivalent QP
(
min
α∈IRn
1
2
α
⊤Gα
with Pn
i=1 αi = 1 0 ≤ αi ≤ C i = 1, n
Both dual forms provide the same solution α, but not the same Lagrange
multipliers. ρ is the Lagrange multiplier of the equality constraint of the
dual of the OCSVM and R = c + α
⊤Gα − 2ρ. Using the SVDD dual, it
turns out that R = λeq + α
⊤Gα where λeq is the Lagrange multiplier of
the equality constraint of the SVDD dual form.Plan
1 Support Vector Data Description (SVDD)
SVDD, the smallest enclosing ball problem
The minimum enclosing ball problem with errors
The minimum enclosing ball problem in a RKHS
The two class Support vector data description (SVDD)
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 27 / 35The two class Support vector data description (SVDD)
−4 −3 −2 −1 0 1 2 3
−3
−2
−1
0
1
2
3
4
−4 −3 −2 −1 0 1 2 3
−3
−2
−1
0
1
2
3
4
.
min
c,R,ξ+,ξ−
R
2+C
X
yi =1
ξ
+
i +
X
yi =−1
ξ
−
i
with kxi − ck
2 ≤ R
2+ξ
+
i
, ξ+
i ≥ 0 i such that yi = 1
and kxi − ck
2 ≥ R
2−ξ
−
i
, ξ−
i ≥ 0 i such that yi = −1
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 28 / 35The two class SVDD as a QP
min
c,R,ξ+,ξ−
R
2+C
X
yi =1
ξ
+
i +
X
yi =−1
ξ
−
i
with kxi − ck
2 ≤ R
2+ξ
+
i
, ξ+
i ≥ 0 i such that yi = 1
and kxi − ck
2 ≥ R
2−ξ
−
i
, ξ−
i ≥ 0 i such that yi = −1
kxik
2 − 2x
⊤
i
c + kck
2 ≤ R
2+ξ
+
i
, ξ+
i ≥ 0 i such that yi = 1
kxik
2 − 2x
⊤
i
c + kck
2 ≥ R
2−ξ
−
i
, ξ−
i ≥ 0 i such that yi = −1
2x
⊤
i
c ≥ kck
2 − R
2 + kxik
2−ξ
+
i
, ξ+
i ≥ 0 i such that yi = 1
−2x
⊤
i
c ≥ −kck
2 + R
2 − kxik
2−ξ
−
i
, ξ−
i ≥ 0 i such that yi = −1
2yix
⊤
i
c ≥ yi(kck
2 − R
2 + kxik
2
)−ξi
, ξi ≥ 0 i = 1, n
change variable: ρ = kck
2 − R
2
min
c,ρ,ξ
kck
2 − ρ + C
Pn
i=1
ξi
with 2yixi
⊤c ≥ yi(ρ − kxik
2
)−ξi
i = 1, n
and ξi ≥ 0 i = 1, nThe dual of the two class SVDD
Gij = yi yjxix
⊤
j
The dual formulation:
min
α∈IRn
α
⊤Gα −
Pn
i=1 αi yikxik
2
with Xn
i=1
yiαi = 1
0 ≤ αi ≤ C i = 1, n
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 30 / 35The two class SVDD vs. one class SVDD
The two class SVDD (left) vs. the one class SVDD (right)
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 31 / 35Small Sphere and Large Margin (SSLM) approach
Support vector data description with margin [Wu and Ye, 2009]
min
w,R,ξ∈IRn
R
2+C
X
yi =1
ξ
+
i +
X
yi =−1
ξ
−
i
with kxi − ck
2 ≤ R
2 − 1+ξ
+
i
, ξ+
i ≥ 0 i such that yi = 1
and kxi − ck
2 ≥ R
2 + 1−ξ
−
i
, ξ−
i ≥ 0 i such that yi = −1
kxi − ck
2 ≥ R
2 + 1−ξ
−
i
and yi = −1 ⇐⇒ yi kxi − ck
2 ≤ yiR
2 − 1+ξ
−
i
L(c, R, ξ, α, β) = R
2+C
Xn
i=1
ξi +
Xn
i=1
αi
yikxi − ck
2 − yiR
2 + 1−ξi
−
Xn
i=1
βi ξi
−4 −3 −2 −1 0 1 2 3
−3
−2
−1
0
1
2
3
4SVDD with margin – dual formulation
L(c, R, ξ, α, β) = R
2+C
Xn
i=1
ξi +
Xn
i=1
αi
yikxi − ck
2 − yiR
2 + 1−ξi
−
Xn
i=1
βi ξi
Optimality: c =
Xn
i=1
αi yixi
;
Xn
i=1
αi yi = 1 ; 0 ≤ αi ≤ C
L(α) = Xn
i=1
αi
yikxi −
Xn
j=1
αi yjxjk
2
+
Xn
i=1
αi
= −
Xn
i=1
Xn
j=1
αjαi yi yjx
⊤
j xi +
Xn
i=1
kxik
2
yiαi +
Xn
i=1
αi
Dual SVDD is also a quadratic program
problem D
min
α∈IRn
α
⊤Gα − e
⊤α − f
⊤α
with y
⊤α = 1
and 0 ≤ αi ≤ C i = 1, n
with G a symmetric matrix n × n such that Gij = yi yjx
⊤
j
xi and fi = kxik
2
yiConclusion
Applications
◮ outlier detection
◮ change detection
◮ clustering
◮ large number of classes
◮ variable selection, . . .
A clear path
◮ reformulation (to a standart problem)
◮ KKT
◮ Dual
◮ Bidual
a lot of variations
◮ L
2 SVDD
◮ two classes non symmetric
◮ two classes in the symmetric classes (SVM)
◮ the multi classes issue
practical problems with translation invariant
kernels
.Bibliography
Bo Liu, Yanshan Xiao, Longbing Cao, Zhifeng Hao, and Feiqi Deng.
Svdd-based outlier detection on uncertain data. Knowledge and
information systems, 34(3):597–618, 2013.
B. Schölkopf and A. J. Smola. Learning with Kernels. MIT Press, 2002.
John Shawe-Taylor and Nello Cristianini. Kernel methods for pattern
analysis. Cambridge university press, 2004.
David MJ Tax and Robert PW Duin. Support vector data description.
Machine learning, 54(1):45–66, 2004.
Régis Vert and Jean-Philippe Vert. Consistency and convergence rates of
one-class svms and related algorithms. The Journal of Machine Learning
Research, 7:817–854, 2006.
Mingrui Wu and Jieping Ye. A small sphere and large margin approach for
novelty detection using training data with outliers. Pattern Analysis and
Machine Intelligence, IEEE Transactions on, 31(11):2088–2092, 2009.
Stéphane Canu (INSA Rouen - LITIS) May 12, 2014 35 / 35
Lecture 5: SVM as a kernel machine
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
April 26, 2014Plan
1 Kernel machines
Non sparse kernel machines
Sparse kernel machines: SVM
SVM: variations on a theme
Sparse kernel machines for regression: SVR
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1 1
1
1
1
1
1
1
1
1
1
1
1Interpolation splines
find out f ∈ H such that f (xi) = yi
, i = 1, ..., n
It is an ill posed problemInterpolation splines: minimum norm interpolation
(
min
f ∈H
1
2
kf k
2
H
such that f (xi) = yi
, i = 1, ..., n
The lagrangian (αi Lagrange multipliers)
L(f , α) = 1
2
kf k
2 −
Xn
i=1
αi
f (xi) − yi
Interpolation splines: minimum norm interpolation
(
min
f ∈H
1
2
kf k
2
H
such that f (xi) = yi
, i = 1, ..., n
The lagrangian (αi Lagrange multipliers)
L(f , α) = 1
2
kf k
2 −
Xn
i=1
αi
f (xi) − yi
optimality for f : ∇f L(f , α) = 0 ⇔ f (x) = Xn
i=1
αik(xi
, x)Interpolation splines: minimum norm interpolation
(
min
f ∈H
1
2
kf k
2
H
such that f (xi) = yi
, i = 1, ..., n
The lagrangian (αi Lagrange multipliers)
L(f , α) = 1
2
kf k
2 −
Xn
i=1
αi
f (xi) − yi
optimality for f : ∇f L(f , α) = 0 ⇔ f (x) = Xn
i=1
αik(xi
, x)
dual formulation (remove f from the lagrangian):
Q(α) = −
1
2
Xn
i=1
Xn
j=1
αiαjk(xi
, xj) +Xn
i=1
αi yi solution: max
α∈IRn
Q(α)
Kα = yRepresenter theorem
Theorem (Representer theorem)
Let H be a RKHS with kernel k(s,t). Let ℓ be a function from X to IR
(loss function) and Φ a non decreasing function from IR to IR. If there
exists a function f ∗minimizing:
f
∗ = argmin
f ∈H
Xn
i=1
ℓ
yi
, f (xi)
+ Φ
kf k
2
H
then there exists a vector α ∈ IRn
such that:
f
∗
(x) = Xn
i=1
αik(x, xi)
it can be generalized to the semi parametric case: +
Pm
j=1
βjφj(x)Elements of a proof
1 Hs = span{k(., x1), ..., k(., xi), ..., k(., xn)}
2 orthogonal decomposition: H = Hs ⊕ H⊥ ⇒ ∀f ∈ H; f = fs + f⊥
3 pointwise evaluation decomposition
f (xi) = fs (xi) + f⊥(xi)
= hfs (.), k(., xi)iH + hf⊥(.), k(., xi)iH
| {z }
=0
= fs (xi)
4 norm decomposition kf k
2
H = kfsk
2
H + kf⊥k
2
H | {z }
≥0
≥ kfsk
2
H
5 decompose the global cost
Xn
i=1
ℓ
yi
, f (xi)
+ Φ
kf k
2
H
=
Xn
i=1
ℓ
yi
, fs (xi)
+ Φ
kfsk
2
H + kf⊥k
2
H
≥
Xn
i=1
ℓ
yi
, fs (xi)
+ Φ
kfsk
2
H
6 argmin
f ∈H
= argmin
f ∈Hs
.Smooting splines
introducing the error (the slack) ξ = f (xi) − yi
(S)
min
f ∈H
1
2
kf k
2
H +
1
2λ
Xn
i=1
ξ
2
i
such that f (xi) = yi + ξi
, i = 1, n
3 equivalent definitions
(S
′
) min
f ∈H
1
2
Xn
i=1
f (xi ) − yi
2 +
λ
2
kf k
2
H
min
f ∈H
1
2
kf k
2
H
such that Xn
i=1
f (xi ) − yi
2 ≤ C
′
min
f ∈H
Xn
i=1
f (xi ) − yi
2
such that kf k
2
H ≤ C
′′
using the representer theorem
(S
′′) min
α∈IRn
1
2
kKα − yk
2 +
λ
2
α
⊤Kα
solution: (S) ⇔ (S
′
) ⇔ (S
′′) ⇔ α = (K + λI)
−1
y
6= ridge regression:
min
α∈IRn
1
2
kKα − yk
2 +
λ
2
α
⊤α with α = (K
⊤K + λI)
−1K
⊤yKernel logistic regression
inspiration: the Bayes rule
D(x) = sign
f (x) + α0
=⇒ log
IP(Y =1|x)
IP(Y =−1|x)
= f (x) + α0
probabilities:
IP(Y = 1|x) = expf (x)+α0
1 + expf (x)+α0
IP(Y = −1|x) = 1
1 + expf (x)+α0
Rademacher distribution
L(xi
, yi
, f , α0) = IP(Y = 1|xi)
yi +1
2 (1 − IP(Y = 1|xi))
1−yi
2
penalized likelihood
J(f , α0) = −
Xn
i=1
log
L(xi
, yi
, f , α0)
+
λ
2
kf k
2
H
=
Xn
i=1
log
1 + exp−yi (f (xi )+α0)
+
λ
2
kf k
2
HKernel logistic regression (2)
(R)
min
f ∈H
1
2
kf k
2
H +
1
λ
Xn
i=1
log
1 + exp−ξi
with ξi = yi (f (xi) + α0), i = 1, n
Representer theorem
J(α, α0) = 1I⊤ log
1I + expdiag(y)Kα+α0y
+
λ
2
α
⊤Kα
gradient vector anf Hessian matrix:
∇αJ(α, α0) = K
y − (2p − 1I)
+ λKα
HαJ(α, α0) = Kdiag
p(1I − p)
K + λK
solve the problem using Newton iterations
α
new = α
old+
Kdiag
p(1I − p)
K + λK
−1
K
y − (2p − 1I) + λαLet’s summarize
pros
◮ Universality
◮ from H to IRn
using the representer theorem
◮ no (explicit) curse of dimensionality
splines O(n
3
) (can be reduced to O(n
2
))
logistic regression O(kn3
) (can be reduced to O(kn2
)
no scalability!
sparsity comes to the rescue!Roadmap
1 Kernel machines
Non sparse kernel machines
Sparse kernel machines: SVM
SVM: variations on a theme
Sparse kernel machines for regression: SVR
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
−1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1 1
1
1
1
1
1
1
1
1
1
1
1
Stéphane Canu (INSA Rouen - LITIS) April 26, 2014 11 / 38SVM in a RKHS: the separable case (no noise)
max
f ,b
m
with yi
f (xi) + b
≥ m
and kf k
2
H = 1
⇔
(
min
f ,b
1
2
kf k
2
H
with yi
f (xi) + b
≥ 1
3 ways to represent function f
f (x)
| {z }
in the RKHS H
=
X
d
j=1
wj φj(x)
| {z }
d features
=
Xn
i=1
αi yi k(x, xi)
| {z }
n data points
(
min
w,b
1
2
kwk
2
IRd =
1
2 w⊤w
with yi
w⊤φ(xi) + b
≥ 1
⇔
(
min
α,b
1
2
α
⊤Kα
with yi
α
⊤K(:, i) + b
≥ 1using relevant features...
a data point becomes a function x −→ k(x, •)Representer theorem for SVM
(
min
f ,b
1
2
kf k
2
H
with yi
f (xi) + b
≥ 1
Lagrangian
L(f , b, α) = 1
2
kf k
2
H −
Xn
i=1
αi
yi(f (xi) + b) − 1
α ≥ 0
optimility condition: ∇f L(f , b, α) = 0 ⇔ f (x) = Xn
i=1
αi yik(xi
, x)
Eliminate f from L:
kf k
2
H =
Xn
i=1
Xn
j=1
αiαjyi yjk(xi
, xj)
Xn
i=1
αi yif (xi) = Xn
i=1
Xn
j=1
αiαjyi yjk(xi
, xj)
Q(b, α) = −
1
2
Xn
i=1
Xn
j=1
αiαjyi yjk(xi
, xj) −
Xn
i=1
αi
yib − 1
Dual formulation for SVM
the intermediate function
Q(b, α) = −
1
2
Xn
i=1
Xn
j=1
αiαjyi yjk(xi
, xj) − b
Xn
i=1
αi yi
+
Xn
i=1
αi
max
α
min
b
Q(b, α)
b can be seen as the Lagrange multiplier of the following (balanced)
constaint Pn
i=1 αi yi = 0 which is also the optimality KKT condition on b
Dual formulation
max
α∈IRn
−
1
2
Xn
i=1
Xn
j=1
αiαjyi yjk(xi
, xj) +Xn
i=1
αi
such that Xn
i=1
αi yi = 0
and 0 ≤ αi
, i = 1, nSVM dual formulation
Dual formulation
max
α∈IRn
−
1
2
Xn
i=1
Xn
j=1
αiαjyi yjk(xi
, xj) +Xn
i=1
αi
with Xn
i=1
αi yi = 0 and 0 ≤ αi
, i = 1, n
The dual formulation gives a quadratic program (QP)
(
min
α∈IRn
1
2
α
⊤Gα − I1
⊤α
with α
⊤y = 0 and 0 ≤ α
with Gij = yi yjk(xi
, xj)
with the linear kernel f (x) = Pn
i=1 αi yi(x
⊤xi) = Pd
j=1
βjxj
when d is small wrt. n primal may be interesting.the general case: C-SVM
Primal formulation
(P)
min
f ∈H,b,ξ∈IRn
1
2
kf k
2 +
C
p
Xn
i=1
ξ
p
i
such that yi
f (xi) + b
≥ 1 − ξi
, ξi ≥ 0, i = 1, n
C is the regularization path parameter (to be tuned)
p = 1 , L1 SVM
(
max
α∈IRn
−
1
2
α
⊤Gα + α
⊤1I
such that α
⊤y = 0 and 0 ≤ αi ≤ C i = 1, n
p = 2, L2 SVM
(
max
α∈IRn
−
1
2
α
⊤
G +
1
C
I
α + α
⊤1I
such that α
⊤y = 0 and 0 ≤ αi
i = 1, n
the regularization path: is the set of solutions α(C) when C variesData groups: illustration
f (x) = Xn
i=1
αi k(x, xi )
D(x) = sign
f (x) + b
useless data important data suspicious data
well classified support
α = 0 0 < α < C α = C
the regularization path: is the set of solutions α(C) when C variesThe importance of being support
f (x) = Xn
i=1
αi yik(xi
, x)
data
point α
constraint
value set
xi useless αi = 0 yi
f (xi) + b
> 1 I0
xi support 0 < αi < C yi
f (xi) + b
= 1 Iα
xi suspicious αi = C yi
f (xi) + b
< 1 IC
Table : When a data point is « support » it lies exactly on the margin.
here lies the efficiency of the algorithm (and its complexity)!
sparsity: αi = 0The active set method for SVM (1)
min
α∈IRn
1
2
α
⊤Gα − α
⊤1I
such that α
⊤y = 0 i = 1, n
and 0 ≤ αi
i = 1, n
Gα − 1I − β + by = 0
α
⊤y = 0
0 ≤ αi
i = 1, n
0 ≤ βi
i = 1, n
αiβi = 0 i = 1, n
αa
0
− − + b
1
1
0
β0
ya
y0
=
0
0
G α − − 1I β + b y = 0
Ga
Gi G0
G
⊤
i
(1) Gaαa − 1Ia + bya = 0
(2) Giαa − 1I0 − β0 + by0 = 0
1 solve (1) (find α together with b)
2 if α < 0 move it from Iα to I0
goto 1
3 else solve (2)
if β < 0 move it from I0 to Iα
goto 1The active set method for SVM (2)
Function (α, b, Iα) ←Solve_QP_Active_Set(G, y)
% Solve minα 1/2α⊤Gα − 1I⊤α
% s.t. 0 ≤ α and y⊤α = 0
(Iα, I0, α) ← initialization
while The_optimal_is_not_reached do
(α, b) ← solve
Gaαa − 1Ia + bya
y⊤
a αa
= 0
if ∃i ∈ Iα such that αi < 0 then
α ← projection( αa, α)
move i from Iα to I0
else if ∃j ∈ I0 such that βj < 0 then
use β0 = y0(Kiαa + b1I0) − 1I0
move j from I0 to Iα
else
The_optimal_is_not_reached ← FALSE
end if
end while
α
α
old
α
new
Projection step of the active
constraints algorithm
d = alpha - alphaold;
alpha = alpha + t * d;
Caching Strategy
Save space and computing time by computing only the needed parts of kernel matrix GTwo more ways to derivate SVM
Using the hinge loss
min
f ∈H,b∈IR
1
p
Xn
i=1
max
0, 1 − yi(f (xi) + b)
p
+
1
2C
kf k
2
Minimizing the distance between the convex hulls
min
α
ku − vk
2
H
with u(x) = X
{i|yi =1}
αik(xi
, x), v(x) = X
{i|yi =−1}
αik(xi
, x)
and X
{i|yi =1}
αi = 1,
X
{i|yi =−1}
αi = 1, 0 ≤ αi
i = 1, n
f (x) = 2
ku − vk
2
H
u(x) − v(x)
and b =
kuk
2
H − kvk
2
H
ku − vk
2
H
the regularization path: is the set of solutions α(C) when C variesRegularization path for SVM
min
f ∈H
Xn
i=1
max(1 − yif (xi), 0) + λo
2
kf k
2
H
Iα is the set of support vectors s.t. yi
f (xi) = 1;
∂f J(f ) = X
i∈Iα
γi yiK(xi
, •) −
X
i∈I1
yiK(xi
, •) + λo f (•) with γi ∈ ∂H(1) =] − 1, 0[Regularization path for SVM
min
f ∈H
Xn
i=1
max(1 − yif (xi), 0) + λo
2
kf k
2
H
Iα is the set of support vectors s.t. yi
f (xi) = 1;
∂f J(f ) = X
i∈Iα
γi yiK(xi
, •) −
X
i∈I1
yiK(xi
, •) + λo f (•) with γi ∈ ∂H(1) =] − 1, 0[
Let λn a value close enough to λo to keep the sets I0, Iα and IC unchanged
In particular at point xj ∈ Iα (fo (xj) = fn(xj) = yj) : ∂f J(f )(xj) = 0
P
i∈Iα
γioyiK(xi
, xj) = P
i∈I1
yiK(xi
P , xj) − λo yj
i∈Iα
γinyiK(xi
, xj) = P
i∈I1
yiK(xi
, xj) − λn yj
G(γn − γo) = (λo − λn)y avec Gij = yiK(xi
, xj)
γn = γo + (λo − λn)w
w = (G)
−1
yExample of regularization path
γi ∈] − 1, 0[ yiγi ∈] − 1, −1[ λ =
1
C
γi = −
1
C
αi
; performing together estimation and data selectionHow to choose ℓ and P to get linear regularization path?
the path is piecewise linear ⇔
one is piecewise quadratic
and the other is piecewise linear
the convex case [Rosset & Zhu, 07]
min
β∈IRd
ℓ(β) + λP(β)
1 piecewise linearity: lim
ε→0
β(λ + ε) − β(λ)
ε
= constant
2 optimality
∇ℓ(β(λ)) + λ∇P(β(λ)) = 0
∇ℓ(β(λ + ε)) + (λ + ε)∇P(β(λ + ε)) = 0
3 Taylor expension
lim
ε→0
β(λ + ε) − β(λ)
ε
=
∇2
ℓ(β(λ)) + λ∇2P(β(λ))−1∇P(β(λ))
∇2
ℓ(β(λ)) = constant and ∇2P(β(λ)) = 0
Lecture 4: kernels and associated functions
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
March 4, 2014Plan
1 Statistical learning and kernels
Kernel machines
Kernels
Kernel and hypothesis set
Functional differentiation in RKHSIntroducing non linearities through the feature map
SVM Val
f (x) = X
d
j=1
xjwj + b =
Xn
i=1
αi(x
⊤
i x) + b
t1
t2
∈ IR2
x1
x2
x3
x4
x5
linear in x ∈ IR5
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 3 / 37Introducing non linearities through the feature map
SVM Val
f (x) = X
d
j=1
xjwj + b =
Xn
i=1
αi(x
⊤
i x) + b
t1
t2
∈ IR2 φ(t) =
t1 x1
t
2
1
x2
t2 x3
t
2
2
x4
t1t2 x5
linear in x ∈ IR5
quadratic in t ∈ IR2
The feature map
φ : IR2 −→ IR5
t 7−→ φ(t) = x
x
⊤
i x = φ(ti)
⊤φ(t)
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 3 / 37Introducing non linearities through the feature map
A. Lorena & A. de Carvalho, Uma Introducão às Support Vector Machines, 2007
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 4 / 37Non linear case: dictionnary vs. kernel
in the non linear case: use a dictionary of functions
φj(x), j = 1, p with possibly p = ∞
for instance polynomials, wavelets...
f (x) = X
p
j=1
wjφj(x) with wj =
Xn
i=1
αi yiφj(xi)
so that
f (x) = Xn
i=1
αi yi
X
p
j=1
φj(xi)φj(x)
| {z }
k(xi
,x)
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 5 / 37Non linear case: dictionnary vs. kernel
in the non linear case: use a dictionary of functions
φj(x), j = 1, p with possibly p = ∞
for instance polynomials, wavelets...
f (x) = X
p
j=1
wjφj(x) with wj =
Xn
i=1
αi yiφj(xi)
so that
f (x) = Xn
i=1
αi yi
X
p
j=1
φj(xi)φj(x)
| {z }
k(xi
,x)
p ≥ n so what since k(xi
, x) = Pp
j=1
φj(xi)φj(x)
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 5 / 37closed form kernel: the quadratic kernel
The quadratic dictionary in IRd
:
Φ : IRd → IRp=1+d+
d(d +1)
2
s 7→ Φ =
1,s1,s2, ...,sd ,s
2
1
,s
2
2
, ...,s
2
d
, ...,sisj
, ...
in this case
Φ(s)
⊤Φ(t) = 1 + s1t1 + s2t2 + ... + sd td + s
2
1
t
2
1 + ... + s
2
d
t
2
d + ... + sisjtitj + ...
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 6 / 37closed form kernel: the quadratic kernel
The quadratic dictionary in IRd
:
Φ : IRd → IRp=1+d+
d(d +1)
2
s 7→ Φ =
1,s1,s2, ...,sd ,s
2
1
,s
2
2
, ...,s
2
d
, ...,sisj
, ...
in this case
Φ(s)
⊤Φ(t) = 1 + s1t1 + s2t2 + ... + sd td + s
2
1
t
2
1 + ... + s
2
d
t
2
d + ... + sisjtitj + ...
The quadratic kenrel: s, t ∈ IRd
, k(s, t) =
s
⊤t + 1
2
= 1 + 2s
⊤t +
s
⊤t
2
computes the dot product of the reweighted dictionary:
Φ : IRd → IRp=1+d+
d(d +1)
2
s 7→ Φ =
1,
√
2s1,
√
2s2, ..., √
2sd ,s
2
1
,s
2
2
, ...,s
2
d
, ..., √
2sisj
, ...
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 6 / 37closed form kernel: the quadratic kernel
The quadratic dictionary in IRd
:
Φ : IRd → IRp=1+d+
d(d +1)
2
s 7→ Φ =
1,s1,s2, ...,sd ,s
2
1
,s
2
2
, ...,s
2
d
, ...,sisj
, ...
in this case
Φ(s)
⊤Φ(t) = 1 + s1t1 + s2t2 + ... + sd td + s
2
1
t
2
1 + ... + s
2
d
t
2
d + ... + sisjtitj + ...
The quadratic kenrel: s, t ∈ IRd
, k(s, t) =
s
⊤t + 1
2
= 1 + 2s
⊤t +
s
⊤t
2
computes the dot product of the reweighted dictionary:
Φ : IRd → IRp=1+d+
d(d +1)
2
s 7→ Φ =
1,
√
2s1,
√
2s2, ..., √
2sd ,s
2
1
,s
2
2
, ...,s
2
d
, ..., √
2sisj
, ...
p = 1 + d +
d(d+1)
2 multiplications vs. d + 1
use kernel to save computration
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 6 / 37kernel: features throught pairwise comparizons
x φ(x)
e.g. a text e.g. BOW
K
n examples
n examples
Φ
p features
n examples
k(xi
, xj) = X
p
j=1
φj(xi)φj(xj)
K The matrix of pairwise comparizons (O(n
2
))
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 7 / 37Kenrel machine
kernel as a dictionary
f (x) = Xn
i=1
αik(x, xi)
αi
influence of example i depends on yi
k(x, xi) the kernel do NOT depend on yi
Definition (Kernel)
Let X be a non empty set (the input space).
A kernel is a function k from X × X onto IR.
k : X × X 7−→ IR
s, t −→ k(s, t)Kenrel machine
kernel as a dictionary
f (x) = Xn
i=1
αik(x, xi)
αi
influence of example i depends on yi
k(x, xi) the kernel do NOT depend on yi
Definition (Kernel)
Let X be a non empty set (the input space).
A kernel is a function k from X × X onto IR.
k : X × X 7−→ IR
s, t −→ k(s, t)
semi-parametric version: given the family qj(x), j = 1, p
f (x) = Xn
i=1
αik(x, xi)+
X
p
j=1
βjqj(x)Kernel Machine
Definition (Kernel machines)
A
(xi
, yi)i=1,n
(x) = ψ
Xn
i=1
αik(x, xi) +X
p
j=1
βjqj(x)
α et β: parameters to be estimated.
Exemples
A(x) = Xn
i=1
αi(x − xi)
3
+ + β0 + β1x splines
A(x) = signX
i∈I
αi exp−
kx−xi
k
2
b +β0
SVM
IP(y|x) = 1
Z
expX
i∈I
αi1I{y=yi }(x
⊤xi + b)
2
exponential familyPlan
1 Statistical learning and kernels
Kernel machines
Kernels
Kernel and hypothesis set
Functional differentiation in RKHS
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 10 / 37In the beginning was the kernel...
Definition (Kernel)
a function of two variable k from X × X to IR
Definition (Positive kernel)
A kernel k(s,t) on X is said to be positive
if it is symetric: k(s,t) = k(t,s)
an if for any finite positive interger n:
∀{αi}i=1,n ∈ IR, ∀{xi}i=1,n ∈ X ,
Xn
i=1
Xn
j=1
αiαjk(xi
, xj) ≥ 0
it is strictly positive if for αi 6= 0
Xn
i=1
Xn
j=1
αiαjk(xi
, xj) > 0Examples of positive kernels
the linear kernel: s, t ∈ IRd
, k(s, t) = s
⊤t
symetric: s
⊤t = t
⊤s
positive: Xn
i=1
Xn
j=1
αiαj k(xi
, xj ) = Xn
i=1
Xn
j=1
αiαj x
⊤
i
xj
=
Xn
i=1
αi xi
!⊤
Xn
j=1
αj xj
=
Xn
i=1
αi xi
2
the product kernel: k(s, t) = g(s)g(t) for some g : IRd → IR,
symetric by construction
positive: Xn
i=1
Xn
j=1
αiαj k(xi
, xj ) = Xn
i=1
Xn
j=1
αiαj g(xi )g(xj )
=
Xn
i=1
αi g(xi )
!
Xn
j=1
αj g(xj )
=
Xn
i=1
αi g(xi )
!2
k is positive ⇔ (its square root exists) ⇔ k(s, t) = hφs, φti
J.P. Vert, 2006Example: finite kernel
let φj
, j = 1, p be a finite dictionary of functions from X to IR (polynomials,
wavelets...)
the feature map and linear kernel
feature map: Φ : X → IRp
s 7→ Φ =
φ1(s), ..., φp(s)
Linear kernel in the feature space:
k(s, t) =
φ1(s), ..., φp(s)
⊤
φ1(t), ..., φp(t)
e.g. the quadratic kernel: s, t ∈ IRd
, k(s, t) =
s
⊤t + b
2
feature map:
Φ : IRd → IRp=1+d+
d(d +1)
2
s 7→ Φ =
1,
√
2s1, ..., √
2sj
, ..., √
2sd ,s
2
1
, ...,s
2
j
, ...,s
2
d
, ..., √
2sisj
, ...Positive definite Kernel (PDK) algebra (closure)
if k1(s,t) and k2(s,t) are two positive kernels
DPK are a convex cone: ∀a1 ∈ IR+
a1k1(s, t) + k2(s, t)
product kernel k1(s, t)k2(s, t)
proofs
by linearity:
Xn
i=1
Xn
j=1
αiαj
a1k1(i, j) + k2(i, j)
= a1
Xn
i=1
Xn
j=1
αiαj k1(i, j) +Xn
i=1
Xn
j=1
αiαj k2(i, j)
assuming ∃ψℓ s.t. k1(s, t) = X
ℓ
ψℓ(s)ψℓ(t)
Xn
i=1
Xn
j=1
αiαj k1(xi
, xj )k2(xi
, xj ) = Xn
i=1
Xn
j=1
αiαj
X
ℓ
ψℓ(xi )ψℓ(xj )k2(xi
, xj )
=
X
ℓ
Xn
i=1
Xn
j=1
αiψℓ(xi )
αjψℓ(xj
)
k2(xi
, xj )
N. Cristianini and J. Shawe Taylor, kernel methods for pattern analysis, 2004Kernel engineering: building PDK
for any polynomial with positive coef. φ from IR to IR
φ
k(s,t)
if Ψis a function from IRd
to IRd
k
Ψ(s), Ψ(t)
if ϕ from IRd
to IR+, is minimum in 0
k(s,t) = ϕ(s + t) − ϕ(s − t)
convolution of two positive kernels is a positive kernel
K1 ⋆ K2
Example : the Gaussian kernel is a PDK
exp(−ks − tk
2
) = exp(−ksk
2 − ktk
2 + 2s
⊤t)
= exp(−ksk
2
) exp(−ktk
2
) exp(2s
⊤t)
s
⊤t is a PDK and function exp as the limit of positive series expansion, so
exp(2s
⊤t) is a PDK
exp(−ksk
2
) exp(−ktk
2
) is a PDK as a product kernel
the product of two PDK is a PDK
O. Catoni, master lecture, 2005an attempt at classifying PD kernels
stationary kernels, (also called translation invariant):
k(s,t) = ks (s − t)
◮ radial (isotropic) gaussian: exp
− r
2
b
, r = ks − tk
◮ with compact support
c.s. Matèrn : max
0, 1 −
r
b
κ
r
b
kBk
r
b
, κ ≥ (d + 1)/2
◮ locally stationary kernels: k(s,t) = k1(s + t)ks (s − t)
K1 is a non negative function and K2 a radial kernel.
non stationary (projective kernels):
k(s,t) = kp(s
⊤t)
◮ separable kernels k(s,t) = k1(s)k2(t) with k1 and k2(t) PDK
in this case K = k1k
⊤
2 where k1 = (k1(x1), ..., k1(xn))
MG Genton, Classes of Kernels for Machine Learning: A Statistics Perspective - JMLR, 2002some examples of PD kernels...
type name k(s,t)
radial gaussian exp
−
r
2
b
, r = ks − tk
radial laplacian exp(−r/b)
radial rationnal 1 −
r
2
r
2+b
radial loc. gauss. max
0, 1 −
r
3b
d
exp(−
r
2
b
)
non stat. χ
2
exp(−r/b), r =
P
k
(sk−tk )
2
sk+tk
projective polynomial (s
⊤t)
p
projective affine (s
⊤t + b)
p
projective cosine s
⊤t/kskktk
projective correlation exp
s⊤t
kskktk − b
Most of the kernels depends on a quantity b called the bandwidththe importance of the Kernel bandwidth
for the affine Kernel: Bandwidth = biais
k(s, t) = (s
⊤t + b)
p = b
p
s
⊤t
b
+ 1
p
for the gaussian Kernel: Bandwidth = influence zone
k(s, t) = 1
Z
exp
−
ks − tk
2
2σ
2
b = 2σ
2the importance of the Kernel bandwidth
for the affine Kernel: Bandwidth = biais
k(s, t) = (s
⊤t + b)
p = b
p
s
⊤t
b
+ 1
p
for the gaussian Kernel: Bandwidth = influence zone
k(s, t) = 1
Z
exp
−
ks − tk
2
2σ
2
b = 2σ
2
Illustration
1 d density estimation b =
1
2
b = 2
+ data
(x1, x2, ..., xn)
– Parzen estimate
IPb(x) = 1
Z
Xn
i=1
k(x, xi)kernels for objects and structures
kernels on histograms and probability distributions
kernel on strings
spectral string kernel k(s, t) = P
u φu(s)φu(t)
using sub sequences
similarities by alignements k(s, t) = P
π
exp(β(s, t, π))
kernels on graphs
the pseudo inverse of the (regularized) graph Laplacian
L = D − A A is the adjency matrixD the degree matrix
diffusion kernels 1
Z(b)
expbL
subgraph kernel convolution (using random walks)
and kernels on HMM, automata, dynamical system...
Shawe-Taylor & Cristianini’s Book, 2004 ; JP Vert, 2006Multiple kernel
M. Cuturi, Positive Definite Kernels in Machine Learning, 2009Gram matrix
Definition (Gram matrix)
let k(s,t) be a positive kernel on X and (xi)i=1,n a sequence on X . the
Gram matrix is the square K of dimension n and of general term
Kij = k(xi
, xj).
practical trick to check kernel positivity:
K is positive ⇔ λi > 0 its eigenvalues are posivies: if Kui = λiui
; i = 1, n
u
⊤
i Kui = λiu
⊤
i ui = λi
matrix K is the one to be usedExamples of Gram matrices with different bandwidth
raw data Gram matrix for b = 2
b = .5 b = 10different point of view about kernels
kernel and scalar product
k(s, t) = hφ(s), φ(t)iH
kernel and distance
d(s, t)
2 = k(s, s) + k(t, t) − 2k(s, t)
kernel and covariance: a positive matrix is a covariance matrix
IP(f) = 1
Z
exp
−
1
2
(f − f0)
⊤K
−1
(f − f0)
if f0 = 0 and f = Kα, IP(α) = 1
Z
exp − 1
2
α⊤Kα
Kernel and regularity (green’s function)
k(s, t) = P
∗Pδs−t for some operator P (e.g. some differential)Let’s summarize
positive kernels
there is a lot of them
can be rather complex
2 classes: radial / projective
the bandwith matters (more than the kernel itself)
the Gram matrix summarize the pairwise comparizonsRoadmap
1 Statistical learning and kernels
Kernel machines
Kernels
Kernel and hypothesis set
Functional differentiation in RKHS
Stéphane Canu (INSA Rouen - LITIS) March 4, 2014 25 / 37From kernel to functions
H0 =
f
mf < ∞; fj ∈ IR;tj ∈ X , f (x) = Xmf
j=1
fjk(x,tj)
let define the bilinear form (g(x) = Pmg
i=1
gi k(x, si )) :
∀f , g ∈ H0, hf , giH0 =
Xmf
j=1
Xmg
i=1
fj gi k(tj
,si)
Evaluation functional: ∀x ∈ X
f (x) = hf (•), k(x, •)iH0
from k to H
for any positive kernel, a hypothesis set can be constructed H = H0 with
its metricRKHS
Definition (reproducing kernel Hibert space (RKHS))
a Hilbert space H embeded with the inner product h•, •iH is said to be
with reproducing kernel if it exists a positive kernel k such that
∀s ∈ X , k(•,s) ∈ H
∀f ∈ H, f (s) = hf (•), k(s, •)iH
Beware: f = f (•) is a function while f (s) is the real value of f at point s
positive kernel ⇔ RKHS
any function in H is pointwise defined
defines the inner product
it defines the regularity (smoothness) of the hypothesis set
Exercice: let f (•) = Pn
i=1 αik(•, xi). Show that kf k
2
H = α
⊤KαOther kernels (what really matters)
finite kernels
k(s, t) =
φ1(s), ..., φp(s)
⊤
φ1(t), ..., φp(t)
Mercer kernels
positive on a compact set ⇔ k(s, t) = Pp
j=1
λjφj(s)φj(t)
positive kernels
positive semi-definite
conditionnaly positive (for some functions pj)
∀{xi}i=1,n, ∀αi
,
Xn
i
αipj(xi) = 0; j = 1, p,
Xn
i=1
Xn
j=1
αiαjk(xi
, xj) ≥ 0
symetric non positive
k(s, t) = tanh(s
⊤t + α0)
non symetric – non positive
the key property: ∇Jt
(f ) = k(t, .) holds
C. Ong et al, ICML , 2004The kernel map
observation: x = (x1, . . . , xj
, . . . , xd )
⊤
◮ f (x) = w⊤x = hw, xi
IRd
feature map: x −→ Φ(x) = (φ1(x), . . . , φj(x), . . . , φp(x))⊤
◮ Φ : IRd
7−→ IRp
◮ f (x) = w⊤Φ(x) = hw, Φ(x)iIRp
kernel dictionary: x −→ k(x) = (k(x, x1), . . . , k(x, xi), . . . , k(x, xn))⊤
◮ k : IRd
7−→ IRn
◮ f (x) = Xn
i=1
αik(x, xi) = hα, k(x)iIRn
kernel map: x −→ k(•, x) p = ∞
◮ f (x) = hf (•),K(•, x)iHRoadmap
1 Statistical learning and kernels
Kernel machines
Kernels
Kernel and hypothesis set
Functional differentiation in RKHSFunctional differentiation in RKHS
Let J be a functional
J : H → IR
f 7→ J(f )
examples: J1(f ) = kf k
2
H, J2(f ) = f (x),
J directional derivative in direction g at point f
dJ(f , g) = lim
ε → 0
J(f + εg) − J(f )
ε
Gradient ∇J (f )
∇J : H → H
f 7→ ∇J (f )
if dJ(f , g) = h∇J (f ), giH
exercise: find out ∇J1
(f ) et ∇J2
(f )Hint
dJ(f , g) = dJ(f + εg)
dε
ε=0Solution
dJ1(f , g) = lim
ε → 0
kf +εgk
2−kf k
2
ε
=
lim
ε → 0
kf k
2+ε
2kgk
2+2εhf ,giH−kf k
2
ε
=
lim
ε → 0
εkgk
2 + 2hf , giH
= h2f , giH
⇔ ∇J1
(f ) = 2f
dJ2(f , g) = lim
ε → 0
f (x)+εg(x)−f (x)
ε
= g(x)
= hk(x, .), giH
⇔ ∇J2
(f ) = k(x, .)Solution
dJ1(f , g) = lim
ε → 0
kf +εgk
2−kf k
2
ε
=
lim
ε → 0
kf k
2+ε
2kgk
2+2εhf ,giH−kf k
2
ε
=
lim
ε → 0
εkgk
2 + 2hf , giH
= h2f , giH
⇔ ∇J1
(f ) = 2f
dJ2(f , g) = lim
ε → 0
f (x)+εg(x)−f (x)
ε
= g(x)
= hk(x, .), giH
⇔ ∇J2
(f ) = k(x, .)
Minimize
f ∈H
J(f ) ⇔ ∀g ∈ H, dJ(f , g) = 0 ⇔ ∇J (f ) = 0Subdifferential in a RKHS H
Definition (Sub gradient)
a subgradient of J : H 7−→ IR at f0 is any function g ∈ H such that
∀f ∈ V(f0), J(f ) ≥ J(f0) + hg,(f − f0)iH
Definition (Subdifferential)
∂J(f ), the subdifferential of J at f is the set of all subgradients of J at f .
H = IR J3(x) = |x| ∂J3(0) = {g ∈ IR | − 1 < g < 1}
H = IR J4(x) = max(0, 1 − x) ∂J4(1) = {g ∈ IR | − 1 < g < 0}
Theorem (Chain rule for linear Subdifferential)
Let T be a linear operator H 7−→ IR and ϕ a function from IR to IR
If J(f ) = ϕ(Tf )
Then ∂J(f ) = {T
∗g | g ∈ ∂ϕ(Tf )}, where T
∗ denotes T’s adjoint operatorexample of subdifferential in H
evaluation operator and its adjoint
T : H −→ IRn
f 7−→ Tf = (f (x1), . . . , f (xn))⊤
T
∗
: IRn −→ H
α 7−→ T
∗α
build the adjoint hTf , αiIRn = hf ,T
∗αiHexample of subdifferential in H
evaluation operator and its adjoint
T : H −→ IRn
f 7−→ Tf = (f (x1), . . . , f (xn))⊤
T
∗
: IRn −→ H
α 7−→ T
∗α =
Xn
i=1
αik(•, xi)
build the adjoint hTf , αiIRn = hf ,T
∗αiH
hTf , αiIRn =
Xn
i=1
f (xi)αi
=
Xn
i=1
hf (•), k(•, xi)iHαi
= hf (•),
Xn
i=1
αik(•, xi)
| {z }
T∗α
iHexample of subdifferential in H
evaluation operator and its adjoint
T : H −→ IRn
f 7−→ Tf = (f (x1), . . . , f (xn))⊤
T
∗
: IRn −→ H
α 7−→ T
∗α =
Xn
i=1
αik(•, xi)
build the adjoint hTf , αiIRn = hf ,T
∗αiH
hTf , αiIRn =
Xn
i=1
f (xi)αi
=
Xn
i=1
hf (•), k(•, xi)iHαi
= hf (•),
Xn
i=1
αik(•, xi)
| {z }
T∗α
iH
TT∗
: IRn −→ IRn
α 7−→ TT∗α =
Xn
j=1
αjk(xj
, xi)
= Kαexample of subdifferential in H
evaluation operator and its adjoint
T : H −→ IRn
f 7−→ Tf = (f (x1), . . . , f (xn))⊤
T
∗
: IRn −→ H
α 7−→ T
∗α =
Xn
i=1
αik(•, xi)
build the adjoint hTf , αiIRn = hf ,T
∗αiH
hTf , αiIRn =
Xn
i=1
f (xi)αi
=
Xn
i=1
hf (•), k(•, xi)iHαi
= hf (•),
Xn
i=1
αik(•, xi)
| {z }
T∗α
iH
TT∗
: IRn −→ IRn
α 7−→ TT∗α =
Xn
j=1
αjk(xj
, xi)
= Kα
Example of subdifferentials
x given J5(f ) = |f (x)| ∂J5(f0) =
g(•) = αk(•, x) ; −1 < α < 1
x given J6(f ) = max(0, 1 − f (x)) ∂J6(f1) =
g(•) = αk(•, x) ; −1 < α < 0
Optimal conditions
Theorem (Fermat optimality criterion)
When J(f ) is convex, f
⋆
is a stationary point of problem min
f ∈H
J(f )
If and only if 0 ∈ ∂J(f
⋆
)
f
f ⋆
⋆
∂J(f
⋆
)
exercice: find for a given y ∈ IR (from Obozinski)
min
x∈IR
1
2
(x − y)
2 + λ|x|Let’s summarize
positive kernels ⇔ RKHS = H ⇔ regularity kf k
2
H
the key property: ∇Jt
(f ) = k(t, .) holds not only for positive kernels
f (xi) exists (pointwise defined functions)
universal consistency in RKHS
the Gram matrix summarize the pairwise comparizons
Lecture 3: Linear SVM with slack variables
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
March 23, 2014The non separable case
−1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 3
−1
−0.5
0
0.5
1
1.5
2
2.5Road map
1 Linear SVM
The non separable case
The C (L1) SVM
The L2 SVM and others “variations on a theme”
The hinge loss
0 0
Slack jThe non separable case: a bi criteria optimization problem
Modeling potential errors: introducing slack variables ξi
(xi
, yi)
no error: yi(w⊤xi + b) ≥ 1 ⇒ ξi = 0
error: ξi = 1 − yi(w⊤xi + b) > 0
0 0
Slack j
min
w,b,ξ
1
2
kwk
2
min
w,b,ξ
C
p
Xn
i=1
ξ
p
i
with yi(w⊤xi + b) ≥ 1 − ξi
ξi ≥ 0 i = 1, n
Our hope: almost all ξi = 0Bi criteria optimization and dominance
L(w) = 1
p
Xn
i=1
ξ
p
i
P(w) = kwk
2
Dominance
w1 dominates w2
if L(w1) ≤ L(w2) and P(w1) ≤ P(w2)
Pareto front (or Pareto Efficient Frontier)
it is the set of all nondominated solutions
P(w) = || w ||2
L(w) = 1/p Y
n
i=1
j
p
i
admisible set
Pareto’s front
w = 0
Admissible solution
Figure: dominated point (red),
non dominated point (purple)
and Pareto front (blue).
Pareto frontier
⇔
Regularization path
Stéphane Canu (INSA Rouen - LITIS) March 23, 2014 5 / 293 equivalent formulations to reach Pareto’s front
min
w∈IRd
1
p
Xn
i=1
ξ
p
i + λ kwk
2
it works for CONVEX criteria!
Stéphane Canu (INSA Rouen - LITIS) March 23, 2014 6 / 293 equivalent formulations to reach Pareto’s front
min
w∈IRd
1
p
Xn
i=1
ξ
p
i + λ kwk
2
min
w
1
p
Xn
i=1
ξ
p
i
with kwk
2 ≤ k
it works for CONVEX criteria!
Stéphane Canu (INSA Rouen - LITIS) March 23, 2014 6 / 293 equivalent formulations to reach Pareto’s front
min
w∈IRd
1
p
Xn
i=1
ξ
p
i + λ kwk
2
min
w
1
p
Xn
i=1
ξ
p
i
with kwk
2 ≤ k
min
w
kwk
2
with 1
p
Xn
i=1
ξ
p
i ≤ k
′
it works for CONVEX criteria!
Stéphane Canu (INSA Rouen - LITIS) March 23, 2014 6 / 29The non separable case
Modeling potential errors: introducing slack variables ξi
(xi
, yi)
no error: yi(w⊤xi + b) ≥ 1 ⇒ ξi = 0
error: ξi = 1 − yi(w⊤xi + b) > 0
Minimizing also the slack (the error), for a given C > 0
min
w,b,ξ
1
2
kwk
2 +
C
p
Xn
i=1
ξ
p
i
with yi(w⊤xi + b) ≥ 1 − ξi
i = 1, n
ξi ≥ 0 i = 1, n
Looking for the saddle point of the lagrangian with the Lagrange
multipliers αi ≥ 0 and βi ≥ 0
L(w, b, α, β) = 1
2
kwk
2 +
C
p
Xn
i=1
ξ
p
i −
Xn
i=1
αi
yi(w
⊤xi + b) − 1 + ξi
−
Xn
i=1
βi ξiThe KKT(p = 1)
L(w, b, α, β) = 1
2
kwk
2 +
C
p
Xn
i=1
ξ
p
i −
Xn
i=1
αi
yi(w
⊤xi + b) − 1 + ξi
−
Xn
i=1
βi ξi
stationarity w −
Xn
i=1
αi yixi = 0 and Xn
i=1
αi yi = 0
C − αi − βi = 0 i = 1, . . . , n
primal admissibility yi(w⊤xi + b) ≥ 1 i = 1, . . . , n
ξi ≥ 0 i = 1, . . . , n
dual admissibility αi ≥ 0 i = 1, . . . , n
βi ≥ 0 i = 1, . . . , n
complementarity αi
yi(w⊤xi + b) − 1 + ξi
= 0 i = 1, . . . , n
βi ξi = 0 i = 1, . . . , n
Let’s eliminate β!KKT (p = 1)
stationarity w −
Xn
i=1
αi yixi = 0 and Xn
i=1
αi yi = 0
primal admissibility yi(w⊤xi + b) ≥ 1 i = 1, . . . , n
ξi ≥ 0 i = 1, . . . , n;
dual admissibility αi ≥ 0 i = 1, . . . , n
C − αi ≥ 0 i = 1, . . . , n;
complementarity αi
yi(w⊤xi + b) − 1 + ξi
= 0 i = 1, . . . , n
(C − αi) ξi = 0 i = 1, . . . , n
sets I0 IA IC
αi 0 0 < α < C C
βi C C − α 0
ξi 0 0 1 − yi(w⊤xi + b)
yi(w⊤xi + b) > 1 yi(w⊤xi + b) = 1 yi(w⊤xi + b) < 1
useless usefull (support vec) suspiciousThe importance of being support
−2 −1 0 1 2 3 4
−2
−1
0
1
2
3
4
−2 −1 0 1 2 3 4
−2
−1
0
1
2
3
4
.
data
point α
constraint
value set
xi useless αi = 0 yi
w⊤xi + b
> 1 I0
xi support 0 < αi < C yi
w⊤xi + b
= 1 Iα
xi suspicious αi = C yi
w⊤xi + b
< 1 IC
Table: When a data point is « support » it lies exactly on the margin.
here lies the efficiency of the algorithm (and its complexity)!
sparsity: αi = 0Optimality conditions (p = 1)
L(w, b, α, β) = 1
2
kwk
2 + C
Xn
i=1
ξi −
Xn
i=1
αi
yi(w
⊤xi + b) − 1 + ξi
−
Xn
i=1
βi ξi
Computing the gradients:
∇wL(w, b, α) = w −
Xn
i=1
αi yixi
∂L(w, b, α)
∂b
=
Xn
i=1
αi yi
∇ξiL(w, b, α) = C − αi − βi
no change for w and b
βi ≥ 0 and C − αi − βi = 0 ⇒ αi ≤ C
The dual formulation:
min
α∈IRn
1
2
α
⊤Gα − e
⊤α
with y
⊤α = 0
and 0 ≤ αi ≤ C i = 1, nSVM primal vs. dual
Primal
min
w,b,ξ∈IRn
1
2
kwk
2 + C
Xn
i=1
ξi
with yi(w⊤xi + b) ≥ 1 − ξi
ξi ≥ 0 i = 1, n
d + n + 1 unknown
2n constraints
classical QP
to be used when n is too
large to build G
Dual
min
α∈IRn
1
2
α
⊤Gα − e
⊤α
with y
⊤α = 0
and 0 ≤ αi ≤ C i = 1, n
n unknown
G Gram matrix (pairwise
influence matrix)
2n box constraints
easy to solve
to be used when n is not too
largeThe smallest C
C small ⇒ all the points are in IC : αi = C
−2 −1 0 1 2 3 4
−3
−2
−1
0
1
2
3
4
5
6
−1 ≤ fj = C
Xn
i=1
yi(x
⊤
i xj)+b ≤ 1
fM = max(f ) fm = min(f )
Cmax =
2
fM − fmRoad map
1 Linear SVM
The non separable case
The C (L1) SVM
The L2 SVM and others “variations on a theme”
The hinge loss
0 0
Slack jL2 SVM: optimality conditions (p = 2)
L(w, b, α, β) = 1
2
kwk
2 +
C
2
Xn
i=1
ξ
2
i −
Xn
i=1
αi
yi(w
⊤xi + b) − 1 + ξi
Computing the gradients:
∇wL(w, b, α) = w −
Xn
i=1
αi yixi
∂L(w, b, α)
∂b
=
Xn
i=1
αi yi
∇ξiL(w, b, α) = Cξi − αi
no need of the positivity constraint on ξi
no change for w and b
Cξi − αi = 0 ⇒ C
2
Pn
i=1
ξ
2
i −
Pn
i=1 αi ξi = −
1
2C
Pn
i=1 α
2
i
The dual formulation:
min
α∈IRn
1
2
α
⊤(G +
1
C
I)α − e
⊤α
with y
⊤α = 0
and 0 ≤ αi
i = 1, nSVM primal vs. dual
Primal
min
w,b,ξ∈IRn
1
2
kwk
2 +
C
2
Xn
i=1
ξ
2
i
with yi(w⊤xi + b) ≥ 1 − ξi
d + n + 1 unknown
n constraints
classical QP
to be used when n is too
large to build G
Dual
min
α∈IRn
1
2
α
⊤(G +
1
C
I)α − e
⊤α
with y
⊤α = 0
and 0 ≤ αi
i = 1, n
n unknown
G Gram matrix is regularized
n box constraints
easy to solve
to be used when n is not too
largeOne more variant: the ν SVM
max
v,a
m
with min
i=1,n
|v
⊤xi + a| ≥ m
kvk
2 = k
min
v,a
1
2
kvk
2 − ν m +
Pn
i=1
ξi
with yi(v
⊤xi + a) ≥ m − ξi
ξi ≥ 0, m ≥ 0
The dual formulation:
min
α∈IRn
1
2
α
⊤Gα
with y
⊤α = 0
and 0 ≤ αi ≤ 1/n i = 1, n
m ≤ e
⊤αThe convex hull formulation
Minimizing the distance between the convex hulls
min
α
ku − vk
with u =
X
{i|yi =1}
αixi
, v =
X
{i|yi =−1}
αixi
and X
{i|yi =1}
αi = 1,
X
{i|yi =−1}
αi = 1, 0 ≤ αi ≤ C i = 1, n
w
⊤x =
2
ku − vk
u
⊤x − v
⊤x
and b =
kuk − kvk
ku − vkSVM with non symetric costs
Problem in the primal (p = 1)
min
w,b,ξ∈IRn
1
2
kwk
2 + C
+ X
{i|yi =1}
ξi + C
− X
{i|yi =−1}
ξi
with yi
w⊤xi + b
≥ 1 − ξi
, ξi ≥ 0, i = 1, n
for p = 1 the dual formulation is the following:
(
max
α∈IRn
−
1
2
α
⊤Gα + α
⊤e
with α
⊤y = 0 and 0 ≤ αi ≤ C
+ or C
− i = 1, n
It generalizes to any cost (useful for unbalanced data)Road map
1 Linear SVM
The non separable case
The C (L1) SVM
The L2 SVM and others “variations on a theme”
The hinge loss
0 0
Slack jEliminating the slack but not the possible mistakes
min
w,b,ξ∈IRn
1
2
kwk
2 + C
Xn
i=1
ξi
with yi(w⊤xi + b) ≥ 1 − ξi
ξi ≥ 0 i = 1, n
Introducing the hinge loss
ξi = max
1 − yi(w
⊤xi + b), 0
min
w,b
1
2
kwk
2 + C
Xn
i=1
max
0, 1 − yi(w
⊤xi + b)
Back to d + 1 variables, but this is no longer an explicit QPOoops! the notion of sub differential
Definition (Sub gradient)
a subgradient of J : IRd
7−→ IR at f0 is any vector g ∈ IRd
such that
∀f ∈ V(f0), J(f ) ≥ J(f0) + g
⊤(f − f0)
Definition (Subdifferential)
∂J(f ), the subdifferential of J at f is the set of all subgradients of J at f .
IRd = IR J3(x) = |x| ∂J3(0) = {g ∈ IR | − 1 < g < 1}
IRd = IR J4(x) = max(0, 1 − x) ∂J4(1) = {g ∈ IR | − 1 < g < 0}Regularization path for SVM
min
w
Xn
i=1
max(1 − yiw
⊤xi
, 0) + λo
2
kwk
2
Iα is the set of support vectors s.t. yiw⊤xi = 1;
∂wJ(w) = X
i∈Iα
αi yixi −
X
i∈I1
yixi + λo w with αi ∈ ∂H(1) =] − 1, 0[Regularization path for SVM
min
w
Xn
i=1
max(1 − yiw
⊤xi
, 0) + λo
2
kwk
2
Iα is the set of support vectors s.t. yiw⊤xi = 1;
∂wJ(w) = X
i∈Iα
αi yixi −
X
i∈I1
yixi + λo w with αi ∈ ∂H(1) =] − 1, 0[
Let λn a value close enough to λo to keep the sets I0, Iα and IC unchanged
In particular at point xj ∈ Iα (w
⊤
o xj = w
⊤
n xj = yj) : ∂wJ(w)(xj) = 0
P
i∈Iα
αioyix
⊤
i
xj =
P
i∈I1
yix
⊤
i
P
xj − λo yj
i∈Iα
αinyix
⊤
i
xj =
P
i∈I1
yix
⊤
i
xj − λn yj
G(αn − αo) = (λo − λn)y with Gij = yix
⊤
i
xj
αn = αo + (λo − λn)d
d = (G)
−1
ySolving SVM in the primal
min
w,b
1
2
kwk
2 + C
Xn
i=1
max
0, 1 − yi(w
⊤xi + b)
What for: Yahoo!, Twiter, Amazon,
Google (Sibyl), Facebook. . . : Big data
Data-intensive machine learning systems
"on terascale datasets, with trillions of
features,1 billions of training examples
and millions of parameters in an hour
using a cluster of 1000 machines"
How: hybrid online+batch approach adaptive gradient updates (stochastic
gradient descent)
Code available: http://olivier.chapelle.cc/primal/Solving SVM in the primal
J(w, b) = 1
2
kwk
2
2 +
C
2
Xn
i=1
max
1 − yi(w
⊤xi + b), 0
2
=
1
2
kwk
2
2 +
C
2
ξ
⊤ξ
with Xn
ξi = max
1 − yi(w
⊤xi + b), 0
∇wJ(w, b) = w − C
Xn
i=1
max
1 − yi(w
⊤xi + b), 0
yixi
= w − C (diag(y)X)
⊤ξ
HwJ(w, b) = Id + C
Xn
i∈/I0
xix
⊤
i
Optimal step size ρ in the Newton direction:
w
new = w
old − ρ H
−1
w ∇wJ(w
old
, b
old)The hinge and other loss
Square hinge: (huber/hinge) and Lasso SVM
min w,b
k
w
k
1
+
C
Xni=1
max
1
−
yi
(
w
⊤
x
i
+
b
)
,
0
p
Penalized Logistic regression (Maxent)
min w,b
k
w
k
22
−
C
Xni=1
log
1
+ exp
−
2
yi
(
w
⊤
x
i
+
b
)
The exponential loss (commonly used in boosting)
min w,b
k
w
k
22
+
C
Xni=1
exp
−
yi
(
w
⊤
x
i
+
b
)
The sigmoid loss
min w,b
k
w
k
22
−
C
Xni=1
tanh
yi
(
w
⊤
x
i
+
b
)
−
1
0
1
01
yf(x)
classification loss
0/1 loss
hinge
hinge
2
logistic
exponential
sigmoidChoosing the data fitting term and the penalty
For a given C: controling the tradeoff between loss and penalty
min
w,b
pen(w) + C
Xn
i=1
Loss
yi(w
⊤xi + b)
For a long list of possible penalties:
A Antoniadis, I Gijbels, M Nikolova, Penalized likelihood regression for
generalized linear models with non-quadratic penalties, 2011.
A tentative of classification:
convex/non convex
differentiable/non differentiable
What are we looking for
consistency
efficiency −→ sparcityConclusion: variables or data point?
seeking for a universal learning algorithm
◮ no model for IP(x, y)
the linear case: data is separable
◮ the non separable case
double objective: minimizing the error together with the regularity of
the solution
◮ multi objective optimisation
dualiy : variable – example
◮ use the primal when d < n (in the liner case) or when matrix G is hard
to compute
◮ otherwise use the dual
universality = nonlinearity
◮ kernelsBibliography
C. Cortes & V. Vapnik, Support-vector networks, Machine learning, 1995
J. Bi & V. Vapnik, Learning with rigorous SVM, COLT 2003
T. Hastie, S. Rosset, R. Tibshirani, J. Zhu, The entire regularization path
for the support vector machine, JMLR, 2004
P. Bartlett, M. Jordan, J. McAuliffe, Convexity, classification, and risk
bounds, JASA, 2006.
A. Antoniadis, I. Gijbels, M. Nikolova, Penalized likelihood regression for
generalized linear models with non-quadratic penalties, 2011.
A Agarwal, O Chapelle, M Dudík, J Langford, A reliable effective terascale
linear learning system, 2011.
informatik.unibas.ch/fileadmin/Lectures/FS2013/CS331/Slides/my_SVM_without_b.pdf
http://ttic.uchicago.edu/~gregory/courses/ml2010/lectures/lect12.pdf
http://olivier.chapelle.cc/primal/
Stéphane Canu (INSA Rouen - LITIS) March 23, 2014 29 / 29
Lecture 2: Linear SVM in the Dual
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
March 12, 2014Road map
1 Linear SVM
Optimization in 10 slides
Equality constraints
Inequality constraints
Dual formulation of the linear SVM
Solving the dual
Figure from L. Bottou & C.J. Lin, Support vector machine solvers, in Large scale kernel machines, 2007.Linear SVM: the problem
Linear SVM are the solution of the following problem (called primal)
Let {(xi
, yi); i = 1 : n} be a set of labelled data with
xi ∈ IRd
, yi ∈ {1, −1}.
A support vector machine (SVM) is a linear classifier associated with the
following decision function: D(x) = sign
w⊤x + b
where w ∈ IRd
and
b ∈ IR a given thought the solution of the following problem:
(
min
w,b
1
2
kwk
2 =
1
2w⊤w
with yi(w⊤xi + b) ≥ 1 i = 1, n
This is a quadratic program (QP):
(
min
z
1
2
z
⊤Az − d
⊤z
with Bz ≤ e
z = (w, b)⊤, d = (0, . . . , 0)⊤, A =
I 0
0 0
, B = −[diag(y)X, y] et e = −(1, . . . , 1)⊤Road map
1 Linear SVM
Optimization in 10 slides
Equality constraints
Inequality constraints
Dual formulation of the linear SVM
Solving the dualA simple example (to begin with)
(
min
x1,x2
J(x) = (x1 − a)
2 + (x2 − b)
2
with
x
x
⋆
∇xJ(x)
iso cost lines: J(x) = kA simple example (to begin with)
(
min
x1,x2
J(x) = (x1 − a)
2 + (x2 − b)
2
with H(x) = α(x1 − c)
2 + β(x2 − d)
2 + γx1x2 − 1
Ω = {x|H(x) = 0}
x
x
⋆
∇xJ(x)
∆x
∇xH(x)
tangent hyperplane
iso cost lines: J(x) = k
∇xH(x) = λ ∇xJ(x)The only one equality constraint case
(
min
x
J(x) J(x + εd) ≈ J(x) + ε∇xJ(x)
⊤d
with H(x) = 0 H(x + εd) ≈ H(x) + ε∇xH(x)
⊤d
Loss J : d is a descent direction if it exists ε0 ∈ IR such that
∀ε ∈ IR, 0 < ε ≤ ε0
J(x + εd) < J(x) ⇒ ∇xJ(x)
⊤d < 0
constraint H : d is a feasible descent direction if it exists ε0 ∈ IR such
that ∀ε ∈ IR, 0 < ε ≤ ε0
H(x + εd) = 0 ⇒ ∇xH(x)
⊤d = 0
If at x
⋆
, vectors ∇xJ(x
⋆
) and ∇xH(x
⋆
) are collinear there is no feasible
descent direction d. Therefore, x
⋆
is a local solution of the problem.Lagrange multipliers
Assume J and functions Hi are continuously differentials (and independent)
P =
min
x∈IRn
J(x)
avec H1(x) = 0
et H2(x) = 0
. . .
Hp(x) = 0Lagrange multipliers
Assume J and functions Hi are continuously differentials (and independent)
P =
min
x∈IRn
J(x)
avec H1(x) = 0 λ1
et H2(x) = 0 λ2
. . .
Hp(x) = 0 λp
each constraint is associated with λi
: the Lagrange multiplier.Lagrange multipliers
Assume J and functions Hi are continuously differentials (and independent)
P =
min
x∈IRn
J(x)
avec H1(x) = 0 λ1
et H2(x) = 0 λ2
. . .
Hp(x) = 0 λp
each constraint is associated with λi
: the Lagrange multiplier.
Theorem (First order optimality conditions)
for x
⋆ being a local minima of P, it is necessary that:
∇x J(x
⋆
) +X
p
i=1
λi∇xHi(x
⋆
) = 0 and Hi(x
⋆
) = 0, i = 1, pPlan
1 Linear SVM
Optimization in 10 slides
Equality constraints
Inequality constraints
Dual formulation of the linear SVM
Solving the dual
Stéphane Canu (INSA Rouen - LITIS) March 12, 2014 8 / 32The only one inequality constraint case
(
min
x
J(x) J(x + εd) ≈ J(x) + ε∇xJ(x)
⊤d
with G(x) ≤ 0 G(x + εd) ≈ G(x) + ε∇xG(x)
⊤d
cost J : d is a descent direction if it exists ε0 ∈ IR such that
∀ε ∈ IR, 0 < ε ≤ ε0
J(x + εd) < J(x) ⇒ ∇xJ(x)
⊤d < 0
constraint G : d is a feasible descent direction if it exists ε0 ∈ IR such that
∀ε ∈ IR, 0 < ε ≤ ε0
G(x + εd) ≤ 0 ⇒
G(x) < 0 : no limit here on d
G(x) = 0 : ∇xG(x)
⊤d ≤ 0
Two possibilities
If x
⋆
lies at the limit of the feasible domain (G(x
⋆
) = 0) and if vectors
∇xJ(x
⋆
) and ∇xG(x
⋆
) are collinear and in opposite directions, there is no
feasible descent direction d at that point. Therefore, x
⋆
is a local solution
of the problem... Or if ∇xJ(x
⋆
) = 0Two possibilities for optimality
∇xJ(x
⋆
) = −µ ∇xG(x
⋆
) and µ > 0; G(x
⋆
) = 0
or
∇xJ(x
⋆
) = 0 and µ = 0; G(x
⋆
) < 0
This alternative is summarized in the so called complementarity condition:
µ G(x
⋆
) = 0
µ = 0
G(x
⋆
) < 0
G(x
⋆
) = 0
µ > 0First order optimality condition (1)
problem P =
min
x∈IRn
J(x)
with hj(x) = 0 j = 1, . . . , p
and gi(x) ≤ 0 i = 1, . . . , q
Definition: Karush, Kuhn and Tucker (KKT) conditions
stationarity ∇J(x
⋆
) +X
p
j=1
λj∇hj(x
⋆
) +X
q
i=1
µi∇gi(x
⋆
) = 0
primal admissibility hj(x
⋆
) = 0 j = 1, . . . , p
gi(x
⋆
) ≤ 0 i = 1, . . . , q
dual admissibility µi ≥ 0 i = 1, . . . , q
complementarity µigi(x
⋆
) = 0 i = 1, . . . , q
λj and µi are called the Lagrange multipliers of problem PFirst order optimality condition (2)
Theorem (12.1 Nocedal & Wright pp 321)
If a vector x
⋆
is a stationary point of problem P
Then there existsa Lagrange multipliers such that
x
⋆
, {λj}j=1:p, {µi}i=1:q
fulfill KKT conditions
a
under some conditions e.g. linear independence constraint qualification
If the problem is convex, then a stationary point is the solution of the
problem
A quadratic program (QP) is convex when. . .
(QP)
(
min
z
1
2
z
⊤Az − d
⊤z
with Bz ≤ e
. . . when matrix A is positive definiteKKT condition - Lagrangian (3)
problem P =
min
x∈IRn
J(x)
with hj(x) = 0 j = 1, . . . , p
and gi(x) ≤ 0 i = 1, . . . , q
Definition: Lagrangian
The lagrangian of problem P is the following function:
L(x, λ, µ) = J(x) +X
p
j=1
λjhj(x) +X
q
i=1
µigi(x)
The importance of being a lagrangian
the stationarity condition can be written: ∇L(x
⋆
, λ, µ) = 0
the lagrangian saddle point max
λ,µ
min
x
L(x, λ, µ)
Primal variables: x and dual variables λ, µ (the Lagrange multipliers)Duality – definitions (1)
Primal and (Lagrange) dual problems
P =
min
x∈IRn
J(x)
with hj(x) = 0 j = 1, p
and gi(x) ≤ 0 i = 1, q
D =
(
max
λ∈IRp,µ∈IRq
Q(λ, µ)
with µj ≥ 0 j = 1, q
Dual objective function:
Q(λ, µ) = inf
x
L(x, λ, µ)
= inf
x
J(x) +X
p
j=1
λjhj(x) +X
q
i=1
µigi(x)
Wolf dual problem
W =
max
x,λ∈IRp,µ∈IRq
L(x, λ, µ)
with µj ≥ 0 j = 1, q
and ∇J(x
⋆
) +X
p
j=1
λj∇hj(x
⋆
) +X
q
i=1
µi∇gi(x
⋆
) = 0Duality – theorems (2)
Theorem (12.12, 12.13 and 12.14 Nocedal & Wright pp 346)
If f , g and h are convex and continuously differentiablea
, then the solution
of the dual problem is the same as the solution of the primal
a
under some conditions e.g. linear independence constraint qualification
(λ
⋆
, µ⋆
) = solution of problem D
x
⋆ = arg min
x
L(x, λ⋆
, µ⋆
)
Q(λ
⋆
, µ⋆
) = arg min
x
L(x, λ⋆
, µ⋆
) = L(x
⋆
, λ⋆
, µ⋆
)
= J(x
⋆
) + λ
⋆H(x
⋆
) + µ
⋆G(x
⋆
) = J(x
⋆
)
and for any feasible point x
Q(λ, µ) ≤ J(x) → 0 ≤ J(x) − Q(λ, µ)
The duality gap is the difference between the primal and dual cost functionsRoad map
1 Linear SVM
Optimization in 10 slides
Equality constraints
Inequality constraints
Dual formulation of the linear SVM
Solving the dual
Figure from L. Bottou & C.J. Lin, Support vector machine solvers, in Large scale kernel machines, 2007.Linear SVM dual formulation - The lagrangian
(
min
w,b
1
2
kwk
2
with yi(w⊤xi + b) ≥ 1 i = 1, n
Looking for the lagrangian saddle point max
α
min
w,b
L(w, b, α) with so called
lagrange multipliers αi ≥ 0
L(w, b, α) = 1
2
kwk
2 −
Xn
i=1
αi
yi(w
⊤xi + b) − 1
αi represents the influence of constraint thus the influence of the training
example (xi
, yi)Stationarity conditions
L(w, b, α) = 1
2
kwk
2 −
Xn
i=1
αi
yi(w
⊤xi + b) − 1
Computing the gradients:
∇wL(w, b, α) = w −
Xn
i=1
αi yixi
∂L(w, b, α)
∂b
=
Pn
i=1 αi yi
we have the following optimality conditions
∇wL(w, b, α) = 0 ⇒ w =
Xn
i=1
αi yixi
∂L(w, b, α)
∂b
= 0 ⇒
Xn
i=1
αi yi = 0KKT conditions for SVM
stationarity w −
Xn
i=1
αi yixi = 0 and Xn
i=1
αi yi = 0
primal admissibility yi(w⊤xi + b) ≥ 1 i = 1, . . . , n
dual admissibility αi ≥ 0 i = 1, . . . , n
complementarity αi
yi(w⊤xi + b) − 1
= 0 i = 1, . . . , n
The complementary condition split the data into two sets
A be the set of active constraints: usefull points
A = {i ∈ [1, n]
yi(w
∗⊤xi + b
∗
) = 1}
its complementary A¯ useless points
if i ∈ A/ , αi = 0The KKT conditions for SVM
The same KKT but using matrix notations and the active set A
stationarity w − X
⊤Dyα = 0
α
⊤y = 0
primal admissibility Dy (Xw + b I1) ≥ I1
dual admissibility α ≥ 0
complementarity Dy (XAw + b I1A) = I1A
αA¯ = 0
Knowing A, the solution verifies the following linear system:
w −X
⊤
A DyαA = 0
−DyXAw −byA = −eA
−y
⊤
AαA = 0
with Dy = diag(yA), αA = α(A) , yA = y(A) et XA = X(XA; :).The KKT conditions as a linear system
w −X
⊤
A DyαA = 0
−DyXAw −byA = −eA
−y
⊤
AαA = 0
with Dy = diag(yA), αA = α(A) , yA = y(A) et XA = X(XA; :).
=
I −X
⊤
A Dy 0
−DyXA 0 −yA
0 −y
⊤
A 0
w
αA
b
0
−eA
0
we can work on it to separate w from (αA, b)The SVM dual formulation
The SVM Wolfe dual
max
w,b,α
1
2
kwk
2 −
Xn
i=1
αi
yi(w
⊤xi + b) − 1
with αi ≥ 0 i = 1, . . . , n
and w −
Xn
i=1
αi yixi = 0 and Xn
i=1
αi yi = 0
using the fact: w =
Xn
i=1
αi yixi
The SVM Wolfe dual without w and b
max
α
−
1
2
Xn
i=1
Xn
j=1
αjαi yi yjx
⊤
j xi +
Xn
i=1
αi
with αi ≥ 0 i = 1, . . . , n
and Xn
i=1
αi yi = 0Linear SVM dual formulation
L(w, b, α) = 1
2
kwk
2 −
Xn
i=1
αi
yi(w
⊤xi + b) − 1
Optimality: w =
Xn
i=1
αi yixi
Xn
i=1
αi yi = 0
L(α) = 1
2
Xn
i=1
Xn
j=1
αjαi yi yjx
⊤
j xi
| {z }
w⊤w
−
Pn
i=1 αi yi
Xn
j=1
αjyjx
⊤
j
| {z }
w⊤
xi − b
Xn
i=1
αi yi
| {z }
=0
+
Pn
i=1 αi
= −
1
2
Xn
i=1
Xn
j=1
αjαi yi yjx
⊤
j xi +
Xn
i=1
αi
Dual linear SVM is also a quadratic program
problem D
min
α∈IRn
1
2
α
⊤Gα − e
⊤α
with y
⊤α = 0
and 0 ≤ αi
i = 1, n
with G a symmetric matrix n × n such that Gij = yi yjx
⊤
j
xiSVM primal vs. dual
Primal
min
w∈IRd
,b∈IR
1
2
kwk
2
with yi(w⊤xi + b) ≥ 1
i = 1, n
d + 1 unknown
n constraints
classical QP
perfect when d << n
Dual
min
α∈IRn
1
2
α
⊤Gα − e
⊤α
with y
⊤α = 0
and 0 ≤ αi
i = 1, n
n unknown
G Gram matrix (pairwise
influence matrix)
n box constraints
easy to solve
to be used when d > nSVM primal vs. dual
Primal
min
w∈IRd
,b∈IR
1
2
kwk
2
with yi(w⊤xi + b) ≥ 1
i = 1, n
d + 1 unknown
n constraints
classical QP
perfect when d << n
Dual
min
α∈IRn
1
2
α
⊤Gα − e
⊤α
with y
⊤α = 0
and 0 ≤ αi
i = 1, n
n unknown
G Gram matrix (pairwise
influence matrix)
n box constraints
easy to solve
to be used when d > n
f (x) = X
d
j=1
wjxj + b =
Xn
i=1
αi yi(x
⊤xi) + bThe bi dual (the dual of the dual)
min
α∈IRn
1
2
α
⊤Gα − e
⊤α
with y
⊤α = 0
and 0 ≤ αi
i = 1, n
L(α, λ, µ) = 1
2
α
⊤Gα − e
⊤α + λ y
⊤α − µ
⊤α
∇αL(α, λ, µ) = Gα − e + λ y − µ
The bidual
max
α,λ,µ
−
1
2
α
⊤Gα
with Gα − e + λ y − µ = 0
and 0 ≤ µ
since kwk
2 =
1
2
α
⊤Gα and DXw = Gα
(
max
w,λ
−
1
2
kwk
2
with DXw + λ y ≥ e
by identification (possibly up to a sign)
b = λ is the Lagrange multiplier of the equality constraintCold case: the least square problem
Linear model
yi =
X
d
j=1
wjxij + εi
, i = 1, n
n data and d variables; d < n
min
w
=
Xn
i=1
Xd
j=1
xijwj − yi
2
= kXw − yk
2
Solution: we = (X
⊤X)
−1X
⊤y
f (x) = x
⊤ (X
⊤X)
−1X
⊤y
| {z }
we
What is the influence of each data point (matrix X lines) ?
Shawe-Taylor & Cristianini’s Book, 2004data point influence (contribution)
for any new data point x
f (x) = x
⊤ (X
⊤X)(X
⊤X)
−1
(X
⊤X)
−1X
⊤y
| {z }
we
= x
⊤ X
⊤ X(X
⊤X)
−1
(X
⊤X)
−1X
⊤y
| {z }
αb
x⊤
n examples
d variables
X ⊤
αb
we
f (x) = X
d
j=1
wejxjdata point influence (contribution)
for any new data point x
f (x) = x
⊤ (X
⊤X)(X
⊤X)
−1
(X
⊤X)
−1X
⊤y
| {z }
we
= x
⊤ X
⊤ X(X
⊤X)
−1
(X
⊤X)
−1X
⊤y
| {z }
αb
x⊤
n examples
d variables
X ⊤
αb
we
x⊤xi
f (x) = X
d
j=1
wejxj =
Xn
i=1
αbi (x
⊤xi)
from variables to examples
αb = X(X
⊤X)
−1we
| {z }
n examples
et we = X
⊤αb | {z }
d variables
what if d ≥ n !SVM primal vs. dual
Primal
min
w∈IRd
,b∈IR
1
2
kwk
2
with yi(w⊤xi + b) ≥ 1
i = 1, n
d + 1 unknown
n constraints
classical QP
perfect when d << n
Dual
min
α∈IRn
1
2
α
⊤Gα − e
⊤α
with y
⊤α = 0
and 0 ≤ αi
i = 1, n
n unknown
G Gram matrix (pairwise
influence matrix)
n box constraints
easy to solve
to be used when d > n
f (x) = X
d
j=1
wjxj + b =
Xn
i=1
αi yi(x
⊤xi) + bRoad map
1 Linear SVM
Optimization in 10 slides
Equality constraints
Inequality constraints
Dual formulation of the linear SVM
Solving the dual
Figure from L. Bottou & C.J. Lin, Support vector machine solvers, in Large scale kernel machines, 2007.Solving the dual (1)
Data point influence
αi = 0 this point is useless
αi 6= 0 this point is said to be
support
f (x) = X
d
j=1
wjxj + b =
Xn
i=1
αi yi(x
⊤xi) + bSolving the dual (1)
Data point influence
αi = 0 this point is useless
αi 6= 0 this point is said to be
support
f (x) = X
d
j=1
wjxj + b =
X
3
i=1
αi yi(x
⊤xi) + b
Decison border only depends on 3 points (d + 1)Solving the dual (2)
Assume we know these 3 data points
min
α∈IRn
1
2
α
⊤Gα − e
⊤α
with y
⊤α = 0
and 0 ≤ αi
i = 1, n
=⇒
(
min
α∈IR3
1
2
α
⊤Gα − e
⊤α
with y
⊤α = 0
L(α, b) = 1
2
α
⊤Gα − e
⊤α + b y
⊤α
solve the following linear system
Gα + b y = e
y
⊤α = 0
U = chol(G); % upper
a = U\ (U’\e);
c = U\ (U’\y);
b = (y’*a)\(y’*c)
alpha = U\ (U’\(e - b*y));Conclusion: variables or data point?
seeking for a universal learning algorithm
◮ no model for IP(x, y)
the linear case: data is separable
◮ the non separable case
double objective: minimizing the error together with the regularity of
the solution
◮ multi objective optimisation
dualiy : variable – example
◮ use the primal when d < n (in the liner case) or when matrix G is hard
to compute
◮ otherwise use the dual
universality = nonlinearity
◮ kernels
SVM and Kernel machine
Lecture 1: Linear SVM
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
March 12, 2014Road map
1 Linear SVM
Separating hyperplanes
The margin
Linear SVM: the problem
Linear programming SVM
0 0 0
margin
"The algorithms for constructing the separating hyperplane considered
above will be utilized for developing a battery of programs for pattern
recognition." in Learning with kernels, 2002 - from V .Vapnik, 1982Hyperplanes in 2d: intuition
It’s a line!Hyperplanes: formal definition
Given vector v ∈ IRd
and bias a ∈ IR
Hyperplane as a function h,
h : IRd −→ IR
x 7−→ h(x) = v
⊤x + a
Hyperplane as a border in IRd
(and an implicit function)
∆(v, a) = {x ∈ IRd
v
⊤x + a = 0}
The border invariance property
∀k ∈ IR, ∆(kv, ka) = ∆(v, a)
∆ = {x ∈ IR2
| v
⊤x + a = 0}
the decision border
∆
(x, h(x)) = v
⊤x + a)
(x, 0)
h(x)
d(x, ∆)Separating hyperplanes
Find a line to separate (classify) blue from red
D(x) = sign
v
⊤x + a
Separating hyperplanes
Find a line to separate (classify) blue from red
D(x) = sign
v
⊤x + a
the decision border:
v
⊤x + a = 0Separating hyperplanes
Find a line to separate (classify) blue from red
D(x) = sign
v
⊤x + a
the decision border:
v
⊤x + a = 0
there are many solutions...
The problem is ill posed
How to choose a solution?This is not the problem we want to solve
{(xi
, yi); i = 1 : n} a training sample, i.i.d. drawn according to IP(x, y)
unknown
we want to be able to classify new
observations: minimize IP(error)This is not the problem we want to solve
{(xi
, yi); i = 1 : n} a training sample, i.i.d. drawn according to IP(x, y)
unknown
we want to be able to classify new
observations: minimize IP(error)
Looking for a universal approach
use training data: (a few errors)
prove IP(error) remains small
scalable - algorithmic complexityThis is not the problem we want to solve
{(xi
, yi); i = 1 : n} a training sample, i.i.d. drawn according to IP(x, y)
unknown
we want to be able to classify new
observations: minimize IP(error)
Looking for a universal approach
use training data: (a few errors)
prove IP(error) remains small
scalable - algorithmic complexity
with high probability (for the canonical hyperplane):
IP(error) < IPb (error)
| {z }
=0 here
+ ϕ(
1
margin
| {z }
=kvk
)
Vapnik’s Book, 1982Margin guarantees
min
i∈[1,n]
dist(xi
, ∆(v, a))
| {z }
margin: m
Theorem (Margin Error Bound)
Let R be the radius of the smallest ball BR(a) =
x ∈ IRd
| kx − ck < R
,
containing the points (x1, . . . , xn) i.i.d from some unknown distribution IP.
Consider a decision function D(x) = sign(v
⊤x) associated with a
separating hyperplane v of margin m (no training error).
Then, with probability at least 1 − δ for any δ > 0, the generalization error
of this hyperplane is bounded by
IP(error) ≤ 2
r
R2
n m2
+ 3
r
ln(2/δ)
2n
R
v’x = 0
m
theorem 4.17 p 102 in J Shawe-Taylor, N Cristianini Kernel methods for pattern analysis, Cambridge 2004Statistical machine learning – Computation learning theory
(COLT)
{xi
, yi}
{xi
, yi}
i = 1, n A f = v
⊤x + a
x
yp = f (x)
IPb (error)
= 1
n
L(f (xi), yi)
Loss L
Vapnik’s Book, 1982Statistical machine learning – Computation learning theory
(COLT)
{xi
, yi}
{xi
, yi}
i = 1, n A f = v
⊤x + a
x
yp = f (x)
IPb (error)
= 1
n
L(f (xi), yi)
y Loss L
IP(error)
=
IE(L)
∀IP ∈ P
P IP
Prob
≤ + ϕ(kvk) ≥ δ
Vapnik’s Book, 1982linear discrimination
Find a line to classify blue and red
D(x) = sign
v
⊤x + a
the decision border:
v
⊤x + a = 0
there are many solutions...
The problem is ill posed
How to choose a solution ?
⇒ choose the one with larger marginRoad map
1 Linear SVM
Separating hyperplanes
The margin
Linear SVM: the problem
Linear programming SVM
0 0 0
marginMaximize our confidence = maximize the margin
the decision border: ∆(v, a) = {x ∈ IRd
v
⊤x + a = 0}
0 0 0
margin
maximize the margin
max
v,a
min
i∈[1,n]
dist(xi
, ∆(v, a))
| {z }
margin: m
Maximize the confidence
max
v,a
m
with min
i=1,n
|v
⊤xi + a|
kvk
≥ m
the problem is still ill posed
if (v, a) is a solution, ∀ 0 < k (kv, ka) is also a solution. . .Margin and distance: details
Theorem (The geometrical margin)
Let x be a vector in IRd
and ∆(v, a) = {s ∈ IRd
v
⊤s + a = 0} an
hyperplane. The distance between vector x and the hyperplane ∆(v, a)) is
dist(xi
, ∆(v, a)) = |v⊤x+a|
kvk
Let sx be the closest point to x in ∆ , sx = arg min
s∈∆
kx − sk. Then
x = sx + r
v
kvk
⇔ r
v
kvk
= x − sx
So that, taking the scalar product with vector v we have:
v
⊤r
v
kvk
= v
⊤(x − sx ) = v
⊤x − v
⊤sx = v
⊤x + a − (v
⊤sx + a)
| {z }
=0
= v
⊤x + a
and therefore
r =
v⊤x + a
kvk
leading to:
dist(xi
, ∆(v, a)) = min
s∈∆
kx − sk = r =
|v⊤x + a|
kvkGeometrical and numerical margin
∆ = {x ∈ IR2
| v
⊤x + a = 0}
the decision border
∆
d(x, ∆) = |v
⊤x + a|
kvk
the geometrical margin
d(xb, ∆)
(xr, v
⊤xr + a)
(xr, 0)
mr
d(xr, ∆)
(xb, v
⊤xb + a)
mb
(xb, 0)
m = |v
⊤x + a|
the numerical marginFrom the geometrical to the numerical margin
+1
ï1
ï1/|w|
1/|w|
{x | wT
x = 0}
<ï ï marge >
x
w
T
x
Valeur de la marge dans le cas monodimensionnel
Maximize the (geometrical) margin
max
v,a
m
with min
i=1,n
|v
⊤xi + a|
kvk
≥ m
if the min is greater, everybody is greater
(yi ∈ {−1, 1})
max
v,a
m
with yi(v
⊤xi + a)
kvk
≥ m, i = 1, n
change variable: w =
v
mkvk
and b =
a
mkvk =⇒ kwk =
1
m
max
w,b
m
with yi(w⊤xi + b) ≥ 1 ; i = 1, n
and m =
1
kwk
min
w,b
kwk
2
with yi(w⊤xi + b) ≥ 1
i = 1, nThe canonical hyperplane
(
min
w,b
kwk
2
with yi(w⊤xi + b) ≥ 1 i = 1, n
Definition (The canonical hyperplane)
An hyperplane (w, b) in IRd
is said to be canonical with respect the set of
vectors {xi ∈ IRd
, i = 1, n} if
min
i=1,n
|w
⊤xi + b| = 1
so that the distance
min
i=1,n
dist(xi
, ∆(w, b)) = |w⊤x + b|
kwk
=
1
kwk
The maximal margin (=minimal norm) canonical hyperplaneRoad map
1 Linear SVM
Separating hyperplanes
The margin
Linear SVM: the problem
Linear programming SVM
0 0 0
marginLinear SVM: the problem
The maximal margin (=minimal norm)
canonical hyperplane
0 0 0
margin
Linear SVMs are the solution of the following problem (called primal)
Let {(xi
, yi); i = 1 : n} be a set of labelled data with x ∈ IRd
, yi ∈ {1, −1}
A support vector machine (SVM) is a linear classifier associated with the
following decision function: D(x) = sign
w⊤x + b
where w ∈ IRd
and
b ∈ IR a given thought the solution of the following problem:
(
min
w∈IRd
, b∈IR
1
2
kwk
2
with yi(w⊤xi + b) ≥ 1 , i = 1, n
This is a quadratic program (QP): (
min
z
1
2
z
⊤Az − d
⊤z
with Bz ≤ eSupport vector machines as a QP
The Standart QP formulation
(
min
w,b
1
2
kwk
2
with yi(w⊤xi + b) ≥ 1, i = 1, n
⇔
(
min
z∈IRd+1
1
2
z
⊤Az − d
⊤z
with Bz ≤ e
z = (w, b)
⊤, d = (0, . . . , 0)
⊤, A =
I 0
0 0
, B = −[diag(y)X, y] and
e = −(1, . . . , 1)
⊤
Solve it using a standard QP solver such as (for instance)
% QUADPROG Quadratic programming .
% X = QUADPROG (H ,f ,A ,b ) attempts to solve the quadratic programming problem :
%
% min 0.5* x ’* H*x + f ’* x subject to : A*x <= b
% x
% so that the solution is in the range LB <= X <= UB
For more solvers (just to name a few) have a look at:
plato.asu.edu/sub/nlores.html#QP-problem
www.numerical.rl.ac.uk/people/nimg/qp/qp.htmlRoad map
1 Linear SVM
Separating hyperplanes
The margin
Linear SVM: the problem
Linear programming SVM
0 0 0
marginOther SVMs: Equivalence between norms
L1 norm
variable selection
(especially with
redundant noisy features)
Mangassarian, 1965
max
m,v,a
m
with yi(v
⊤xi + a) ≥ m kvk2 ≥ m
1
√
d
kvk1
i = 1, n
1-norm or Linear Programming-SVM (LP SVM)
(
min
w,b
kwk1 =
Pp
j=1
|wj
|
with yi(w
⊤xi + b) ≥ 1 ; i = 1, n
Generalized SVM (Bradley and Mangasarian, 1998)
(
min
w,b
kwk
p
p
with yi(w
⊤xi + b) ≥ 1 ; i = 1, n
p = 2: SVM, p = 1: LPSVM (also with p = ∞), p = 0: L0 SVM,
p= 1 and 2: doubly regularized SVM (DrSVM)Linear support vector support (LP SVM)
(
min
w,b
kwk1 =
Pp
j=1 w
+
j + w
−
j
with yi(w
⊤xi + b) ≥ 1 ; i = 1, n
w = w
+ − w
− with w
+ ≥ 0 and w
− ≥ 0
The Standart LP formulation
min
x
f
⊤x
with Ax ≤ d
and 0 ≤ x
x = [w
+; w
−; b] f = [1 . . . 1; 0] d = −[1 . . . 1]
⊤ A = [−yiXi yiXi − yi]
% linprog (f ,A ,b , Aeq , beq ,LB , UB )
% attempts to solve the linear programming problem :
% min f ’* x subject to : A* x <= b
% x
% so that the solution is in the range LB <= X <= UBAn example of linear discrimination: SVM and LPSVM
true line
QP SVM
LPSVM
Figure: SVM and LP SVMThe linear discrimination problem
from Learning with Kernels, B. Schölkopf and A. Smolla, MIT Press, 2002.Conclusion
SVM =
Separating hyperplane (to begin with the simpler)
+ Margin, Norm and statistical learning
+ Quadratic and Linear programming (and associated rewriting issues)
+ Support vectors (sparsity)
SVM preforms the selection of the most relevant data pointsBibliography
V. Vapnik, the generalized portrait method p 355 in Estimation of
dependences based on empirical data, Springer, 1982
B. Boser, I. Guyon & V. Vapnik, A training algorithm for optimal margin
classifiers. COLT, 1992
P. S. Bradley & O. L. Mangasarian. Feature selection via concave
minimization and support vector machines. ICML 1998
B. Schölkopf & A. Smolla, Learning with Kernels, MIT Press, 2002
M. Mohri, A. Rostamizadeh & A. Talwalkar, Foundations of Machine
Learning, MIT press 2012
http://agbs.kyb.tuebingen.mpg.de/lwk/sections/section72.pdf
http://www.cs.nyu.edu/~mohri/mls/lecture_4.pdf
http://en.wikipedia.org/wiki/Quadratic_programming
Stéphane Canu (INSA Rouen - LITIS) March 12, 2014 25 / 25
Understanding SVM (and associated kernel machines)
through the development of a Matlab toolbox
Stephane Canu
To cite this version:
Stephane Canu. Understanding SVM (and associated kernel machines) through the development
of a Matlab toolbox. Ecole d’ing´enieur. Introduction to Support Vector Machines (SVM), ´
Sao Paulo, 2014, pp.33.
HAL Id: cel-01003007
https://cel.archives-ouvertes.fr/cel-01003007
Submitted on 8 Jun 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Lecture 8: Multi Class SVM
Stéphane Canu
stephane.canu@litislab.eu
Sao Paulo 2014
April 10, 2014Roadmap
1 Multi Class SVM
3 different strategies for multi class SVM
Multi Class SVM by decomposition
Multi class SVM
Coupling convex hulls
1.5
1.5
1.5
1.5
1.5
1.5
2.5
2.5
2.5
−0.5 0 0.5 1 1.5
0
0.5
1
1.5
23 different strategies for multi class SVM
1 Decomposition approaches
◮ one vs all: winner takes all
◮ one vs one:
⋆ max-wins voting
⋆ pairwise coupling: use probability
◮ c SVDD
2 global approach (size c × n),
◮ formal (different variations)
min
f ∈H,α0,ξ∈IRn
1
2
Xc
ℓ=1
kfℓk
2
H +
C
p
Xn
i=1
Xc
ℓ=1,ℓ6=yi
ξ
p
iℓ
with fyi
(xi) + byi ≥ fℓ(xi) + bℓ + 2 − ξiℓ
and ξiℓ ≥ 0 for i = 1, ..., n; ℓ = 1, ..., c; ℓ 6= yi
non consistent estimator but practically useful
◮ structured outputs
3 A coupling formulation using the convex hulls3 different strategies for multi class SVM
1 Decomposition approaches
◮ one vs all: winner takes all
◮ one vs one:
⋆ max-wins voting
⋆ pairwise coupling: use probability – best results
◮ c SVDD
2 global approach (size c × n),
◮ formal (different variations)
min
f ∈H,α0,ξ∈IRn
1
2
Xc
ℓ=1
kfℓk
2
H +
C
p
Xn
i=1
Xc
ℓ=1,ℓ6=yi
ξ
p
iℓ
with fyi
(xi) + byi ≥ fℓ(xi) + bℓ + 2 − ξiℓ
and ξiℓ ≥ 0 for i = 1, ..., n; ℓ = 1, ..., c; ℓ 6= yi
non consistent estimator but practically useful
◮ structured outputs
3 A coupling formulation using the convex hullsMulticlass SVM: complexity issues
n training data
n = 60, 000 for MNIST
c class
c = 10 for MNIST
approach problem
size
number of
sub problems discrimination rejection
1 vs. all n c ++ -
1 vs. 1 2n
c
c(c−1)
2 ++ -
c SVDD n
c
c - ++
all together n × c 1 ++ -
coupling CH n 1 + +Roadmap
1 Multi Class SVM
3 different strategies for multi class SVM
Multi Class SVM by decomposition
Multi class SVM
Coupling convex hulls
1.5
1.5
1.5
1.5
1.5
1.5
2.5
2.5
2.5
−0.5 0 0.5 1 1.5
0
0.5
1
1.5
2Multi Class SVM by decomposition
One-Against-All Methods
→ winner-takes-all strategy
One-vs-One: pairwise methods
→ max-wins voting
→ directed acyclic graph (DAG)
→ error-correcting codes
→ post process probabilities
Hierarchical binary tree for
multi-class SVM
http://courses.media.mit.edu/2006fall/
mas622j/Projects/aisen-project/SVM and probabilities (Platt, 1999)
The decision function of the SVM is: sign
f (x) + b
log IP(Y = 1|x)
IP(Y = −1|x)
should have (almost) the same sign as f (x) + b
log IP(Y = 1|x)
IP(Y = −1|x)
= a1(f (x) + b) + a2 IP(Y = 1|x) = 1 −
1
1 + expa1(f (x)+b)+a2
a1 et a2 estimated using maximum likelihood on new data
max
a1,a2
L
with L =
Yn
i=1
IP(Y = 1|xi)
yi + (1 − IP(Y = 1|xi))(1−yi )
and log L =
Pn
i=1
yi
log(IP(Y = 1|xi)) + (1 − yi)log(1 − IP(Y = 1|xi))
=
Pn
i=1
yi
log
IP(Y =1|xi )
1−IP(Y =1|xi )
+ log(1 − IP(Y = 1|xi))
=
Pn
i=1
yi
a1(f (xi) + b) + a2
− log(1 + expa1(f (xi )+b)+a2 )
=
Pn
i=1
yi
a
⊤zi
− log(1 + expa
⊤zi)
Newton iterations: a
new ← a
old − H
−1∇logLSVM and probabilities (Platt, 1999)
max
a∈IR2
log L =
Xn
i=1
yi
a
⊤zi
− log(1 + expa
⊤zi)
Newton iterations
a
new ← a
old − H
−1∇logL
∇logL =
Xn
i=1
yi zi −
expa
⊤z
1 + expa⊤z
zi
=
Xn
i=1
yi − IP(Y = 1|xi)
zi = Z
⊤(y − p)
H = −
Xn
i=1
zi z
⊤
i
IP(Y = 1|xi)
1 − IP(Y = 1|xi)
= −Z
⊤WZ
Newton iterations
a
new ← a
old + (Z
⊤WZ)
−1Z
⊤(y − p)SVM and probabilities: practical issues
y −→ t =
1 − ε+ =
n+ + 1
n+ + 2
if yi = 1
ε− =
1
n− + 2
if yi = −1
1 in: X, y, f /out: p
2 t ←
3 Z ←
4 loop until convergence
1 p ← 1 −
1
1+expa⊤z
2 W ← diag
p(1 − p)
3 a
new ← a
old + (Z
⊤WZ)
−1Z
⊤(t − p)SVM and probabilities: pairwise coupling
From pairwise probabilities IP(cℓ
, cj) to class probabilities pℓ = IP(cℓ
|x)
min
p
Xc
ℓ=1
X
ℓ−1
j=1
IP(cℓ
, cj)
2
(pℓ − pj)
2
Q e
e
⊤ 0
p
µ
=
0
1
with Qℓj =
IP(cℓ
, cj)
2
P
ℓ 6= j
i
IP(cℓ
, ci)
2
ℓ = j
The global procedure :
1 (Xa, ya, Xt, yt) ← split(X, y)
2 (Xℓ, yℓ, Xp, yp) ← split(Xa, ya)
3 loop for all pairs (ci
, cj) of classes
1 modeli,j ← train_SVM(Xℓ, yℓ,(ci
, cj))
2 IP(ci
, cj) ← estimate_proba(Xp, yp, model) % Platt estimate
4 p ← post_process(Xt, yt,IP) % Pairwise Coupling
Wu, Lin & Weng, 2004, Duan & Keerti, 05SVM and probabilities
Some facts
SVM is universally consistent (converges towards the Bayes risk)
SVM asymptotically implements the bayes rule
but theoretically: no consistency towards conditional probabilities (due
to the nature of sparsity)
to estimate conditional probabilities on an interval
(typically[
1
2 − η, 1
2 + η]) to sparseness in this interval (all data points
have to be support vectors)
Bartlett & Tewari, JMLR, 07SVM and probabilities (2/2)
An alternative approach
g(x) − ε
−(x) ≤ IP(Y = 1|x) ≤ g(x) + ε
+(x)
with g(x) = 1
1+4−f (x)−α0
non parametric functions ε
− and ε
+ have to verify:
g(x) + ε
+(x) = exp−a1(1−f (x)−α0)++a2
1 − g(x) − ε
−(x) = exp−a1(1+f (x)+α0)++a2
with a1 = log 2 and a2 = 0
Grandvalet et al., 07Roadmap
1 Multi Class SVM
3 different strategies for multi class SVM
Multi Class SVM by decomposition
Multi class SVM
Coupling convex hulls
1.5
1.5
1.5
1.5
1.5
1.5
2.5
2.5
2.5
−0.5 0 0.5 1 1.5
0
0.5
1
1.5
2Multi class SVM: the decision function
One hyperplane by class
fℓ(x) = w
⊤
ℓ
x + bℓ ℓ = 1, c
Winner takes all decision function
D(x) = Argmax
ℓ=1,c
w
⊤
1 x + b1, w
⊤
2 x + b2, . . . , w
⊤
ℓ
x + bℓ
, . . . , w
⊤
c x + bc
We can revisit the 2 classes case in this setting
c × (d + 1) unknown variables (wℓ, bℓ); ℓ = 1, cMulti class SVM: the optimization problem
The margin in the multidimensional case
m = min
ℓ6=yi
v
⊤
yi
xi − ayi − v
⊤
ℓ xi + aℓ
= v
⊤
yi
xi + ayi − max
ℓ6=yi
v
⊤
ℓ xi + aℓ
The maximal margin multiclass SVM
max
vℓ,aℓ
m
with v
⊤
yi
xi + ayi − v
⊤
ℓ
xi − aℓ ≥ m for i = 1, n; ℓ = 1, c; ℓ 6= yi
and 1
2
Xc
ℓ=1
kvℓk
2 = 1
The multiclass SVM
min
wℓ,bℓ
1
2
Xc
ℓ=1
kwℓk
2
with x
⊤
i
(wyi − wℓ) + byi − bℓ ≥ 1 for i = 1, n; ℓ = 1, c; ℓ 6= yiMulti class SVM: KKT and dual form: The 3 classes case
min
wℓ,bℓ
1
2
X
3
ℓ=1
kwℓk
2
with w⊤
yi
xi + byi ≥ w⊤
ℓ
xi + bℓ + 1 for i = 1, n; ℓ = 1, 3; ℓ 6= yi
min
wℓ,bℓ
1
2
kw1k
2 +
1
2
kw2k
2 +
1
2
kw3k
2
with w⊤
1
xi + b1 ≥ w⊤
2
xi + b2 + 1 for i such that yi = 1
w⊤
1
xi + b1 ≥ w⊤
3
xi + b3 + 1 for i such that yi = 1
w⊤
2
xi + b2 ≥ w⊤
1
xi + b1 + 1 for i such that yi = 2
w⊤
2
xi + b2 ≥ w⊤
3
xi + b3 + 1 for i such that yi = 2
w⊤
3
xi + b3 ≥ w⊤
1
xi + b1 + 1 for i such that yi = 3
w⊤
3
xi + b3 ≥ w⊤
2
xi + b2 + 1 for i such that yi = 3
L =
1
2
(kw1k
2 + kw2k
2 + kw3k
2
) −α
⊤
12(X1(w1 − w2) + b1 − b2 − 1)
−α
⊤
13(X1(w1 − w3) + b1 − b3 − 1)
−α
⊤
21(X2(w2 − w1) + b2 − b1 − 1)
−α
⊤
23(X2(w2 − w3) + b2 − b3 − 1)
−α
⊤
31(X3(w3 − w1) + b3 − b1 − 1)
−α
⊤
32(X3(w3 − w2) + b3 − b2 − 1)Multi class SVM: KKT and dual form: The 3 classes case
L =
1
2
kwk
2 − α
⊤(XMw + Ab − 1)
with
w =
w1
w2
w3
∈ IR3d M = M ⊗ I =
I −I 0
I 0 −I
−I I 0
0 I −I
−I 0 I
0 −I I
a 6d × 3d matrix
where
I the identity matrix
and
X =
X1 0 0 0 0 0
0 X1 0 0 0 0
0 0 X2 0 0 0
0 0 0 X2 0 0
0 0 0 0 X3 0
0 0 0 0 0 X3
a 2n × 6d matrix
with input data
X =
X1
X2
X3
n × dMulti class SVM: KKT and dual form: The 3 classes case
KKT Stationality conditions =
∇wL = w − M⊤X ⊤α
∇bL = A
⊤α
The dual
min
α∈IR2n
1
2
α
⊤Gα − e
⊤α
with Ab = 0
and 0 ≤ α
With
G = XMM⊤X
⊤
= X (M ⊗ I)(M ⊗ I)
⊤X
⊤
= X (MM⊤ ⊗ I)X
⊤
= (MM⊤ ⊗ I). × XX ⊤
= (MM⊤ ⊗ I). × 1I K 1I⊤
and M =
1 −1 0
1 0 −1
−1 1 0
0 1 −1
−1 0 1
0 −1 1
Multi class SVM and slack variables (2 variants)
A slack for all (Vapnik & Blanz, Weston & Watkins 1998)
min
wℓ,bℓ,ξ∈IRcn
1
2
Xc
ℓ=1
kwℓk
2 + C
Xn
i=1
Xc
ℓ=1,ℓ6=yi
ξiℓ
with w⊤
yi
xi + byi − w⊤
ℓ
xi − bℓ ≥ 1 − ξiℓ
and ξiℓ ≥ 0 for i = 1, n; ℓ = 1, c; ℓ 6= yi
The dual
min
α∈IR2n
1
2
α
⊤Gα − e
⊤α
with Ab = 0
and 0 ≤ α ≤ C
Max error, a slack per training data (Cramer and Singer, 2001)
min
wℓ,bℓ,ξ∈IRn
1
2
Xc
ℓ=1
kwℓk
2 + C
Xn
i=1
ξi
with (wyi − wℓ)
⊤xi ≥ 1 − ξi for i = 1, n; ℓ = 1, c; ℓ 6= yi
X
i=1
and ξi ≥ 0 for i = 1, nMulti class SVM and Kernels
min
f ∈H,α0,ξ∈IRcn
1
2
Xc
ℓ=1
kfℓk
2
H + C
Xn
i=1
Xc
ℓ=1,ℓ6=yi
ξiℓ
with fyi
(xi) + byi − fℓ(xi) − bℓ ≥ 1 − ξiℓ
Xn
i=1
and ξiℓ ≥ 0 for i = 1, n; ℓ = 1, c; ℓ 6= yi
The dual
min
α∈IR2n
1
2
α
⊤Gα − e
⊤α
with Ab = 0
and 0 ≤ α≤ C
where G is the multi class kernel matrixOther Multi class SVM
Lee, Lin & Wahba, 2004
min
f ∈H
λ
2
Xc
ℓ=1
kfℓk
2
H +
1
n
Xn
i=1
Xc
ℓ=1,ℓ6=yi
(fℓ(xi) + 1
c − 1
)+
with Xc
ℓ=1
fℓ(x) = 0 ∀x
Structured outputs = Cramer and Singer, 2001
MSVMpack : A Multi-Class Support Vector Machine Package Fabien Lauer
& Yann GuermeurRoadmap
1 Multi Class SVM
3 different strategies for multi class SVM
Multi Class SVM by decomposition
Multi class SVM
Coupling convex hulls
1.5
1.5
1.5
1.5
1.5
1.5
2.5
2.5
2.5
−0.5 0 0.5 1 1.5
0
0.5
1
1.5
2One more way to derivate SVM
Minimizing the distance between the convex hulls
min
α
ku − vk
2
with u(x) = X
{i|yi =1}
αi(x
⊤
i x), v(x) = X
{i|yi =−1}
αi(x
⊤
i x)
and X
{i|yi =1}
αi = 1,
X
{i|yi =−1}
αi = 1, 0 ≤ αi
i = 1, nThe multi class case
min
α
Xc
ℓ=1
Xc
ℓ
′=1
kuℓ − uℓ
′k
2
with uℓ(x) = X
{i|yi =ℓ}
αi,ℓ(x
⊤
i x), ℓ = 1, c
and X
{i|yi =ℓ}
αi,ℓ = 1, 0 ≤ αi,ℓ i = 1, n; ℓ = 1, cBibliography
Estimating probabilities
◮ Platt, J. (2000). Probabilistic outputs for support vector machines and
comparison to regularized likelihood methods. In Advances in large
margin classifiers. MIT Press.
◮ T. Lin, C.-J. Lin, R.C. Weng, A note on Platt’s probabilistic outputs
for support vector machines, Mach. Learn. 68 (2007) 267–276
◮ http://www.cs.cornell.edu/courses/cs678/2007sp/platt.pdf
Multiclass SVM
◮ K.-B. Duan & S. Keerthi (2005). "Which Is the Best Multiclass SVM
Method? An Empirical Study".
◮ T.-F. Wu, C.-J. Lin, R.C. Weng, Probability estimates for multi-class
classification by pairwise coupling, JMLR. 5 (2004) 975–1005.
◮ K. Crammer & Y. Singer (2001). "On the Algorithmic Implementation
of Multiclass Kernel-based Vector Machines". JMLR 2: 265–292.
◮ Lee, Y.; Lin, Y.; and Wahba, G. (2001). "Multicategory Support
Vector Machines". Computing Science and Statistics 33.
◮ http://www.loria.fr/~guermeur/NN2008_M_SVM_YG.pdf
◮ http://jmlr.org/papers/volume12/lauer11a/lauer11a.pdf
Stéphane Canu (INSA Rouen - LITIS) April 10, 2014 25 / 25
https://hal.inria.fr/cel-01082588v2/document
Tutoriel Android - TP de prise en main
Dima Rodriguez
To cite this version:
Dima Rodriguez. Tutoriel Android - TP de prise en main. Ecole d’ing´enieur. France. 2014, ´
pp.51.
HAL Id: cel-01082588
https://hal.archives-ouvertes.fr/cel-01082588v2
Submitted on 26 Nov 2014
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of scientific
research documents, whether they are published
or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destin´ee au d´epˆot et `a la diffusion de documents
scientifiques de niveau recherche, publi´es ou non,
´emanant des ´etablissements d’enseignement et de
recherche fran¸cais ou ´etrangers, des laboratoires
publics ou priv´es.Tutoriel Android TM
TP de prise en main
Dima RodriguezPolytech’ Paris Sud
Tutoriel AndroidTM
Dima Rodriguez
Novembre 2014
TP de prise en mainTable des matières
Préambule 4
1 Installation de l’IDE 5
2 Configuration de l’IDE 6
Installation des paquets supplémentaires et des mises à jours . . . . . . 6
Configuration d’un émulateur . . . . . . . . . . . . . . . . . . . . . . . 6
3 Notre première application Android 10
Création d’un projet et d’une application “Hello World” . . . . . . . . . 10
Exécution de l’application . . . . . . . . . . . . . . . . . . . . . . . . . 11
Se repérer dans le projet . . . . . . . . . . . . . . . . . . . . . . . . . 14
Modification de l’interface utilisateur . . . . . . . . . . . . . . . . . . . 16
Répondre aux évènements . . . . . . . . . . . . . . . . . . . . . . . . . 21
Créer et lancer une autre activité . . . . . . . . . . . . . . . . . . . . . 22
Créer des animations . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Créer un View personnalisé pour gérer un jeu . . . . . . . . . . . . . . 32
Temporisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Rajouter un bouton sur la barre d’action . . . . . . . . . . . . . . . . . 40
Lancement d’une autre application . . . . . . . . . . . . . . . . . . . . 41
Changement de langue . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Annexes 46
Explication du code généré par défaut pour la classe Principale . . . . . 46
Cycle de vie d’une activité . . . . . . . . . . . . . . . . . . . . . . . . 49
2Table des figures
2.1 SDK Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Android Virtual Device Manager . . . . . . . . . . . . . . . . . . 8
2.3 Création d’un appareil virtuel . . . . . . . . . . . . . . . . . . . . 9
3.1 Création d’un projet . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Créer une activité . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Nouvelle activité . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4 Exécution de l’application . . . . . . . . . . . . . . . . . . . . . . 13
3.5 Aperçu de l’interface Eclipse . . . . . . . . . . . . . . . . . . . 14
3.6 Hiérarchie de LinearLayout . . . . . . . . . . . . . . . . . . . . . 17
3.7 Premier test de l’application modifiée . . . . . . . . . . . . . . . . 20
3.8 Champ de saisie et bouton . . . . . . . . . . . . . . . . . . . . . 21
3.9 Création d’une nouvelle activité . . . . . . . . . . . . . . . . . . . 23
3.10 Nouveau xml pour définir une animation . . . . . . . . . . . . . . 28
3.11 Animation en LinearLayout . . . . . . . . . . . . . . . . . . . . . 30
3.12 Animation en RelativeLayout . . . . . . . . . . . . . . . . . . . . 31
3.13 Création de la classe MonViewPerso . . . . . . . . . . . . . . . . 33
3.14 Ajout d’un bouton pour lancer le jeu . . . . . . . . . . . . . . . . 36
3.15 Activité avec vue personnalisée . . . . . . . . . . . . . . . . . . . 39
3.16 Barre d’action . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.17 Cycle de vie d’une activité . . . . . . . . . . . . . . . . . . . . . 50
3Préambule
Le système d’exploitation Android est actuellement l’OS le plus utilisé dans le
monde faisant tourner des smartphones, tablettes, montres connectées, liseuses
électroniques, télévisions interactives, et bien d’autres. C’est un système, open
source qui utilise le noyau Linux. Il a été créée par Android, Inc. qui fut rachetée
par Google en 2005. Le développement d’applications pour Android s’effectue
en Java en utilisant des bibliothèques spécifiques.
Le but de ce tutoriel est de vous familiariser avec l’esprit de développement Android
et ses bibliothèques. Nous introduirons les concepts de bases de création
d’application en mettant en œuvre quelques fonctionnalités simples. Ce tutoriel
n’est en aucun cas exhaustive, le potentiel des applications Android est beaucoup
plus ample, les exemples cités dans ce document ne devront pas brider votre
imagination ni votre curiosité.
Sur le site officiel pour les développeurs Android vous trouverez la documentation
des classes, des tutoriels ainsi que les lignes directrices pour préparer une
distribution Google Play. Un lexique à la fin de ce document définit quelques
mot du vocabulaire Android utilisé dans ce tutoriel.
41 Installation de l’IDE
Dans cette section nous allons décrire la procédure d’installation d’un environnement
de développement Android.
Attention : Il faut exécuter les étapes dans l’ordre cité ci-dessous.
a. Téléchargez le JDK7 (Java Development Kit) que vous pouvez trouver sur
le site d’Oracle 1
.
b. Désinstallez des éventuelles versions antérieures du JDK
c. Installez le nouveau JDK
d. Téléchargez le paquet ADT (Android Developer Tools). Il contient le SDK
(Software Development Kit) Android et une version d’Eclipse avec ADT
intégré.
e. Pour installer l’IDE, il faut juste placer le dossier téléchargé dans le répertoire
où vous avez l’habitude d’installer vos programmes (ou directement
sur votre partition principale) et le dé-zipper. Vous pouvez également lui
changer de nom si vous souhaitez, mais veillez à ne pas mettre des espaces
ou des accents quand vous le renommez.
f. Dans le dossier dé-zippé vous trouverez un exécutable Eclipse que vous
pouvez désormais lancer pour commencer la configuration de votre environnement.
i
Au moment de l’écriture de ce document, Eclipse est le seul IDE (Integrated
Development Environment) officiellement supporté. Un nouvel environnement,
Android Studio, est en cours de développement mais est encore
en version bêta pas très stable.
Si vous souhaitez utiliser une version d’Eclipse que vous avez déjà sur votre
machine il faudrait prendre le SDK et un plugin ADT et configurer Eclipse
pour son utilisation.
1. Ce tutoriel a été réalisé avec JDK7u60
52 Configuration de l’IDE
Installation des paquets supplémentaires et des
mises à jours
a. Lancez Eclipse
b. On commencera par s’assurer que l’environnement installé est à jour. Dans
le menu Help sélectionnez Check for Updates et installez les mises à jour
le cas échéant.
c. Pour vérifier la version du SDK installé, allez dans le menu Window >
Android SDK Manager et lancez le gestionnaire du SDK. Dans le gestionnaire
(fig.2.1) vous verrez la version du SDK installé (avec les mises jour
disponibles) et aussi la version de l’API (Application Programming Interface)
installée et la version du OS pour laquelle elle vous permettra de
développer. Installez les paquets proposés par défaut.
i
Si vous voulez développer pour des versions Android plus anciennes il faut
installer les versions API correspondantes.
Configuration d’un émulateur
Un émulateur permet de reproduire le comportement d’un appareil réel d’une façon
virtuelle. L’utilisation d’un émulateur nous évite d’avoir à charger à chaque fois
l’application dans un appareil pour la tester. On pourra ainsi lancer l’application
dans l’IDE et elle s’exécutera sur un appareil virtuel appelé Android Virtual Device
AVD qui émule le comportement d’un téléphone, une tablette ou autre.
Eclipse ne propose pas d’émulateur par défaut, avant de commencer à créer
notre application il faut en configurer un.
6Tutoriel Android 7
Figure 2.1 – SDK Manager
Dans cet exemple, il existe une mise à jour disponible pour le SDK. L’API installée est la
version 20 qui permet un développement pour Android 4.4, mais il existe une API plus
récente pour Android 5.0.
Polytech’ Paris Sud Dima RodriguezTutoriel Android 8
Figure 2.2 – Android Virtual Device Manager
Allez dans le menu Window > Android Virtual Device Manager, une fois le gestionnaire
ouvert cliquez sur le bouton Create (fig. 2.2). Une fenêtre de configuration
s’affiche (fig. 2.3a). On propose de configurer un émulateur Nexus One avec les
paramètres indiqués (fig.2.3b).
Notez qu’à la création de l’appareil sa résolution vous est signalée. Dans cet
exemple l’appareil a une résolution 480x800 qui correspond à hdpi (high density
dots per inch). Ceci est important à noter pour l’intégration d’images dans
l’application.
i
Notez que pour certains émulateurs proposés le processeur n’est pas installé
par défaut, pour pouvoir les créer il faut installer un processeur adapté dans
le SDK Manager.
Polytech’ Paris Sud Dima RodriguezTutoriel Android 9
(a) Fenêtre de création AVD (b) Création d’un appareil Nexus One
Figure 2.3 – Création d’un appareil virtuel
Polytech’ Paris Sud Dima Rodriguez3 Notre première application
Android
Création d’un projet et d’une application “Hello
World”
a. Dans le menu File > New, sélectionnez Android Application Project , et
renseignez les informations comme dans la figure 3.1
Application name : c’est le nom qui va apparaitre dans la liste des applications
sur l’appareil et dans le Play Store.
Project name : c’est le nom utilisé par Eclipse (typiquement le même
que celui de l’application).
Package name : il est utilisé comme identifiant de l’application, il permet
de considérer différentes versions d’une application comme étant une
même application.
Minimum required SDK : c’est la version Android la plus ancienne sur
laquelle l’application peut tourner. Il faut éviter de remonter trop en
arrière ça réduirait les fonctionnalités que vous pourriez donner à votre
application.
Target SDK : c’est la version pour laquelle l’application est développée et
testée. Typiquement la dernière version API que vous avez installée. 1
Compile with : c’est la version d’API à utiliser pour la compilation. Typiquement
la dernière version du SDK installée.
Theme : c’est l’apparence par défaut qu’aura votre application.
1. Ce tutoriel a été réalisé avec la version 4.4.2
10Tutoriel Android 11
b. Cliquez sur Next et laissez les choix par défaut. Vous pouvez éventuellement
modifier l’emplacement de votre projet en décochant Create Project in
Workspace et parcourir le disque pour sélectionner un autre dossier.
c. Cliquez sur Next. La fenêtre suivante vous propose de définir une icône pour
votre application. Nous laisserons l’icône proposée par défaut. Vous pourrez
ultérieurement créer votre propre icône pour vos applications. Remarquez
que l’image doit être proposée avec différentes résolutions pour s’adapter
aux différents appareils.
d. Cliquez sur Next. Nous arrivons à la création d’une activité (un écran avec
une interface graphique). Sélectionnez Blank Activity (fig. 3.2) et cliquez
Next.
e. Selon la version de l’ADT que vous avez, vous verrez soit la fenêtre de la
figure 3.3a ou celle de la figure 3.3b. La dernière version impose l’utilisation
de fragments. Chaque activité dispose d’un layout qui définit la façon dont
les composants seront disposés sur l’écran. Une activité peut être divisée
en portions (ou fragments) chacune ayant son propre layout. La notion
de fragment a été introduite pour favoriser la ré-utilisabilité de morceaux
d’activité (un fragment peut être définit une fois et réutilisé dans plusieurs
activités). Renseignez les champs comme indiqué dans la figure.
f. Cliquez sur Finish, le projet est crée.
!
Si vous créez un fragment ce sera le fichier fragment_principale.xml
que vous devriez modifier dans la suite du tutoriel sinon vous modi-
fierez le fichier activite_principale.xml.
Exécution de l’application
Sur l’émulateur
Appuyez sur le bouton d’exécution (fig.3.4 ) et sélectionnez Android Application
dans la fenêtre qui s’affiche. L’émulateur se lance, ça peut prendre quelques minutes
soyez patients. Rassurez-vous, vous n’aurez pas à le relancer à chaque fois que
vous compilez votre projet, laissez-le ouvert et à chaque fois que vous compilez et
relancez votre application, elle sera rechargée dans l’émulateur en cours.
Polytech’ Paris Sud Dima RodriguezTutoriel Android 12
Figure 3.1 – Création d’un projet
Figure 3.2 – Créer une activité
Polytech’ Paris Sud Dima RodriguezTutoriel Android 13
(a) Création d’activité sans fragment (b) Création d’activité avec fragment
Figure 3.3 – Nouvelle activité
Figure 3.4 – Exécution de l’application
Polytech’ Paris Sud Dima RodriguezTutoriel Android 14
Explorateur
Palette des composants graphiques
Navigateur des fichiers ouverts
Liste des composants
de l'activité
Propritétés du
composant selectionné
Navigation entre vue graphique et xml
Output
Aperçu de
l'activité
Debug et Execution
Figure 3.5 – Aperçu de l’interface Eclipse
Sur un appareil réel
Connectez l’appareil par câble USB à l’ordinateur et installez le pilote si nécessaire.
Activez l’option de débogage USB sur votre appareil (en général sous Settings
> Applications > Development). Lancez l’application depuis Eclipse comme
précédemment. Eclipse charge l’application sur votre appareil et la lance.
i
Une fois que votre application est compilée, un fichier MonAppli.apk
est créé dans le dossier bin de votre répertoire de travail. C’est l’exé-
cutable de votre application. C’est ce fichier que vous devez déployer
pour distribuer votre application. Le contenu de ce fichier peut être
inspecté à l’aide de n’importe quel logiciel standard de compression/-
décompression de fichiers.
Se repérer dans le projet
La figure 3.5 montre les principaux éléments de l’interface Eclipse.
Tout projet Android doit respecter une hiérarchie bien précise qui permettra au
compilateur de retrouver les différents éléments et ressources lors de la génération
de l’application. Cette hiérarchie favorise la modularité des applications Android.
A la création du projet, Eclipse crée automatiquement des dossiers pour contenir
Polytech’ Paris Sud Dima RodriguezTutoriel Android 15
les fichiers de code Java, les fichiers XML, et les fichiers multimédias. L’explorateur
de projet vous permettra de naviguer dans ces dossiers.
Les dossiers que nous utiliserons le plus sont src et res. Le premier contient le code
Java qui définit le comportement de l’application et le second comporte des sous
dossiers où sont stockés les ressources qui définissent l’interface de l’application
(l’apparence).
i
La séparation entre fonctionnalité et apparence est un point essentiel de la
philosophie Android.
Le code de la classe principale de l’application (Principale.java) est situé dans le
sous dossier polytech.android.monappli de src. Vous trouverez en annexe une brève
explication du code qui y est généré par défaut. C’est dans le dossier src que seront
enregistrées toutes les classes que nous allons créer dans ce projet.
Par ailleurs, tout ce qui touche à l’interface utilisateur sera intégré dans les sous
dossiers de res, dont voici une brève description :
layout regroupe les fichiers XML qui définissent la disposition des composants
sur l’écran. Il contient déjà, dès la création du projet, le layout de l’activité
principale que nous avons créée.
drawable-**** contient tout élément qui peut être dessiné sur l’écran : images
(en PNG de préférence), formes, animations, transitions, icône, etc.. Cinq
dossiers drawable permettent aux développeurs de proposer des éléments
graphiques pour tout genre d’appareil Android en fonction de sa résolution.
En populant correctement ces dossiers on peut ainsi créer des applications
avec une interface qui s’adapte à chaque résolution d’écran avec un
seul fichier .apk.
ldpi low-resolution dots per inch. Pour des images destinées à des
écrans de basse résolution (~120dpi)
mdpi pour des écrans de moyenne resolution (~160dpi)
hdpi pour des écrans de haute résolution (~240dpi)
xhdpi pour des écrans ayant une extra haute résolution (~320dpi)
xxhdpi pour des écrans ayant une extra extra haute résolution (~480dpi).
menu contient les fichiers XML définissant les menus
Polytech’ Paris Sud Dima RodriguezTutoriel Android 16
values contient les fichiers XML qui définissent des valeurs constantes (des
chaines de caractères, des dimensions, des couleurs, des styles etc.)
Dans le dossier gen vous verrez du code java généré automatiquement par Eclipse.
Nous nous intéresserons particulièrement au fichier R.java dans le package polytech.android.monappli.
Ce fichier définit une classe R dans laquelle sont définis les
identifiants des ressources de l’application. A chaque fois que vous rajouterez une
ressource à votre application un identifiant sera généré automatiquement dans
cette classe vous permettant par la suite de pouvoir le référencer pour l’utiliser
dans votre code 2
.
Vous trouverez également sur la racine du projet un fichier nommé AndroidManifest.xml.
Ce fichier est obligatoire dans tout projet Android, et doit toujours
avoir ce même nom. Ce fichier permet au système de reconnaitre l’application.
Modification de l’interface utilisateur
Pour l’instant notre application ne fait qu’afficher un message sur l’écran, dans
cette section nous allons modifier l’interface pour y mettre un champ de saisie et
un bouton.
Une interface utilisateur est en général constituée de ce qu’on appelle des ViewGroups
qui contiennent des objets de type View ainsi que d’autres ViewGroups.
Un View est un composant, tel un bouton ou un champ de texte, et les ViewGroups
sont des conteneurs qui définissent une disposition des composants (Views)
qui y sont placés. ViewGroup définit la classe de base des différents layouts.
Comprendre le layout
La disposition de notre interface est définie dans le fichier fragment_principale.xml
situé dans le dossier layout de res. (ou bien le fichier activite_principale.xml si vous
n’avez pas définit de fragment à la création de votre projet). Ouvrez ce fichier.
2. A l’intérieur de classe R sont définies plusieurs classes, dites nichées, telles que string,
drawable, layout, menu, id, etc. Une classe nichée est membre de la classe qui la contient.
On a recours à ce genre de classe en général lorsqu’on veut définir une classe qui n’est utilisée
qu’à l’intérieur d’une autre classe. Si on la déclare privée elle ne sera visible qu’a l’intérieur de la
classe qui l’a définie. Par ailleurs cette dernière peut également accéder aux attributs privés de la
classe nichée. C’est une façon d’améliorer la lisibilité du code en regroupant les fonctionnalités qui
vont ensemble. Dans notre cas toutes les classes nichées dans R sont publiques, donc accessibles
depuis l’extérieur, mais comme elles sont membres de la classe R, pour y accéder, il faut passer
par R. On utilisera des notations telles que R.string puisque ces classes sont statiques.
Polytech’ Paris Sud Dima RodriguezTutoriel Android 17
La première balise que vous retrouverez est qui définit
le type du conteneur qui compose l’interface, il impose la façon dont les composants
seront disposés. Plusieurs types de conteneurs existent, les plus communs
sont RelativeLayout, LinearLayout, TableLayout, GridView,
ListView. L’utilisation d’un RelativeLayout, par exemple, implique que les
composants seront placés selon des positions relatives les uns par rapport aux
autres. Un LinearLayout implique une disposition linéaire verticale ou horizontale,
un GridView permet la disposition des éléments selon une grille qui peut
défiler, etc.
A l’intérieur de la balise vous verrez un ensemble d’attributs
définis selon le format
plateforme:caractéristique=”valeur”
Par exemple le premier attribut xmlns:android précise où sont définis les balises
Android utilisées dans ce fichier.
La balise , fille de la balise , définit un composant
texte qui sera placé sur le layout. En effet, c’est sur ce composant là qu’on
écrit le “Hello World” qu’affiche notre application. Cette chaine de caractère est
définie par l’attribut android:text. La notation "@string/hello_world"
fait référence à une chaine de caractère qui s’appelle hello_world et qui est
définie dans le fichier strings.xml (dans le dossier values).
Modifier le type de layout
Nous allons maintenant modifier le type du layout pour le transformer en LinearLayout.
La figure 3.6 trace la dérivation de la classe LinearLayout. Nous
rajouterons ensuite nos composants sur ce layout dans une disposition linéaire.
Figure 3.6 – Hiérarchie de LinearLayout
Les layouts sont des ViewGroup qui sont eux mêmes des View [1]
Dans le fichier fragment_principale.xml
Polytech’ Paris Sud Dima RodriguezTutoriel Android 18
. supprimez l’élément
. remplacez l’élément par
. rajoutez l’attribut android:orientation et mettre sa valeur à “horizontal”
Le code dans le fichier devient ainsi
Rajouter d’un champ de saisie
. Rajoutez un élément dans le tel que
Nous avons ainsi placé un champ de saisie avec les attributs suivants :
android :id permet de donner un identifiant unique à ce View qu’on utilisera
pour référencer cet objet à l’intérieur de notre code.
Le symbol @ est nécessaire pour faire référence à un objet ressource à partir
d’un fichier XML. id est le type de ressource et chp_saisie est le nom
qu’on donne à notre ressource. Le symbole + est utilisé pour définir un ID
pour la première fois. Il indique aux outils du SDK qu’il faudrait générer
un ID dans le fichier R.java pour référencer cet objet. Un attribut public
static final chp_saisie sera défini dans la classe id.Le symbole
+ ne doit être utilisé qu’une seule fois au moment où on déclare la ressource
pour la première fois. Par la suite si on veut faire référence à cet élément,
à partir d’un XML, il suffira d’écrire @id/chp_saisie.
Polytech’ Paris Sud Dima RodriguezTutoriel Android 19
android :layout_width permet de spécifier la largeur de élément.
“wrap_content” signifie que le View doit être aussi large que nécessaire
pour s’adapter à la taille de son contenu. Si en revanche on précise
“match_parent” comme on l’avait fait pour le LinearLayout, dans
ce cas le EditText occuperait toute la largeur de l’écran puisque sa largeur
sera celle de son parent c-à-d le LinearLayout
android :layout_height idem que pour le layout_width mais pour la hauteur
android :hint précise le texte par défaut à afficher dans le champ de saisie
quand il est vide. Nous aurions pu préciser directement la chaine de caractère
ici codée en dur, mais on préfère utiliser plutôt une ressource qu’on
définira dans strings.xml . Noter que l’utilisation de + ici n’est pas nécessaire
parce qu’on fait référence à une ressource concrète (qu’on définira
dans le fichier xml) et non pas à un identifiant que le SDK doit créer dans
la classe R.
i
Privilégiez toujours l’utilisation des ressources strings plutôt que des chaines
de caractères codées en dur. Cela permet de regrouper tout le texte de votre
interface dans un seul endroit pour simplifier la recherche et la mise à jour
du texte, de plus ceci est indispensable pour que votre application puisse être
multilingue. l’IDE vous affichera un avertissement en cas de non respect de
cette recommandation.
Après la modification du code que nous venons de faire, quand vous sauvegarderez
le fichier, un message d’erreur vous indiquera que l’identifiant str_chp_saisie
n’est pas connu. Nous allons donc le définir.
. Ouvrez le fichier strings.xml qui se trouve dans res>values
. Rajoutez une nouvelle string nommée str_chp_saisie et dont la valeur
est “Entrer un texte”
. Vous pouvez éventuellement supprimer la ligne qui définit “hello_world”
Votre fichier strings.xml ressemblera donc à ceci
MonAppliEntrer un texte
string>
Polytech’ Paris Sud Dima RodriguezTutoriel Android 20
Figure 3.7 – Premier test de l’application modifiée
Settings
. Une fois que vos modifications sont sauvegardées vous remarquerez la création
de deux attributs dans le fichier R.java.
• Un attribut constant nommé chp_saisie dans la classe id. C’est un
numéro unique qui identifie l’élément EditText que nous venons de
rajouter. Cet identifiant nous permettra de manipuler l’élément à partir
du code.
• Un attribut constant nommé str_chp_saisie dans la classe string.
Il fait référence à la chaine de caractère et nous permettra de l’utiliser
dans le code.
Lancez l’application, l’émulateur affichera un écran tel que dans la figure 3.7.
Tapez un texte et remarquez comment la taille du champ de saisie s’adapte à la
longueur du texte.
Polytech’ Paris Sud Dima RodriguezTutoriel Android 21
(a) Disposition par défaut (b) Le EditText a un poids de 1
Figure 3.8 – Champ de saisie et bouton
Rajouter un bouton
. Dans le fichier strings.xml rajoutez une chaine de caractère qui s’appelle
"btn_envoyer" et qui vaut Envoi.
. Dans le fichier du layout rajoutez un élément