Commit 5f163f16 authored by Ulysse Beaugnon's avatar Ulysse Beaugnon

Added distance plots

parent 8bc989a6
......@@ -172,17 +172,14 @@ int Graph::UpdateLowRoutes(double& avgDistance, double unreachable, double* arit
for(int i = 0; i<size; i++)
{
routesResult r = results[i];
if((adjacency[i].size() > 16 && adjacency[i].size() < 26) || round % 4 == 0)
while(!r.toDelete.empty())
{
nUpdated++;
while(!r.toDelete.empty())
{
RemoveEdge(i, r.toDelete.top());
r.toDelete.pop();
}
RemoveEdge(i, r.toDelete.top());
r.toDelete.pop();
}
SaturateNode(i);
nUpdated++;
avgDistance += r.avgDistance*(size-r.unreachable);
avgDistanceWeight += size-r.unreachable;
......@@ -258,3 +255,18 @@ void Graph::KillMachines(float proportion)
}
}
}
void Graph::Reboot(double proba)
{
uniform_real_distribution<double> d(0.0, 1.0);
for(int i=0; i<size; i++)
if(d(generator) <= proba)
{
for(int j : generated[i])
RemoveEdge(i, j);
for(int j : adjacency[i])
RemoveEdge(j, i);
SaturateNode(i);
}
}
\ No newline at end of file
......@@ -16,12 +16,10 @@ void simulate(int size, int k, int maxPeer, int seed, const Latency& latency, co
Graph graph(size, k, maxPeer, rng, latency);
cout << "\r" << 0 << "/" << 300;
cout << "\r" << 0 << "/" << 3000;
cout.flush();
long long int nUpdates = 0;
for(int i=0; i<300; i++)
for(int i=0; i<3000; i++)
{
/*for(float a=0.05; a<1; a+=0.05)
{
......@@ -35,9 +33,10 @@ void simulate(int size, int k, int maxPeer, int seed, const Latency& latency, co
double avgDistance, unreachable;
double arityDistrib[31], bcArity[31];
nUpdates += graph.UpdateLowRoutes(avgDistance, unreachable, arityDistrib, bcArity, 1, i);
graph.Reboot(1.0/(1036.8 + 1.0));
graph.UpdateLowRoutes(avgDistance, unreachable, arityDistrib, bcArity, 1, i);
fprintf(output, "%d,%f, %lld", i, avgDistance, nUpdates);
fprintf(output, "%d,%f", i, avgDistance);
for(int j=0; j<=30; j++)
fprintf(output, ",%f", arityDistrib[j]);
for(int j=0; j<=30; j++)
......@@ -46,7 +45,7 @@ void simulate(int size, int k, int maxPeer, int seed, const Latency& latency, co
fflush(output);
fsync(fno);
cout << "\r" << i+1 << "/" << 300;
cout << "\r" << i+1 << "/" << 3000;
cout.flush();
}
......@@ -78,4 +77,4 @@ int main(int argc, char** argv)
threads[i].get();
return 0;
}
\ No newline at end of file
}
......@@ -34,6 +34,7 @@ public:
~Graph() { delete[] adjacency; delete[] generated; };
int UpdateLowRoutes(double& avgDistance, double unreachable, double* arityDistrib, double* bcArity, int nRefresh, int round);
double GetUnAvalaibility();
void Reboot(double proba);
void KillMachines(float proportion);
private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment