Example Matlab Simulation

advertisement
Example Matlab Simulation
Based on Teaching Social
Simulation with
MatlabJournal of Artificial
Societies and Social
Simulation vol. 3, no. 1,
<http://www.soc.surrey.ac.uk/
JASSS/3/1/forum/1.htm
"Take it or leave it."
• A friend is looking for a mate
• Goal: Find matches that meet criterion
number of desirable attributes in a mate:
– honesty, intelligence, beauty, lets you cheat off
them…
– Different people have different numbers of these
attributes - we give them a “score” based on the
number of desirable attributes they have. - we
can describe the population by a distribution on
this score.
– Picky friend makes a wants a “12”.
– How hard will that be to achieve?
Prospect distribution
• Prospect’s scores are normally distributed
and have mean 6, standard deviation 3.
• Scores can be negative, but all scores are
integers.
Meanscore = 6;
Stdscores = 3;
NumberProspects = 1000;
prospects=ceil(6+3*randn(1,NumberProspects))
This is your dating pool
How many prospects for
friend?
goodones=find(prospects >= 12)
Now what?
• Which dates should the friend take?
• How many possible matches?
– That depends on the PROSPECT’s criteria
– We need to know our friend’s score. Say it is a
“10”
– Assign each PROSPECT a criteria.
– Let us say PROSPECT criteria are about +/-2
points from their own score on average.
– Finally MATCHES are made first date that both
exceed criteria.
PROSPECT CRITERIA
prospectcriteria=ceil(prospects+2*randn(1,NumberProspects))
MATCH GAME
Isdatablecount =0;
For possibledates=1:NumberProspects,
isdatable = prospects(possibledates)>=friendscriterion
isdatablecount = isdatablecount +1;
if isdatable,
ismatch= friendsscore >=
prospectscriterion(possibledates;
if ismatch,
matchscore = prospects(possibledates);
break;
end
end
end
Be systematic!
• What is the average match scores
– As a function of friend’s score?
• What is the effect of
– Dating pool size
– Pool quality
Download