[freenet-cvs] r17755 - trunk/freenet/src/freenet/node/simulator

2008-02-09 Thread [email protected]
Author: toad
Date: 2008-02-09 14:57:29 + (Sat, 09 Feb 2008)
New Revision: 17755

Modified:
   trunk/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java
   trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
   trunk/freenet/src/freenet/node/simulator/RealNodeTest.java
Log:
Add option to always link neighbours.
Use the code for RealNodeRoutingTest too.

Modified: 
trunk/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java
===
--- trunk/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java   
2008-02-09 14:52:30 UTC (rev 17754)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java   
2008-02-09 14:57:29 UTC (rev 17755)
@@ -109,8 +109,8 @@
 Logger.normal(RealNodeRoutingTest.class, "Created "+totalNodes+" 
nodes");

 // Now link them up
-makeKleinbergNetwork(subnetA, true /* make it easy, we're not testing 
swapping here */, DEGREE);
-   makeKleinbergNetwork(subnetB, true /* make it easy, we're not 
testing swapping here */, DEGREE);
+makeKleinbergNetwork(subnetA, true /* make it easy, we're not testing 
swapping here */, DEGREE, false);
+   makeKleinbergNetwork(subnetB, true /* make it easy, we're not 
testing swapping here */, DEGREE, false);

 Logger.normal(RealNodeRoutingTest.class, "Added small-world links, 
weakly connect the subnets");


Modified: trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
===
--- trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java   
2008-02-09 14:52:30 UTC (rev 17754)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java   
2008-02-09 14:57:29 UTC (rev 17755)
@@ -28,9 +28,10 @@
  * 
  * Then run some node-to-node searches.
  */
-public class RealNodeRoutingTest {
+public class RealNodeRoutingTest extends RealNodeTest {

 static final int NUMBER_OF_NODES = 50;
+static final int DEGREE = 5;
 static final short MAX_HTL = (short)7;

 public static void main(String[] args) throws FSParseException, 
PeerParseException, InvalidThresholdException, NodeInitException, 
ReferenceSignatureVerificationException {
@@ -54,27 +55,7 @@
 }
 Logger.normal(RealNodeRoutingTest.class, "Created "+NUMBER_OF_NODES+" 
nodes");
 // Now link them up
-// Connect the set
-for(int i=0;i "+nodeB);
-Node a = nodes[nodeA];
-Node b = nodes[nodeB];
-a.connect(b);
-b.connect(a);
-}
+makeKleinbergNetwork(nodes, false, DEGREE, true);

 Logger.normal(RealNodeRoutingTest.class, "Added random links");


Modified: trunk/freenet/src/freenet/node/simulator/RealNodeTest.java
===
--- trunk/freenet/src/freenet/node/simulator/RealNodeTest.java  2008-02-09 
14:52:30 UTC (rev 17754)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeTest.java  2008-02-09 
14:57:29 UTC (rev 17755)
@@ -21,7 +21,7 @@
/*
 Borrowed from mrogers simulation code (February 6, 2008)
 */
-   static void makeKleinbergNetwork (Node[] nodes, boolean idealLocations, 
int degree)
+   static void makeKleinbergNetwork (Node[] nodes, boolean idealLocations, 
int degree, boolean forceNeighbourConnections)
{
// First set the locations up so we don't spend a long time 
swapping just to stabilise each network.
double div = 1.0 / (nodes.length + 1);
@@ -30,6 +30,12 @@
nodes[i].setLocation(loc);
loc += div;
}
+   if(forceNeighbourConnections) {
+   for(int i=0;i

[freenet-cvs] r17755 - trunk/freenet/src/freenet/node/simulator

2008-02-09 Thread toad
Author: toad
Date: 2008-02-09 14:57:29 + (Sat, 09 Feb 2008)
New Revision: 17755

Modified:
   trunk/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java
   trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
   trunk/freenet/src/freenet/node/simulator/RealNodeTest.java
Log:
Add option to always link neighbours.
Use the code for RealNodeRoutingTest too.

Modified: 
trunk/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java
===
--- trunk/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java   
2008-02-09 14:52:30 UTC (rev 17754)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeNetworkColoringTest.java   
2008-02-09 14:57:29 UTC (rev 17755)
@@ -109,8 +109,8 @@
 Logger.normal(RealNodeRoutingTest.class, "Created "+totalNodes+" 
nodes");

 // Now link them up
-makeKleinbergNetwork(subnetA, true /* make it easy, we're not testing 
swapping here */, DEGREE);
-   makeKleinbergNetwork(subnetB, true /* make it easy, we're not 
testing swapping here */, DEGREE);
+makeKleinbergNetwork(subnetA, true /* make it easy, we're not testing 
swapping here */, DEGREE, false);
+   makeKleinbergNetwork(subnetB, true /* make it easy, we're not 
testing swapping here */, DEGREE, false);

 Logger.normal(RealNodeRoutingTest.class, "Added small-world links, 
weakly connect the subnets");
 

Modified: trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java
===
--- trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java   
2008-02-09 14:52:30 UTC (rev 17754)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeRoutingTest.java   
2008-02-09 14:57:29 UTC (rev 17755)
@@ -28,9 +28,10 @@
  * 
  * Then run some node-to-node searches.
  */
-public class RealNodeRoutingTest {
+public class RealNodeRoutingTest extends RealNodeTest {
 
 static final int NUMBER_OF_NODES = 50;
+static final int DEGREE = 5;
 static final short MAX_HTL = (short)7;
 
 public static void main(String[] args) throws FSParseException, 
PeerParseException, InvalidThresholdException, NodeInitException, 
ReferenceSignatureVerificationException {
@@ -54,27 +55,7 @@
 }
 Logger.normal(RealNodeRoutingTest.class, "Created "+NUMBER_OF_NODES+" 
nodes");
 // Now link them up
-// Connect the set
-for(int i=0;i "+nodeB);
-Node a = nodes[nodeA];
-Node b = nodes[nodeB];
-a.connect(b);
-b.connect(a);
-}
+makeKleinbergNetwork(nodes, false, DEGREE, true);
 
 Logger.normal(RealNodeRoutingTest.class, "Added random links");
 

Modified: trunk/freenet/src/freenet/node/simulator/RealNodeTest.java
===
--- trunk/freenet/src/freenet/node/simulator/RealNodeTest.java  2008-02-09 
14:52:30 UTC (rev 17754)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeTest.java  2008-02-09 
14:57:29 UTC (rev 17755)
@@ -21,7 +21,7 @@
/*
 Borrowed from mrogers simulation code (February 6, 2008)
 */
-   static void makeKleinbergNetwork (Node[] nodes, boolean idealLocations, 
int degree)
+   static void makeKleinbergNetwork (Node[] nodes, boolean idealLocations, 
int degree, boolean forceNeighbourConnections)
{
// First set the locations up so we don't spend a long time 
swapping just to stabilise each network.
double div = 1.0 / (nodes.length + 1);
@@ -30,6 +30,12 @@
nodes[i].setLocation(loc);
loc += div;
}
+   if(forceNeighbourConnections) {
+   for(int i=0;ihttp://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs