tsp fitness has been modified and berlin52 instance has been added
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@814 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
e0b82a27d1
commit
f78186ac6f
4 changed files with 84 additions and 29 deletions
|
|
@ -0,0 +1,53 @@
|
|||
52
|
||||
565 575
|
||||
25 185
|
||||
345 750
|
||||
945 685
|
||||
845 655
|
||||
880 660
|
||||
25 230
|
||||
525 1000
|
||||
580 1175
|
||||
650 1130
|
||||
1605 620
|
||||
1220 580
|
||||
1465 200
|
||||
1530 5
|
||||
845 680
|
||||
725 370
|
||||
145 665
|
||||
415 635
|
||||
510 875
|
||||
560 365
|
||||
300 465
|
||||
520 585
|
||||
480 415
|
||||
835 625
|
||||
975 580
|
||||
1215 245
|
||||
1320 315
|
||||
1250 400
|
||||
660 180
|
||||
410 250
|
||||
420 555
|
||||
575 665
|
||||
1150 1160
|
||||
700 580
|
||||
685 595
|
||||
685 610
|
||||
770 610
|
||||
795 645
|
||||
720 635
|
||||
760 650
|
||||
475 960
|
||||
95 260
|
||||
875 920
|
||||
700 500
|
||||
555 815
|
||||
830 485
|
||||
1170 65
|
||||
830 610
|
||||
605 625
|
||||
595 360
|
||||
1340 725
|
||||
1740 245
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
/*
|
||||
* <part_route_eval.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sébastien Cahon, Thomas Legrand
|
||||
* Sébastien Cahon, Jean-Charles Boisson
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
|
|
@ -37,22 +37,17 @@
|
|||
#include "part_route_eval.h"
|
||||
#include "graph.h"
|
||||
|
||||
PartRouteEval :: PartRouteEval (float __from,
|
||||
float __to
|
||||
) : from (__from),
|
||||
to (__to) {
|
||||
|
||||
}
|
||||
PartRouteEval :: PartRouteEval (float __from, float __to) : from (__from), to (__to)
|
||||
{}
|
||||
|
||||
void PartRouteEval :: operator () (Route & __route) {
|
||||
|
||||
|
||||
void PartRouteEval :: operator () (Route & __route)
|
||||
{
|
||||
float len = 0 ;
|
||||
|
||||
for (unsigned i = (unsigned) (__route.size () * from) ;
|
||||
i < (unsigned) (__route.size () * to) ;
|
||||
i ++)
|
||||
len -= Graph :: distance (__route [i], __route [(i + 1) % Graph :: size ()]) ;
|
||||
|
||||
|
||||
for (unsigned int i = (unsigned int) (__route.size () * from) ; i < (unsigned int ) (__route.size () * to) ; i ++)
|
||||
{
|
||||
len += Graph :: distance (__route [i], __route [(i + 1) % Graph :: size ()]) ;
|
||||
}
|
||||
|
||||
__route.fitness (len) ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
/*
|
||||
* <route.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sébastien Cahon, Thomas Legrand
|
||||
* Sébastien Cahon, Jean-Charles Boisson
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
|
|
@ -38,7 +38,11 @@
|
|||
#define route_h
|
||||
|
||||
#include <eoVector.h>
|
||||
#include <eoScalarFitness.h>
|
||||
|
||||
typedef eoVector <float, unsigned> Route ; // [Fitness (- length), Gene (city)]
|
||||
// A float that has to be minimized.
|
||||
typedef eoScalarFitness< float, std::greater<float> > tspFitness ;
|
||||
|
||||
typedef eoVector <tspFitness, unsigned int> Route ; // [Fitness (length), Gene (city)]
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
/*
|
||||
* <route_eval.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sébastien Cahon, Thomas Legrand
|
||||
* Sébastien Cahon, Jean-Charles Boisson
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
|
|
@ -37,12 +37,15 @@
|
|||
#include "route_eval.h"
|
||||
#include "graph.h"
|
||||
|
||||
void RouteEval :: operator () (Route & __route) {
|
||||
|
||||
float len = 0 ;
|
||||
|
||||
for (unsigned i = 0 ; i < Graph :: size () ; i ++)
|
||||
len -= Graph :: distance (__route [i], __route [(i + 1) % Graph :: size ()]) ;
|
||||
|
||||
void RouteEval :: operator () (Route & __route)
|
||||
{
|
||||
|
||||
float len = 0.0 ;
|
||||
|
||||
for (unsigned int i = 0 ; i < Graph :: size () ; i ++)
|
||||
{
|
||||
len += Graph :: distance (__route [i], __route [(i + 1) % Graph :: size ()]) ;
|
||||
}
|
||||
|
||||
__route.fitness (len) ;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue