Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adding new functionalities.
[mapping.git] / src / and / Mapping / Maheve.java
index c22bfc9..f38b9fc 100644 (file)
@@ -374,7 +374,12 @@ public class Maheve extends Algo
                        
                        ArrayList<Double> calcMark = new ArrayList<Double>() ;
                        
-                       hd = gl.getHeterogenityDegre() ;
+                       double hd_g = gl.getHeterogenityDegre() ;
+                       
+                       /* Correction of hd */
+                       hd =  calcNewHd( hd_g ) ; 
+                       
+                       System.out.println("Corrected hd value: " + hd + " (" + hd_g + ")" ) ;
 
                        /** Sorting clusters **/
                        ArrayList<Cluster> tmp = gl.getClusters() ;
@@ -399,8 +404,8 @@ public class Maheve extends Algo
                                normP = tmp.get( i ).getAvgAvailablePower() * 100 / Pm ;
                                
                                /** The magic formula :P **/
-                               calcLoc = Math.sqrt( Math.pow( (normP * hd), 2) +
-                                                 Math.pow( (normN *(1 - hd)), 2 ) ) ;
+                               calcLoc = Math.pow( (normP * hd), 2) +
+                                                 Math.pow( (normN * (1 - hd)), 2 ) ;
                                
                                ok = false ;
                                
@@ -432,6 +437,28 @@ public class Maheve extends Algo
        }
 
 
+       /**
+        * Compute the new value of hd, by taking care of the application
+        * and execution architecture characteristics.
+        * @param hd_g Original heterogeneity degree
+        * @return The new (corrected) heterogeneity degree
+        */
+       private double calcNewHd( double hd_g ) 
+       {
+               /* Variables */
+               double nhd = 0 ;
+
+               double nbTask = gr.getNbGTask() ;
+               double nbDep = gr.getMaxDep() ;
+               double maxNodes = gl.getMaxClusterNode() ;
+               
+               /* Computation */
+               nhd = hd_g / ( 10 * ( (nbDep / nbTask) + (nbDep / maxNodes) ) ) ;
+               
+               return nhd ;
+       }
+
+
        @Override
        public GNode replaceNode( GNode _dead, ArrayList<GNode> _ag ) 
        {
@@ -506,6 +533,12 @@ public class Maheve extends Algo
                
                return ret ;
        }
+
+
+       @Override
+       public boolean setParams(Object[] _params) {
+               return true ;
+       }
        
 }