commit ba3615db7a8d458ce1d5b25a408bc58b02361c15
parent 27582fde3a9fb3397f0d5c4aafaeab68b99f9808
Author: Marc Jeanmougin <marc@jeanmougin.fr>
Date: Sat, 5 Apr 2014 15:54:32 +0200
Merge branch 'master' of ssh://gitorious.org/ens-ulm-1/ens-ulm-1
Conflicts:
contest/louis/louis.cpp
Diffstat:
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/contest/louis/ameliore.cpp b/contest/louis/ameliore.cpp
@@ -31,15 +31,21 @@ public:
for(int i = 0 ; i < 8 ; i++ )
cibles[i] = o.cibles[i];
}
- void update()
+ void update(int temps)
{
for(int i = 0 ; i < 8 ; i++ )
- {
- const int id = rand() % cibles[i].size();
- const int n = cibles[i][id];
- int v = adj[n][rand()%adj[n].size()] ;
- cibles[i][id] = v;
- }
+ for(int c = 0 ; c <= rand()%(temps+1) ; c++ )
+ {
+ const int id = rand() % cibles[i].size();
+ if(rand()%(temps+1)==1)
+ cibles[i][id] = rand()%cibles[i].size();
+ else
+ {
+ const int n = cibles[i][id];
+ int v = adj[n][rand()%adj[n].size()] ;
+ cibles[i][id] = v;
+ }
+ }
note();
}
};
@@ -51,18 +57,18 @@ void ameliore_louis(vector<int> c[])
const int nb_iter_max = 100*1000 ;
//for( int i = 0 ; i < 10 ; i++ )
{
- temp = 1000 * 1000 ;
+ temp = 20 ;
sol_louis cur(c);
- cur.update();
+ cur.update(20);
sol_louis best = cur ;
int nb_iter = 0;
while( nb_iter < nb_iter_max )
{
if(nb_iter %200 == 0)
- fprintf(stderr,"cur_score %d[%d] | %d | %d \n",cur.score,cur.cibles[0].size(),r_best.score);
+ fprintf(stderr,"cur_score %d[%d] | %d | %lf \n",cur.score,cur.cibles[0].size(),r_best.score,temp);
cur = best;
- cur.update();
+ cur.update(temp);
if( cur.score > best.score)
{
@@ -70,7 +76,7 @@ void ameliore_louis(vector<int> c[])
if( best.score > r_best.score )
r_best = best;
}
- temp *= 0.9935 ;
+ temp *= 0.9998 ;
nb_iter++;
}
}
diff --git a/contest/louis/dist2.gz b/contest/louis/dist2.gz
Binary files differ.