diff options
Diffstat (limited to 'sem_4')
101 files changed, 2893 insertions, 0 deletions
diff --git a/sem_4/Algo/TP1/Q1.cpp b/sem_4/Algo/TP1/Q1.cpp new file mode 100644 index 0000000..116cf84 --- /dev/null +++ b/sem_4/Algo/TP1/Q1.cpp @@ -0,0 +1,74 @@ +#include<iostream>
+#include<cstdlib>
+#include<ctime>
+
+void f1 ( int n);
+void f3 (int n);
+void g2 (int n);
+
+void f1 (int n){
+ for (int i = 1; i <=n; i ++){
+
+ }
+}
+
+void f3 (int n ) {
+ for (int i = 1; i <=n; i ++){
+ for (int i = 1; i <=n; i ++){
+ for (int i = 1; i <=n; i ++){
+ }
+ }
+ }
+}
+
+void g2 (int n){
+ if ( n != 1){
+ g2(n-1);
+ g2(n-1);
+ }
+}
+void g3 (int n){
+ if ( n != 1){
+ g3(n-1);
+ g3(n-1);
+ g3(n-1);
+ }
+}
+
+int main ( int argc, char ** argv){
+ if ( argc != 2){
+ std::cout<<"Syntaxe attendue : ./R1 n"<<std::endl;
+ return 0;
+ }
+ int N = atoi(argv[1]);
+ std::cout<<"N vaut : "<< N<<std::endl;
+ time_t timer =time(NULL);
+ f1(N);
+ int tmpf1= time(NULL)-timer;
+ std::cout<<"Temps exec f1 : "<<tmpf1<<std::endl;
+ timer= time(NULL);
+ f3(N);
+ int tmpf3 = time(NULL)-timer;
+ std::cout<<"Temps exec f3 : "<<tmpf3<<std::endl;
+ timer = time(NULL);
+ g2(N);
+ int tmpg2= time(NULL)-timer;
+ std::cout<<"Temps exec g2 : "<<tmpg2<<std::endl;
+ timer = time(NULL);
+ g3(N);
+ int tmpg3 = time(NULL)-timer;
+ std::cout<<"Temps exec g3 : "<<tmpg3<<std::endl;
+ return 0;
+}
+/*
+ Pour n = 1000, f1 mets 0 secondes, contre 2 secondes pour f3;
+Vers n= 30 on voit que g2 mets plus de temps que f3
+A partir de n = 20, g3 commence a mettre drastiquement plus de temps que g2 ( 4 secondes sur ma machine!)
+
+Concernant les complexités de l'exec successives de fonctions, exemple pour la premiere :
+O(n^3) et O ( n + n^3) appartiennent tout deux a teta(n^3) il existe un difference de complexité lineaire, mais elle est negligeable face a n^3
+Ce principe s'applique de maniere similaire aux autres questions, a chaque fois la complexité de la premiere fonction est negligeable face a celle de la secone.
+
+*/
+
+//g++ Q1.cpp -o R1
diff --git a/sem_4/Algo/TP1/R1 b/sem_4/Algo/TP1/R1 Binary files differnew file mode 100644 index 0000000..2e2afd8 --- /dev/null +++ b/sem_4/Algo/TP1/R1 diff --git a/sem_4/Algo/TP2/SolutionsFonctionMysterieuses.cpp b/sem_4/Algo/TP2/SolutionsFonctionMysterieuses.cpp new file mode 100644 index 0000000..4432f6a --- /dev/null +++ b/sem_4/Algo/TP2/SolutionsFonctionMysterieuses.cpp @@ -0,0 +1,47 @@ +#include <iostream> +#include <cmath> +#include <stdlib.h> /* atoi */ + +#include "fonctionsMysterieuses.h" + +int apuissanceb(int a, int b) { +// renvoie a puissance b + if (b==0) return 1; + if (b % 2 == 0) return apuissanceb(a * a, b / 2); + return a * apuissanceb(a,b-1);} + +int main(int argv, char** argc){ + + int numeroFonction = atoi(argc[1]), + n = atoi(argc[2]), + v; + for (int i = 0; i < n; i+=1){ + + switch (numeroFonction) { + case 1 : v=f1(i); break; + case 2 : v=f2(i); break; + case 3 : v=f3(i); break; + case 4 : v=f4(i); break; + case 5 : v=f5(i); break; + case 6 : v=f6(i); break; + } + std::cout<<"f"<<numeroFonction<<"("<<i<<") renvoie "<<v<<" "<< f5(i)/pow(2,i)<<std::endl; +} + + + + return 0; +} + +/* +ordre de compilation : g++ SolutionsFonctionMysterieuses.cpp fonctionsMysterieuses.o -o test +Ordre d'ex�cution : ./test 1 2 +*/ + +/*f1(x)= 3 * sqrt(x) + f2(x)= 1/10* x^5 + f3(x)= 1/2 * n^2 + f4(x) = 2 * ln(x) + f5(x)= 10* 2^n + f6(x)=20 * 3^n +*/ diff --git a/sem_4/Algo/TP2/fonctionsMysterieuses.h b/sem_4/Algo/TP2/fonctionsMysterieuses.h new file mode 100644 index 0000000..48869c5 --- /dev/null +++ b/sem_4/Algo/TP2/fonctionsMysterieuses.h @@ -0,0 +1,14 @@ +#ifndef FONCTIONSMYSTERIEUSES_H +#define FONCTIONSMYSTERIEUSES_H + +int f1(int); +int f2(int); +int f3(int); +int f4(int); +int f5(int); +int f6(int); + +#endif + + + diff --git a/sem_4/Algo/TP2/fonctionsMysterieuses.o b/sem_4/Algo/TP2/fonctionsMysterieuses.o Binary files differnew file mode 100644 index 0000000..0dc56d5 --- /dev/null +++ b/sem_4/Algo/TP2/fonctionsMysterieuses.o diff --git a/sem_4/Algo/TP2/sujet/TPReconnaissance2.pdf b/sem_4/Algo/TP2/sujet/TPReconnaissance2.pdf Binary files differnew file mode 100644 index 0000000..a243105 --- /dev/null +++ b/sem_4/Algo/TP2/sujet/TPReconnaissance2.pdf diff --git a/sem_4/Algo/TP2/test b/sem_4/Algo/TP2/test Binary files differnew file mode 100644 index 0000000..bd39f36 --- /dev/null +++ b/sem_4/Algo/TP2/test diff --git a/sem_4/Algo/TP3/TP3Tris.pdf b/sem_4/Algo/TP3/TP3Tris.pdf Binary files differnew file mode 100644 index 0000000..22b513e --- /dev/null +++ b/sem_4/Algo/TP3/TP3Tris.pdf diff --git a/sem_4/Algo/TP3/TriOutilsSimples.cpp b/sem_4/Algo/TP3/TriOutilsSimples.cpp new file mode 100644 index 0000000..e915ac4 --- /dev/null +++ b/sem_4/Algo/TP3/TriOutilsSimples.cpp @@ -0,0 +1,27 @@ +#include <iostream> + + +/************************ +Generaux +****************************/ +int max(int a, int b) {if (a > b) return a; return b;} + +int moitieSuperieure(int n){ + if (n % 2 == 0) return n / 2; return (n+1) / 2;} + +void imprimer(int n, int T[]){ + for (int i=0; i<n; i++) std::cout<<T[i]<<" ";} + +void genererInverse(int n, int T[]){ + for (int i=0; i<n; i++) T[i]=n-i; +} + + +void genererRandom(int n, int Max, int T[]){//rempli le tableau T de n nombres aléatoires, tous enttre 0 et Max + for (int i=0; i<n; i++) T[i]=rand() % (Max + 1); +} + + +void echanger(int T[], int i, int j){ + int temp=T[i]; T[i]=T[j]; T[j]=temp; +} diff --git a/sem_4/Algo/TP4/AB.cpp b/sem_4/Algo/TP4/AB.cpp new file mode 100644 index 0000000..379387e --- /dev/null +++ b/sem_4/Algo/TP4/AB.cpp @@ -0,0 +1,72 @@ +//AB.cpp + +#include "AB.h" + + +Sommet::Sommet(Valeur v){ + racine = v; + SAG = NULL; + SAD = NULL; + Pere = NULL; +} + +Sommet::Sommet(Sommet& s){ + racine = s.racine; + SAG = s.SAG; + SAD = s.SAD; + +} + + +bool Sommet::FeuilleP(){ + if (SAG == SAD && SAG == NULL){ + return true; + } + return false; +} + + +void Sommet::SupprimerSAG(){ + if (!FeuilleP()){ + SAG->SupprimerSAG(); + delete SAG; + } +} + + +void Sommet::SupprimerSAD(){ + if (!FeuilleP()){ + SAD->SupprimerSAD(); + delete SAD; + } +} + + +void Sommet::GrefferSAG(AB g){ + SupprimerSAG(); + SAG = g; + g->Pere = this; + g->FGP= true; + } + +void Sommet::GrefferSAD(AB d){ + SupprimerSAD(); + SAD=d; + d->Pere=this; + d->FGP=false; + } + + +void Sommet::RemplacerPourLePerePar(AB Ar){ + //le pere existe + if ( FGP ){ + Pere->GrefferSAG(Ar); +} +else { + Pere->GrefferSAD(Ar); +} +} + + +/*Question 1 : L'etiquette d'un sommet est dans "racine", on voit que l'arbo est binaire car chaque sommet ne peut avoir que 2 fils au maximum. +*/ diff --git a/sem_4/Algo/TP4/AB.h b/sem_4/Algo/TP4/AB.h new file mode 100644 index 0000000..436d639 --- /dev/null +++ b/sem_4/Algo/TP4/AB.h @@ -0,0 +1,44 @@ +//AB.h + +#ifndef AB_H +#define AB_H + +#include <iostream> +#include <sstream> + +typedef int Valeur; + +class Sommet; + +typedef Sommet* AB; +void SortieLatex(AB Ar, std::string filepath); + std::string* TikzRecursAB(int ligne,int gauche, int droite, int numeroPere, int typeFils, AB Ar); + +class Sommet { + public: + Valeur racine; + AB Pere,SAG, SAD; + bool FGP; + + int hauteur,balanceGmoinsD; + + + Sommet(Valeur v); + Sommet(Sommet& s); + + void GrefferSAG(AB g); + void GrefferSAD(AB d); + + void SupprimerSAG(); + void SupprimerSAD(); + + bool FeuilleP(); + + void RemplacerPourLePerePar(AB); + + std::string* TikzRecursAB(int ligne,int gauche, int droite, int numeroPere, int typeFils, AB Ar); +}; + + + +#endif diff --git a/sem_4/Algo/TP4/SortieLatex.cpp b/sem_4/Algo/TP4/SortieLatex.cpp new file mode 100644 index 0000000..b400d1a --- /dev/null +++ b/sem_4/Algo/TP4/SortieLatex.cpp @@ -0,0 +1,110 @@ +//SortieLatex.cpp + +#include <iostream> +#include <fstream> +#include <sstream> +#include <cstdlib> +#include <stdlib.h> + +typedef int Valeur; + +class Sommet; + +typedef Sommet* AB; + +void SortieLatex(AB Ar, std::string filepath); + +class Sommet { + protected: + Valeur racine; + AB Pere,SAG,SAD; + bool FGP; + + // Unused: + // int hauteur,balanceGmoinsD; + + public: + Sommet(Valeur v); + Sommet(Sommet& s); + + AB remonterToutEnHaut(); + + void GrefferSAG(AB g); + void GrefferSAD(AB d); + + void SupprimerSAG(); + void SupprimerSAD(); + + bool FeuilleP(); + + void RemplacerPourLePerePar(AB); + + friend std::string* TikzRecursAB(int ligne,int gauche, int droite, int numeroPere, int typeFils, AB Ar); + + +}; + +std::string* TikzRecursAB(int ligne,int gauche, int droite, int numeroPere, int typeFils, AB Ar); + + + +std::string * TikzRecursAB(int ligne,int gauche, int droite, int numeroPere, int typeFils, AB Ar){ + std::ostringstream ossnum, osslign,osscol,ossnumPere, ossbal, ossnum2Pere,ossnumRac; + + std::string stres(""); + + if (Ar) { + ossnumPere<<numeroPere; + ossnumRac<<"(\\textcolor{red}{" << Ar->racine << "})\\\\this=\\textcolor{red}{" <<Ar <<"}\\\\Pere=\\textcolor{red}{"<<Ar->Pere << "} (FGP=\\textcolor{red}{" << (Ar->FGP?"Gauche":"Droit") <<"})"; + + if (Ar->Pere )ossnum2Pere<<Ar->Pere->racine; else ossnum2Pere<<0; + + int numero; + if (typeFils==-1) { numero=1; } else { numero= 2*numeroPere + typeFils; } + ossnum<<numero; + osslign<<ligne; + int mil = (gauche + droite)/2; + + osscol<<mil; + + stres="\\node[draw, color=black, rounded corners=5pt, text width=3cm, text centered] (SZ" + ossnum.str() + ") at " + + "(" + osscol.str() + ", " + osslign.str() + ") " + + "{ " + ossnumRac.str() + "};\n"; + + if (typeFils!=-1) stres+="\\draw[->, >=latex, color=blue] (SZ"+ossnumPere.str()+") -- (SZ"+ossnum.str() +");\n"; + + if (Ar->SAG) stres+=*TikzRecursAB(ligne-3,gauche,mil-13,numero,0,Ar->SAG); + if (Ar->SAD) stres+=*TikzRecursAB(ligne-3,mil+13,droite,numero,1,Ar->SAD); + } + return new std::string(stres); +} + +std::string * TikzAB(AB Ar){ + return TikzRecursAB(1,1,10,1,-1,Ar); +} + + void SortieLatex(AB Ar, std::string filepath){ //don't insert garbage in filepath, its std::system-ised. + std::ofstream fichier(filepath.c_str(), std::ios::out | std::ios::trunc); + std::string preamb ("\\documentclass{article} \n \\usepackage{tikz} \n \\begin{document} \n \\resizebox{300pt}{!}{\n \\begin{tikzpicture}\n"); + std::cout<<preamb<<"\n"; +std::string post("\\end{tikzpicture}\n } \\end{document} \n"); //rsz box end? + std::cout<<post<<"\n"; + std::cout<<*TikzAB(Ar)<<"\n"; +std::string res1(preamb + *TikzAB(Ar)); + std::string res(res1 + post); + //std::cout<<res1<<"\n"; + fichier <<res<<"\n"; + fichier.close(); + + std::ostringstream system_CARE; + // /dev/null 2>&1 isnt enough to mute pdflatex... + system_CARE << "mkdir pdflatex_temp > /dev/null 2>&1;" + << "pdflatex -output-directory=\"./pdflatex_temp\" -interaction=nonstopmode \"" << filepath << "\" >/dev/null 2>&1;" + << "mv ./pdflatex_temp/*.pdf ./ > /dev/null 2>&1;"; + std::system(system_CARE.str().c_str()); + return; +} + + + +// g++ -c SortieLatex.cpp diff --git a/sem_4/Algo/TP4/TPArborescencesBinaires.pdf b/sem_4/Algo/TP4/TPArborescencesBinaires.pdf Binary files differnew file mode 100644 index 0000000..fdf4ff1 --- /dev/null +++ b/sem_4/Algo/TP4/TPArborescencesBinaires.pdf diff --git a/sem_4/Algo/TP4/main.cpp b/sem_4/Algo/TP4/main.cpp new file mode 100644 index 0000000..6afaf71 --- /dev/null +++ b/sem_4/Algo/TP4/main.cpp @@ -0,0 +1,24 @@ +#include<iostream>
+#include<cstdlib>
+#include<ctime>
+#include"AB.h"
+
+int main ( int argc, char ** argv){
+ AB s1 = new Sommet(2);
+ AB s2 = new Sommet(4);
+ AB s3 = new Sommet(2);
+ AB s4 = new Sommet(4);
+ AB s5 = new Sommet(0);
+ AB s6 = new Sommet(0);
+ AB s7 = new Sommet(6);
+
+ s5->GrefferSAG(s1);
+ s5->GrefferSAD(s2);
+ s6->GrefferSAG(s3);
+ s6->GrefferSAD(s4);
+ s7->GrefferSAG(s5);
+ s7->GrefferSAD(s6);
+ SortieLatex(s7, "test");
+ return 0;
+}
+// La methode estFeuille est testé lors de la suppresion, donc lors des greffes.
diff --git a/sem_4/Algo/TP4/prog b/sem_4/Algo/TP4/prog Binary files differnew file mode 100644 index 0000000..62c1884 --- /dev/null +++ b/sem_4/Algo/TP4/prog diff --git a/sem_4/Algo/TP4/test b/sem_4/Algo/TP4/test Binary files differnew file mode 100644 index 0000000..57bc262 --- /dev/null +++ b/sem_4/Algo/TP4/test diff --git a/sem_4/Algo/TP5/Arbo.cpp b/sem_4/Algo/TP5/Arbo.cpp new file mode 100644 index 0000000..18305d8 --- /dev/null +++ b/sem_4/Algo/TP5/Arbo.cpp @@ -0,0 +1,235 @@ +#include "Arbo.h" + +/******* Liste doublement chainee Début *******/ + +Cellule::Cellule (ContCellule A){ + fils=A; + Apres=NULL; +} + + + + +ListeCellules Cellule::EstDansListeP(ContCellule A){ + if (fils==A) return this; + if (Apres==NULL) return NULL; + return Apres->EstDansListeP(A); +} + + + +ListeCellules Cellule::AjouterSuccesseur(ContCellule A){ + if (!EstDansListeP(A)) { + ListeCellules ptCell=new Cellule(A); + ptCell->Apres=this; + return ptCell; + } + return this; +} + + + +ListeCellules Cellule::RetirerSuccesseur(ContCellule A){ + if (fils==A) return Apres; + if (!Apres) return this; + Apres=Apres->RetirerSuccesseur(A); return this; +} + + + + +/******* Liste doublement chainee Fin *******/ + + +/************Arborescence Debut*************/ + + +Sommet::Sommet(Valeur v){ + racine=v; + ListeSuccesseurs= NULL; +} + + +ListeCellules Sommet::EstSuccesseurP(Arbo A){ + if (ListeSuccesseurs){ + return (ListeSuccesseurs->EstDansListeP(A)); // à completer et decommenter + } + return NULL; +} + + + +void Sommet::AjouterSuccesseur(Arbo A){ + if ( ListeSuccesseurs && !(ListeSuccesseurs->EstDansListeP(A))){ + ListeSuccesseurs = ListeSuccesseurs->AjouterSuccesseur(A); + } + else { + ListeSuccesseurs = new Cellule (A); + } + return; +} + + + +void Sommet::RetirerSuccesseur(Arbo A){ + if (ListeSuccesseurs && ListeSuccesseurs->EstDansListeP(A)) { + ListeSuccesseurs= ListeSuccesseurs->RetirerSuccesseur(A); // à completer et decommenter + } + return; +} + +ostream& operator<<(ostream& os, Sommet& S){ + os<<S.racine<<" "; + return os; +} + +/************Arborescence Fin*************/ + +/************Traversee recursive Debut*************/ + +void TraverseePrefixeRec(Arbo A){ + if (!A) { return;}; + cout<< *A; + for (ListeCellules L=A->ListeSuccesseurs; L!=NULL;L=L->Apres){ + TraverseePrefixeRec(L->fils); + } ; // à completer et decommenter + return; +} + +/************Traversee recursive Fin*************/ + +/**********Pile Début*********/ + +Pile::Pile(){ + Sommet=NULL; +} + + +bool Pile::VideP(){ + return Sommet==NULL; +} + + +void Pile::Empiler(ContCellule A){ + Cellule* ptCellule=new Cellule(A); + ptCellule->Apres=Sommet; + Sommet=ptCellule; + return; +} + + +ContCellule Pile::Depiler(){ + Cellule* ptCellule=Sommet; + Sommet=Sommet->Apres; + return ptCellule->fils; +} + +/**********Pile Fin*********/ + +/************Traversee prefixe iterative Debut*************/ + +void TraverseePrefixeIt(Arbo A){ + Pile* P=new Pile; + P->Empiler(A); + while (!(P->VideP())){ + Arbo tmp = P->Depiler(); + cout<< *tmp; + for (ListeCellules L = tmp->ListeSuccesseurs; L!=NULL; L=L->Apres){ + P->Empiler(L->fils); + } + } + cout<<endl; + // while // à completer et decommenter +} + +/************Traversee prefixe iterative Fin*************/ + + +/**********File Début*********/ + +File::File(){ + Sortie=NULL; Entree=NULL; +} + + +bool File::VideP(){ + return Sortie==NULL; +} + + +void File::Enfiler(ContCellule A){ + Cellule* ptCellule=new Cellule(A); + if (Entree) Entree->Apres=ptCellule; + Entree=ptCellule; + if (! Sortie) Sortie=ptCellule; + return; +} + + +ContCellule File::Defiler(){ + Cellule* ptCellule=Sortie; + Sortie=Sortie->Apres; + return ptCellule->fils; +} + +/**********File Fin*********/ + +/************Traversee Largeur Debut*************/ + +void TraverseeLargeur(Arbo A){ + File * f= new File; + f->Enfiler(A); + while (!f->VideP()){ + A = f->Defiler(); + cout<<(*A); + for (ListeCellules tmp = A->ListeSuccesseurs; tmp != NULL; tmp=tmp->Apres){ + f->Enfiler(tmp->fils); + } + + } +} // à completer + +/************Traversee Largeur Fin*************/ + + +int main(){ + + Arbo A0 = new Sommet(0); + Arbo A1 = new Sommet(1); + Arbo A2 = new Sommet(2); + Arbo A3 = new Sommet(3); + Arbo A4 = new Sommet(4); + Arbo A5 = new Sommet(5); + Arbo A6 = new Sommet(6); + + A3->AjouterSuccesseur(A6); + A1->AjouterSuccesseur(A5); + A3->AjouterSuccesseur(A4); + A2->AjouterSuccesseur(A3); + A0->AjouterSuccesseur(A2); + A0->AjouterSuccesseur(A1); + + cout<<" rec A0 "; + TraverseePrefixeRec(A0); + cout<< endl; + cout<<" iter A0 "; + TraverseePrefixeIt(A0); + cout<< endl; + cout<<" largeur "; + TraverseeLargeur(A0); + cout<< endl; + + + A3->RetirerSuccesseur(A4); + A3->RetirerSuccesseur(A6); + //Alors, pourquoi ? pourquoi essaie t'on de retirer A5 et A2 (respectivement + //fils de A1 et de A0 ?) il y a comme un soucis... + cout<<"rec A0 apres retrait "; + TraverseePrefixeRec(A0); + cout<< endl; + cout<<" iter A0 "; + TraverseePrefixeIt(A0); + cout<< endl; + return 1; +} +//g++ -Wall Arbo.cpp -o prog diff --git a/sem_4/Algo/TP5/Arbo.h b/sem_4/Algo/TP5/Arbo.h new file mode 100644 index 0000000..4658710 --- /dev/null +++ b/sem_4/Algo/TP5/Arbo.h @@ -0,0 +1,115 @@ +#ifndef ARBO_H +#define ARBO_H + +#include <iostream> +#include <sstream> + +using namespace std; + +typedef int Valeur; + +struct Sommet; +typedef Sommet* Arbo; + + + +typedef Arbo ContCellule; + +/******* Liste chainee Début *******/ +struct Cellule; + +typedef Cellule* ListeCellules; + +struct Cellule{ + ContCellule fils; + ListeCellules Apres; + + Cellule (ContCellule A); + + ListeCellules EstDansListeP(ContCellule A); +// Si A apparait dans la liste, renvoie un pointeur sur la sous liste commençant par A; sinon renvoie NULL + + ListeCellules AjouterSuccesseur(ContCellule A); +// si A appartenait déjà à la liste renvoie la liste +// sinon rajoute A en tete et renvoie le nouvelle liste + + + ListeCellules RetirerSuccesseur(ContCellule A); +// renvoie la liste d'où a été retirée A s'il lui appartenait (sinon renvoie la liste initiale) +}; + +/******* Liste chainee Fin *******/ + +/************Arborescence Debut*************/ +struct Sommet { + Valeur racine; + ListeCellules ListeSuccesseurs; + + + Sommet(Valeur v); + + ListeCellules EstSuccesseurP(Arbo A); +// Si A apparait dans la liste ListeSuccesseurs, renvoie un pointeur sur la sous liste de ListeSuccesseurs commençant par A; sinon renvoie NULL + + void AjouterSuccesseur(Arbo A); +//rajoute A comme fils ainé + + void RetirerSuccesseur(Arbo A); +// si A était un fils, il cesse de l'être +}; + +ostream& operator<<(ostream& os, Sommet& S); + +/************Arborescence Fin*************/ + +/************Traversee recursive Debut*************/ + +void TraverseePrefixeRec(Arbo); + +/************Traversee recursive Fin*************/ + +/**********Pile Début*********/ +struct Pile { + ListeCellules Sommet; + + Pile(); + + bool VideP(); + void Empiler(ContCellule); + ContCellule Depiler(); // pas défini si la pile est vide +}; + +/**********Pile Fin*********/ + +/************Traversee prefixe iterative Debut*************/ + +void TraverseePrefixeIt(Arbo); + +/************Traversee prefixe iterative Fin*************/ + +/**********File Début*********/ +struct File { + ListeCellules Sortie; + ListeCellules Entree; + + File(); + + bool VideP(); + void Enfiler(ContCellule); + ContCellule Defiler(); // pas défini si la pile est vide +}; + +/**********File Fin*********/ + +/************Traversee Largeur Debut*************/ + +void TraverseeLargeur(Arbo); + +/************Traversee Largeur Fin*************/ + + + + + + +#endif diff --git a/sem_4/Algo/TP5/TPArbo.pdf b/sem_4/Algo/TP5/TPArbo.pdf Binary files differnew file mode 100644 index 0000000..c2b4758 --- /dev/null +++ b/sem_4/Algo/TP5/TPArbo.pdf diff --git a/sem_4/Algo/TP5/main.cpp b/sem_4/Algo/TP5/main.cpp new file mode 100644 index 0000000..494e997 --- /dev/null +++ b/sem_4/Algo/TP5/main.cpp @@ -0,0 +1,6 @@ +#include<iostream>
+#include"Arbo.h"
+
+int main (int argc, char ** argv){
+
+}
diff --git a/sem_4/Algo/TP5/prog b/sem_4/Algo/TP5/prog Binary files differnew file mode 100644 index 0000000..5e468bb --- /dev/null +++ b/sem_4/Algo/TP5/prog diff --git a/sem_4/Algo/TP6/TPTas.pdf b/sem_4/Algo/TP6/TPTas.pdf Binary files differnew file mode 100644 index 0000000..27bc5b7 --- /dev/null +++ b/sem_4/Algo/TP6/TPTas.pdf diff --git a/sem_4/Algo/TP6/Tas.h b/sem_4/Algo/TP6/Tas.h new file mode 100644 index 0000000..58dad9a --- /dev/null +++ b/sem_4/Algo/TP6/Tas.h @@ -0,0 +1,59 @@ +#ifndef TAS_H +#define TAS_H + +#include <iostream> +#include <sstream> + +#include "AB.h" + +typedef int indiceDansTableauSommet; + +class ArbreParfait +{ + public: + int IndicePremierSommetLibre; + int hauteur; + int* contenu; + void Echanger(indiceDansTableauSommet,indiceDansTableauSommet); + + public: + ArbreParfait(int); +// on passe la hauteur max de l'arbre, un arbre réduit à sa racine étant de hauteur 0 + + + int AjouteSommetArbreParfait(int); +// renvoie -1 si l'ajout a échoué + +bool SommetValide(indiceDansTableauSommet); + +indiceDansTableauSommet Racine(); +bool FeuilleP(indiceDansTableauSommet); +indiceDansTableauSommet Pere(indiceDansTableauSommet); +indiceDansTableauSommet FilsGauche(indiceDansTableauSommet); +indiceDansTableauSommet FilsDroit(indiceDansTableauSommet); + +void SupprimerArbreParfait(indiceDansTableauSommet); + +}; + + +class Tas : public ArbreParfait { + public: + Tas(int); + + void Remonter(indiceDansTableauSommet); + void Descendre(indiceDansTableauSommet); + + void SupprimerTas(indiceDansTableauSommet); + + void AjouterTas(int); + + int Supmin(); + + void DescendreRecursive(indiceDansTableauSommet indiceDansTas, AB S); + + AB TasVersAB(); + +}; + +#endif diff --git a/sem_4/Algo/TP7/ArbreBinaireRecherche.cpp b/sem_4/Algo/TP7/ArbreBinaireRecherche.cpp new file mode 100644 index 0000000..ecd5af9 --- /dev/null +++ b/sem_4/Algo/TP7/ArbreBinaireRecherche.cpp @@ -0,0 +1,95 @@ +#include "ArbreBinaireRecherche.h" + +SommetABR::SommetABR(Valeur v){ + racine=v; SAG=NULL; SAD=NULL;Pere=NULL; +} + +SommetABR::SommetABR(SommetABR& s){ + racine=s.racine; SAG=NULL; SAD=NULL; + if (s.SAG) GrefferSAG(new SommetABR(*(s.SAG))); + if (s.SAD) GrefferSAD(new SommetABR(*(s.SAD))); +} + +ABR SommetABR::PlusPetit(){ + if (this->SAG==NULL){ + return this; + } + else { + return this->SAG->PlusPetit(); + } +} + +ABR SommetABR::RechercherValeur(Valeur v){ + if (this!= NULL){ + if( v < this->racine){ + this->SAG->RechercherValeur(v); + } + else if (v > this->racine){ + this->SAD->RechercherValeur(v); + } + else if ( v == this->racine){ + return this; + } + } + return NULL; +} + +void SommetABR::InsererValeur(Valeur v){ + if (v < racine){ + if (SAG!=NULL){ + SAG->InsererValeur(v); + } + else { + GrefferSAG(SommetABR(v)); + } + } + else { + if (SAD!=NULL){ + SAD->InsererValeur(v); + } + else { + GrefferSAD(SommetABR(v)); + } + } +} + +ABR SommetABR::SupMin(){ + SupprimerValeur(PlusPetit()->racine); + return this; +} + + +ABR SommetABR::SupprimerValeur(Valeur v){ + if ( this!=NULL){ + if (v < racine){ + SAG->SupprimerValeur(v); + } + else if ( v > racine){ + SAD->SupprimerValeur(v); + } + else { + this->racine = this->SAD->racine; + } + } + return NULL; +} + + + + + +int main() { + ABR A1=new SommetABR(11); + ABR A2=new SommetABR(9); + ABR A3=new SommetABR(14); + ABR A4=new SommetABR(3); + ABR A5=new SommetABR(20); + A1->GrefferSAG(A2); + A1->GrefferSAD(A3); + A2->GrefferSAG(A4); + A3->GrefferSAD(A5); + std::cout<<A1->RechercherValeur(11)<<std::endl; + return 1; +} + +/* compiler avec g++ ArbreBinaireRecherche.cpp SortieLatex.cpp */ diff --git a/sem_4/Algo/TP7/ArbreBinaireRecherche.h b/sem_4/Algo/TP7/ArbreBinaireRecherche.h new file mode 100644 index 0000000..56b0e43 --- /dev/null +++ b/sem_4/Algo/TP7/ArbreBinaireRecherche.h @@ -0,0 +1,57 @@ +#ifndef ARBREBINAIRERECHERCHE_H +#define ARBREBINAIRERECHERCHE_H + +#include <iostream> +#include <sstream> + + +#include <cstdlib> +#include <fstream> + + +using namespace std; + + +typedef int Valeur; + +class SommetABR; + +typedef SommetABR* ABR; + +class SommetABR { + public: + Valeur racine; + ABR Pere,SAG, SAD; + bool FGP; + + void GrefferSAG(ABR g); + void GrefferSAD(ABR d); + + SommetABR(Valeur v); + SommetABR(SommetABR& s); + + + void SupprimerSAG(); + void SupprimerSAD(); + + bool FeuilleP(); + + void RemplacerPourLePerePar(ABR); + + std::string* TikzRecursABR(int ligne,int gauche, int droite, int numeroPere, int typeFils, ABR Ar); + +// ABR + + ABR PlusPetit(); + ABR RechercherValeur(Valeur v); + void InsererValeur(Valeur v); + ABR SupprimerValeur(Valeur v); // notez la dissym�trie + ABR SupMin(); +}; + + + //void SortieLatex(ABR, std::string filepath); + + + +#endif diff --git a/sem_4/Algo/TP7/SortieLatex.cpp b/sem_4/Algo/TP7/SortieLatex.cpp new file mode 100644 index 0000000..e5354e6 --- /dev/null +++ b/sem_4/Algo/TP7/SortieLatex.cpp @@ -0,0 +1,101 @@ +//SortieLatex.cpp + +#include <iostream> +#include <fstream> +#include <sstream> + +typedef int Valeur; + +class SommetABR; + +typedef SommetABR* ABR; + +void SortieLatex(ABR Ar); + +class SommetABR { + protected: + Valeur racine; + ABR Pere,SAG, SAD; + + int hauteur,balanceGmoinsD; + + public: + SommetABR(Valeur v); + SommetABR(SommetABR& s); + + ABR remonterToutEnHaut(); + + void GrefferSAG(ABR g); + void GrefferSAD(ABR d); + + void SupprimerSAG(); + void SupprimerSAD(); + + bool FeuilleP(); + + void RemplacerPourLePerePar(ABR); + + friend std::string* TikzRecursABR(int ligne,int gauche, int droite, int numeroPere, int typeFils, ABR Ar); + + +}; + +std::string* TikzRecursABR(int ligne,int gauche, int droite, int numeroPere, int typeFils, ABR Ar); + + + +std::string * TikzRecursABR(int ligne,int gauche, int droite, int numeroPere, int typeFils, ABR Ar){ + std::ostringstream ossnum, osslign,osscol,ossnumPere, ossbal, ossnum2Pere,ossnumRac; + + std::string stres(""); + + if (Ar) { + ossnumPere<<numeroPere; + ossnumRac<<Ar->racine; + if (Ar->Pere )ossnum2Pere<<Ar->Pere->racine; else ossnum2Pere<<0; + int numero; + if (typeFils==-1) numero=1; else numero= 2*numeroPere + typeFils; + ossnum<<numero; + osslign<<ligne; + int mil = (gauche + droite)/2; + osscol<<mil; + + stres="\\node[draw] (SZ" + ossnum.str() + ") at (" + osscol.str() + ", " + osslign.str() + ") { " + ossnumRac.str() + "};\n"; + + if (typeFils!=-1) stres+="\\draw (SZ"+ossnumPere.str()+") -- (SZ"+ossnum.str() +");\n"; + if (Ar->SAG) stres+=*TikzRecursABR(ligne -1 ,gauche,mil-1, numero,0,Ar->SAG); + if (Ar->SAD) stres+=*TikzRecursABR(ligne - 1,mil+1,droite, numero,1,Ar->SAD); + } + return new std::string(stres); +} + +std::string * TikzABR(ABR Ar){ + return TikzRecursABR(1,1,10,1, -1,Ar); +} + + + void SortieLatex(ABR Ar, std::string filepath){ //don't insert garbage in filepath, its std::system-ised. + std::ofstream fichier(filepath.c_str(), std::ios::out | std::ios::trunc); + std::string preamb ("\\documentclass{article} \n \\usepackage{tikz} \n \\begin{document} \n \\resizebox{300pt}{!}{\n \\begin{tikzpicture}\n"); + std::cout<<preamb<<"\n"; +std::string post("\\end{tikzpicture}\n } \\end{document} \n"); //rsz box end? + std::cout<<post<<"\n"; + std::cout<<*TikzAB(Ar)<<"\n"; +std::string res1(preamb + *TikzAB(Ar)); + std::string res(res1 + post); + //std::cout<<res1<<"\n"; + fichier <<res<<"\n"; + fichier.close(); + + std::ostringstream system_CARE; + // /dev/null 2>&1 isnt enough to mute pdflatex... + system_CARE << "mkdir pdflatex_temp > /dev/null 2>&1;" + << "init_texlive;"<< "pdflatex -output-directory=\"./pdflatex_temp\" -interaction=nonstopmode \"" << filepath << "\" >/dev/null 2>&1;" + <<"mv ./pdflatex_temp/*.pdf ./ > /dev/null 2>&1;"; + std::system(system_CARE.str().c_str()); + return; +} + + + +// g++ -c SortieLatex.cpp diff --git a/sem_4/Algo/TP7/TPABR.pdf b/sem_4/Algo/TP7/TPABR.pdf Binary files differnew file mode 100644 index 0000000..beabb1b --- /dev/null +++ b/sem_4/Algo/TP7/TPABR.pdf diff --git a/sem_4/Algo/TP8/graphes.cpp b/sem_4/Algo/TP8/graphes.cpp new file mode 100644 index 0000000..fdd386a --- /dev/null +++ b/sem_4/Algo/TP8/graphes.cpp @@ -0,0 +1,108 @@ +#include <iostream>
+#include "./graphes.h"
+
+
+Sommet::Sommet(){
+ nbVoisins= 0;
+ Voisins = NULL;
+}
+Sommet::Sommet( int n,Sommet ** tab){
+ nbVoisins = n;
+ Voisins = tab;
+}
+int Sommet::getNbVoisins(){
+ return nbVoisins;
+}
+Sommet ** Sommet::getVoisins(){
+ return Voisins;
+}
+void Sommet::setVoisins(Sommet ** t, int taille){
+ nbVoisins = taille;
+ Voisins= t;
+}
+void Sommet::addVoisins(Sommet * s){
+ nbVoisins ++;
+ Sommet ** tmp = new Sommet*[nbVoisins];
+ for (int i = 0; i < nbVoisins-1; i ++){
+ tmp[i]=Voisins[i];
+ }
+ tmp[nbVoisins - 1 ]= s;
+ Voisins = tmp;
+}
+
+void Sommet::removeSommet (Sommet * s){
+ nbVoisins --;
+ Sommet ** tmp= new Sommet*[nbVoisins];
+ int j = 0;
+ for (int i = 0; i < nbVoisins+1;i++){
+ if (!(Voisins[i]==s)){
+ tmp[j]= Voisins[i];
+ j ++;
+ }
+ }
+ Voisins = tmp;
+}
+bool Sommet::estVoisin(Sommet * s){
+ int i = 0;
+ bool found= false;
+ while (!found && i < nbVoisins ){
+ found = (Voisins[i]==s);
+ }
+ return found;
+}
+
+Graphe::Graphe(int n){
+ nbSum = n;
+ Sumtab = new Sommet*[nbSum];
+ for (int i = 0 ; i < nbSum; i ++){
+ Sumtab[i] = new Sommet();
+ }
+}
+Graphe::Graphe(int n, Sommet ** tab){
+ nbSum = n;
+ Sumtab = tab;
+}
+
+int Graphe::getNbSum(){
+ return nbSum;
+}
+Sommet ** Graphe::getSommets(){
+ return Sumtab;
+}
+void Graphe::setSommet(Sommet ** sum){
+ Sumtab= sum;
+}
+void Graphe::addSommet(Sommet * s){
+ nbSum++;
+ Sommet ** tmp = new Sommet*[nbSum];
+ for (int i = 0; i < nbSum-1; i ++){
+ tmp[i]=Sumtab[i];
+ }
+ tmp[nbSum - 1 ]= s;
+ Sumtab = tmp;
+}
+
+void Graphe::removeSommet(Sommet * s){
+ nbSum--;
+ Sommet ** tmp = new Sommet*[nbSum];
+ int j = 0;
+ for (int i = 0; i < nbSum+1; i ++){
+ if (!(Sumtab[i]==s)){
+ tmp[j]= Sumtab[i];
+ j ++;
+ }
+ }
+ tmp[nbSum - 1 ]= s;
+ Sumtab = tmp;
+}
+
+bool Graphe::estdansgraphearc(Sommet * s1, Sommet * s2){
+ return s1->estVoisin(s2)||s2->estVoisin(s1);
+}
+
+int main ( int argc, char ** argv){
+ std::cout<<"Creation d'un graphe de 12 sommets"<<std::endl;
+ Graphe * grph= new Graphe(12);
+
+ return 0;
+}
diff --git a/sem_4/Algo/TP8/graphes.h b/sem_4/Algo/TP8/graphes.h new file mode 100644 index 0000000..9c42c80 --- /dev/null +++ b/sem_4/Algo/TP8/graphes.h @@ -0,0 +1,29 @@ +class Sommet {
+private:
+ int nbVoisins;
+ Sommet ** Voisins;
+public:
+ Sommet ();
+ Sommet( int n,Sommet ** tab);
+ int getNbVoisins();
+ Sommet ** getVoisins();
+ void setVoisins(Sommet ** t, int taille);
+ void addVoisins(Sommet * s);
+ void removeSommet (Sommet * s);
+ bool estVoisin(Sommet * s);
+
+};
+class Graphe {
+private:
+ int nbSum;
+ Sommet ** Sumtab;
+public:
+ Graphe(int n);
+ Graphe(int n, Sommet ** tab);
+ int getNbSum();
+ Sommet ** getSommets();
+ void setSommet(Sommet ** sum);
+ void addSommet(Sommet * s);
+ void removeSommet(Sommet * s);
+ bool estdansgraphearc(Sommet * s1, Sommet * s2);
+};
diff --git a/sem_4/Algo/TP8/zbeb.exe b/sem_4/Algo/TP8/zbeb.exe Binary files differnew file mode 100644 index 0000000..3993c3f --- /dev/null +++ b/sem_4/Algo/TP8/zbeb.exe diff --git a/sem_4/Gestion_Proj/tccp/untitled-1.log b/sem_4/Gestion_Proj/tccp/untitled-1.log new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/sem_4/Gestion_Proj/tccp/untitled-1.log diff --git a/sem_4/Gestion_Proj/tccp/untitled-1.tex b/sem_4/Gestion_Proj/tccp/untitled-1.tex new file mode 100644 index 0000000..7f9b731 --- /dev/null +++ b/sem_4/Gestion_Proj/tccp/untitled-1.tex @@ -0,0 +1,23 @@ +\documentclass [a4paper]{article} +\usepackage[french]{babel} +\usepackage[T1]{frontenc} +\usepackage[utf8]{inputenc} +\pagestyle{empty} +\topmargin=-2.5cm +\textheight=26cm +\evensidemargin=-1cm +\oddsidemargin=-1cm +\textwidth=18cm +\title{Curriculum Vit\ae} +\autor{Gaspard Coulet} +\date{\today} +\begin{document} +\maketitle +\section{\'Etat Civil} +\section{Formation} +\subsection{Diplômes} +\subsection{Stages} +\section{Expériences professionnelles} +\section*{Compétences informatiques} +\section*{Compétences linguistiques} +\end{document}
\ No newline at end of file diff --git a/sem_4/Gestion_Proj/tpgitlab.pdf b/sem_4/Gestion_Proj/tpgitlab.pdf Binary files differnew file mode 100644 index 0000000..e25397c --- /dev/null +++ b/sem_4/Gestion_Proj/tpgitlab.pdf diff --git a/sem_4/Gestion_Proj/tplatex.pdf b/sem_4/Gestion_Proj/tplatex.pdf Binary files differnew file mode 100644 index 0000000..4fd77ac --- /dev/null +++ b/sem_4/Gestion_Proj/tplatex.pdf diff --git a/sem_4/Logique/tpScheme.pdf b/sem_4/Logique/tpScheme.pdf Binary files differnew file mode 100644 index 0000000..a0abec4 --- /dev/null +++ b/sem_4/Logique/tpScheme.pdf diff --git a/sem_4/java/eclipse-workspace/.gitignore b/sem_4/java/eclipse-workspace/.gitignore new file mode 100644 index 0000000..f36c267 --- /dev/null +++ b/sem_4/java/eclipse-workspace/.gitignore @@ -0,0 +1,2 @@ +/.metadata/ +/.recommenders/ diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/.classpath b/sem_4/java/eclipse-workspace/Assoc et collec/.classpath new file mode 100644 index 0000000..e461bea --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/.classpath @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/.project b/sem_4/java/eclipse-workspace/Assoc et collec/.project new file mode 100644 index 0000000..967a089 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Assoc et collec</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/.settings/org.eclipse.jdt.core.prefs b/sem_4/java/eclipse-workspace/Assoc et collec/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..bb35fa0 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/bin/Abonne.class b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Abonne.class Binary files differnew file mode 100644 index 0000000..a719512 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Abonne.class diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/bin/Abonnes.class b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Abonnes.class Binary files differnew file mode 100644 index 0000000..72d7e76 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Abonnes.class diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/bin/Catalogue.class b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Catalogue.class Binary files differnew file mode 100644 index 0000000..8cf9808 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Catalogue.class diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/bin/Exemplaire.class b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Exemplaire.class Binary files differnew file mode 100644 index 0000000..ee3f0ed --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Exemplaire.class diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/bin/Mineur.class b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Mineur.class Binary files differnew file mode 100644 index 0000000..6f4eb18 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Mineur.class diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/bin/Notice.class b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Notice.class Binary files differnew file mode 100644 index 0000000..d40778f --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Notice.class diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/bin/Personne.class b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Personne.class Binary files differnew file mode 100644 index 0000000..a39ae4f --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Personne.class diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/bin/Public.class b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Public.class Binary files differnew file mode 100644 index 0000000..e60d7b5 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Public.class diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/bin/Role.class b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Role.class Binary files differnew file mode 100644 index 0000000..4a518a7 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/bin/Role.class diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/src/Abonne.java b/sem_4/java/eclipse-workspace/Assoc et collec/src/Abonne.java new file mode 100644 index 0000000..2702f62 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/src/Abonne.java @@ -0,0 +1,4 @@ +
+public class Abonne {
+
+}
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/src/Abonnes.java b/sem_4/java/eclipse-workspace/Assoc et collec/src/Abonnes.java new file mode 100644 index 0000000..a664c01 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/src/Abonnes.java @@ -0,0 +1,33 @@ +import java.util.ArrayList;
+
+public class Abonnes extends Personne {
+ public Abonnes(String nom, String ad, Public cate, int numabo) {
+ super(nom, ad, cate);
+ this.numabo=numabo;
+ exemplaireempruntes = new ArrayList<Exemplaire>();
+ }
+ private int numabo;
+ private ArrayList<Exemplaire> exemplaireempruntes;
+ public void emprunter(Notice n) {
+ if ( exemplaireempruntes.size()<5) {
+ Exemplaire e= n.getExemplaireDisponibles();
+ if ( e == null ) {
+ System.out.println("Il n'y a plus d'exemplaire disponibles");
+ }
+ else {
+ exemplaireempruntes.add(e);
+ e.setEmprunteur(this);
+ }
+ }
+ }
+ protected int getNumabo() {
+ return numabo;
+ }
+ protected void setNumabo(int numabo) {
+ this.numabo = numabo;
+ }
+ public void rendre (Exemplaire e) {
+ exemplaireempruntes.remove(e);
+ e.rendre();
+ }
+}
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/src/Catalogue.java b/sem_4/java/eclipse-workspace/Assoc et collec/src/Catalogue.java new file mode 100644 index 0000000..d7cd91f --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/src/Catalogue.java @@ -0,0 +1,21 @@ +import java.util.ArrayList;
+import java.util.Map;
+
+public class Catalogue {
+ private Map<Integer,Notice> listeNotice;
+ public void ajouter (Notice n) {
+ listeNotice.put(n.getIsbn(), n);
+ }
+ public void retirer (Notice n) {
+ listeNotice.remove(n.getIsbn());
+ }
+ public ArrayList<Notice> chercher (String t){
+ ArrayList<Notice> ret = new ArrayList<Notice>();
+ for (Map.Entry<Integer,Notice> e : listeNotice.entrySet()) {
+ if (e.getValue().getTitre().equals(t)) {
+ ret.add(e.getValue());
+ }
+ }
+ return ret;
+ }
+}
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/src/Exemplaire.java b/sem_4/java/eclipse-workspace/Assoc et collec/src/Exemplaire.java new file mode 100644 index 0000000..2316958 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/src/Exemplaire.java @@ -0,0 +1,29 @@ +
+public class Exemplaire {
+ private Notice fiche;
+ private Abonnes emprunteur;
+ protected void emprunter(Abonnes a) {
+ this.setEmprunteur(a);
+
+ }
+ protected Notice getFiche() {
+ return fiche;
+ }
+ protected void setFiche(Notice fiche) {
+ this.fiche = fiche;
+ }
+ public void rendre() {
+ if (emprunteur != null) {
+ this.setEmprunteur(null);
+ fiche.readdEx(this);
+ }
+ }
+ public Abonnes getEmprunteur() {
+ return emprunteur;
+ }
+ public void setEmprunteur(Abonnes emprunteur) {
+ this.emprunteur = emprunteur;
+ }
+}
+
+
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/src/Mineur.java b/sem_4/java/eclipse-workspace/Assoc et collec/src/Mineur.java new file mode 100644 index 0000000..c0f4135 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/src/Mineur.java @@ -0,0 +1,22 @@ +
+public class Mineur extends Abonnes{
+ public Mineur(String nom, String ad, Public cate, int numabo) {
+ super(nom, ad, cate, numabo);
+ }
+
+ public void emprunter (Notice n) {
+ boolean empruntgranted = false;
+
+ for (int i =0; i < n.getPublicCible().size(); i ++) {
+ if (n.getPublicCible().get(i)==Public.enfant) {
+ empruntgranted = true;
+ }
+ if (n.getPublicCible().get(i)==Public.junior) {
+ empruntgranted = true;
+ }
+ }
+ if (empruntgranted) {
+ super.emprunter(n);
+ }
+}
+}
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/src/Notice.java b/sem_4/java/eclipse-workspace/Assoc et collec/src/Notice.java new file mode 100644 index 0000000..2c5fa6f --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/src/Notice.java @@ -0,0 +1,89 @@ +import java.util.ArrayList;
+
+public class Notice {
+ private int isbn;
+ private String titre;
+ private String SsTitre;
+ private int dispo;
+ private Catalogue catalogue;
+ private ArrayList<Exemplaire> listeExemplaire;
+ private ArrayList<Public> publicCible;
+ private ArrayList<Personne> contributeur;
+ protected int getIsbn() {
+ return isbn;
+ }
+ protected void setIsbn(int isbn) {
+ this.isbn = isbn;
+ }
+ protected String getTitre() {
+ return titre;
+ }
+ protected void setTitre(String titre) {
+ this.titre = titre;
+ }
+ protected String getSsTitre() {
+ return SsTitre;
+ }
+ protected void setSsTitre(String ssTitre) {
+ SsTitre = ssTitre;
+ }
+ protected int getDispo() {
+ return dispo;
+ }
+ protected void setDispo(int dispo) {
+ this.dispo = dispo;
+ }
+ protected Catalogue getCatalogue() {
+ return catalogue;
+ }
+ protected void setCatalogue(Catalogue catalogue) {
+ this.catalogue = catalogue;
+ }
+ protected ArrayList<Exemplaire> getListeExemplaire() {
+ return listeExemplaire;
+ }
+ protected void setListeExemplaire(ArrayList<Exemplaire> listeExemplaire) {
+ this.listeExemplaire = listeExemplaire;
+ }
+ protected ArrayList<Public> getPublicCible() {
+ return publicCible;
+ }
+ protected void setPublicCible(ArrayList<Public> publicCible) {
+ this.publicCible = publicCible;
+ }
+ protected ArrayList<Personne> getContributeur() {
+ return contributeur;
+ }
+ protected void setContributeur(ArrayList<Personne> contributeur) {
+ this.contributeur = contributeur;
+ }
+ protected ArrayList<ArrayList<Role>> getRolecontributeur() {
+ return rolecontributeur;
+ }
+ protected void setRolecontributeur(ArrayList<ArrayList<Role>> rolecontributeur) {
+ this.rolecontributeur = rolecontributeur;
+ }
+ private ArrayList<ArrayList<Role>> rolecontributeur;
+
+ public Exemplaire getExemplaireDisponibles() {
+ if ( dispo > 0) {
+ dispo --;
+ return listeExemplaire.get(listeExemplaire.size()-1);
+ }
+ else {
+ return null;
+ }
+ }
+ public void readdEx (Exemplaire e) {
+ boolean dejapresent=false;
+ for (int i =0; i < listeExemplaire.size();i++) {
+ if ( listeExemplaire.get(i)==e) {
+ dejapresent =true;
+ }
+ }
+ if (!dejapresent) {
+ listeExemplaire.add(e);
+ dispo ++;
+ }
+ }
+}
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/src/Personne.java b/sem_4/java/eclipse-workspace/Assoc et collec/src/Personne.java new file mode 100644 index 0000000..9b09d4b --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/src/Personne.java @@ -0,0 +1,17 @@ +import java.util.ArrayList;
+
+public class Personne {
+ private String name;
+ private String adresse;
+ private Public categorie;
+ private ArrayList<Notice> listecontrib;
+ private ArrayList<Role> listerolecontrib;
+ public Personne (String nom, String ad, Public cate) {
+ name=nom;
+ adresse=ad;
+ categorie=cate;
+ listecontrib = new ArrayList<Notice>();
+ listerolecontrib = new ArrayList<Role>();
+ }
+
+}
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/src/Public.java b/sem_4/java/eclipse-workspace/Assoc et collec/src/Public.java new file mode 100644 index 0000000..a37c4b6 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/src/Public.java @@ -0,0 +1,6 @@ +
+public enum Public {
+ enfant,
+ junior,
+ adulte;
+}
diff --git a/sem_4/java/eclipse-workspace/Assoc et collec/src/Role.java b/sem_4/java/eclipse-workspace/Assoc et collec/src/Role.java new file mode 100644 index 0000000..f497bfb --- /dev/null +++ b/sem_4/java/eclipse-workspace/Assoc et collec/src/Role.java @@ -0,0 +1,37 @@ +
+public class Role {
+ private Boolean redacteur;
+private Boolean traducteur;
+private Boolean prefacier;
+private Boolean illustrateur;
+protected Boolean getRedacteur() {
+ return redacteur;
+}
+protected void setRedacteur(Boolean redacteur) {
+ this.redacteur = redacteur;
+}
+protected Boolean getTraducteur() {
+ return traducteur;
+}
+protected void setTraducteur(Boolean traducteur) {
+ this.traducteur = traducteur;
+}
+protected Boolean getPrefacier() {
+ return prefacier;
+}
+protected void setPrefacier(Boolean prefacier) {
+ this.prefacier = prefacier;
+}
+protected Boolean getIllustrateur() {
+ return illustrateur;
+}
+protected void setIllustrateur(Boolean illustrateur) {
+ this.illustrateur = illustrateur;
+}
+public Role ( boolean redac, boolean traducteur, boolean prefacier, boolean illustrateur) {
+ this.traducteur= traducteur;
+ this.redacteur=redac;
+ this.prefacier=prefacier;
+ this.illustrateur=illustrateur;
+}
+}
diff --git a/sem_4/java/eclipse-workspace/Cours406/.classpath b/sem_4/java/eclipse-workspace/Cours406/.classpath new file mode 100644 index 0000000..e461bea --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/.classpath @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sem_4/java/eclipse-workspace/Cours406/.project b/sem_4/java/eclipse-workspace/Cours406/.project new file mode 100644 index 0000000..d656d75 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Cours406</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sem_4/java/eclipse-workspace/Cours406/.settings/org.eclipse.jdt.core.prefs b/sem_4/java/eclipse-workspace/Cours406/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..bb35fa0 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Etudiant.class b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Etudiant.class Binary files differnew file mode 100644 index 0000000..2a1a415 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Etudiant.class diff --git a/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Gestion.class b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Gestion.class Binary files differnew file mode 100644 index 0000000..c9dbb0e --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Gestion.class diff --git a/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Main.class b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Main.class Binary files differnew file mode 100644 index 0000000..102326f --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Main.class diff --git a/sem_4/java/eclipse-workspace/Cours406/bin/tp2/NameGenerator.class b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/NameGenerator.class Binary files differnew file mode 100644 index 0000000..0de7e1d --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/NameGenerator.class diff --git a/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Promotion.class b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Promotion.class Binary files differnew file mode 100644 index 0000000..3d30e73 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/bin/tp2/Promotion.class diff --git a/sem_4/java/eclipse-workspace/Cours406/src/tp2.7z b/sem_4/java/eclipse-workspace/Cours406/src/tp2.7z Binary files differnew file mode 100644 index 0000000..4ebfe89 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/src/tp2.7z diff --git a/sem_4/java/eclipse-workspace/Cours406/src/tp2/Etudiant.java b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Etudiant.java new file mode 100644 index 0000000..ca78a4b --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Etudiant.java @@ -0,0 +1,118 @@ +package tp2;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.text.DateFormat;
+import java.text.ParseException;
+
+public class Etudiant {
+ private String nom;
+ private Date birthdate;
+ private int codeIns;
+ private int codePays;
+ private double note1;
+ private double note2;
+ private double note3;
+ public Etudiant() {
+ nom = "None";
+ }
+ public String getNom() {
+ return nom;
+ }
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
+// public int getAge() throws ParseException {
+// return 2018-;
+// }
+ public Date getBirthYear() {
+ return birthdate;
+ }
+ public void setBirthyear(Date birthyear) {
+ this.birthdate = birthyear;
+ }
+ public int getCodeIns() {
+ return codeIns;
+ }
+ public void setCodeIns(int codeIns) {
+ this.codeIns = codeIns;
+ }
+ public int getCodePays() {
+ return codePays;
+ }
+ public void setCodePays(int codePays) {
+ this.codePays = codePays;
+ }
+ public double getNote1() {
+ return note1;
+ }
+ public void setNote1(double note1) {
+ this.note1 = note1;
+ }
+ public double getNote2() {
+ return note2;
+ }
+ public void setNote2(double note2) {
+ this.note2 = note2;
+ }
+ public double getNote3() {
+ return note3;
+ }
+ public void setNote3(double note3) {
+ this.note3 = note3;
+ }
+ public Etudiant(String name, /*Date birthyear,*/ int codeIns, int codePays, double note1, double note2, double note3) {
+ super();
+ this.nom=name;
+// this.birthdate = birthyear;
+ this.codeIns = codeIns;
+ this.codePays = codePays;
+ this.note1 = note1;
+ this.note2 = note2;
+ this.note3 = note3;
+ }
+ public double getMoy() {
+ return (note1+note2+note3)/3;
+ }
+ public String getMention() {
+ double moy = getMoy();
+ if ( moy > 10) {
+ if (moy < 12) {
+ return "Admis";
+ }
+ else if (moy < 14) {
+ return "Assez bien";
+ }
+ else if (moy < 16) {
+ return "Bien";
+ }
+ else {
+ return "Très bien";
+ }
+ }
+ else {
+ return "Ajourné";
+ }
+ }
+ public void ligneResultats (){
+ String tmp = getMention();
+ String ret = getNom()+" "+ getBirthYear()+" "+(int)(getMoy()*100)/100.+" "+tmp+" ";
+ if (tmp.equals("Ajourné")) {
+ if ( note1>=10 ) {
+ ret+="module 1 acquis ";
+ }
+ if ( note2>=10 ) {
+ ret+="module 2 acquis ";
+ }
+ if ( note3>=10 ) {
+ ret+="module 3 acquis ";
+ }
+ }
+ System.out.println(ret);
+ }
+ public String toString() {
+ String ret = "Nom : "+getNom()+"\n"+/*"Age : "+getAge()+"\n"+*/"Année de naissance : "+getBirthYear()+"\n"+"Premiere inscription ? " +(getCodeIns()==0?"Oui":"Non")+"\n"+ "Nationalité : "+ (getCodePays()==0? "Francaise": (getCodePays()==1? "Autre francophone":"Autre non-francophone"))+ "\n"+"Notes : "+ (int)(getNote1()*100)/100.+" "+ (int)(getNote2()*100)/100.+" "+(int)(getNote3()*100)/100.+"\n"+"Moyenne : "+(int)(getMoy()*100)/100.+" "+getMention()+"\n";
+ return ret;
+ }
+}
+
diff --git a/sem_4/java/eclipse-workspace/Cours406/src/tp2/Gestion.java b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Gestion.java new file mode 100644 index 0000000..01a6da9 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Gestion.java @@ -0,0 +1,29 @@ +package tp2;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+public class Gestion {
+
+ public static void mainzbeb(String[] args) throws Exception {
+ Etudiant[] groupe=new Etudiant[150];
+ String string = "January 2, 2010";
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM d, yyyy", Locale.ENGLISH);
+ LocalDate date = LocalDate.parse(string, formatter);
+
+ //Date d=df.parse(test);
+ for (int i=0; i < 150; i ++) {
+ groupe[i]=new Etudiant(NameGenerator.generateName()+" "+NameGenerator.generateName(),/*date,*/ (int)(Math.random()*(2-0)),(int)(Math.random()*(4-0)),(double)(Math.random()*(21-0)),(double)(Math.random()*(21-0)),(double)(Math.random()*(21-0)));
+ //groupe[i].ligneResultats();
+ System.out.println(groupe[i].toString());
+ }
+
+
+
+
+ }
+
+}
diff --git a/sem_4/java/eclipse-workspace/Cours406/src/tp2/Main.java b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Main.java new file mode 100644 index 0000000..bbafbcc --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Main.java @@ -0,0 +1,23 @@ +package tp2;
+
+import java.util.ArrayList;
+
+public class Main {
+
+ public static void main(String[] args) {
+ int nbetu= 20000;
+ Promotion prom = new Promotion(2017);
+ for ( int i = 0; i < nbetu; i ++) {
+ prom.Inscrire(NameGenerator.generateName()+" "+NameGenerator.generateName(),/*date,*/ (int)(Math.random()*(1-0)),(int)(Math.random()*(3-0)),(double)(Math.random()*(20-0)),(double)(Math.random()*(20-0)),(double)(Math.random()*(20-0)));
+ }
+ ArrayList<Etudiant> nofranco = prom.nouveauxInscritsNonFrancophones();
+ for (int i = 0 ; i < nofranco.size(); i ++) {
+ System.out.println(nofranco.get(i).toString());
+ }
+ ArrayList<Etudiant> boss = prom.majors();
+ for (int i = 0 ; i < boss.size(); i ++) {
+ System.out.println(boss.get(i).toString());
+ }
+ }
+
+}
diff --git a/sem_4/java/eclipse-workspace/Cours406/src/tp2/NameGenerator.java b/sem_4/java/eclipse-workspace/Cours406/src/tp2/NameGenerator.java new file mode 100644 index 0000000..35bb016 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/src/tp2/NameGenerator.java @@ -0,0 +1,27 @@ +package tp2;
+
+import java.util.Random;
+
+public class NameGenerator {
+
+ private static String[] Beginning = { "Kr", "Ca", "Ra", "Mrok", "Cru",
+ "Ray", "Bre", "Zed", "Drak", "Mor", "Jag", "Mer", "Jar", "Mjol",
+ "Zork", "Mad", "Cry", "Zur", "Creo", "Azak", "Azur", "Rei", "Cro",
+ "Mar", "Luk" };
+ private static String[] Middle = { "air", "ir", "mi", "sor", "mee", "clo",
+ "red", "cra", "ark", "arc", "miri", "lori", "cres", "mur", "zer",
+ "marac", "zoir", "slamar", "salmar", "urak" };
+ private static String[] End = { "d", "ed", "ark", "arc", "es", "er", "der",
+ "tron", "med", "ure", "zur", "cred", "mur" };
+
+ private static Random rand = new Random();
+
+ public static String generateName() {
+
+ return Beginning[rand.nextInt(Beginning.length)] +
+ Middle[rand.nextInt(Middle.length)]+
+ End[rand.nextInt(End.length)];
+
+ }
+
+ }
\ No newline at end of file diff --git a/sem_4/java/eclipse-workspace/Cours406/src/tp2/Promotion.java b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Promotion.java new file mode 100644 index 0000000..6fe7d45 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Promotion.java @@ -0,0 +1,85 @@ +package tp2;
+
+import java.util.ArrayList;
+public class Promotion {
+ private ArrayList<Etudiant> listeetudiants;
+ private int annee;
+ public Promotion () {
+
+ }
+ public Promotion (int ext_annee) {
+ listeetudiants= new ArrayList<Etudiant> ();
+ annee = ext_annee;
+ }
+ public int getNbEtu() {
+ return listeetudiants.size();
+ }
+ public Etudiant getEtu(int n) {
+ return listeetudiants.get(n);
+ }
+ public void Inscrire (String name, /*Date birthyear,*/ int codeIns, int codePays, double note1, double note2, double note3) {
+ listeetudiants.add(new Etudiant(name,codeIns,codePays,note1, note2, note3));
+ }
+ public double moyenneGenerale () {
+ double totnotes =0;
+ for (int i =0; i < this.getNbEtu();i ++ ) {
+ totnotes += listeetudiants.get(i).getMoy();
+ }
+ if (getNbEtu()!=0) {
+ return totnotes/this.getNbEtu();
+ }
+ else return -1;
+ }
+ public void afficheRes () {
+ for (int i =0 ; i < this.getNbEtu();i++) {
+ listeetudiants.get(i).ligneResultats();
+ }
+ }
+ public Etudiant recherche( String name) {
+ Etudiant ret= new Etudiant();
+ for (int i =0 ; i < this.getNbEtu();i++) {
+ if ( listeetudiants.get(i).getNom() == name) {
+ ret = listeetudiants.get(i);
+ }
+
+ }
+ return ret;
+ }
+ public ArrayList<Etudiant> admis () {
+ ArrayList<Etudiant> ret = new ArrayList<Etudiant>();
+ for ( int i =0; i < this.getNbEtu(); i ++) {
+ if ( listeetudiants.get(i).getMoy()>=10) {
+ ret.add(listeetudiants.get(i));
+ }
+ }
+ return ret;
+ }
+ public ArrayList<Etudiant> nouveauxInscritsNonFrancophones() {
+ ArrayList<Etudiant> ret = new ArrayList<Etudiant>();
+ for ( int i =0; i < this.getNbEtu(); i ++) {
+ if ( listeetudiants.get(i).getCodeIns()==0) {
+ if ( listeetudiants.get(i).getCodePays()==2) {
+ ret.add(listeetudiants.get(i));
+ }
+ }
+ }
+ return ret;
+ }
+ public ArrayList<Etudiant> majors() {
+ ArrayList<Etudiant> ret = new ArrayList<Etudiant>();
+ double maxmoy = 0;
+ for (int i =0; i < this.getNbEtu();i++) {
+ if ( listeetudiants.get(i).getMoy() > maxmoy) {
+ maxmoy = listeetudiants.get(i).getMoy();
+ }
+ }
+ for (int i =0; i < this.getNbEtu();i++) {
+ if ( listeetudiants.get(i).getMoy() == maxmoy) {
+ ret.add(listeetudiants.get(i));
+ }
+ }
+ return ret;
+
+
+ }
+}
diff --git a/sem_4/java/eclipse-workspace/Laponie/.classpath b/sem_4/java/eclipse-workspace/Laponie/.classpath new file mode 100644 index 0000000..e461bea --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/.classpath @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sem_4/java/eclipse-workspace/Laponie/.project b/sem_4/java/eclipse-workspace/Laponie/.project new file mode 100644 index 0000000..e293a26 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Laponie</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sem_4/java/eclipse-workspace/Laponie/.settings/org.eclipse.jdt.core.prefs b/sem_4/java/eclipse-workspace/Laponie/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..bb35fa0 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/sem_4/java/eclipse-workspace/Laponie/bin/Colis.class b/sem_4/java/eclipse-workspace/Laponie/bin/Colis.class Binary files differnew file mode 100644 index 0000000..7fbdac8 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/bin/Colis.class diff --git a/sem_4/java/eclipse-workspace/Laponie/bin/Lettre.class b/sem_4/java/eclipse-workspace/Laponie/bin/Lettre.class Binary files differnew file mode 100644 index 0000000..d80fa8b --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/bin/Lettre.class diff --git a/sem_4/java/eclipse-workspace/Laponie/bin/Objpostal.class b/sem_4/java/eclipse-workspace/Laponie/bin/Objpostal.class Binary files differnew file mode 100644 index 0000000..8d9aaa4 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/bin/Objpostal.class diff --git a/sem_4/java/eclipse-workspace/Laponie/bin/Sacpostal.class b/sem_4/java/eclipse-workspace/Laponie/bin/Sacpostal.class Binary files differnew file mode 100644 index 0000000..6d84960 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/bin/Sacpostal.class diff --git a/sem_4/java/eclipse-workspace/Laponie/src/Colis.java b/sem_4/java/eclipse-workspace/Laponie/src/Colis.java new file mode 100644 index 0000000..26e5dfd --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/src/Colis.java @@ -0,0 +1,51 @@ +
+public class Colis extends Objpostal{
+ private String contenu;
+ private double valeurdec;
+ public double tarifaff() {
+ double ret = 2;
+ int tmp = super.tauxrecommand();
+ if ( tmp >= 1 ) {
+ ret += 0.5;
+ }
+ if ( tmp >= 2) {
+ ret += 1.5;
+ }
+ if ( super.getVol()> (1/8)) {
+ ret += 3;
+ }
+ return ret;
+ }
+ protected String getContenu() {
+ return contenu;
+ }
+ protected void setContenu(String contenu) {
+ this.contenu = contenu;
+ }
+ protected double getValeurdec() {
+ return valeurdec;
+ }
+ protected void setValeurdec(double valeurdec) {
+ this.valeurdec = valeurdec;
+ }
+ public double tauxremboursement () {
+ double ret = 0;
+ int tmp = super.tauxrecommand();
+ if ( tmp == 1 ) {
+ ret += 0.1 * this.valeurdec;
+ }
+ else if ( tmp == 2) {
+ ret += 0.5 * this.valeurdec;
+ }
+ super.setTauxRemboursement(ret);
+ return ret;
+ }
+ public void tostring() {
+ System.out.println(super.getCodepost()+"/"+super.getDestination()+"/"+super.getTauxrecommand()+"/"+super.getVol()+"/"+this.valeurdec);
+ }
+ public Colis (String ext_origin, String ext_dest, int ext_codepost, double ext_poid, double ext_volume, int ext_tauxrec, String ext_contenu, double ext_value ) {
+ super(ext_origin, ext_dest, ext_codepost, ext_poid, ext_volume, ext_tauxrec);
+ this.setContenu(ext_contenu);
+ this.setValeurdec(ext_value);
+ }
+}
diff --git a/sem_4/java/eclipse-workspace/Laponie/src/Lettre.java b/sem_4/java/eclipse-workspace/Laponie/src/Lettre.java new file mode 100644 index 0000000..2b30991 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/src/Lettre.java @@ -0,0 +1,43 @@ +
+public class Lettre extends Objpostal {
+ private boolean urgent;
+ public double tarifaff() {
+ double ret = 0.5;
+ int tmp = super.tauxrecommand();
+ if ( tmp >= 1 ) {
+ ret += 0.5;
+ }
+ if ( tmp >= 2) {
+ ret += 1.5;
+ }
+ if ( urgent) {
+ ret += 0.3;
+ }
+ return ret;
+ }
+ public double tauxremboursement () {
+ double ret = 0;
+ int tmp = super.tauxrecommand();
+ if ( tmp == 1 ) {
+ ret += 1.5;
+ }
+ else if ( tmp == 2) {
+ ret += 15;
+ }
+ super.setTauxRemboursement(ret);
+ return ret;
+ }
+ public void tostring() {
+ System.out.println(super.getCodepost()+"/"+super.getDestination()+"/"+super.tauxrecommand()+"/"+(this.urgent ? "urgent":"ordinaire"));
+ }
+ public Lettre (String ext_origin, String ext_dest, int ext_codepost, double ext_poid, double ext_volume, int ext_tauxrec, boolean ext_urgent) {
+ super(ext_origin, ext_dest, ext_codepost, ext_poid, ext_volume, ext_tauxrec);
+ this.setUrgent(ext_urgent);
+ }
+ protected boolean isUrgent() {
+ return urgent;
+ }
+ protected void setUrgent(boolean urgent) {
+ this.urgent = urgent;
+ }
+}
diff --git a/sem_4/java/eclipse-workspace/Laponie/src/Objpostal.java b/sem_4/java/eclipse-workspace/Laponie/src/Objpostal.java new file mode 100644 index 0000000..384438f --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/src/Objpostal.java @@ -0,0 +1,76 @@ +
+public abstract class Objpostal {
+ private String origine;
+ private String destination;
+ private int codepost;
+ private double poids;
+ private double vol;
+ private int tauxrecommand;
+ private double tauxremboursement;
+ protected void setTauxRemboursement (double taux ) {
+ tauxremboursement = taux;
+ }
+ protected double getTauxRemboursement () {
+ return tauxremboursement;
+ }
+
+ public int tauxrecommand () {
+ return this.tauxrecommand;
+ }
+
+ protected String getOrigine() {
+ return origine;
+ }
+
+ protected void setOrigine(String origine) {
+ this.origine = origine;
+ }
+
+ protected String getDestination() {
+ return destination;
+ }
+
+ protected void setDestination(String destination) {
+ this.destination = destination;
+ }
+
+ protected int getCodepost() {
+ return codepost;
+ }
+
+ protected void setCodepost(int codepost) {
+ this.codepost = codepost;
+ }
+
+ protected double getPoids() {
+ return poids;
+ }
+
+ protected void setPoids(double poids) {
+ this.poids = poids;
+ }
+
+ protected double getVol() {
+ return vol;
+ }
+
+ protected void setVol(double vol) {
+ this.vol = vol;
+ }
+
+ protected int getTauxrecommand() {
+ return tauxrecommand;
+ }
+
+ protected void setTauxrecommand(int tauxrecommand) {
+ this.tauxrecommand = tauxrecommand;
+ }
+ public Objpostal (String ext_origin, String ext_dest, int ext_codepost, double ext_poid, double ext_volume, int ext_tauxrec) {
+ this.setOrigine(ext_origin);
+ this.setDestination(ext_dest);
+ this.setCodepost(ext_codepost);
+ this.setPoids(ext_poid);
+ this.setVol(ext_volume);
+ this.setTauxrecommand(ext_tauxrec);
+ }
+}
diff --git a/sem_4/java/eclipse-workspace/Laponie/src/Sacpostal.java b/sem_4/java/eclipse-workspace/Laponie/src/Sacpostal.java new file mode 100644 index 0000000..86b7f0f --- /dev/null +++ b/sem_4/java/eclipse-workspace/Laponie/src/Sacpostal.java @@ -0,0 +1,49 @@ +import java.util.ArrayList;
+
+public class Sacpostal {
+ private ArrayList<Objpostal> listeobj;
+ private double sizemax;
+ private double occupation;
+ private double valeurrefund;
+
+ public Sacpostal () {
+ occupation = 5;
+ sizemax=500;
+ listeobj = new ArrayList<Objpostal>();
+ }
+ public Sacpostal (double taille) {
+ occupation = 5;
+ sizemax=taille;
+ listeobj = new ArrayList<Objpostal>();
+ }
+
+ public double getOccupation () {
+ return occupation;
+ }
+ public void addObject(Objpostal obj) {
+ if (sizemax > occupation+ obj.getVol()) {
+ listeobj.add(obj);
+ occupation+=obj.getVol();
+ valeurrefund+= obj.getTauxRemboursement();
+ }
+ }
+ public void removeObject(Objpostal obj) {
+ if (listeobj.remove(obj)) {
+ occupation -=obj.getVol();
+ valeurrefund -= obj.getTauxRemboursement();
+ }
+ }
+ public double getRefund () {
+ return valeurrefund;
+ }
+ public void extractToo (Sacpostal cible, int codepost) {
+ for (int i =0 ; i < listeobj.size(); i ++) {
+ if (listeobj.get(i).getCodepost()==codepost) {
+ cible.addObject(listeobj.get(i));
+ removeObject(listeobj.get(i));
+ }
+ }
+ }
+
+ }
+
diff --git a/sem_4/java/polyTDTP.pdf b/sem_4/java/polyTDTP.pdf Binary files differnew file mode 100644 index 0000000..d7f65b5 --- /dev/null +++ b/sem_4/java/polyTDTP.pdf diff --git a/sem_4/progaapp/TP1/GaspardCoulet b/sem_4/progaapp/TP1/GaspardCoulet Binary files differnew file mode 100644 index 0000000..2cf6a87 --- /dev/null +++ b/sem_4/progaapp/TP1/GaspardCoulet diff --git a/sem_4/progaapp/TP1/day.bak b/sem_4/progaapp/TP1/day.bak new file mode 100644 index 0000000..a363622 --- /dev/null +++ b/sem_4/progaapp/TP1/day.bak @@ -0,0 +1,15 @@ +#lang racket +(define bissextile + (lambda (x) + ( if (= (modulo x 4) 0) + (if (not (= ( modulo x 100) 0)) + (#t) + (if (= ( modulo x 400) 0) + (#t) + (#f)) + ) + (#f)) + ) + ) + +
\ No newline at end of file diff --git a/sem_4/progaapp/TP1/day.rkt b/sem_4/progaapp/TP1/day.rkt new file mode 100644 index 0000000..c55d5f5 --- /dev/null +++ b/sem_4/progaapp/TP1/day.rkt @@ -0,0 +1,103 @@ +#lang racket +(define bissextile + (lambda (x) + ( if (= (modulo x 4) 0) + (if (not (= ( modulo x 100) 0)) + #t + (if (= ( modulo x 400) 0) + #t + #f) + ) + #f) + ) + ) + +(define nb-annee-bissextile + (lambda (x) + (letrec ( (f + (lambda (x i) + (if (not (= x 1900)) + (if (bissextile x) + (f (- x 1) (+ i 1)) + (f (- x 1) i) + ) + i) + ) + )) + ( f x 0) + ) + ) + ) + +(define nb-jours-au-1-jan + (lambda (x) + (letrec ((f + (lambda (x i) + (if (not(= x 1)) + (if (or (= 2 x) (= x 4) (= x 6) (= x 9) (= x 11)) + (if (= x 2) + (f (- x 1) ( + i 28)) + (f (- x 1) (+ i 30)) + ) + (f (- x 1) (+ i 31)) + ) + ( + i 31) + ) + ) + )) + (if (= 1 x) + 0 + ( f (- x 1) 0) + ) + ) + ) + ) + +(define nb-jours (lambda (m d y) + (let ((i (if (= y 1900) + 0 + (+ (* (nb-annee-bissextile y) 1) (* 365 (- y 1900))) + ) + )) + (let ((i (+ i (nb-jours-au-1-jan m)))) + (let ((i (+ i d))) + (- i 1) + ) + ) + ) + ) + ) + +(define jour-semaine (lambda (m d y) + (let ((nbjour (nb-jours m d y))) + (if (= (modulo nbjour 7) 0) + (display "Lundi") + (if (= (modulo nbjour 7) 1) + (display "Mardi") + (if (= (modulo nbjour 7) 2) + (display "Mercredi") + (if (= (modulo nbjour 7) 3) + (display "Jeudi") + (if (= (modulo nbjour 7) 4) + (display "Vendredi") + (if (= (modulo nbjour 7) 5) + (display "Samedi") + (if (= (modulo nbjour 7) 6) + (display "Dimanche") + (display "whut?") + ) + + ) + ) + ) + ) + ) + ) + ) + ) + ) + + + + +
\ No newline at end of file diff --git a/sem_4/progaapp/TP1/divers.bak b/sem_4/progaapp/TP1/divers.bak new file mode 100644 index 0000000..f9c02be --- /dev/null +++ b/sem_4/progaapp/TP1/divers.bak @@ -0,0 +1,11 @@ +#lang racket +(define genliste ( lambda (d f p) + (letrec ((f(lambda (li d) + (if (< f (+ d p) ) + ( f (append li (+ d p)) (+ d p)) + li) + ))) + (f '() d) + ) + )) +(define somme (lambda (x y z) (+ x y z)))
\ No newline at end of file diff --git a/sem_4/progaapp/TP1/divers.rkt b/sem_4/progaapp/TP1/divers.rkt new file mode 100644 index 0000000..576f153 --- /dev/null +++ b/sem_4/progaapp/TP1/divers.rkt @@ -0,0 +1,39 @@ +;Gaspard Coulet 21601609 Groupe B +#lang racket + +;Exercice 9 : +(define genliste (lambda (d f p) + (letrec ((fun(lambda (li d) + (if (> f (+ d p) ) + ( fun (append li (list (+ d p))) (+ d p)) + li) + ))) + (fun '() (- d p)) + ) + )) + +;Exercice 10 : + +(define make-lancer (lambda (x y z) + (list x y z))) +(define premier (lambda ( li ) (car li))) +(define deuxieme (lambda ( li ) (cadr li))) +(define troisieme (lambda (li) (caddr li))) + +;Exercice 11 : +(define gagnant? (lambda (li) (and (xor(xor ( = (premier li ) 4) (= (deuxieme li) 4)) (= (troisieme li) 4)) + (xor(xor ( = (premier li ) 2) (= (deuxieme li) 2)) (= (troisieme li) 2)) + (xor(xor ( = (premier li ) 1) (= (deuxieme li) 1)) (= (troisieme li) 1))))) + +(define jouer (lambda () + (gagnant? (make-lancer (+(random 5) 1) (+(random 5) 1) (+(random 5) 1))))) + + +;Exercice 12 : +(define jeux (lambda (n) + (if ( < 0 n) + ( cons (jeux (- n 1)) (jouer)) + #f + ) + )) +
\ No newline at end of file diff --git a/sem_4/progaapp/TP1/fichiertd.rkt b/sem_4/progaapp/TP1/fichiertd.rkt new file mode 100644 index 0000000..6d18283 --- /dev/null +++ b/sem_4/progaapp/TP1/fichiertd.rkt @@ -0,0 +1,3 @@ +#lang racket +(define (puis2 x)(* x x)) +(define (puis4 x)(puis2 (puis2 x))) diff --git a/sem_4/progaapp/TP1/lecomptestbon.bak b/sem_4/progaapp/TP1/lecomptestbon.bak new file mode 100644 index 0000000..1ab23a7 --- /dev/null +++ b/sem_4/progaapp/TP1/lecomptestbon.bak @@ -0,0 +1,164 @@ +(define LVal '(1 2 3 4 5 6 7 8 9 10 25 50 75 100)) +(define Op '(+ * - /)) + +(define make-cible (lambda () (+ 100 (random 900)))) +(define make-tirage (lambda ( ) (letrec ((f (lambda(x li) + (if (not(= 6 x)) + (f (+ x 1) (cons (letrec ((g (lambda (n liref) + (if (= 0 n) + (car liref) + (g (- n 1) (cdr liref)) + ) + ) + )) + (g (random 14) LVal)) + li)) + li + )))) + ( f 0 '()) + ) + )) + +(define estDans? (lambda (x li) + (letrec ((f (lambda ( x li) + (if (not(null? li)) + (if (= (car li) x) + #t + ( f x (cdr li)) + ) + #f) + ) + )) + (f x li) + ) + ) + ) +(define estValide? (lambda (a b op) + (if (< 0 ((eval op) a b)) + (if (integer? ((eval op) a b)) + #t + #f) + #f) + ) + ) +(define opere (lambda (liop a b) + (letrec ((f (lambda (liop lires) + (if (not(null? liop)) + (if (estValide? a b (car liop)) + (cons ((eval (car liop)) a b) (f (cdr liop) lires)) + (if (or (eqv?(car liop) (cadddr Op)) (eqv? (car liop) (caddr Op))) + (if ( estValide? b a (car liop)) + (cons ((eval (car liop)) b a) (f (cdr liop) lires)) + (f (cdr liop) lires) + ) + (f (cdr liop) lires) + ) + ) + lires)))) + (f Op '()) + ) + ) + ) +(define retire_a_b ( lambda (a b li) + (letrec (( f (lambda (a b li) + (if (not(null? li)) + (if (= (car li) a) + (f 0 b (cdr li)) + (if (= (car li) b) + (f a 0 (cdr li)) + (cons (car li) (f a b (cdr li))) + )) + li + ) + ) + )) + (f a b li) + ))) + + +(define genere_plaques (lambda ( ope li) + (letrec ((f (lambda(li1 lires) + (if (not(null? li1)) + (begin(letrec ((g (lambda (li1 li2 lires) + (if (not(null? li2)) + (begin (letrec ((h (lambda ( ope lires ) + (if (not(null? ope)) + (if (estValide? (car li1) (car li2) (car ope)) + (h (cdr ope) (cons (cons ((eval (car ope)) (car li1) (car li2)) (retire_a_b (car li1)(car li2) li)) lires)) + (if (estValide? (car li2) (car li1) (car ope)) + (h (cdr ope) (cons (cons ((eval (car ope)) (car li2) (car li1)) (retire_a_b (car li1)(car li2) li)) lires)) + (h (cdr ope) lires) + ) + ) + lires + ) + ))) + (set! lires (h ope lires))) + (g li1 (cdr li2) lires)) + lires + ) + ) + )) + (set! lires (g li1 (cdr li1) lires)) + ) + (f (cdr li1) lires)) + lires + ) + ))) + (f li '()) + ) + ) + ) +(define cherche_dans_li ( lambda (li cible) + (letrec (( f (lambda (li) + (if (not(null? li)) + (if (= (car li) cible) + #t + (f (cdr li))) + #f) + ))) + (f li)) + ) + ) + + +(define ceb (lambda (ope plaques cible) + (letrec ((f(lambda(li old) + (if (null? li) + (and #t (display "Le compte n'est pas bon, au mieux :") (display old)) + (if (list? (car li)) + (begin(or(f (car li) old)(f (cdr li) old))) + (if (cherche_dans_li li cible) + (and #t (display "le compte est bon")) + (begin (set! old (approche li cible)) + (if (null? (cdr li )) + (f (cdr li) old) + (f (genere_plaques ope li) old) + )) + + ) + ) + ) + + ))) + + (f plaques (car plaques)) + + ))) +(define abso (lambda ( x) + (if (< x 0) + (- x) + x))) + + (define approche ( lambda ( li cible) + (letrec ((f (lambda ( li old) + (if (not(null? li)) + (if (<(abso(- cible (car li)))(abso(- cible old))) + (f (cdr li) (car li)) + (f (cdr li) old) + ) + old) + ))) + (f li (car li))))) + +
\ No newline at end of file diff --git a/sem_4/progaapp/TP1/tdp1.bak b/sem_4/progaapp/TP1/tdp1.bak new file mode 100644 index 0000000..1e9e3cb --- /dev/null +++ b/sem_4/progaapp/TP1/tdp1.bak @@ -0,0 +1,16 @@ +#lang racket +(define x 5) +(define (f x ) (* x x )) + +(define d 1) +(define (plusd x) ( + x d)) + +(set! d 5) + +(define (g x ) (+ 1 (h x))) +(define (h x) (* x x)) + +(define monabs ( lambda (x) (sqrt (* x x)))) +(define care-div ( lambda (x y) (if (not ( = 0 y)) (/ x y) ( display "Err div 0")))) +(define exo9 (lambda (t) (if (and ( >= t -3) (<= t -1)) 1 (if (and (>= t 2) (<= t 4)) 2 0)))) +(define placement (lambda (x t y) (expt (+ x (* t x)) y )))
\ No newline at end of file diff --git a/sem_4/progaapp/TP1/tortue.bak b/sem_4/progaapp/TP1/tortue.bak new file mode 100644 index 0000000..3d35313 --- /dev/null +++ b/sem_4/progaapp/TP1/tortue.bak @@ -0,0 +1,5 @@ +#lang racket +(require (lib "turtles.ss" "graphics")) +(define carre (lambda (lgr) (begin (turtles #t) (draw lgr) (turn 90) (draw lgr) (turn 90 ) (draw lgr) (turn 90) (draw lgr)))) +(define hexagone ( lambda (lgr) (begin (turtles #t ) ( draw lgr )(turn 60) ( draw lgr )(turn 60)( draw lgr )(turn 60)( draw lgr )(turn 60)( draw lgr )(turn 60)( draw lgr )(turn 60)))) +(define figure ( lambda (n lgt) (let ( angle (/ 360 n)) (begin
\ No newline at end of file diff --git a/sem_4/progaapp/TP1/tortue.rkt b/sem_4/progaapp/TP1/tortue.rkt new file mode 100644 index 0000000..bab2885 --- /dev/null +++ b/sem_4/progaapp/TP1/tortue.rkt @@ -0,0 +1,6 @@ +#lang racket +(require (lib "turtles.ss" "graphics")) +(define carre (lambda (lgr) (begin (turtles #t) (draw lgr) (turn 90) (draw lgr) (turn 90 ) (draw lgr) (turn 90) (draw lgr)))) +(define hexagone ( lambda (lgr) (begin (turtles #t ) ( draw lgr )(turn 60) ( draw lgr )(turn 60)( draw lgr )(turn 60)( draw lgr )(turn 60)( draw lgr )(turn 60)( draw lgr )(turn 60)))) +(define figure ( lambda (n lgt) (let (( angle (/ 360 n))) (letrec ((f (lambda(i) (if (not (= i 0)) (begin (draw lgt) (turn angle) (f (- i 1))) (turn ( / 360 (/ n 2)) ))))) (f n) + )))) diff --git a/sem_4/progaapp/TP1/tp1.rkt b/sem_4/progaapp/TP1/tp1.rkt new file mode 100644 index 0000000..bb92134 --- /dev/null +++ b/sem_4/progaapp/TP1/tp1.rkt @@ -0,0 +1,111 @@ +;Gaspard Coulet, 21601609 Groupe B + +#lang racket +(define exo9 (lambda (t) (if (and ( >= t -3) (<= t -1)) 1 (if (and (>= t 2) (<= t 4)) 2 0)))) + + +(define bissextile + (lambda (x) + ( if (= (modulo x 4) 0) + (if (not (= ( modulo x 100) 0)) + #t + (if (= ( modulo x 400) 0) + #t + #f) + ) + #f) + ) + ) + +(define nb-annee-bissextile + (lambda (x) + (letrec ( (f + (lambda (x i) + (if (not (= x 1900)) + (if (bissextile x) + (f (- x 1) (+ i 1)) + (f (- x 1) i) + ) + i) + ) + )) + ( f x 0) + ) + ) + ) + +(define nb-jours-au-1-jan + (lambda (x) + (letrec ((f + (lambda (x i) + (if (not(= x 1)) + (if (or (= 2 x) (= x 4) (= x 6) (= x 9) (= x 11)) + (if (= x 2) + (f (- x 1) ( + i 28)) + (f (- x 1) (+ i 30)) + ) + (f (- x 1) (+ i 31)) + ) + ( + i 31) + ) + ) + )) + (if (= 1 x) + 0 + ( f (- x 1) 0) + ) + ) + ) + ) + +(define nb-jours (lambda (m d y) + (let ((i (if (= y 1900) + 0 + (+ (* (nb-annee-bissextile y) 1) (* 365 (- y 1900))) + ) + )) + (let ((i (+ i (nb-jours-au-1-jan m)))) + (let ((i (+ i d))) + (- i 1) + ) + ) + ) + ) + ) + +(define jour-semaine (lambda (m d y) + (let ((nbjour (nb-jours m d y))) + (if (= (modulo nbjour 7) 0) + (display "Lundi") + (if (= (modulo nbjour 7) 1) + (display "Mardi") + (if (= (modulo nbjour 7) 2) + (display "Mercredi") + (if (= (modulo nbjour 7) 3) + (display "Jeudi") + (if (= (modulo nbjour 7) 4) + (display "Vendredi") + (if (= (modulo nbjour 7) 5) + (display "Samedi") + (if (= (modulo nbjour 7) 6) + (display "Dimanche") + (display "étrange") + ) + + ) + ) + ) + ) + ) + ) + ) + ) + ) + +;Question devoir TP1 : +; Exercice 1 : +; (map exo9 '(-5 -4 -3 -2 -1 0 1 2 3 4 5)) +; Exercice 2 : +; (bissextile 1408) +; (bissextile 1500) +; (jour-semaine 1 13 2408) diff --git a/sem_4/progaapp/TP1/tp2.rkt b/sem_4/progaapp/TP1/tp2.rkt new file mode 100644 index 0000000..bdc8c5b --- /dev/null +++ b/sem_4/progaapp/TP1/tp2.rkt @@ -0,0 +1,174 @@ +;Gaspard Coulet 21601609 Groupe B + +(define LVal '(1 2 3 4 5 6 7 8 9 10 25 50 75 100)) +(define Op '(+ * - /)) + +(define make-cible (lambda () (+ 100 (random 900)))) +(define make-tirage (lambda ( ) (letrec ((f (lambda(x li) + (if (not(= 6 x)) + (f (+ x 1) (cons (letrec ((g (lambda (n liref) + (if (= 0 n) + (car liref) + (g (- n 1) (cdr liref)) + ) + ) + )) + (g (random 14) LVal)) + li)) + li + )))) + ( f 0 '()) + ) + )) + +(define estDans? (lambda (x li) + (letrec ((f (lambda ( x li) + (if (not(null? li)) + (if (= (car li) x) + #t + ( f x (cdr li)) + ) + #f) + ) + )) + (f x li) + ) + ) + ) +(define estValide? (lambda (a b op) + (if (< 0 ((eval op) a b)) + (if (integer? ((eval op) a b)) + #t + #f) + #f) + ) + ) +(define opere (lambda (liop a b) + (letrec ((f (lambda (liop lires) + (if (not(null? liop)) + (if (estValide? a b (car liop)) + (cons ((eval (car liop)) a b) (f (cdr liop) lires)) + (if (or (eqv?(car liop) (cadddr Op)) (eqv? (car liop) (caddr Op))) + (if ( estValide? b a (car liop)) + (cons ((eval (car liop)) b a) (f (cdr liop) lires)) + (f (cdr liop) lires) + ) + (f (cdr liop) lires) + ) + ) + lires)))) + (f Op '()) + ) + ) + ) +(define retire_a_b ( lambda (a b li) + (letrec (( f (lambda (a b li) + (if (not(null? li)) + (if (= (car li) a) + (f 0 b (cdr li)) + (if (= (car li) b) + (f a 0 (cdr li)) + (cons (car li) (f a b (cdr li))) + )) + li + ) + ) + )) + (f a b li) + ))) + + +(define genere_plaques (lambda ( ope li) + (letrec ((f (lambda(li1 lires) + (if (not(null? li1)) + (begin(letrec ((g (lambda (li1 li2 lires) + (if (not(null? li2)) + (begin (letrec ((h (lambda ( ope lires ) + (if (not(null? ope)) + (if (estValide? (car li1) (car li2) (car ope)) + (h (cdr ope) (cons (cons ((eval (car ope)) (car li1) (car li2)) (retire_a_b (car li1)(car li2) li)) lires)) + (if (estValide? (car li2) (car li1) (car ope)) + (h (cdr ope) (cons (cons ((eval (car ope)) (car li2) (car li1)) (retire_a_b (car li1)(car li2) li)) lires)) + (h (cdr ope) lires) + ) + ) + lires + ) + ))) + (set! lires (h ope lires))) + (g li1 (cdr li2) lires)) + lires + ) + ) + )) + (set! lires (g li1 (cdr li1) lires)) + ) + (f (cdr li1) lires)) + lires + ) + ))) + (f li '()) + ) + ) + ) +(define cherche_dans_li ( lambda (li cible) + (letrec (( f (lambda (li) + (if (not(null? li)) + (if (= (car li) cible) + #t + (f (cdr li))) + #f) + ))) + (f li)) + ) + ) + + +(define ceb (lambda (ope plaques cible) + (letrec ((f(lambda(li old) + (if (null? li) + (and #t (display "Le compte n'est pas bon, au mieux :") (display old)) + (if (list? (car li)) + (begin(or(f (car li) old)(f (cdr li) old))) + (if (cherche_dans_li li cible) + (and #t (display "le compte est bon")) + (begin (set! old (approche li cible)) + (if (null? (cdr li )) + (f (cdr li) old) + (f (genere_plaques ope li) old) + )) + + ) + ) + ) + + ))) + + (f plaques (car plaques)) + + ))) +(define abso (lambda ( x) + (if (< x 0) + (- x) + x))) + + (define approche ( lambda ( li cible) + (letrec ((f (lambda ( li old) + (if (not(null? li)) + (if (<(abso(- cible (car li)))(abso(- cible old))) + (f (cdr li) (car li)) + (f (cdr li) old) + ) + old) + ))) + (f li (car li))))) + + +; Exercice 3 : +; (make-tirage) +; Exercice 4 : +; (ceb Op '(9 100 75 3 8) 288) +; +; +; +;
\ No newline at end of file diff --git a/sem_4/progaapp/exo.txt b/sem_4/progaapp/exo.txt new file mode 100644 index 0000000..64b369a --- /dev/null +++ b/sem_4/progaapp/exo.txt @@ -0,0 +1,67 @@ +INTRO
+Exercice 1 :
+#t
+#t
+6
+erreur
+
+Exercice 2 :
+(if (< 10 20) #t #f)
+equivalent a (< 10 20)
+
+Exercce 3 :
+2 -6 + 10 ==> (+ (- 2 6) 10) ==> 6
+2+5 * (-3 + 12) ==> (+ 2 (* 5 ( - 12 3 ))) ==> 47
+( 9/2) / (2/4) ==> (quotient (quotient 9 2) (quotient 2 4)) ==> quotient non defini pour 0
+
+Exercice 4 :
+#t
+#f j'aurais pu prevoir
+
+Exercice 5 :
+non (A et B) <=> non(A) ou non(B)
+(lois de morgan )
+
+Exercice 6 :
+
+Exercice 7 :
+Exercice 8 :
+
+Exercice 9 :
+
+Exercice 10 :
+>(expt 12345 12345)
+>A FINIR
+
+PARTIE 1 :
+
+Exercice 2 :
+Vraisemblablement cela devrait renvoyer 100, car le 10 masque l'ancienne valeurs de x dans le top-level
+Et effectivement.
+
+Exercice 3 :
+Rendra 11 : effectivement.
+
+Exercice 4
+DrRacket rale parce que d est deja defini, en remplacant le define par un set!, on obtient 15
+
+Exercice 5 :
+101, soit 10*10 + 1
+En inversant les definitions, cela fonctionne toujours
+
+Exercice 6 :
+1/3
+0.3333333
+1/3
+0.3333333
+1/2
+1 1/2
+
+
+Exercice 7 :
+
+Exercice 8 :
+
+Notes pour day :
+trouver un app qui associe au numero du mois le nombre de mois a 30 jours ecoulés depuis :
+ 1
diff --git a/sem_4/progaapp/td1.pdf b/sem_4/progaapp/td1.pdf Binary files differnew file mode 100644 index 0000000..7242e6e --- /dev/null +++ b/sem_4/progaapp/td1.pdf diff --git a/sem_4/progaapp/td2.pdf b/sem_4/progaapp/td2.pdf Binary files differnew file mode 100644 index 0000000..42986d1 --- /dev/null +++ b/sem_4/progaapp/td2.pdf diff --git a/sem_4/progaapp/td3.pdf b/sem_4/progaapp/td3.pdf Binary files differnew file mode 100644 index 0000000..633c005 --- /dev/null +++ b/sem_4/progaapp/td3.pdf diff --git a/sem_4/progaapp/td4.pdf b/sem_4/progaapp/td4.pdf Binary files differnew file mode 100644 index 0000000..b1be561 --- /dev/null +++ b/sem_4/progaapp/td4.pdf diff --git a/sem_4/projs4/notes.txt b/sem_4/projs4/notes.txt new file mode 100644 index 0000000..62f9918 --- /dev/null +++ b/sem_4/projs4/notes.txt @@ -0,0 +1,76 @@ +
+Début du projet : 22 janvier 2018
+Fin du projet : 27 avril 2018
+Consigne des rapports (dans la plateforme Moodle) : 5 mai 2018
+Date limite pour le rendu des livrables (aux encadrants) : 5 mai 2018
+Soutenances : 28-30 mai 2018
+
+
+
+On est acutellement en Gradient descent
+On voudrait passer en Stochastic gradient descent
+Batch size ( 10 )
+SUr les 100 exemples du jeu de test, on va en faire passer que Bs
+augmenter la vitesse de chaque epoque en limitant le nombre de fois que l'on backward
+( taille de training set / BS)
+
+On calcule la moyenne des erreur pour BS test successif, PUIS on backPropagation
+
+On cherche alors a tester laquel des methodes est plus efficace que l'autre, Ã quel niveau
+
+Integrer d'autres methodes d'FonctionActivatio:
+atest : RELU
+relu = max(0,z) avec z = Wx + b
+
+Permettre de choisir la fonction d'activation et la fonction de calcul d'erreur ( actuellement
+erreur quadratique ( attendut-output)^2 ( plus adaptée a de la regression ))
+On pourrait utiliser
+Cross Entropy :
+-Sigma(attendu*log(output))
+
+
+
+Seance finale :
+
+
+Rapport :
+intro : presenter d'abord la classification supervisée quesaquo, puis parler du cahier des charges
+Classification multiclasse : chaque element n'est que dans une classe max
+
+ajouter la gueule de la sigmoide dans le 2.1.x
+Retirer la partie code de la 2.x pour tout recentrer dans une partie dedié au code
+mettre le vocabulaire ( lexique ) en entrée du rapport plutot
+
+partie 3 :
+d'abord le modele puis l'implementation
+ajouter la partie formelle ( backprop dans un reseau )
+macro latex piur les fleches : \rightarrow
+macro \mathit....
+++ Partie experiences, experimentation avec les jeux de données, détailler les jeux de donnés
+++ aprler des gradient descent
+++ citer les platefrome d'apprentissage
+kaffe pythorch desrtflow?
+parler de la precision des descripteur
+
+
+
+pour la presentation : 15 minutes, 7 transparents: dire bien qui a travaillé sur quelle Partie,
+ptite demo avec le JS deja enregistré ( qui tombe sur des resultat sympathique )
+
+transprent :
+1 : poser le probleme
+2 : dire qu'on est pas les seuls, big data, deeplearning, plateforme existantes ( On implemente notre plateforme)
+3 : On demarre
+un peu sur le neuronne
+reseau methode,
+implementation
+diagrame UML
+/!!!!\ experiences, montrer des jeux de de données differents jeu complexe => modele complexe
+
+demo (2/3min)
+conclusion + ouverture / perspective
+
+Prochain rendu du rapport le 2/3
+
+
+L'an prochain : meme difficulté ( voire un peu moins )
|
