Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New version of MAHEVE plus corrections.
[mapping.git] / src / and / Mapping / DefaultMapping.java
index 3de90b1..5aa64e5 100644 (file)
@@ -33,10 +33,9 @@ public class DefaultMapping extends Algo
         * @param _gr Tasks graph to be mapped
         * @param _gd Grid graph
         */
-       public DefaultMapping( Graph _gr, Grid _gd, ArrayList<GNode> _gnodes )
+       public DefaultMapping( Graph _gr, Grid _gd )
        {
                super( _gr, _gd ) ;
-               archi = _gnodes ;
                name = "DefaultMapping" ;
        }
        
@@ -49,6 +48,8 @@ public class DefaultMapping extends Algo
                if( gr.getNbGTask() <= gl.getNbGNode() )
                {
                        atraiter = gr.getGraph() ;
+                       archi = gl.getFreeGNodes() ;
+                       
                        
                        System.out.println( "*******************************************" ) ;
                        System.out.println( "* Launching the Default Mapping algorithm *" ) ;
@@ -57,7 +58,9 @@ public class DefaultMapping extends Algo
                        /** Save the Mapping **/
                        for( int i = 0 ; i < atraiter.size() ; i++ )
                        {
-                               mp.addMapping( new Association( archi.get( i ), atraiter.get( i ) ) ) ;
+                               Random r = new Random() ;
+                               int ret = r.nextInt( archi.size() ) ;
+                               mp.addMapping( archi.remove( ret ), atraiter.get( i ) ) ;
                        }
                
                } else {
@@ -110,6 +113,12 @@ public class DefaultMapping extends Algo
                
                return null ;
        }
+
+
+       @Override
+       public boolean setParams(Object[] _params) {
+               return true ;
+       }
 }