SelectiveCitizen class documentation

Authors

Generated by pauljohn

Software documentation for the SelectiveCitizen class

SelectiveCitizen : Axelrod

Declared in:
SelectiveCitizen.h

In the Axelrod class, citizens choose others in a relatively random way.

In order to create a framework for a richer logic, this class creates some record-keeping apparatus that allows subclasses from it to be more discerining in their selections of discussants.

The main problem solved in this class is the "stranger problem." If agents are choosing discussants on the basis of their experience with them, then sometimes it will happen that an agent chooses between interacting with a stranger and interacting with another on which it has records. How should it choose? Are strangers always bad? Or good?

Here we attack that problem by supposing that people keep notes on strangers they encounter and do some checking on their attibutes. They store their averager similarity with strangers in a moving average and then when they need to decide whether or not to interact with a stranger, then they can use their stored summary information about strangers.

This class also serves one convenience purpose that is really quite unrelated. SelectiveCitizen is subclassed from Axelrod. That means that it has access to Axelrod agent methods for finding discussants and adjusting to them. When classes are built that inherit from SelectiveCitizen, it is often the case that we wonder "what would this new class do if it used the Axelrod method to select a discussant?" Or, "what if it used the Axelrod method of responding to input?"

To make this situation as clear and foolproof as possible, subclasses have instance variables called axelrodSelect and axelrodAdjust. If those variables are set to YES, then when it is time for those agents to select discussants or respond, they do not use their own methods for those chores. Instead, they "reach up" the hierarchy to use the methods of the Axelrod class. Since SelectiveCitizen sits between the subclasses and Axelrod, this is possible by creating methods in SelectiveCitizen called axelrodSelectADiscussant: and axelrodAdjustOpinionAgaint:. This is done to assure that the method from the intended rank in the Hierarchy is actually used. There are less explicit ways to get this part done, but perhaps we would not feel so safe with using them.

Method summary

axelrodAdjustOpinionAgainst:

- (id) axelrodAdjustOpinionAgainst: (id)other;

This is a fool-proof way to make sure that Axelrod's method of opinion adjustment is used. For an immediate subclass of SelectiveCitizen, calling this is the same as [super adjustOpinionAgainst: other]; But if one works with a subclass that is several layers deep in the hierarchy, there is no way to gain access to the Axelrod method without a trick like this.


axelrodSelectADiscussant:

- (id) axelrodSelectADiscussant: (Position*)position;

This is a fool-proof way to make sure that Axelrod's method is used. For an immediate subclass of SelectiveCitizen, calling this is the same as
[super selectADiscussantInPosition: position];
But if one works with a subclass that is several layers deep in the hierarchy, there is no way to gain access to the Axelrod method without a sneaky trick of the sort used in this method. So far as I know :)


bareLispOutDeep:

- (void) bareLispOutDeep: (id)stream;

For serialization, write out values of the variables in this class.


buildObjects

- (id) buildObjects;

Create a stranger moving average to keep tabs on one's similarity with strangers


createEnd

- (id) createEnd;

Complete the creation of the object


getAxelrodSelect

- (BOOL) getAxelrodSelect;

Return the setting of axelrodSelect


measureAppeal:

- (int) measureAppeal: (const char*)other;

Given the 'other', then use records to find out how similar other is to self, or return stranger value if other is not in contact map


setAxelrodAdjust:

- (id) setAxelrodAdjust: (BOOL)value;

All subclasses from Selective citizen are expected to have their own methods for responding to interaction. For comparison purposes, we may want to tell these agents to ignore their own methods and instead use Axelrod's method


setAxelrodSelect:

- (id) setAxelrodSelect: (BOOL)value;

All subclasses from Selective citizen are expected to have their own methods for choosing discussants. For comparison purposes, we may want to tell these agents to ignore their own methods and instead use Axelrod's method


setStrangerValue:

- (void) setStrangerValue: (double)v;

Somewhat misleading name. This will insert one stranger value into the moving average. The intention is that this should be used at the outset of the model to seed agent expectations. The stranger value is the number of features that the agent expects to share with other citizens that it has not met before. If this is called after a series of stranger values have already been inserted, then this method just adds one more. Come to think of it, it is the same as updateStrangerMA, but we leave this here because it could be rewritten to do something more drastic, such as erase the stranger MA and start over.


updateContactRecord:Feature:Similarity:

- (BOOL) updateContactRecord: (Citizen*)other Feature: (int)featureToTest Similarity: (int)k;

UpdateContactRecord from superclass Citizen is overridden and supplemented with record keeping on experiences strangers


updateStrangerMA:

- (void) updateStrangerMA: (int)x;

Update strangerValue variables.


updateStrangerRecord:Similarity:Acquainted:

- (void) updateStrangerRecord: (id)other Similarity: (int)similarity Acquainted: (BOOL)acq;

The stranger moving average is updated here. When a stranger is encountered, we update our beliefs about how agreeable strangers might be. There are two cases we have argued about. In the first case (case=0), the agents are just told how similar the stranger is to them and they record the number of shared features. In the second case (case=1), the agents sample one feature from the other and then they keep a running tally of the similarity they have with strangers on the basis of those sampled features. The number that is stored is the expected number of shared features, and that expectation is based on the proportion of random tests that indicate similarity. Mostly case=0 has been our focus. If one wants to do some serious study of the problem, one ought to just create a subclass and override this method.