Outline CAS Project Presentation Aim of the project...

11
CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze dell’Informazione, Università di Bologna Outline ! Aim of the project ! ResourceWorld ! Project Specifications ! Peersim guidelines ! Clustering Coefficient and Average Path Length Aim of the project ! The aim of this project is to take an existing protocol for P2P networks called ResourceWorld ! To propose 2 modifications of such protocol ! Analyze the results obtained with this two modifications in order to understand the global emergent mechanism ResourceWorld

Transcript of Outline CAS Project Presentation Aim of the project...

Page 1: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

CAS Project Presentation

Andrea Marcozzi

12/04/2007

Dipartimento di Scienze

dell’Informazione, Università di

Bologna

Outline

! Aim of the project

! ResourceWorld

! Project Specifications

! Peersim guidelines

! Clustering Coefficient and Average Path

Length

Aim of the project

! The aim of this project is to take an

existing protocol for P2P networks

called ResourceWorld

! To propose 2 modifications of such

protocol

! Analyze the results obtained with this

two modifications in order to understand

the global emergent mechanism

ResourceWorld

Page 2: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

ResourceWorld Introduction

! In several peer-to-peer applications, systemsrequire their member nodes to behave in asocially beneficial way

! This approach is in contrast with the principle ofclassical individual rationality that states agentsshould select actions that maximize theirindividual utility

! ResourceWorld is a simple locally adaptiveprotocol that claim to produce socially rationaloutcomes through a process of self-organisationeven though nodes only act on their own utilityvalues

The ResourceWorld scenario

! We consider a situation in which there arepopulations of peer nodes that can storeand serve some number of resources (i.e.:Files)

! Each node has its own single nativeresource that it wishes to serve to someusers community achieving somespecified service level

! In each interaction, nodes get anappropriate utility

The ResourceWorld Model (I)

! Let’s consider a P2P overlay network in whicheach node has the following state:

– Strategy bit, A ! {0,1} (indicates if the nodeis altruistic or not)

– Skill, S ! {1,2,3,4,5} (indicates the resourceof the node)

– Neighbour list (max 20 neighbours)

! Periodically, with probability 0.5, nodes receivea request to be completed (Job, J !{1,2,3,4,5})

! Periodically, with a small probability, tworandom nodes are selected and their utilitiesare compared (SLAC)

System architecture

0. Newscast

(Peer Sampling Service)

1. SLACER

2. RW

(Application)

utility

Random node

(movement)

Cooperative

neighbor

Three protocol: Newscast,

SLACER, ResourceWorld (RW)

Page 3: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

The ResourceWorld Model (II) ResourceWorld Pseudo-code

At each cycle with probability 0.5:

each node i receives a certain job

if ( Si == job) then Ui += 1;

else

if ( STRATi == true ) then

for all neighbors j with random order

if ( Sj == job) then

Ui += -0.25;

Uj += 1;

With probability 0.2 the SLAC algorithm takes place

Experiments (parameters)! Peersim (http://peersim.sf.net)

! SLAC

! Network size: 4000 nodes

! Network degree: 20

! Initial topology: random

! Single node initialization:

– Strategy bit: 0 (defect)

– Skill: random

! Mutation: (MRT = 0.01; MRS = 0.005)

! Payoffs:

– Benefits from 0.1 to 2.0 by 0.1 steps

– Costs from 0.1 to 2.0 by 0.1 steps

! 10 runs for each experiments meaning

20 X 20 X 10 runs

Experiments (results) (I)

The utility measure we used to evaluate the

performances of the model is the Pcj : the

percentage of completed jobs

We found that to obtain a Pcj > 80%, the

Benefit payoff must be greater or equal

than the Cost payoff

When Cost > Benefit, we obtain a very low Pcj

When Cost = Benefit, the system takes longer

to reach Pcj > 80%

Page 4: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

Experiments (results) (II)

ResourceWorld Conclusions

! We took the ResourceWorld model and

modified both benefit and cost utilities to

explore a large space of possible values

! In each case we checked if the protocol

maximized the collective utility or not

Project Specification

Implementation part

! Define 2 new mechanism of “Jobpassing”

– Pass only to altruistic nodes

– Job executed by altruistic nodes only

– Ordered visit of neighbors list

– Recursive job passing (small degree)

– …

! The global emergent mechanism mustbe understood

– Results must be compared and explainedwhatever they are

Page 5: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

Beware not to cheat!

! Everything is based on local knowledge

! Other nodes’ state known only when

interacting with them

! It’s forbidden to chose nodes directly

from the network structure

– No global knowledge

– Only local views available for each node

Elaboration of the Data

! Examine the effects of the newproposed mechanisms (throughObservers):

– Cooperation• Cooperation level (Percentage of coop nodes)

• Percentage of completed jobs (Pcj)

• Time for cooperation and Pcj

– Topology• Clustering coefficient (CC)

• Average path length (APL)

• Network Snapshots

Elaboration of the Data (II)

! Examine initial settings effects on

performances

– Network size

– Network degree

– Skills number

– SLACER dropping parameter (W)

Provided code

! The package casProject provides:– Slacer

• Slacer protocol

• SLACERapp must be extended

• BooleanStrategyObserver (cooperating nodes)

• SlacerGraphPrinter (observer for snapshots)

– casProjectApp• casProject is the code you must write (extends

SLACERapp)

• casProjectObserver (Percentage of cooperating nodes)

! Additional Classes– If you need some additional mechanism feel free to

implement and use it!• New specific observer

Page 6: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

Peersim Guidelines

Implementing new classes

! All the new code should be included in

classes implementing one (or more) of

the main peersim interfaces

– CDProtocol

– Linkable

– Control

Implementing CDProtocol interface

! peersim.cdsim.CDProtocol provides asingle method to describe protocolactions

– Void nextCycle (Node node, intprotocolID);

•node is the current running node

•protocolID is the protocol id in the currentnode protocol stack

– In nextCycle() any action performed by eachnode at each simulation cycle should beimplemented

Implementing Linkable interface

! peersim.core.Linkable provides abstract

methods for node view management

– public int degree();

– public Node getNeighbor(int i);

– public boolean addNeighbor(Node neighbor);

– public boolean contains(Node neighbor);

Page 7: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

Implementing Control interface

! peersim.core.Control provides a single

method to describe global network

actions

– boolean execute();

! In execute(); any action performed at

each simulation cycle for global

management

Defining configuration parameters

! It is possible that components need

parameters to be passed by

configuration file

! peersim.config.Configuration provides

utilities to read parameters from

configuration file

– Numeric values

CDProtocol implementation example

public class casProject extends SLACERapp{

// configuration parameter definition

public static final String PAR_SKILLS = "numskills";

public casProject(String prefix) {

numSkills=Configuration.getInt(prefix+"."+PAR_SKILLS,5);

}

public void nextCycle( Node node, int protocolID ){

// protocol behavior

}

Control implementation examplepublic class casProjectObserver implements Control

{

public static final String PAR_PROT = "protocol";

public casProjectObserver(String name){

this.name = name;

pid = Configuration.getInt(name + "." + PAR_PROT);

}

public boolean execute(){

IncrementalStats queries=new IncrementalStats();

IncrementalStats completed=new IncrementalStats();

for (int i = 0; i<Network.size(); i++){

casProject protocol = (casProject) Network.get(i).getProtocol(pid);

queries.add(protocol.queries);

completed.add(protocol.completed);

}

double ratioComp=((double)completed.getSum()) / queries.getSum();

System.out.println(ratioComp);

Return false;

}

Page 8: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

Configuration File (I)#random.seed 1150540268549

simulation.cycles 300

network.Shuffle

network.size 4000

protocol.0 example.newscast.SimpleNewscast

protocol.0.cache 20

protocol.1 slacer.Slacer

protocol.1.degree 20

protocol.1.linkable 0

protocol.1.application 2

protocol.1.reprprob 0.20

protocol.1.mutation 1

protocol.1.tagmutation 0.01

protocol.2 slacer.casProjectApp.casProject

protocol.2.linkable 1

protocol.2.numskills 5

protocol.2.queryprob 0.5

protocol.2.completed 1

protocol.2.processed -0.2

General settings

Protocols settings

Configuration File (II)init.0 peersim.dynamics.WireKOut

init.0.protocol 0

init.0.k 20

init.1 slacer.SlacerInitializer

init.1.protocol 1

init.1.isolateprob 1

init.1.copyprob 1

init.2 slacer.casProjectApp.casProjectStrategyInitializer

init.2.protocol 2

init.2.quantity 0

Init.2.numskills 5

Init.2.skill_m 0.001

Init.2.strat_m 0.001

init.3 peersim.dynamics.WireKOut

init.3.protocol 1

init.3.k 20

Init.3.undirected

control.ob0 slacer.BooleanStrategyObserver

control.ob0.protocol 2

control.ob1 slacer.casProjectApp.casProjectObserver

control.ob1.protocol 2

Control settings:

initialization

Configuration File (II)

control.ob0 slacer.BooleanStrategyObserver

control.ob0.protocol 2

control.ob1 slacer.casProjectApp.casProjectObserver

control.ob1.protocol 2

control.ob2 slacer.SlacerGraphPrinter

control.ob2.protocol 1

control.ob2.outf RWplot/

control.ob2.format dot

control.ob2.period 20

control.ob4 peersim.reports.GraphStats

control.ob4.protocol 1

control.ob4.period 50

control.ob4.nl 100

control.ob4.nc 100

Control settings:

Observers

Working with Peersim

Page 9: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

Getting Peersim

! Peersim is available at

http://peersim.sourceforge.net

! Java 5 must be used, SunJava

JDK5.0(J2SE 1.5.0)

Compiling and Launching

! The easiest way for compiling peersim is

through this command:

javac -cp .:jep-2.3.0.jar:djep-1.0.0.jar `find . -name "*.java"`

To run a simulation the command you should

use is:

java -cp .:peersim-1.0.1.jar:jep-2.3.0.jar:djep-1.0.0.jar

peersim.Simulator slacer/casProjectApp/RW-conf1

Plotting the results

! Log files can easily be plotted using

Gnuplot or dragging them into Excel

! For the Network Snapshots, an easy

linux utility called Neato can be used

! For further information on Gnuplot and

Neato go to:– http://www.gnuplot.info/documentation.html

– http://www.graphviz.org/Documentation/neatoguide.pdf

Clustering Coefficient and

Average Path Length

Page 10: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

Clustering Coefficient (CC)

! The CC for node i is the proportion of:

– links between the vertices within itsneighbourhood

– the number of links that could possiblyexist in i neighborhood

! If the graph is directed the number of

possible links is:

! It the graph is undirected the number

of possible links is:

! Network CC:

– Is the average of every node’s CC

!

ki(k

i"1)

!

ki(k

i"1)

2

Average Path Length (APL)

! Path length between node i and node j

– Minimum number of hops needed to gofrom i to j

– If j is a neighbor of i, the path length is 1

! APL is defined as the average number

of steps along the shortest paths for all

possible pairs of network nodes

Small World Networks

! A network with high CC and lo APL is said tobe a Small World Network

! A Small World Network is a class of randomgraphs where most nodes are not neighborsof one another, but most nodes can bereached from every other by a small numberof hops or steps

! Examples– People acquaintance (social networks)

– Internet connectivity

– Gene networks

Calculating CC and APL with

Peersim

! Use the component:

peersim.reports.GraphStats

! Parameters:

– Protocol: the id of the protocol on which calculate

the CC and APL

– Period: every how many cycles

– nl: number indicating the dimension of the sample

of nodes on which to calculate the APL

– nc: number indicating the dimension of the sample

of nodes on which to calculate the APL

Page 11: Outline CAS Project Presentation Aim of the project ...babaoglu/courses/cas06-07/slides/project.pdf · CAS Project Presentation Andrea Marcozzi 12/04/2007 Dipartimento di Scienze

If you need any help

! Peersim resources page:http://peersim.sf.net

! These slides on:http://www.cs.unibo.it/~marcozzi

! For any questions:[email protected]

! Find me: Dip. Scienzedell’Informazione, Lab C, floor -1

References

! Hales, D. and Arteconi, S. (2006) Slacer: A self-organizingprotocol for coordination in p2p networks. IEEE IntelligentSystems

! Hales, D. (2004) From selfish nodes to cooperativenetworks - emergent link based incentives in peer-to-peernetworks. In Proc. of the 4th IEEE InternationalConference on Peer-to-Peer Computing (P2P2004). IEEEComputer Soc. Press

! Marcozzi, A. and Hales, D. (2006) Emergent SocialRationality in a Peer-to-Peer System. Technical ReportUBLCS-2006-23, University of Bologna, Department ofComputer Science