august 15 social networks module, matsim castasegna meeting, october 2007 jeremy hackney

24
Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Upload: susan-little

Post on 15-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Social networks module, MATSim Castasegna meeting, October 2007

Jeremy Hackney

Page 2: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Social interactions in transportation science

Long term

how travel technology and other factors influence contacts

Short term

how social contacts influence activity travel choices, mental maps, spatial discovery

Page 3: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Social interaction and travel behavior

Transportationsupply

Geography

Activity travelbehavior

Socialbehavior

Transportplanning

Sociology

Statisticalphysics

New areas

Page 4: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Features of the Social Network Module

Initial social network

Face to face interactions (spatial)

Modify social network

Other interactions (non-spatial)

Modify activity plans using social influence model

Re-evaluate plans

Calculate complex network statistics

Output movements, socializing, and statistics

Page 5: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Module API classes

EgoNetwork (Person.knowledge)• A map of affiliated Persons and

SocialLinks to them

CoolPlaces (Person.knowledge.map)• Facilities <> Activities

SocialNetwork• A map of EgoNetworks• Initialization, modification methods

Knowledge is modified (Person)• Ego Network• CoolPlaces

Interactors (SocialNetwork)• Spatial (face to face)• NonSpatial (not observed, not face to face)

SocialNetworkStatistics• Probes of social and travel behavior

Page 6: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

MATSim Controller

Load Data

Startup

Adjust Plans

Shutdown

.xml:

PlansWorld

NetworkFacilities

MatrixCensus

Etc.

Choose Strategyand Scoring

ReplanStrategy

Page 7: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Social Network Controller

Load Data

Startup

Adjust Plans

Shutdown

.xml:

PlansWorld

NetworkFacilities

MatrixCensus

Etc.

Choose Strategyand Scoring

InitializeSocialNet

SocialNetInteractions

Page 8: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

NOTE: Scoring

For quickly generating the social network, new evaluation of the new plans is necessary. However, precise traffic assignment is not important. MobSim in RePlanning can be a simple Euclidean distance. I have not programmed this, though.

Instead, I generate the social network quickly by iterating outside of the RePlanning loop. I have had to write my own scoring function (not a standard MATSim scoring function, which is tied to the replanning package).

IMPROVEMENT: I want to use the MATSim scoring package but I need a simpler plan scoring device than full assignment

Page 9: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

NOTE: Coupling

Partial relaxation technique used for socializing

Number of iterations of socializing before replanning is adjustable

This amounts to variable coupling strength between social network algorithm and travel algorithms

This will be very important, I think (see sample results)

Page 10: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

SNInteractions

SpatialInteractions

NonspatialInteractions

Link Removal

ExchangeKnowledge

Return SocialNet

Calculate andwrite outStatistics

Map agents <>activity locations

Agents interactat

locations

Write outSocial Net

(Negotiateactivities)

Wrapup

Input SocialNetand Plans

Page 11: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

SN Plan Adjustments

ProbeKnowledge

Change CopiedPlan

Copy SelectedPlan

Pick Activityof same Type

from Plan

Return Plans

Calculate andwrite outStatistics

Pick Typeof Activity

Pick Facilityof this Type

from Knowledge

Either Re-Assignor other Measure

Replaceits Facility

from Knowledge

EvaluateChange

Input SocialNetand Plans

Page 12: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Example "experiment"

Initial social network Erdös/Renyi

Face to face interactions Renew link or make friend

Modify social network Remove "old" links

Other interactions Exchange info about locations Introduce friends of friendsModify activity plans Switch secondary location

Re-evaluate plans Select: shortest total length

Calculate complex network statistics

Output movements, socializing, and statistics

Page 13: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Example "experiment"

1008 randomly generated agents0-3 random out of home activitiesRandom activity destinationsEqual time for each activity1 day

Network:

Sou

rce

: M

ich

ael B

alm

er 2

007

Page 14: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Sample Configuration File

<!-- ====================================================================== --><module name="socialnetwork" >

<param name="degree_saturation_rate" value="0" /><param name="edge_type" value="UNDIRECTED" /><param name="factype_ns"

value="leisure,shop,education,work,person" /><param name="fract_ns_interact" value="0." /><param name="fract_s_interact" value="1." /><param name="kbar" value="0" /><param name="max_sn_iter" value="100" /><param name="nonspatial_interactor_type" value="random" /><param name="num_ns_interactions" value="1" /><param name="outputDirSocialNets" value="C:/Documents and

<param name="prob_befriend" value="1." /><param name="replanning_interval" value="1000" /><param name="s_weights" value=".01,.05,.005,.05,.005" /><param name="socnetalgorithm" value="random" /><param name="socnetlinkremovalage" value="5" /><param name="socnetlinkremovalalgorithm"

value="random_link_age1" /><param name="socnetlinkremovalp" value="0.05" /><param name="socnetlinkstrengthalgorithm" value="constant" /><param name="spatial_interactor_type" value="random" /><param name="switch_weights" value="0.0,0.01,1.0,0.01,1.0" />

</module><!-- ====================================================================== -->

Page 15: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Analysis 1: Overview

Calculating statistics in MATSim run requires

JUNG library

Support libraries for JUNG

Costs time, information not used in run (analysis only)

Other statistics from output network (iterations) in Space-ASCII

Postprocess with R and Pajek

Postprocessing will be impossible with larger networks/bigger files

Page 16: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Analysis 2: Some output files

Agent file (nodes)

iter id homeid deg asd1 asd2 asd3 clust plantype numknown0 1 110 0 NaN 193.54 610.6 0.0 hlwhh 00 640 101 1 120.93 0.0 0.0 0.0 hhh 00 300 105 3 151.87 0.0 0.0 0.0 hhhhh 00 850 102 6 133.96 40.0 160.0 0.0 hehh 0...

Edge file (edges)

iter tlast tfirst dist egoid alterid purpose timesmet0 0 0 200.0 437 382 initialized 1...100 86 86 0.0 463 67 renewwork 1100 91 91 200.0 108 319 newrandomintro 1100 95 95 175.0 649 400 newleisure 1...

Graph file (statistics)

iter deg clust clustratio asd1 asd2 asd3 dyad_dist link_age meet_freq0 2.994 0.0019 0.672 125.961 127.277 383.09 127.54 0.0 Infinity1 3.049 0.0071 2.353 124.953 126.152 378.26 126.74 0.95 1.002 3.134 0.0143 4.616 123.515 125.556 374.77 125.32 1.87 0.50...

Page 17: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Analysis 3: Analysis tools

Network statistics:

MATSim /socialnets/stats R .pdf's single .pdf

Visualization:

MATSim /socialnets/pajek Pajek .svg

Movies of "Evolution" would be possible if I wrote out the format

KML is no problem except HUGE files and not sure what it shows

Automatic detection of clusters, different stats from MATSim would give more insight

Page 18: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

For output example

See Frontiers in Transportation presentation

(inserted 22.10.2007)

Model 1 no optimization of activities: only iterate social network (friends-of-friends meeting, spatial meeting)

Model 2 optimize secondary locations: each social network iteration (friends-of-friends meeting, spatial meeting, exchange of spatial information), replan by changing secondary location. Choose path with shortest-length chain (no MobSim)

Page 19: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Validation of social network output

Exponential degree distribution P(ij)~exp(N(z))

Average degree

Clustering coefficient > random

Short path lengths

Homophily (assortativity)

Geographic attributes

Visit frequency vs. distance, etc.

Page 20: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Analysis: Sample Degree Distribution

020406080

100120140160180200

1 3 5 7 9 11 13 15 17 19 21 23

Degree

Nu

mb

er

of

Ag

en

ts

y = -0.2779x - 1.3482R2 = 0.9661

y = -0.3082x - 1.1713R2 = 0.9109

-8

-7

-6

-5

-4

-3

-2

-1

0 5 10 15 20 25

Degree

ln(P

(Deg

ree)

)

STRC05

STRC04

020406080

100120140160180200

1 3 5 7 9 11 13 15 17 19 21 23

Degree

Nu

mb

er

of

Ag

en

ts

y = -4.2047x + 5.6948R2 = 0.9055

-8

-7

-6

-5

-4

-3

-2

-1

0 0.5 1 1.5 2 2.5 3 3.5

ln(Degree)

ln(P

(Deg

ree)

)

STRC05

STRC04

Activities constant

Activities optimized

Log-normal

Log-log

Page 21: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Analysis: Sample Graph Statistics, N=1008

Runconfiguration

Diameter Number of components

Average clustering ratio relative to Erdös/Renyi

Average Degree

Constant activity plan

14 125 2.13 3.77

Optimized activity plan

12 195 1.31 3.57

Erdös/Renyireference graph

~12±-1 ~48±3 1.00 3.6-3.7

The 2 social network graphs have exponentially distributed degree which isthe same whether activities are replanned or not. However othergraph and travel statistics are very different in the two models.

Page 22: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Analysis: Sample Activity Space Measures

Plan type = "hwlh"

Circle representation of average distance to all activities (asd1)

Circle representation of average distance to all friends (asd2)

Sum of arrow length is Euclidean-based length of plan (activity chain) (asd3)

Page 23: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Analysis: Sample Activity Space Measures

No replanning of secondary activity location Replanning secondary activity locationeach iteration of social network

Page 24: August 15 Social networks module, MATSim Castasegna meeting, October 2007 Jeremy Hackney

Calculation size

Interaction calculation scales as N * degree

~ pN * N where p is the percent of population that agent knows, i.e. a function of 1/N

Knowledge exchange calculation scales as N * q * degree

where q is the number of places known to the agent

Introducing friends calculation scales as N * degree