- Main Page
- Namespaces
- Classes
- Files

- Search for |

# route_init.cpp

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 // "route_init.cpp"
    00004
    00005 // (c) OPAC Team, LIFL, 2003-2006
    00006
    00007 /* LICENCE TEXT
    00008
    00009    Contact: paradiseo-help@lists.gforge.inria.fr
    00010 */
    00011
    00012 #include <utils/eoRNG.h>
    00013
    00014 #include "route_init.h"
    00015 #include "graph.h"
    00016
    00017 void RouteInit :: operator () (Route & __route)
    00018 {
    00019
    00020   // Init.
    00021   __route.clear () ;
    00022   for (unsigned int i = 0 ; i < Graph :: size () ; i ++)
    00023     {
    00024       __route.push_back (i) ;
    00025     }
    00026
    00027   // Swap. cities
    00028
    00029   for (unsigned int i = 0 ; i < Graph :: size () ; i ++)
    00030     {
    00031       //unsigned int j = rng.random (Graph :: size ()) ;
    00032
    00033       unsigned int j = (unsigned int) (Graph :: size () * (rand () / (RAND_MAX + 1.0))) ;
    00034       unsigned int city = __route [i] ;
    00035       __route [i] = __route [j] ;
    00036       __route [j] = city ;
    00037     }
    00038 }