[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[freehaven-cvs] expand potential values for alice dist strategy
Update of /home/freehaven/cvsroot/doc/e2e-traffic/src
In directory moria.mit.edu:/tmp/cvs-serv13042
Modified Files:
rng.cpp rng.h simmain.cpp trials.cpp trials.h
Log Message:
expand potential values for alice dist strategy
Index: rng.cpp
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/rng.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rng.cpp 22 Dec 2003 03:58:20 -0000 1.7
+++ rng.cpp 22 Dec 2003 04:37:33 -0000 1.8
@@ -5,6 +5,7 @@
#include <math.h>
#include "rng.h"
#include <boost/random.hpp>
+#include <fstream.h>
//
// If we're prototyping, use a lagged finonacci generator: it's fastest.
@@ -40,6 +41,25 @@
return state.norm();
}
+#define SEEDFILE "/dev/urandom"
+
+void
+seed_rng()
+{
+ // We use the default seed for repeatable results.
+ /*
+#define SEEDTYPE unsigned long
+ SEEDTYPE u;
+ ifstream ifs("SEEDFILE");
+ for (int i = 0; i < 20; ++i) {
+ ifs.get((char*)&u,sizeof(u));
+ data[i] = (SEEDTYPE) u;
+ state.rng._
+ }
+ ifs.close();
+*/
+}
+
CumulativeDist::CumulativeDist(const std::vector<double> &dist)
: prob(dist), cumDist(dist.size())
{
Index: rng.h
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/rng.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rng.h 22 Dec 2003 03:58:20 -0000 1.7
+++ rng.h 22 Dec 2003 04:37:34 -0000 1.8
@@ -14,6 +14,8 @@
// mean 0.0 and std deviation 1.0
double normal_rng();
+void seed_rng();
+
// Return a pseudorandom number x such that 0 <= x < m
inline int rng(int m) { return (int) (rng()*m); }
Index: simmain.cpp
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/simmain.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- simmain.cpp 22 Dec 2003 03:58:20 -0000 1.10
+++ simmain.cpp 22 Dec 2003 04:37:34 -0000 1.11
@@ -55,17 +55,20 @@
void trial2()
{
+ const double pMsgAlice[] = { 0.6, 0.9, 0.99 };
+
// attack with small-worlds network and unknown background.
for (int batchSize = 5; batchSize < 5000; incBatchSize(batchSize)) {
for (int nRecips = 32; nRecips <= 2000000; nRecips *= 2) {
for (int nAR = 1; (nAR <= 1024 && nAR < nRecips); nAR *= 2) {
- for (int pMA = 6; pMA <= 9; pMA += 3) {
- for (int AISW=0; AISW <= 1; ++AISW) {
+ for (int pMA = 0; pMA <= 2; ++pMA) {
+ for (int AISW=0; AISW <= 2; ++AISW) {
UnkBGBatchTrialSpec s;
s.setNRecipients(nRecips).setNAliceRecipients(nAR)
.setBatchSize(batchSize).setPaddingLevel(0).setCutoff(1000000)
- .setAliceIsSmallworld(AISW).setExpMsgDist(true)
- .setPMsgAlice(pMA/10.0)
+ .setAliceIsSmallworld(AISW>0).setWeightAlice(AISW==2)
+ .setExpMsgDist(true)
+ .setPMsgAlice(pMsgAlice[pMA])
.setPDummyAlice(0.0);
if (nRecips > 2000)
s.setGranularity(100);
@@ -99,6 +102,7 @@
std::cout << "no args given";
return -1;
}
+ seed_rng();
std::string trialname(v[1]);
Index: trials.cpp
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/trials.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- trials.cpp 22 Dec 2003 03:58:20 -0000 1.8
+++ trials.cpp 22 Dec 2003 04:37:34 -0000 1.9
@@ -141,9 +141,13 @@
else
o << "\"uniform";
if (expMsgDist)
- o << "-geometric\"";
+ o << "-geometric";
else
- o << "-uniform\"";
+ o << "-uniform";
+ if (weightAlice)
+ o << "-weighted\"";
+ else
+ o << "\"";
o << ",pMessage=" << pMsgAlice << ",pDummy=" << pDummyAlice
<< ",paddingLevel="<< paddingLevel << ")" << std::endl;
// XXX paddingLevel is wrong, so include it when it's right.
@@ -162,7 +166,7 @@
bool expMsgDist,
double pMsgA, double pDA,
int padding, double pOnline,
- int g, int c)
+ int g, int c, bool weightAlice)
{
GeometricDist aMsgsE(1.0-pMsgA);
GeometricDist aDummiesE(1.0-pDA);
@@ -174,7 +178,7 @@
std::vector<int> *aliceRecipients = 0;
getCommunicationLinks(aliceRecipDist, backgroundTrafficDist,
aliceRecipients,
- nAR, nR, 0, smallworldAlice);
+ nAR, nR, weightAlice, smallworldAlice);
truth = *aliceRecipients;
if (expMsgDist)
Index: trials.h
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/trials.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- trials.h 22 Dec 2003 03:58:20 -0000 1.7
+++ trials.h 22 Dec 2003 04:37:34 -0000 1.8
@@ -132,7 +132,7 @@
friend class UnkBGBatchTrial;
protected:
int nRecipients, nAliceRecipients, batchSize;
- bool aliceIsSmallworld, expMsgDist, ais_set, emd_set;
+ bool aliceIsSmallworld, expMsgDist, weightAlice, ais_set, emd_set;
double pMsgAlice, pDummyAlice, pOnline;
int paddingLevel, granularity;
int cutoff;
@@ -142,6 +142,7 @@
nRecipients = nAliceRecipients = batchSize = 0;
pMsgAlice = pDummyAlice = -1;
ais_set = emd_set = false;
+ weightAlice = false;
}
UnkBGBatchTrialSpec &setNRecipients(int n) { nRecipients = n; return *this; }
UnkBGBatchTrialSpec &setNAliceRecipients(int n) { nAliceRecipients = n; return *this; }
@@ -154,6 +155,7 @@
aliceIsSmallworld = b; ais_set = true; return *this; }
UnkBGBatchTrialSpec &setExpMsgDist(bool b) {
expMsgDist = b; emd_set = true; return *this; }
+ UnkBGBatchTrialSpec &setWeightAlice(bool b) { weightAlice = b; return *this;}
UnkBGBatchTrialSpec &setPMsgAlice(double p) { pMsgAlice = p; return *this; }
UnkBGBatchTrialSpec &setPDummyAlice(double p) { pDummyAlice = p; return *this; }
@@ -173,15 +175,16 @@
int batchSize, bool aliceIsSmallworld,
bool expMsgDist, // if true, alice sends N msgs on exp. dist
double pMsgAlice, double pDummyAlice,
- int paddingLevel=0, // if true, and if alice sends dummies in a round, she sends fillDummies messages total.
- double pOnline=1.0,
- int granularity=5, int cutoff=1000000000);
+ int paddingLevel, // if true, and if alice sends dummies in a round, she sends fillDummies messages total.
+ double pOnline,
+ int granularity, int cutoff, bool weightAlice);
public:
UnkBGBatchTrial(const UnkBGBatchTrialSpec &s) {
s.assertFilled();
init(s.nRecipients, s.nAliceRecipients, s.batchSize,
s.aliceIsSmallworld, s.expMsgDist, s.pMsgAlice, s.pDummyAlice,
- s.paddingLevel, s.pOnline, s.granularity, s.cutoff);
+ s.paddingLevel, s.pOnline, s.granularity, s.cutoff,
+ s.weightAlice);
}
~UnkBGBatchTrial();
***********************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe freehaven-cvs in the body. http://freehaven.net/