commit 7b152fea05f15aaffea1e46f89b17f6bd53ebc29
parent 045d85da7aafd30360ed0f1dce919b128eacd4dd
Author: Marc Jeanmougin <marc@jeanmougin.fr>
Date: Sat, 5 Apr 2014 16:54:35 +0200
Merge branch 'master' of ssh://gitorious.org/ens-ulm-1/ens-ulm-1
Conflicts:
contest/mc/mc2.cpp
Diffstat:
3 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/contest/louis/ameliore.cpp b/contest/louis/ameliore.cpp
@@ -36,7 +36,7 @@ public:
for(int i = 0 ; i < 8 ; i++ )
for(int c = 0 ; c <= rand()%(temps+1) ; c++ )
{
- const int id = rand() % cibles[i].size();
+ const int id = (rand() % (cibles[i].size()-1))+1;
if(rand()%(temps+1)==1)
cibles[i][id] = rand()%cibles[i].size();
else
@@ -54,7 +54,7 @@ void ameliore_louis(vector<int> c[])
{
sol_louis r_best(c) ;
double temp = 1000 * 1000 ;
- const int nb_iter_max = 100*1000 ;
+ const int nb_iter_max = 2*1000 ;
//for( int i = 0 ; i < 10 ; i++ )
{
temp = 20 ;
@@ -80,5 +80,9 @@ void ameliore_louis(vector<int> c[])
nb_iter++;
}
}
- affiche_sortie(r_best.cibles);
+ vector<int> r[8];
+ for(int i = 0 ; i < 8 ; i++ )
+ r[i] = complete(r_best.cibles[i]);
+ tronque_solution(r,0);
+ affiche_sortie(r);
}
diff --git a/contest/louis/louis.cpp b/contest/louis/louis.cpp
@@ -12,7 +12,7 @@ short use[N_SOMMETS_MAJ][N_SOMMETS_MAJ] ;
int cur_dist[N_SOMMETS_MAJ] ;
void init_use()
{
- FILE * f = fopen("dist","rb");
+ FILE * f = fopen("dist2","rb");
if(!f)
fprintf(stderr,"dist not found !");
fread(use,sizeof(use),1,f);
@@ -65,7 +65,8 @@ int go_to( int depart, int arrivee)
vector<int> complete ( vector<int> & c)
{
vector<int> r ;
- r.push_back(c[0]); fprintf(stderr,"complete : %d\n",r.back());
+ r.push_back(c[0]);
+ // fprintf(stderr,"complete : %d\n",r.back());
for(size_t i = 0 ; i+1 < c.size() ; i++ )
{
while(r.back() != c[i+1])
diff --git a/contest/mc/mc2.cpp b/contest/mc/mc2.cpp
@@ -1,4 +1,5 @@
#include "../louis/louis.cpp"
+#include "../louis/ameliore.cpp"
#include "prune.cpp"
vector<int> sortie[8];
@@ -9,7 +10,7 @@ int choose(vector<int> sss,vector<bool> eee,int pt){
int somme=0;
for(int aaaa=0;aaaa<adj[pt].size();aaaa++){
if(eee[id_arete[make_pair(pt,adj[pt][aaaa])]])p[aaaa]=1;
- else p[aaaa]=1000*adj[adj[pt][aaaa]].size()*sss[adj[pt][aaaa]];
+ else p[aaaa]=1000*adj[adj[pt][aaaa]].size()/sss[adj[pt][aaaa]]/distance[id_arete[make_pair(pt,adj[pt][aaaa])]];
//else if(sss[adj[pt][aaaa]])p[aaaa]=200;
// else p[aaaa]=10000;
somme+=p[aaaa];
@@ -60,7 +61,6 @@ int main(){
srand(time(NULL));
lecture_entree();
init_use();
-printf("%d\n",n_vehicules);
int bsol=0;
@@ -76,11 +76,9 @@ sortie[i].clear();
int pt=s_depart;
sortie[i].push_back(s_depart);
sortie[i].push_back(8255);
-
+ sortie[i].push_back(rand()%n_sommets);
sortie[i]=complete(sortie[i]);
- int ttt=evalue_solution(sortie[i])[sortie[i].size()];
-
- completion_hasard(ttt,i,sss,eee);
+ completion_hasard(evalue_solution(sortie).at(i),i,sss,eee);
}
int aaa=score_solution(sortie);
if( aaa > bsol){ for(int i=0;i<n_vehicules;i++)best_sol[i]=sortie[i]; bsol=aaa;fprintf(stderr,"%d\n",aaa);}
@@ -102,12 +100,13 @@ for(int i=0;i<n_vehicules;i++){
for(int j=0;j<bs2[i].size();j++){printf("%d\n",bs2[i][j]);}
}
*/
-
+ameliore_louis(bs2);
+/*
for(int i=0;i<n_vehicules;i++){
printf("%d\n",best_sol[i].size());
for(int j=0;j<best_sol[i].size();j++){printf("%d\n",best_sol[i][j]);}
}
-
+*/