Ajouter un commentaire

willbback
Pareil sur mon poste...

Effectivement, avec le dernier code posté (le mien en l'occurence) la matrice ne présente pas de NaN. Nous avons donc un écart de code avec toi.
La seul remarque que je peux faire, c'est que cette matrice est carrée et non plus n*m comme indiqué par

           final int NB_POINTS = 9;
	   private int n = NB_POINTS;

	   private int m = NB_POINTS - 1;

	   // Matrice des positions initiales
	   public double[][] coordonneesInitiales = new double[n][m];

La définition de m n'est peut-être pas bonne dans ton algorithme.

Résultat avec m=NB_POINTS - 1

Matrice Initiale Complète
0|   0.099   0.0   0.0   0.0   0.0   0.0   0.0   0.0   
1|   0.065   0.292   0.0   0.0   0.0   0.0   0.0   0.0   
2|   0.478   0.612   0.059   0.0   0.0   0.0   0.0   0.0   
3|   0.748   0.791   0.885   0.244   0.0   0.0   0.0   0.0   
4|   0.35   0.306   0.032   0.114   0.367   0.0   0.0   0.0   
5|   0.132   0.077   0.876   0.079   0.15   0.87   0.0   0.0   
6|   0.963   0.061   0.335   0.75   0.966   0.878   0.998   0.0   
7|   0.166   0.547   0.288   0.3   0.759   0.557   0.919   0.756   
8|   0.017   0.842   0.067   0.895   0.68   0.137   0.921   0.91   
Matrice distance
0|   0.0   0.2939727878562912   0.7222644944893802   1.374642862710166   0.552581215750228   1.24901361081455   2.0310061545943183   1.6670539883279125   
1|   0.2939727878562912   0.0   0.5257851272145304   1.2482992429702104   0.47971866755422393   1.266385012545553   2.057798338030236   1.5970588592785178   
2|   0.7222644944893802   0.5257851272145304   0.0   0.9201918278272201   0.5083640427882365   1.363477539235612   1.969148546961351   1.595755933719189   
3|   1.374642862710166   1.2482992429702104   0.9201918278272201   0.0   1.1281963481593087   1.3022895223413264   1.9590061255646956   1.749351879982984   
4|   0.552581215750228   0.47971866755422393   0.5083640427882365   1.1281963481593087   0.0   1.2718156312925235   1.7486531960340221   1.4394717781186266   
5|   1.24901361081455   1.266385012545553   1.363477539235612   1.3022895223413264   1.2718156312925235   0.0   1.759449629855882   1.581640920057394   
6|   2.0310061545943183   2.057798338030236   1.969148546961351   1.9590061255646956   1.7486531960340221   1.759449629855882   0.0   1.3415591675360428   
7|   1.6670539883279125   1.5970588592785178   1.595755933719189   1.749351879982984   1.4394717781186266   1.581640920057394   1.3415591675360428   0.0   
8|   1.9179968717388463   1.807713472871185   1.79555562431243   1.9461235829206738   1.674051970519434   2.1007896134549027   1.7500377138793324   0.8476160687481095   
Matrice resultat
0|   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   
1|   0.2939727878562912   0.0   0.0   0.0   0.0   0.0   0.0   0.0   
2|   0.5640590110709848   0.4511135467148184   0.0   0.0   0.0   0.0   0.0   0.0   
3|   0.7106304006006282   0.845553235494761   0.8183441572385862   0.0   0.0   0.0   0.0   0.0   
4|   0.2749166022792148   0.28644631519585045   0.02873032815495471   0.38326223208931004   0.0   0.0   0.0   0.0   
5|   0.07266658984246778   0.15589590626950392   0.8473239749681973   0.09120659782029286   0.8967577549635228   0.0   0.0   0.0   
6|   -0.039336974297272766   0.9016385736644148   0.43262071765637694   1.1125176690221803   0.768253031155888   1.138164098810563   0.0   0.0   
7|   0.5355801846426934   0.1663664752428089   0.34578205869891643   0.7862465808992009   0.5455242010622685   0.8608568453856572   0.829532989969456   0.0   
8|   0.8458333909516604   0.02455934664270381   0.3282700085960744   0.8918283358684781   -0.013458714498495766   1.1051221730801026   0.7882142842439311   0.4656155299457704   
Nombre NaN :0.0

Résultat avec m=NB_POINTS

Matrice Initiale Complète
0|   0.099   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   
1|   0.065   0.292   0.0   0.0   0.0   0.0   0.0   0.0   0.0   
2|   0.478   0.612   0.059   0.0   0.0   0.0   0.0   0.0   0.0   
3|   0.748   0.791   0.885   0.244   0.0   0.0   0.0   0.0   0.0   
4|   0.35   0.306   0.032   0.114   0.367   0.0   0.0   0.0   0.0   
5|   0.132   0.077   0.876   0.079   0.15   0.87   0.0   0.0   0.0   
6|   0.963   0.061   0.335   0.75   0.966   0.878   0.998   0.0   0.0   
7|   0.166   0.547   0.288   0.3   0.759   0.557   0.919   0.756   0.0   
8|   0.017   0.842   0.067   0.895   0.68   0.137   0.921   0.91   0.547   
Matrice distance
0|   0.0   0.2939727878562912   0.7222644944893802   1.374642862710166   0.552581215750228   1.24901361081455   2.0310061545943183   1.6670539883279125   1.9944726119954619   
1|   0.2939727878562912   0.0   0.5257851272145304   1.2482992429702104   0.47971866755422393   1.266385012545553   2.057798338030236   1.5970588592785178   1.8886601070600288   
2|   0.7222644944893802   0.5257851272145304   0.0   0.9201918278272201   0.5083640427882365   1.363477539235612   1.969148546961351   1.595755933719189   1.8770266380635094   
3|   1.374642862710166   1.2482992429702104   0.9201918278272201   0.0   1.1281963481593087   1.3022895223413264   1.9590061255646956   1.749351879982984   2.0215355549680547   
4|   0.552581215750228   0.47971866755422393   0.5083640427882365   1.1281963481593087   0.0   1.2718156312925235   1.7486531960340221   1.4394717781186266   1.7611527474923918   
5|   1.24901361081455   1.266385012545553   1.363477539235612   1.3022895223413264   1.2718156312925235   0.0   1.759449629855882   1.581640920057394   2.170835323095697   
6|   2.0310061545943183   2.057798338030236   1.969148546961351   1.9590061255646956   1.7486531960340221   1.759449629855882   0.0   1.3415591675360428   1.833532383133715   
7|   1.6670539883279125   1.5970588592785178   1.595755933719189   1.749351879982984   1.4394717781186266   1.581640920057394   1.3415591675360428   0.0   1.0087923473143519   
8|   1.9944726119954619   1.8886601070600288   1.8770266380635094   2.0215355549680547   1.7611527474923918   2.170835323095697   1.833532383133715   1.0087923473143519   0.0   
Matrice resultat
0|   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   
1|   0.2939727878562912   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   
2|   0.5640590110709848   0.4511135467148184   0.0   0.0   0.0   0.0   0.0   0.0   0.0   
3|   0.7106304006006282   0.845553235494761   0.8183441572385862   0.0   0.0   0.0   0.0   0.0   0.0   
4|   0.2749166022792148   0.28644631519585045   0.02873032815495471   0.38326223208931004   0.0   0.0   0.0   0.0   0.0   
5|   0.07266658984246778   0.15589590626950392   0.8473239749681973   0.09120659782029286   0.8967577549635228   0.0   0.0   0.0   0.0   
6|   -0.039336974297272766   0.9016385736644148   0.43262071765637694   1.1125176690221803   0.768253031155888   1.138164098810563   0.0   0.0   0.0   
7|   0.5355801846426934   0.1663664752428089   0.34578205869891643   0.7862465808992009   0.5455242010622685   0.8608568453856572   0.829532989969456   0.0   0.0   
8|   0.8458333909516619   0.024559346642701103   0.3282700085960759   0.8918283358684784   -0.013458714498497065   1.105122173080105   0.7882142842439279   0.7183361481414366   0.0   
Nombre NaN :0.0

Le parcours dans le 2ème cas est complet pour la matrice, ce qui n'est pas le cas dans m=n-1

Filtered HTML

Plain text

CAPTCHA
Cette question permet de vérifier que vous n'êtes pas un robot spammeur :-)
 K  K  TTTTTT  H  H      J  U   U 
K K TT H H J U U
KK TT HHHH J U U
K K TT H H J J U U
K K TT H H JJJ UUU