Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correction of bugs and new functionalities.
authorSébastien Miquée <sebastien.miquee@univ-fcomte.fr>
Mon, 22 Feb 2010 20:55:44 +0000 (21:55 +0100)
committerSébastien Miquée <sebastien.miquee@univ-fcomte.fr>
Mon, 22 Feb 2010 20:55:44 +0000 (21:55 +0100)
- Simplification of some functions and suppression of unused or not
  useful variables.

- Correction of some functions after having done different tests of
  non regression.

src/and/Mapping/Algo.java
src/and/Mapping/Cluster.java
src/and/Mapping/DefaultMapping.java
src/and/Mapping/Graph.java
src/and/Mapping/Grid.java
src/and/Mapping/LSM.java
src/and/Mapping/Mapping.java
src/and/Mapping/QM.java
src/and/Mapping/Simple.java
src/and/Mapping/Utils.java

index e85d04f..a06171e 100644 (file)
@@ -94,6 +94,22 @@ public abstract class Algo implements Serializable
        {
                return gr ;
        }
        {
                return gr ;
        }
+       
+       
+       /**
+        * Update the grid status after having done the mapping.
+        */
+       protected void updateGrid()
+       {
+               if( mp.getMappedGNodes().size() >= 0 )
+               {
+                       ArrayList<GNode> temp = mp.getMappedGNodes() ;
+                       for( int i = 0 ; i < temp.size() ; i++ )
+                       {
+                               gl.getClusterOfNode( temp.get( i ) ).setGNodeStatus( temp.get( i ), true ) ;
+                       }
+               }
+       }
 }
 
 /** La programmation est un art, respectons ceux qui la pratiquent !! **/
 }
 
 /** La programmation est un art, respectons ceux qui la pratiquent !! **/
index 0561682..a9abe87 100644 (file)
@@ -14,11 +14,12 @@ public class Cluster implements Serializable
 {
        private static final long serialVersionUID = 1L;
        
 {
        private static final long serialVersionUID = 1L;
        
-       private int nb_node ;
+//     private int nb_node ;
        private String name ;
        private ArrayList<GNode> nodes ;
        private String name ;
        private ArrayList<GNode> nodes ;
+       private ArrayList<GNode> freenodes ;
        private String site ;
        private String site ;
-       private int indice ;
+//     private int indice ;
        
        
        /**
        
        
        /**
@@ -26,52 +27,54 @@ public class Cluster implements Serializable
         */
        public Cluster()
        {
         */
        public Cluster()
        {
-               nb_node = 0 ;
+//             nb_node = 0 ;
                name = "" ;
                nodes = new ArrayList<GNode>() ;
                name = "" ;
                nodes = new ArrayList<GNode>() ;
+               freenodes = new ArrayList<GNode>() ;
                site = "" ;
                site = "" ;
-               indice = 0 ;
+//             indice = 0 ;
        }
        
        
        }
        
        
-       /**
-        * Constructor.
-        * @param _nb The amount of computing nodes in the cluster
-        */
-       public Cluster( int _nb )
-       {
-               nb_node = _nb ;
-               name = "" ;
-               nodes = new ArrayList<GNode>() ;
-               site = "" ;
-               indice = 0 ;
-               
-               
-               for( int i = 0 ; i < nb_node ; i++ )
-               {
-                       nodes.add( new GNode() ) ;
-               }
-       }
+//     /**
+//      * Constructor.
+//      * @param _nb The amount of computing nodes in the cluster
+//      */
+//     public Cluster( int _nb )
+//     {
+//             nb_node = _nb ;
+//             name = "" ;
+//             nodes = new ArrayList<GNode>() ;
+//             freenodes = new ArrayList<GNode>() ;
+//             site = "" ;
+////           indice = 0 ;
+//             
+//             
+//             for( int i = 0 ; i < nb_node ; i++ )
+//             {
+//                     nodes.add( new GNode() ) ;
+//             }
+//     }
        
        
        
        
-       /**
-        * Constructor.
-        * @param _nb The amount of computing nodes in the cluster
-        * @param _name Cluster's name
-        */
-       public Cluster( int _nb, String _name )
-       {
-               nb_node = _nb ;
-               name = _name ;
-               nodes = new ArrayList<GNode>() ;
-               site = "" ;
-               indice = 0 ;
-               
-               for( int i = 0 ; i < nb_node ; i++ )
-               {
-                       nodes.add( new GNode() ) ;
-               }
-       }
+//     /**
+//      * Constructor.
+//      * @param _nb The amount of computing nodes in the cluster
+//      * @param _name Cluster's name
+//      */
+//     public Cluster( int _nb, String _name )
+//     {
+////           nb_node = _nb ;
+//             name = _name ;
+//             nodes = new ArrayList<GNode>() ;
+//             site = "" ;
+////           indice = 0 ;
+//             
+//             for( int i = 0 ; i < nb_node ; i++ )
+//             {
+//                     nodes.add( new GNode() ) ;
+//             }
+//     }
        
        
        /**
        
        
        /**
@@ -90,10 +93,18 @@ public class Cluster implements Serializable
         */
        public void addGNode( GNode _n )
        {
         */
        public void addGNode( GNode _n )
        {
-               _n.setInCluster( true ) ;
-               nodes.add( _n ) ;
+               if( _n != null )
+               {
+                       _n.setInCluster( true ) ;
+                       nodes.add( _n ) ;
 
 
-               nb_node++ ;
+//                     nb_node++ ;
+               
+                       if( ! _n.getMapped() )
+                       {
+                               freenodes.add( _n ) ;
+                       }
+               }
        }
        
        
        }
        
        
@@ -123,7 +134,8 @@ public class Cluster implements Serializable
         */
        public int getNbGNode()
        {
         */
        public int getNbGNode()
        {
-               return nb_node ;
+//             return nb_node ;
+               return nodes.size() ;
        }
        
        
        }
        
        
@@ -150,29 +162,35 @@ public class Cluster implements Serializable
        /**
         * Test if a computing node is in the cluster.
         * @param _g The node to be tested
        /**
         * Test if a computing node is in the cluster.
         * @param _g The node to be tested
-        * @return True is _g is in, False else
+        * @return The position of the node
         */
         */
-       public boolean isIn( GNode _g )
+       public int isIn( GNode _g )
        {
        {
+               int pos = -1 ;
+               
                if( _g != null )
                {
                if( _g != null )
                {
-                       for( int i = 0; i < nodes.size(); i ++ )
+                       for( int i = 0 ; i < nodes.size() ; i ++ )
                        {
                                if( nodes.get( i ).getId() == _g.getId() )
                        {
                                if( nodes.get( i ).getId() == _g.getId() )
-                                       return true ;
+                               {
+                                       pos = i ;
+                                       break ;
+                               }
+                               
                        }
                }
                
                        }
                }
                
-               return false ;
+               return pos ;
        }
        
        }
        
-       /**
-        * Initialization of indice variable.
-        */
-       public void initIndice()
-       {
-               indice = 0 ;
-       }
+//     /**
+//      * Initialization of indice variable.
+//      */
+//     public void initIndice()
+//     {
+//             indice = 0 ;
+//     }
 
 
        /**
 
 
        /**
@@ -184,10 +202,14 @@ public class Cluster implements Serializable
        {
                GNode ret = null ;
                
        {
                GNode ret = null ;
                
-               if( indice < nb_node )
+//             if( indice < nb_node )
+//             {
+//                     ret = nodes.get( indice ) ;
+//                     indice++ ;
+//             }
+               if( freenodes.size() > 0 )
                {
                {
-                       ret = nodes.get( indice ) ;
-                       indice++ ;
+                       ret = freenodes.remove( 0 ) ;
                }
                
                return ret ;
                }
                
                return ret ;
@@ -206,14 +228,51 @@ public class Cluster implements Serializable
                        {
                                if( _dead.getId() == nodes.get( i ).getId() )
                                {
                        {
                                if( _dead.getId() == nodes.get( i ).getId() )
                                {
-                                       nodes.remove( i ) ;
-                                       nb_node-- ;
+                                       freenodes.remove( nodes.remove( i ) ) ;
+//                                     nb_node-- ;
                                        
                                        break ;
                                }
                        }
                }
                                        
                                        break ;
                                }
                        }
                }
-               
+       }
+       
+       
+       /**
+        * Set the mapped status of a node of the cluster.
+        * @param _g The mapped node
+        * @param _status The status of the node
+        */
+       public void setGNodeStatus( GNode _g, boolean _status )
+       {
+               if( _g != null )
+               {
+                       for( int i = 0 ; i < nodes.size() ; i++ )
+                       {
+                               if( nodes.get( i ).getId() == _g.getId() )
+                               {
+                                       nodes.get( i ).setMapped( _status ) ;
+                                       
+                                       if( _status ) 
+                                       {
+                                               freenodes.remove( nodes.get(i) ) ;
+                                       } else {
+                                               if( ! freenodes.contains( nodes.get( i ) ) )
+                                                       freenodes.add( nodes.get( i ) ) ;
+                                       }
+                               }
+                       }
+               }
+       }
+       
+       
+       /**
+        * Return the amount of available free nodes in the cluster.
+        * @return The amount of free nodes
+        */
+       public int getNbFreeNodes()
+       {
+               return freenodes.size() ;
        }
        
 }
        }
        
 }
index 9e10bf5..1b21ea6 100644 (file)
@@ -42,7 +42,7 @@ public class DefaultMapping extends Algo
        @Override
        public void map() 
        {
        @Override
        public void map() 
        {
-               /* If the mapping is possible ... */
+               /** If the mapping is possible ... **/
                if( gr.getNbGTask() <= gl.getNbGNode() )
                {
                        atraiter = gr.getGraph() ;
                if( gr.getNbGTask() <= gl.getNbGNode() )
                {
                        atraiter = gr.getGraph() ;
@@ -60,6 +60,9 @@ public class DefaultMapping extends Algo
                } else {
                        System.err.println( "\n\n!!! Unable to map application !\n\n" ) ;
                }
                } else {
                        System.err.println( "\n\n!!! Unable to map application !\n\n" ) ;
                }
+               
+               /** Update in cluster the status of nodes **/
+               updateGrid() ;
        }
 
 
        }
 
 
@@ -85,10 +88,12 @@ public class DefaultMapping extends Algo
                        } else {
                                System.err.println( "Not enought available nodes in gnodes to replace one !" ) ;
                                return null ;
                        } else {
                                System.err.println( "Not enought available nodes in gnodes to replace one !" ) ;
                                return null ;
-                       }
-                       
+                       }               
                }
                
                }
                
+               /** Update in cluster the status of nodes **/
+               updateGrid() ;
+               
                return ret ;
        }
 
                return ret ;
        }
 
index 58a719d..3387f60 100644 (file)
@@ -8,7 +8,7 @@ import java.util.ArrayList;
 
 
 /**
 
 
 /**
- * Class representing the interaction graph of an application
+ * Class representing the application's graph
  * @author S&eacute;bastien Miqu&eacute;e
  */
 public class Graph implements Serializable
  * @author S&eacute;bastien Miqu&eacute;e
  */
 public class Graph implements Serializable
@@ -17,7 +17,7 @@ public class Graph implements Serializable
 
        
        private ArrayList<GTask> graph ;
 
        
        private ArrayList<GTask> graph ;
-       private int nb_task ;
+//     private int nb_task ;
        private int nb_dep_total ;
        
        
        private int nb_dep_total ;
        
        
@@ -27,7 +27,7 @@ public class Graph implements Serializable
        public Graph()
        {
                graph = new ArrayList<GTask>() ;
        public Graph()
        {
                graph = new ArrayList<GTask>() ;
-               nb_task = 0 ;
+//             nb_task = 0 ;
                nb_dep_total = 0 ;
        }
        
                nb_dep_total = 0 ;
        }
        
@@ -38,21 +38,40 @@ public class Graph implements Serializable
         */
        public int getNbGTask()
        {
         */
        public int getNbGTask()
        {
-               return nb_task ;
+               return graph.size() ;
+//             return nb_task ;
        }
        
        
        /**
        }
        
        
        /**
-        * Add a task in the interaction graph.
+        * Add a task into the graph.
         * @param t Task to be add
         */
         * @param t Task to be add
         */
-       public void addGTask( GTask t )
+       public void addGTask( GTask _t )
        {
        {
-               if( t != null )
+               if( _t != null )
                {
                {
-                       graph.add( t.getNum(), t ) ;
-                       nb_dep_total += t.getNbDep() ;
-                       nb_task ++ ;
+                       graph.add( _t.getNum(), _t ) ;
+                       nb_dep_total += _t.getNbDep() ;
+//                     nb_task ++ ;
+               }
+       }
+       
+       
+       /**
+        * Add a list of tasks into the graph.
+        * @param _lt : Tasks list to be added
+        */
+       public void addGTasks( ArrayList<GTask> _lt )
+       {
+               if( _lt != null )
+               {
+                       for( int i = 0 ; i < _lt.size() ; i++ )
+                       {
+                               graph.add( _lt.get( i ).getNum(), _lt.get( i ) ) ;
+                               nb_dep_total += _lt.get( i ).getNbDep() ;
+//                             nb_task ++ ;
+                       }
                }
        }
        
                }
        }
        
@@ -73,18 +92,18 @@ public class Graph implements Serializable
         */
        public double getAverageDep()
        {
         */
        public double getAverageDep()
        {
-               return nb_dep_total / nb_task ;
+               return nb_dep_total / graph.size() ;
        }
 
 
        /**
        }
 
 
        /**
-        * Print the graph in a text version.
+        * Print the graph in a comprehensible text version.
         */
        public void print() 
        {
                System.out.println();
                System.out.println( "\t=> Composition of interaction graph:\n" ) ; 
         */
        public void print() 
        {
                System.out.println();
                System.out.println( "\t=> Composition of interaction graph:\n" ) ; 
-               for( int i = 0 ; i < nb_task ; i++ )
+               for( int i = 0 ; i < graph.size() ; i++ )
                {
                        System.out.println( "\t\tTask \""+ graph.get(i).getNum() +"\" => " + graph.get(i).printDep() ) ;
                }
                {
                        System.out.println( "\t\tTask \""+ graph.get(i).getNum() +"\" => " + graph.get(i).printDep() ) ;
                }
index eb3fb4f..0370940 100644 (file)
@@ -15,8 +15,8 @@ public class Grid implements Serializable
        private static final long serialVersionUID = 1L;
 
        
        private static final long serialVersionUID = 1L;
 
        
-       private int nb_cluster ;
-       private int nb_node ;
+//     private int nb_cluster ;
+//     private int nb_node ;
        private ArrayList<Cluster> clusters ;
        private ArrayList<GNode> gnodesList;
        private boolean gnodesList_done;
        private ArrayList<Cluster> clusters ;
        private ArrayList<GNode> gnodesList;
        private boolean gnodesList_done;
@@ -27,8 +27,8 @@ public class Grid implements Serializable
         */
        public Grid()
        {
         */
        public Grid()
        {
-               nb_cluster = 0 ;
-               nb_node = 0 ;
+//             nb_cluster = 0 ;
+//             nb_node = 0 ;
                clusters = new ArrayList<Cluster>() ;
                gnodesList = new ArrayList<GNode>() ;
                gnodesList_done = false ;
                clusters = new ArrayList<Cluster>() ;
                gnodesList = new ArrayList<GNode>() ;
                gnodesList_done = false ;
@@ -44,8 +44,13 @@ public class Grid implements Serializable
                if( c != null )
                {
                        clusters.add( c ) ;
                if( c != null )
                {
                        clusters.add( c ) ;
-                       nb_cluster ++ ;
-                       nb_node += c.getNbGNode() ;
+                       
+                       for( int i = 0 ; i < c.getNbGNode() ; i++ )
+                       {
+                               gnodesList.add( c.getGNodes().get( i ) ) ;
+                       }
+//                     nb_cluster++ ;
+//                     nb_node += c.getNbGNode() ;
                }
        }
        
                }
        }
        
@@ -63,9 +68,9 @@ public class Grid implements Serializable
                        for( int i = 0 ; i < al.size() ; i++ )
                        {
                                clusters.add( al.get( i ) ) ;
                        for( int i = 0 ; i < al.size() ; i++ )
                        {
                                clusters.add( al.get( i ) ) ;
-                               nb_cluster ++ ;
+//                             nb_cluster++ ;
                                nbCLusterNodes = al.get( i ).getNbGNode() ;
                                nbCLusterNodes = al.get( i ).getNbGNode() ;
-                               nb_node += nbCLusterNodes ;
+//                             nb_node += nbCLusterNodes ;
                                
                                for( int j = 0 ; j < nbCLusterNodes ; j++ )
                                {
                                
                                for( int j = 0 ; j < nbCLusterNodes ; j++ )
                                {
@@ -82,7 +87,8 @@ public class Grid implements Serializable
         */
        public int getNbCluster()
        {
         */
        public int getNbCluster()
        {
-               return nb_cluster ;
+               return clusters.size() ;
+//             return nb_cluster ;
        }
        
        
        }
        
        
@@ -92,7 +98,8 @@ public class Grid implements Serializable
         */
        public int getNbGNode()
        {
         */
        public int getNbGNode()
        {
-               return nb_node ;
+               return gnodesList.size() ;
+//             return nb_node ;
        }
        
        
        }
        
        
@@ -106,16 +113,16 @@ public class Grid implements Serializable
        }
        
        
        }
        
        
-       /**
-        * Initialization of clusters.
-        */
-       public void initClusters()
-       {
-               for( int i = 0 ; i < nb_cluster ; i++ )
-               {
-                       clusters.get( i ).initIndice() ;
-               }
-       }
+//     /**
+//      * Initialization of clusters.
+//      */
+//     public void initClusters()
+//     {
+//             for( int i = 0 ; i < nb_cluster ; i++ )
+//             {
+//                     clusters.get( i ).initIndice() ;
+//             }
+//     }
        
        
        /**
        
        
        /**
@@ -137,13 +144,13 @@ public class Grid implements Serializable
                
                for( int i = 0 ; i < clusters.size() ; i++ )
                {
                
                for( int i = 0 ; i < clusters.size() ; i++ )
                {
-                       if( clusters.get( i ).isIn( _g1) )
+                       if( clusters.get( i ).isIn( _g1 ) != -1 )
                        {
                                cluster1 = clusters.get( i ).getName() ;
                                site1 = clusters.get( i ).getSite() ;
                        }
                        
                        {
                                cluster1 = clusters.get( i ).getName() ;
                                site1 = clusters.get( i ).getSite() ;
                        }
                        
-                       if( clusters.get( i ).isIn( _g2) )
+                       if( clusters.get( i ).isIn( _g2 ) != -1 )
                        {
                                cluster2 = clusters.get( i ).getName() ;
                                site2 = clusters.get( i ).getSite() ;
                        {
                                cluster2 = clusters.get( i ).getName() ;
                                site2 = clusters.get( i ).getSite() ;
@@ -211,7 +218,9 @@ public class Grid implements Serializable
                                {
                                        if( _gnodes.get( i ).getCluster().equalsIgnoreCase( clusters.get( j ).getName() ) )
                                        {
                                {
                                        if( _gnodes.get( i ).getCluster().equalsIgnoreCase( clusters.get( j ).getName() ) )
                                        {
-                                               if( ! clusters.get( j ).isIn( _gnodes.get( i ) ) )
+                                               int pos = clusters.get( j ).isIn( _gnodes.get( i ) ) ;
+                                               
+                                               if( pos == -1 )
                                                {
                                                        _gnodes.get( i ).setCluster( clusters.get( j ).getName() ) ;
                                                        _gnodes.get( i ).setSite( clusters.get( j ).getSite() ) ;
                                                {
                                                        _gnodes.get( i ).setCluster( clusters.get( j ).getName() ) ;
                                                        _gnodes.get( i ).setSite( clusters.get( j ).getSite() ) ;
@@ -219,8 +228,11 @@ public class Grid implements Serializable
                                                        _gnodes.get( i ).setMapped( false ) ;
                                                
                                                        clusters.get( i ).addGNode( _gnodes.get( j ) ) ;
                                                        _gnodes.get( i ).setMapped( false ) ;
                                                
                                                        clusters.get( i ).addGNode( _gnodes.get( j ) ) ;
-                                                       nb_node++ ;
+//                                                     nb_node++ ;
                                                        gnodesList.add( _gnodes.get( i ) ) ;
                                                        gnodesList.add( _gnodes.get( i ) ) ;
+                                                       
+                                               } else {
+                                                       clusters.get( j ).setGNodeStatus( _gnodes.get( i ), _gnodes.get( i ).getMapped() ) ;
                                                }
                                                
                                                break ;
                                                }
                                                
                                                break ;
@@ -248,10 +260,10 @@ public class Grid implements Serializable
                                        _gnodes.get( i ).setCluster( cluster ) ;
                                        
                                        nClust.addGNode( _gnodes.get( i ) ) ;
                                        _gnodes.get( i ).setCluster( cluster ) ;
                                        
                                        nClust.addGNode( _gnodes.get( i ) ) ;
-                                       nb_cluster++ ;
+//                                     nb_cluster++ ;
                                        
                                        clusters.add( nClust ) ;
                                        
                                        clusters.add( nClust ) ;
-                                       nb_node++ ;
+//                                     nb_node++ ;
                                        gnodesList.add( _gnodes.get( i ) ) ;
                                }
                        }
                                        gnodesList.add( _gnodes.get( i ) ) ;
                                }
                        }
@@ -289,7 +301,7 @@ public class Grid implements Serializable
                        }
                        
                        /** Removing the dead node from the global list **/
                        }
                        
                        /** Removing the dead node from the global list **/
-                       for( int i = 0 ; i < nb_node ; i++ )
+                       for( int i = 0 ; i < gnodesList.size() ; i++ )
                        {
                                if( _dead.getId() == gnodesList.get( i ).getId() )
                                {
                        {
                                if( _dead.getId() == gnodesList.get( i ).getId() )
                                {
@@ -299,19 +311,63 @@ public class Grid implements Serializable
                        }
                }
                
                        }
                }
                
-               nb_node-- ;
+//             nb_node-- ;
                gnodesList_done = false ;
        }
        
        
        /**
                gnodesList_done = false ;
        }
        
        
        /**
+        * Change the mapping status of a node in the grid and in its cluster.
+        * @param _g The node to change the mapping status
+        * @param _status The node's mapping status
+        */
+       public void setMappedStatus( GNode _g, boolean _status )
+       {
+               if( _g != null )
+               {
+                       getClusterOfNode( _g ).setGNodeStatus( _g, _status ) ;
+                       
+                       for( int i = 0 ; i < gnodesList.size() ; i++ )
+                       {
+                               if( _g.getId() == gnodesList.get( i ).getId() )
+                               {
+                                       gnodesList.get( i ).setMapped( _status ) ;
+                                       break ;
+                               }
+                       }
+               }
+       }
+       
+       
+       /**
+        * Search and return the cluster containing the specified node.
+        * @param _g A node
+        * @return The cluster containing the node
+        */
+       public Cluster getClusterOfNode( GNode _g )
+       {
+               if( _g != null )
+               {
+                       for( int i = 0 ; i < clusters.size() ; i++ )
+                       {
+                               if( _g.getCluster().equalsIgnoreCase( clusters.get( i ).getName() ) ) 
+                               {
+                                       return clusters.get( i ) ;
+                               }
+                       }
+               }
+               
+               return null ;
+       }
+       
+       /**
         * Compute the heterogeneity degree of the grid.
         * This is based on the relative standard deviation.
         * @return The heterogeneity degree of the grid
         */
        public double getHeterogenityDegre()
        {
         * Compute the heterogeneity degree of the grid.
         * This is based on the relative standard deviation.
         * @return The heterogeneity degree of the grid
         */
        public double getHeterogenityDegre()
        {
-               if( nb_node != gnodesList.size() )
+               if( ! ( gnodesList.size() > 0 ) )
                {
                        System.err.println( "Mapping - Heterogeneity degree computation! " +
                                        "List's size not corresponding!" ) ;
                {
                        System.err.println( "Mapping - Heterogeneity degree computation! " +
                                        "List's size not corresponding!" ) ;
@@ -325,22 +381,22 @@ public class Grid implements Serializable
                double temp = 0 ;
                
                /** Computation of the average power of computing nodes **/
                double temp = 0 ;
                
                /** Computation of the average power of computing nodes **/
-               for( int i = 0 ; i < nb_node ; i++ )
+               for( int i = 0 ; i < gnodesList.size() ; i++ )
                {
                        temp += gnodesList.get(i).getPower() ;
                }
                
                {
                        temp += gnodesList.get(i).getPower() ;
                }
                
-               average = temp / nb_node ;
+               average = temp / gnodesList.size() ;
                
                /** Computation of the variance **/
                temp = 0 ;
                
                /** Computation of the variance **/
                temp = 0 ;
-               for( int i = 0 ; i < nb_node ; i++ )
+               for( int i = 0 ; i < gnodesList.size() ; i++ )
                {
                        temp += Math.pow( ( gnodesList.get(i).getPower() - average ), 2 ) ;
                }
                
                /** Computation of the standard deviation **/
                {
                        temp += Math.pow( ( gnodesList.get(i).getPower() - average ), 2 ) ;
                }
                
                /** Computation of the standard deviation **/
-               temp = temp / nb_node ;
+               temp = temp / gnodesList.size() ;
                std = Math.sqrt( temp ) ;
                
                /** Computation of the relative standard deviation
                std = Math.sqrt( temp ) ;
                
                /** Computation of the relative standard deviation
@@ -359,8 +415,8 @@ public class Grid implements Serializable
        public void print()
        {
                System.out.println();
        public void print()
        {
                System.out.println();
-               System.out.println( "\t=> Grid composition :\n" ) ; 
-               for( int i = 0 ; i < nb_cluster ; i++ )
+               System.out.println( "\t=> Grid composition:\n" ) ; 
+               for( int i = 0 ; i < clusters.size() ; i++ )
                {
                        System.out.println( "\t\tCluster \""+ clusters.get(i).getName() +"\" : " + clusters.get(i).getNbGNode() ) ;
                }
                {
                        System.out.println( "\t\tCluster \""+ clusters.get(i).getName() +"\" : " + clusters.get(i).getNbGNode() ) ;
                }
index 44b5676..c193bc8 100644 (file)
@@ -224,6 +224,9 @@ public class LSM extends Algo
                } else {
                        System.out.println( "\n\n!!! Mapping impossible ! There are more tasks than nodes !!!\n" ) ;
                }
                } else {
                        System.out.println( "\n\n!!! Mapping impossible ! There are more tasks than nodes !!!\n" ) ;
                }
+               
+               /** Update in cluster the status of nodes **/
+               updateGrid() ;
        }
        
        /**
        }
        
        /**
@@ -405,6 +408,9 @@ public class LSM extends Algo
        @Override
        public GNode replaceNode( GNode _dead, ArrayList<GNode> _ag ) 
        {
        @Override
        public GNode replaceNode( GNode _dead, ArrayList<GNode> _ag ) 
        {
+               /** Update in cluster the status of nodes **/
+               updateGrid() ;
+               
                return null;
        }
 
                return null;
        }
 
index 1136d55..c6ee73a 100644 (file)
@@ -181,7 +181,7 @@ public class Mapping implements Serializable
        public void print()
        {
                System.out.println();
        public void print()
        {
                System.out.println();
-               System.out.println( "\t=> Mapping done :\n" ) ;
+               System.out.println( "\t=> Mapping done:\n" ) ;
                
                if( type == 0 )
                {
                
                if( type == 0 )
                {
index 04f6a43..70799f2 100644 (file)
@@ -208,6 +208,9 @@ public class QM extends Algo
                } else {
                        System.err.println( "\n\n!!! Unable to map application !\n\n" ) ;
                }
                } else {
                        System.err.println( "\n\n!!! Unable to map application !\n\n" ) ;
                }
+               
+               /** Update in cluster the status of nodes **/
+               updateGrid() ;
        }
        
        /**
        }
        
        /**
@@ -509,6 +512,8 @@ public class QM extends Algo
        @Override
        public GNode replaceNode(GNode _dead, ArrayList<GNode> _ag ) 
        {
        @Override
        public GNode replaceNode(GNode _dead, ArrayList<GNode> _ag ) 
        {
+               /** Update in cluster the status of nodes **/
+               updateGrid() ;
                return null;
        }
 
                return null;
        }
 
index abf443d..8bf957a 100644 (file)
@@ -112,6 +112,9 @@ public class Simple extends Algo
                } else {
                        System.err.println( "\n\n!!! Unable to map application !\n\n" ) ;
                }
                } else {
                        System.err.println( "\n\n!!! Unable to map application !\n\n" ) ;
                }
+               
+               /** Update in cluster the status of nodes **/
+               updateGrid() ;
        }
 
 
        }
 
 
@@ -119,6 +122,11 @@ public class Simple extends Algo
        public GNode replaceNode(GNode replaced, ArrayList<GNode> _ag ) 
        {
                // TODO
        public GNode replaceNode(GNode replaced, ArrayList<GNode> _ag ) 
        {
                // TODO
+               
+               /** Update in cluster the status of nodes **/
+               updateGrid() ;
+               
+               
                return null ;
        }
 
                return null ;
        }
 
index 7e05ca2..ff2393a 100644 (file)
@@ -77,6 +77,7 @@ public class Utils
                n.setMemory( memory ) ;
                n.setNb_cores( nbCore ) ;
                n.setName( name ) ;
                n.setMemory( memory ) ;
                n.setNb_cores( nbCore ) ;
                n.setName( name ) ;
+               n.setMapped( false ) ;
                
                return n ;
        }
                
                return n ;
        }
@@ -180,10 +181,10 @@ public class Utils
        /**
         * Write the Grid object in an XML file.
         * @param _gl Grid graph to be write
        /**
         * Write the Grid object in an XML file.
         * @param _gl Grid graph to be write
-        * @param _file File's name 
         * @param _path File's path
         * @param _path File's path
+        * @param _file File's name 
         */
         */
-       public static void writeGrid( Grid _gl, String _file, String _path )
+       public static void writeGrid( Grid _gl, String _path, String _file )
        {
                if( _file.equals( "" ) )
                {
        {
                if( _file.equals( "" ) )
                {
@@ -230,10 +231,10 @@ public class Utils
        /**
         * Write an application Graph in a file.
         * @param _gr Application Graph to be write
        /**
         * Write an application Graph in a file.
         * @param _gr Application Graph to be write
-        * @param _file File's name
         * @param _path File's path
         * @param _path File's path
+        * @param _file File's name
         */
         */
-       public static void writeGraph( Graph _gr, String _file, String _path )
+       public static void writeGraph( Graph _gr, String _path, String _file )
        {
                if( _file.equals( "" ) )
                {
        {
                if( _file.equals( "" ) )
                {