<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.santafe.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AndrewStout</id>
	<title>Santa Fe Institute Events Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.santafe.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AndrewStout"/>
	<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php/Special:Contributions/AndrewStout"/>
	<updated>2026-04-03T22:54:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=CustomNode.java.2.wp&amp;diff=3885</id>
		<title>CustomNode.java.2.wp</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=CustomNode.java.2.wp&amp;diff=3885"/>
		<updated>2006-06-27T04:20:46Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[WikiPeerCode]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * CustomNode.java&lt;br /&gt;
 *&lt;br /&gt;
 * Created on January 22, 2005, 2:41 PM&lt;br /&gt;
 * Modified on June 18, 2006, 13:55 by Jack&lt;br /&gt;
 * Modified June 22, 2006 00:16 by Andrew&lt;br /&gt;
 * Modified June 22, 2006 16:40 by Jack&lt;br /&gt;
 * Modified June 26, 2006 22:14 by Andrew&lt;br /&gt;
 *&lt;br /&gt;
 * This class contains the parameters and methods&lt;br /&gt;
 *  for an agent acting on the network&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
package RepMod;&lt;br /&gt;
import uchicago.src.sim.gui.NetworkDrawable;&lt;br /&gt;
import uchicago.src.sim.network.DefaultDrawableNode;&lt;br /&gt;
import uchicago.src.sim.gui.DrawableNonGridNode;&lt;br /&gt;
import uchicago.src.sim.util.Random;&lt;br /&gt;
import uchicago.src.sim.gui.OvalNetworkItem;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import uchicago.src.sim.gui.ColorMap;&lt;br /&gt;
import uchicago.src.sim.engine.CustomProbeable;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * @author Jack Waddell&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// DefaultDrawableNode lets us draw it in the GUI&lt;br /&gt;
// CustomProbeable lets us define which attributes appear when&lt;br /&gt;
//  probed in the GUI&lt;br /&gt;
public class CustomNode extends DefaultDrawableNode implements CustomProbeable {&lt;br /&gt;
    //***********************************&lt;br /&gt;
    // Static Parameters&lt;br /&gt;
&lt;br /&gt;
    // tracks next unique id&lt;br /&gt;
    public static int                   nextID = 0;      &lt;br /&gt;
    &lt;br /&gt;
    public static GUIModel              guiModel = null;&lt;br /&gt;
    public static RepMod           model;&lt;br /&gt;
&lt;br /&gt;
    // voteType, whether to use democratic or meritocratic votes&lt;br /&gt;
    // 0 = democratic&lt;br /&gt;
    // 1 = meritocratic&lt;br /&gt;
    // public static int    voteType; &lt;br /&gt;
&lt;br /&gt;
	// intVoteValue, the intrinsic value of an agent&#039;s vote&lt;br /&gt;
	// vote weight = intVoteValue + (1-intVoteValue)*reputation&lt;br /&gt;
	// now have continuous scale between democratic and meritocratic,&lt;br /&gt;
	// and also avoid divide by zero for zero rep agents voting.&lt;br /&gt;
	// 1 = democratic&lt;br /&gt;
	// 0 = complete meritocratic&lt;br /&gt;
	public static double intVoteValue;&lt;br /&gt;
&lt;br /&gt;
    // the degree by which the historical opinion is weighted&lt;br /&gt;
    public static double histWeight;&lt;br /&gt;
		// weight of current reputation of focus when assigning new opinion&lt;br /&gt;
		public static double repWeight;     &lt;br /&gt;
&lt;br /&gt;
    // the (negative of) slope of skill vs variance of noise&lt;br /&gt;
    public static double noiseSlope;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //********************************8**&lt;br /&gt;
    // Instance parameters&lt;br /&gt;
&lt;br /&gt;
    // Two colormaps are generated for color-coding the nodes in GUI&lt;br /&gt;
    public static ColorMap              centerColorMap;    &lt;br /&gt;
    public static ColorMap              edgeColorMap;&lt;br /&gt;
    public static final int             colorMapSize = 16;&lt;br /&gt;
    public static final int             colorMapMax = colorMapSize - 1;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    private int   id;                   // uniquely ids node&lt;br /&gt;
    public Color  myColor;              // used to draw color in GUI&lt;br /&gt;
    public String myPajekColor = &amp;quot;Red&amp;quot;; // color to appear in Pajek output&lt;br /&gt;
    public double reputation;              // current wealth or stored reputation&lt;br /&gt;
    public double skill;          // skill parameter&lt;br /&gt;
    //public int    numVotes;              // the number of vote rounds &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
       &lt;br /&gt;
&lt;br /&gt;
    //public double success;              // most recent success&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ///////////////////////////////////////////////////////////////&lt;br /&gt;
    // constructor&lt;br /&gt;
    // Inputs: NetworkDrawable drawable, to draw in GUI&lt;br /&gt;
    //         double skill, the skill parameter&lt;br /&gt;
    public CustomNode (NetworkDrawable drawable, double skill) {&lt;br /&gt;
	super(drawable);&lt;br /&gt;
	id = nextID++;              // set id and iterate to next&lt;br /&gt;
	this.skill = skill;&lt;br /&gt;
	reputation = 0.5;	            // Generalize.  Currently hard-coded&lt;br /&gt;
	if (guiModel != null)&lt;br /&gt;
	    setNodeEdgeColorFromSkill();&lt;br /&gt;
	//numVotes = 0;&lt;br /&gt;
	//success = 0;&lt;br /&gt;
    }&lt;br /&gt;
     &lt;br /&gt;
    ///////////////////////////////////////////////////////////&lt;br /&gt;
    // getProbedProperties&lt;br /&gt;
    // Required to implement CustomProbeable&lt;br /&gt;
    // Inputs: none&lt;br /&gt;
    // Outputs: array of strings holding parameter names&lt;br /&gt;
    public String[] getProbedProperties(){&lt;br /&gt;
	return new String[] {&amp;quot;id&amp;quot;, &amp;quot;reputation&amp;quot;, &amp;quot;skill&amp;quot;};&lt;br /&gt;
    }&lt;br /&gt;
     &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // step&lt;br /&gt;
    // Input:  none&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // (Can be) Called by main model to have nodes execute a single step&lt;br /&gt;
    public void step(){&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // setNodeColorFromReputation&lt;br /&gt;
    // Input:  maxReputation, the highest reputation from all agents&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Sets the node color to the colormap leval depending on reputation&lt;br /&gt;
    public void setNodeColorFromReputation(double maxReputation){&lt;br /&gt;
	int i = (int) Math.round(colorMapMax*(reputation)/ (maxReputation));&lt;br /&gt;
	this.setColor(centerColorMap.getColor(i));&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // setNodeEdgeColorFromSkill&lt;br /&gt;
    // Input:  none&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Sets the node edge color to the colormap level depending on skill&lt;br /&gt;
    public void setNodeEdgeColorFromSkill(){&lt;br /&gt;
	int i = (int) Math.round(colorMapMax*skill);&lt;br /&gt;
	this.setBorderColor(edgeColorMap.getColor(i));&lt;br /&gt;
	this.setBorderWidth(3);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////&lt;br /&gt;
    // getDegree&lt;br /&gt;
    // Input: none&lt;br /&gt;
    // Output: int degree&lt;br /&gt;
    // Calculates the degree of the node (assuming symmetric)&lt;br /&gt;
    public int getDegree(){	&lt;br /&gt;
	return (this.getOutNodes()).size();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////&lt;br /&gt;
    // formOpinion&lt;br /&gt;
    // Input: double success, the focus&#039; real skill&lt;br /&gt;
    // Output: double vote, the voter&#039;s estimate of focus&#039; skill&lt;br /&gt;
/*&lt;br /&gt;
    public double formOpinion(double fSkill, double prevOp, double fRep){&lt;br /&gt;
	double op = fSkill + model.getNormalDouble(0, getNoiseFromSkill(this.skill));&lt;br /&gt;
	op = histWeight*prevOp + repWeight*fRep + (1 - histWeight- repWeight)*op;&lt;br /&gt;
	return op;&lt;br /&gt;
    }&lt;br /&gt;
*/		&lt;br /&gt;
	// it should /really/ be (arguably, of course):&lt;br /&gt;
	// opinion = (1 - weight) * (focus&#039; real skill + noise)&lt;br /&gt;
	//  + weight * [opinion-weighted average of common nbrs opinions of focus]&lt;br /&gt;
	public double formOpinion(CustomEdge fEdge){&lt;br /&gt;
		CustomNode focus = (CustomNode) fEdge.getTo();&lt;br /&gt;
		double signal = focus.getSkill() + &lt;br /&gt;
				model.getNormalDouble(0, getNoiseFromSkill(this.skill));&lt;br /&gt;
		double myOpinion = histWeight*fEdge.getOpinion() + (1-histWeight)*signal;&lt;br /&gt;
		double localWeightedOpFeedback = 0;&lt;br /&gt;
		ArrayList nbrEdges = this.getOutEdges();&lt;br /&gt;
		// form opinion-weighted average of common nbrs opinions of focus&lt;br /&gt;
		for(int ni = 0; ni &amp;lt; nbrEdges.size(); ni++){&lt;br /&gt;
			CustomEdge nbrEdge = (CustomEdge) nbrEdges.get(ni);&lt;br /&gt;
			CustomNode nbr = (CustomNode) nbrEdge.getTo();&lt;br /&gt;
			ArrayList nbrNbrEdges = nbr.getOutEdges();&lt;br /&gt;
			boolean foundFocus = false;&lt;br /&gt;
			for(int nni = 0; nni &amp;lt; nbrNbrEdges.size(); nni++){&lt;br /&gt;
				CustomEdge nnEdge = (CustomEdge) nbrNbrEdges.get(nni);&lt;br /&gt;
				if(((CustomNode)nnEdge.getTo()).getID() == focus.getID()) { // if nbr knows focus&lt;br /&gt;
					// weight feedback by opinion; balance with own opinion&lt;br /&gt;
					localWeightedOpFeedback +=&lt;br /&gt;
							nbrEdge.getOpinion()*nnEdge.getOpinion() +&lt;br /&gt;
							(1-nbrEdge.getOpinion())*myOpinion;&lt;br /&gt;
					foundFocus = true;&lt;br /&gt;
					break; // break the inner for loop--we&#039;re done with this common nbr&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			if(!foundFocus){&lt;br /&gt;
				// this neighbor didn&#039;t know focus&lt;br /&gt;
				localWeightedOpFeedback += myOpinion;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		localWeightedOpFeedback = &lt;br /&gt;
				localWeightedOpFeedback/(double)nbrEdges.size();&lt;br /&gt;
		double op = repWeight*localWeightedOpFeedback + (1-repWeight)*myOpinion;&lt;br /&gt;
		// here I truncate to [0,1] -- this is open to further discussion&lt;br /&gt;
		if (op &amp;gt; 1) op = 1; // must...not...write...Python...&lt;br /&gt;
		if (op &amp;lt; 0) op = 0; // too many languages in one head!&lt;br /&gt;
		return op;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
///////////////////////////////////////////////////////&lt;br /&gt;
    // formOpinion&lt;br /&gt;
    // Input: double success, the focus&#039; real skill&lt;br /&gt;
    // Output: double vote, the voter&#039;s estimate of focus&#039; skill&lt;br /&gt;
    public double formOpinion(double fSkill, double prevOp){&lt;br /&gt;
	double op = fSkill + model.getNormalDouble(0, getNoiseFromSkill(this.skill));&lt;br /&gt;
	op = histWeight*prevOp + (1-histWeight)*op;&lt;br /&gt;
	return op;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
	// new formOpinion&lt;br /&gt;
	public double formOpinion2(double fSkill, double fRep){&lt;br /&gt;
		// opinion = (1- repweight) * (focus&#039; real skill + noise)&lt;br /&gt;
		//  + repweight * focus&#039; reputation&lt;br /&gt;
		double op = fSkill+model.getNormalDouble(0,getNoiseFromSkill(this.skill));&lt;br /&gt;
		op = repWeight*fRep + (1-repWeight)*op;&lt;br /&gt;
		// here I truncate to [0,1] -- this is open to further discussion&lt;br /&gt;
		if (op &amp;gt; 1) op = 1; // must...not...write...Python...&lt;br /&gt;
		if (op &amp;lt; 0) op = 0; // too many languages in one head!&lt;br /&gt;
		return op;		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
*/&lt;br /&gt;
    ////////////////////////////////////////////////////////&lt;br /&gt;
    // voteAll&lt;br /&gt;
/*&lt;br /&gt;
    public void voteAll(){&lt;br /&gt;
	ArrayList edgeList = this.getOutEdges();&lt;br /&gt;
	double opinion = 0;&lt;br /&gt;
	int vote = 0;&lt;br /&gt;
	for (int i = 0; i &amp;lt; edgeList.size(); i++){&lt;br /&gt;
	    CustomEdge edge = (CustomEdge) edgeList.get(i);&lt;br /&gt;
	    CustomNode node = (CustomNode) edge.getTo();&lt;br /&gt;
	    opinion = formOpinion(node.getSkill(), edge.getOpinion(), node.getReputation());&lt;br /&gt;
	    edge.setOpinion(opinion);&lt;br /&gt;
	    if (opinion &amp;gt; 0.5)&lt;br /&gt;
		vote = 1;&lt;br /&gt;
	    else&lt;br /&gt;
		vote = 0;&lt;br /&gt;
	    edge.setVote(vote);&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
*/&lt;br /&gt;
	// new voteAll&lt;br /&gt;
	public void voteAll(){&lt;br /&gt;
		ArrayList edgeList = this.getOutEdges();&lt;br /&gt;
		double opinion = 0;&lt;br /&gt;
		int vote = 0;&lt;br /&gt;
		for (int i = 0; i &amp;lt; edgeList.size(); i++){&lt;br /&gt;
		// for each neighbor&lt;br /&gt;
	    CustomEdge edge = (CustomEdge) edgeList.get(i);&lt;br /&gt;
	    CustomNode node = (CustomNode) edge.getTo();&lt;br /&gt;
			// get opinion (truncated 0 to 1)&lt;br /&gt;
			opinion = formOpinion(edge);&lt;br /&gt;
			// set those opinions&lt;br /&gt;
			edge.setOpinion(opinion);&lt;br /&gt;
			// votes are opinions&lt;br /&gt;
			edge.setVote(opinion); // Java lines get semicolons, dipshit.&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
    ////////////////////////////////////////////////////////&lt;br /&gt;
    // calcReputation&lt;br /&gt;
    // Input: none&lt;br /&gt;
    // Ouput: none&lt;br /&gt;
    public void calcReputation(){&lt;br /&gt;
	ArrayList edgeList = this.getInEdges();&lt;br /&gt;
	double repSum = 0;&lt;br /&gt;
	double normSum = 0;&lt;br /&gt;
	for (int i = 0; i &amp;lt; edgeList.size(); i++){&lt;br /&gt;
	    CustomEdge edge = (CustomEdge) edgeList.get(i);&lt;br /&gt;
	    CustomNode node = (CustomNode) edge.getFrom();&lt;br /&gt;
		repSum += edge.getVote() *(intVoteValue + (1-intVoteValue)*node.getReputation());&lt;br /&gt;
		normSum += (intVoteValue + (1-intVoteValue)*node.getReputation());&lt;br /&gt;
		/*&lt;br /&gt;
	    if (voteType ==0){&lt;br /&gt;
		repSum += edge.getVote();&lt;br /&gt;
		normSum ++;&lt;br /&gt;
	    }&lt;br /&gt;
	    else if (voteType ==1){&lt;br /&gt;
		repSum += edge.getVote() * node.getReputation();&lt;br /&gt;
		normSum += node.getReputation();&lt;br /&gt;
	    }*/&lt;br /&gt;
	}&lt;br /&gt;
	reputation = repSum/normSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //***************************************************************&lt;br /&gt;
    // Getters and Setters&lt;br /&gt;
    public int      getID() {return id;}&lt;br /&gt;
&lt;br /&gt;
    public void     setMyPajekColor(String i) {myPajekColor = i;}&lt;br /&gt;
    public String   getMyPajekColor() {return myPajekColor;}&lt;br /&gt;
    &lt;br /&gt;
    public double   getReputation() {return reputation;}&lt;br /&gt;
    public void     setReputation(double i) {reputation = i;}&lt;br /&gt;
&lt;br /&gt;
    public double   getSkill() {return skill;}&lt;br /&gt;
    public void     setSkill(double i) {skill = i;}&lt;br /&gt;
&lt;br /&gt;
    //public double   getSuccess() {return success;}&lt;br /&gt;
    //public void     setSuccess(double i) {success = i;}&lt;br /&gt;
    &lt;br /&gt;
    //***************************************************************&lt;br /&gt;
    // Static Methods&lt;br /&gt;
&lt;br /&gt;
    public static void setModel(RepMod m) {model = m;}&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // setUpNodeDrawing&lt;br /&gt;
    // Input: GUIModel m, a pointer to the GUIModel&lt;br /&gt;
    // Output: none&lt;br /&gt;
    public static void setUpNodeDrawing (GUIModel m) {&lt;br /&gt;
	guiModel = m;&lt;br /&gt;
	centerColorMap = new ColorMap();&lt;br /&gt;
	edgeColorMap   = new ColorMap();&lt;br /&gt;
	double minColor = 0.1;&lt;br /&gt;
	&lt;br /&gt;
	for (int i = 0; i &amp;lt; colorMapSize; i++){&lt;br /&gt;
	    double fracColor = minColor + ( (1.0-minColor)*i/colorMapMax );&lt;br /&gt;
&lt;br /&gt;
	    centerColorMap.mapColor(i, 0, 0, fracColor);&lt;br /&gt;
	    edgeColorMap.mapColor(i, 0, fracColor, 0);&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////////&lt;br /&gt;
    // resetNextID&lt;br /&gt;
    // Inputs:  none&lt;br /&gt;
    // Outputs: none&lt;br /&gt;
    // Resets nextID.  Called when the model is reset, and a &lt;br /&gt;
    //  new set of nodes is generated&lt;br /&gt;
    public static void resetNextID(){&lt;br /&gt;
	nextID = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////////&lt;br /&gt;
    // getNoiseFromSkill&lt;br /&gt;
    // Inputs: double skill&lt;br /&gt;
    // Outputs: double, the noise variance&lt;br /&gt;
    public static double getNoiseFromSkill(double skill){&lt;br /&gt;
	return (1-skill)*noiseSlope;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //public static int getVoteType() {return voteType;}&lt;br /&gt;
    //public static void setVoteType(int i) {voteType = i;}&lt;br /&gt;
&lt;br /&gt;
	public static double getIntVoteValue() {return intVoteValue;}&lt;br /&gt;
	public static void setIntVoteValue(double i) {intVoteValue = i;}&lt;br /&gt;
&lt;br /&gt;
    public static double getHistWeight() {return histWeight;}&lt;br /&gt;
    public static void   setHistWeight(double i) {histWeight = i;}&lt;br /&gt;
		&lt;br /&gt;
		public static double getRepWeight() {return repWeight;}&lt;br /&gt;
		public static void setRepWeight(double w) {repWeight = w;}&lt;br /&gt;
&lt;br /&gt;
    public static double getNoiseSlope() {return noiseSlope;}&lt;br /&gt;
    public static void   setNoiseSlope(double i) {noiseSlope = i;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=RepMod.java.2.wp&amp;diff=3884</id>
		<title>RepMod.java.2.wp</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=RepMod.java.2.wp&amp;diff=3884"/>
		<updated>2006-06-27T04:19:34Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[WikiPeerCode]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * RepMod.java&lt;br /&gt;
 *&lt;br /&gt;
 * Created on January 22, 2005, 6:11 PM&lt;br /&gt;
 * Modified June 19, 2006 18:20 by Jack&lt;br /&gt;
 * Modified June 22, 2006 00:16 by Andrew&lt;br /&gt;
 * Modified June 22, 2006 16:40 by Jack&lt;br /&gt;
 * Modified June 26, 2006 22:14 by Andrew&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
package RepMod;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.List;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import java.awt.event.ActionEvent;&lt;br /&gt;
import java.awt.event.ActionListener;&lt;br /&gt;
&lt;br /&gt;
import uchicago.src.sim.engine.BasicAction;&lt;br /&gt;
import uchicago.src.sim.engine.Schedule;&lt;br /&gt;
//import uchicago.src.sim.engine.SimModelImpl;&lt;br /&gt;
//import uchicago.src.sim.gui.DisplaySurface;&lt;br /&gt;
//import uchicago.src.sim.gui.Network2DDisplay;&lt;br /&gt;
import uchicago.src.sim.gui.OvalNetworkItem;&lt;br /&gt;
//import uchicago.src.sim.network.NetworkFactory;&lt;br /&gt;
//import uchicago.src.sim.network.NetworkRecorder;&lt;br /&gt;
//import uchicago.src.sim.network.Node;&lt;br /&gt;
//import uchicago.src.sim.util.Random;&lt;br /&gt;
import uchicago.src.sim.util.SimUtilities;&lt;br /&gt;
//import uchicago.src.sim.network.DefaultDrawableNode;&lt;br /&gt;
//import uchicago.src.sim.network.DefaultDrawableEdge;&lt;br /&gt;
//import uchicago.src.sim.gui.CircularGraphLayout;&lt;br /&gt;
//import uchicago.src.sim.gui.KamadaGraphLayout;&lt;br /&gt;
//import uchicago.src.sim.gui.AbstractGraphLayout;&lt;br /&gt;
//import uchicago.src.sim.space.Object2DGrid;&lt;br /&gt;
//import uchicago.src.sim.gui.Object2DDisplay;&lt;br /&gt;
import uchicago.src.sim.util.*;&lt;br /&gt;
import java.util.Collections;&lt;br /&gt;
import java.util.Comparator;&lt;br /&gt;
&lt;br /&gt;
import uchicago.src.sim.network.NetUtilities;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * @author Jack Waddell&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
public class RepMod extends ModelParameters{&lt;br /&gt;
    &lt;br /&gt;
    // model variables&lt;br /&gt;
    public int numAgents = 16;&lt;br /&gt;
    public ArrayList&amp;lt;CustomNode&amp;gt; agentList = new ArrayList&amp;lt;CustomNode&amp;gt; (numAgents);&lt;br /&gt;
    public int worldXSize = 400;&lt;br /&gt;
    public int worldYSize = 400;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    public Schedule schedule;   // Schedules Events&lt;br /&gt;
    public CompNodeRep compNodes;       // compares node reputations&lt;br /&gt;
    &lt;br /&gt;
    // The P parameter for regular lattice -&amp;gt; small world rewiring   &lt;br /&gt;
    // Also used as the probability in the random network&lt;br /&gt;
    public double reconnectProb;&lt;br /&gt;
&lt;br /&gt;
    // the connection radius of the regular lattice&lt;br /&gt;
    public int    connectRadius;&lt;br /&gt;
&lt;br /&gt;
    // selects which network type to use in Network.java&lt;br /&gt;
    public int    netType;&lt;br /&gt;
&lt;br /&gt;
    // Stores how frequently, in units of time steps, to update...&lt;br /&gt;
    public int updateInterval;          // The report file&lt;br /&gt;
    public int pajekUpdateInterval;     // The pajek files&lt;br /&gt;
&lt;br /&gt;
    Network net;   // The network class&lt;br /&gt;
    &lt;br /&gt;
    // The following class performs calculations on the network&lt;br /&gt;
    NetUtilities netCalculator = new NetUtilities();&lt;br /&gt;
&lt;br /&gt;
    // the degree to weight the voter&#039;s historical opinion vs. new opinion&lt;br /&gt;
    public double histWeight; &lt;br /&gt;
&lt;br /&gt;
	// weight of current reputation in new opinion&lt;br /&gt;
	public double repWeight;&lt;br /&gt;
&lt;br /&gt;
    // voteType, whether to use democratic or meritocratic votes&lt;br /&gt;
    // 0 = democratic&lt;br /&gt;
    // 1 = meritocratic&lt;br /&gt;
    //public int voteType;&lt;br /&gt;
&lt;br /&gt;
	// intVoteValue, the intrinsic value of an agent&#039;s vote&lt;br /&gt;
	// vote weight = intVoteValue + (1-intVoteValue)*reputation&lt;br /&gt;
	// now have continuous scale between democratic and meritocratic,&lt;br /&gt;
	// and also avoid divide by zero for zero rep agents voting.&lt;br /&gt;
	// 1 = democratic&lt;br /&gt;
	// 0 = complete meritocratic&lt;br /&gt;
	public double intVoteValue;&lt;br /&gt;
&lt;br /&gt;
		//public int opScheme; // opinion scheme: 1 = old, 2 = new (AS rep feedback)&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    // the (negative of) slope of skill vs variance of noise&lt;br /&gt;
    public double noiseSlope;&lt;br /&gt;
		&lt;br /&gt;
		public int numTopAgents = 5; // Andrew hacking TopRep calculation&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    /** Creates a new instance of RepMod */&lt;br /&gt;
    public RepMod() {&lt;br /&gt;
    }&lt;br /&gt;
	&lt;br /&gt;
    /////////////////////////////////////////////////&lt;br /&gt;
    // begin&lt;br /&gt;
    // builds model-required elements&lt;br /&gt;
    public void begin () {&lt;br /&gt;
        buildModel ();&lt;br /&gt;
        buildSchedule ();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ///////////////////////////////////////////////////////&lt;br /&gt;
    // addModelSpecificParameters&lt;br /&gt;
    // Maps the input parameters.&lt;br /&gt;
    public void addModelSpecificParameters () {&lt;br /&gt;
	parametersMap.put( &amp;quot;size&amp;quot;, &amp;quot;numAgents&amp;quot;);	&lt;br /&gt;
	parametersMap.put( &amp;quot;ui&amp;quot;, &amp;quot;updateInterval&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;rP&amp;quot;, &amp;quot;reconnectProb&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;cR&amp;quot;, &amp;quot;connectRadius&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;nT&amp;quot;, &amp;quot;netType&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;pUI&amp;quot;, &amp;quot;pajekUpdateInterval&amp;quot;);&lt;br /&gt;
	//parametersMap.put( &amp;quot;vT&amp;quot;, &amp;quot;voteType&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;iVV&amp;quot;, &amp;quot;intVoteValue&amp;quot;);&lt;br /&gt;
	//parametersMap.put( &amp;quot;oS&amp;quot;, &amp;quot;opScheme&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;hW&amp;quot;, &amp;quot;histWeight&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;rW&amp;quot;, &amp;quot;repWeight&amp;quot;); // still not sure what this does...&lt;br /&gt;
	parametersMap.put( &amp;quot;nS&amp;quot;, &amp;quot;noiseSlope&amp;quot;);&lt;br /&gt;
        parametersMap.put( &amp;quot;nTA&amp;quot;, &amp;quot;numTopAgents&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////&lt;br /&gt;
    // getInitParam&lt;br /&gt;
    // Controls what appears the the GUI parameter panel&lt;br /&gt;
    public String[] getInitParam () {&lt;br /&gt;
	String[] params = { &amp;quot;numAgents&amp;quot;, &amp;quot;connectRadius&amp;quot;, &lt;br /&gt;
			    &amp;quot;reconnectProb&amp;quot;, &amp;quot;netType&amp;quot;, &amp;quot;voteType&amp;quot;,&lt;br /&gt;
			    &amp;quot;histWeight&amp;quot;, &amp;quot;noiseSlope&amp;quot;,&lt;br /&gt;
					&amp;quot;numTopAgents&amp;quot;, // AS added for top agents param&lt;br /&gt;
					/*&amp;quot;opScheme&amp;quot;, // AS for new opinion scheme*/&lt;br /&gt;
					&amp;quot;repWeight&amp;quot;, // AS for new opinion scheme&lt;br /&gt;
					&amp;quot;intVoteValue&amp;quot;,&lt;br /&gt;
			    // these are from the super class:&lt;br /&gt;
			    &amp;quot;rDebug&amp;quot;, &amp;quot;seed&amp;quot;};&lt;br /&gt;
	return params;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // getters and setters&lt;br /&gt;
    // ********************   Note   *************************&lt;br /&gt;
    // Specific format required if using inputted parameters&lt;br /&gt;
    //  (either through batch or gui)&lt;br /&gt;
    public int  getWorldXSize () {return worldXSize;}&lt;br /&gt;
    public void setWorldXSize (int size) {worldXSize = size;}&lt;br /&gt;
    public int  getWorldYSize () {return worldYSize;}&lt;br /&gt;
    public void setWorldYSize (int size) {worldYSize = size;}&lt;br /&gt;
   &lt;br /&gt;
    public int  getNumAgents() {return numAgents;}&lt;br /&gt;
    public void setNumAgents(int i) {numAgents = i;}&lt;br /&gt;
&lt;br /&gt;
    public double getReconnectProb() {return reconnectProb;}&lt;br /&gt;
    public void   setReconnectProb(double i) {reconnectProb = i;}&lt;br /&gt;
    public int  getConnectRadius() {return connectRadius;}&lt;br /&gt;
    public void setConnectRadius(int i) {connectRadius = i;}&lt;br /&gt;
&lt;br /&gt;
    public void setNetType(int i) {netType = i;}&lt;br /&gt;
    public int  getNetType() {return netType;}&lt;br /&gt;
    &lt;br /&gt;
	/*&lt;br /&gt;
    public void setVoteType(int i) {&lt;br /&gt;
	voteType = i;&lt;br /&gt;
	CustomNode.setVoteType(i);&lt;br /&gt;
    }&lt;br /&gt;
    public int  getVoteType() {return voteType;}&lt;br /&gt;
&lt;br /&gt;
		*/&lt;br /&gt;
	public void setIntVoteValue(double i) {&lt;br /&gt;
		intVoteValue = i;&lt;br /&gt;
		CustomNode.setIntVoteValue(i);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public double getIntVoteValue() {return intVoteValue;}&lt;br /&gt;
&lt;br /&gt;
		//public void setOpScheme(int i) {opScheme = i;}&lt;br /&gt;
		//public int getOpScheme() { return opScheme;}&lt;br /&gt;
&lt;br /&gt;
    public void   setHistWeight(double i) {&lt;br /&gt;
	histWeight = i;&lt;br /&gt;
	CustomNode.setHistWeight(i);&lt;br /&gt;
    }&lt;br /&gt;
    public double getHistWeight() {return histWeight;}&lt;br /&gt;
		&lt;br /&gt;
		public void setRepWeight(double w) {&lt;br /&gt;
			repWeight = w;&lt;br /&gt;
			CustomNode.setRepWeight(w);&lt;br /&gt;
		}&lt;br /&gt;
		public double getRepWeight() {return repWeight;}&lt;br /&gt;
&lt;br /&gt;
    public void setNoiseSlope(double i) {&lt;br /&gt;
	noiseSlope = i;&lt;br /&gt;
	CustomNode.setNoiseSlope(i);&lt;br /&gt;
    }&lt;br /&gt;
    public double getNoiseSlope() {return noiseSlope;}&lt;br /&gt;
&lt;br /&gt;
    public int    getUpdateInterval() {return updateInterval;}&lt;br /&gt;
    public void  setUpdateInterval(int i) {updateInterval = i;}&lt;br /&gt;
    public int    getPajekUpdateInterval() {return pajekUpdateInterval;}&lt;br /&gt;
    public void  setPajekUpdateInterval(int i) {pajekUpdateInterval = i;}&lt;br /&gt;
		// AS added for top agents param&lt;br /&gt;
		public int getNumTopAgents() {return numTopAgents;}&lt;br /&gt;
		public void setNumTopAgents(int n) {numTopAgents = n;}&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // buildModel&lt;br /&gt;
    // Does what it says&lt;br /&gt;
    public void buildModel(){&lt;br /&gt;
	if(rDebug &amp;gt; 0)&lt;br /&gt;
	    System.out.printf(&amp;quot;Build Model Begin\n&amp;quot;);&lt;br /&gt;
        &lt;br /&gt;
	// CALL FIRST -- defined in super class -- it starts RNG, etc&lt;br /&gt;
	buildModelStart();&lt;br /&gt;
	&lt;br /&gt;
	// set static parameters in node class&lt;br /&gt;
	CustomNode.setHistWeight(histWeight);&lt;br /&gt;
	CustomNode.setRepWeight(repWeight); // AS for new op scheme&lt;br /&gt;
	//CustomNode.setVoteType(voteType);&lt;br /&gt;
	CustomNode.setIntVoteValue(intVoteValue);&lt;br /&gt;
	CustomNode.setNoiseSlope(noiseSlope);&lt;br /&gt;
	CustomNode.setModel(this);&lt;br /&gt;
&lt;br /&gt;
	// setup the network class&lt;br /&gt;
        net = new Network(numAgents, connectRadius, reconnectProb);&lt;br /&gt;
        net.setModel(this);&lt;br /&gt;
&lt;br /&gt;
	// have the network class build the network&lt;br /&gt;
        net.buildAdjacencyMatrix(netType);  // first build the adjacency matrix&lt;br /&gt;
&lt;br /&gt;
	net.buildAgentList();		    // then the agent list&lt;br /&gt;
        agentList = net.getAgentList();&lt;br /&gt;
	&lt;br /&gt;
	// setup the gamemaster&lt;br /&gt;
	compNodes = new CompNodeRep();&lt;br /&gt;
&lt;br /&gt;
	// prepare pajek file&lt;br /&gt;
       	net.startPajekFile(0);&lt;br /&gt;
	&lt;br /&gt;
        System.out.printf(&amp;quot;Build Model End\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// some post-load finishing touches&lt;br /&gt;
        startReportFile();&lt;br /&gt;
	&lt;br /&gt;
	// you probably don&#039;t want to remove any of the following&lt;br /&gt;
	// calls to process parameter changes and write the&lt;br /&gt;
	// initial state to the report file.&lt;br /&gt;
	// NB -&amp;gt; you might remove/add more agentChange processing&lt;br /&gt;
        applyAnyStoredChanges();&lt;br /&gt;
        //stepReport();&lt;br /&gt;
        //getPlaintextReportFile().flush();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // buildSchedule&lt;br /&gt;
    // Sets what is to happen, when.&lt;br /&gt;
    public void buildSchedule () {&lt;br /&gt;
&lt;br /&gt;
	// schedule the current BatchModel&#039;s step() function&lt;br /&gt;
	// to execute every time step starting with time  step 0&lt;br /&gt;
	schedule.scheduleActionBeginning( 0, this, &amp;quot;step&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	// Schedule to stop at a particular time, StopT.  Rem out&lt;br /&gt;
	// to run indefinitely&lt;br /&gt;
	schedule.scheduleActionAt(getStopT(), this, &amp;quot;processEndOfRun&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// Only run every updateInterval steps&lt;br /&gt;
	schedule.scheduleActionAtInterval(updateInterval, new BasicAction() {&lt;br /&gt;
		public void execute() {&lt;br /&gt;
		    System.gc();         // garbage collect&lt;br /&gt;
		    stepReport();        // write step report&lt;br /&gt;
		}&lt;br /&gt;
	    }, Schedule.LAST);&lt;br /&gt;
&lt;br /&gt;
	// Only run every pajekUpdateInterval steps&lt;br /&gt;
	schedule.scheduleActionAtInterval(pajekUpdateInterval, new BasicAction() {&lt;br /&gt;
		public void execute() {&lt;br /&gt;
		    nextPajekNetwork();  // write pajek file and open new one&lt;br /&gt;
		}&lt;br /&gt;
      }, Schedule.LAST);&lt;br /&gt;
					  &lt;br /&gt;
	// Execute at step 1 only&lt;br /&gt;
	schedule.scheduleActionAt(1, new BasicAction() {&lt;br /&gt;
		public void execute() {&lt;br /&gt;
		    stepReport();&lt;br /&gt;
		    nextPajekNetwork();&lt;br /&gt;
		}&lt;br /&gt;
	    }, Schedule.LAST);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // printProjectHelp&lt;br /&gt;
    // this could be filled in with some help to get from running with &lt;br /&gt;
    // -help parameter&lt;br /&gt;
    public void printProjectHelp() {&lt;br /&gt;
	// print project help&lt;br /&gt;
	&lt;br /&gt;
	System.out.printf( &amp;quot;\n%s -- \n&amp;quot;, getName() );&lt;br /&gt;
	&lt;br /&gt;
	System.out.printf( &amp;quot;\n **** Add more info here!! **** \n&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	System.out.printf( &amp;quot;\n&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	printParametersMap();&lt;br /&gt;
	&lt;br /&gt;
	System.exit( 0 );&lt;br /&gt;
	&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
  &lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////////&lt;br /&gt;
    // Setup&lt;br /&gt;
    // Prepares the model, or resets it after the reset button is pressed&lt;br /&gt;
    // in GUI model&lt;br /&gt;
    public void setup () {&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )&lt;br /&gt;
	    System.out.printf( &amp;quot;&amp;lt;== Model setup() done.\n&amp;quot; );&lt;br /&gt;
	// Clean up previous instances&lt;br /&gt;
	schedule = null;&lt;br /&gt;
	System.gc ();&lt;br /&gt;
	&lt;br /&gt;
	// Set default values&lt;br /&gt;
	// These are overwritten by inputted values, if any&lt;br /&gt;
	numAgents              = 64;&lt;br /&gt;
	updateInterval         = 1;&lt;br /&gt;
	pajekUpdateInterval    = 1000000;&lt;br /&gt;
        worldXSize             = 400;&lt;br /&gt;
        worldYSize             = 400;&lt;br /&gt;
&lt;br /&gt;
	netType = 0;&lt;br /&gt;
	connectRadius = 2;&lt;br /&gt;
	reconnectProb = 0.1;&lt;br /&gt;
	&lt;br /&gt;
	//voteType = 0;&lt;br /&gt;
	intVoteValue = 1;&lt;br /&gt;
	histWeight = 0;&lt;br /&gt;
	noiseSlope = 1;&lt;br /&gt;
	repWeight = 0;&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
			// AS added for top agents param&lt;br /&gt;
			numTopAgents = 5;&lt;br /&gt;
		&lt;br /&gt;
        CustomNode.resetNextID();&lt;br /&gt;
        agentList = new ArrayList (numAgents);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        super.setup();	// Reads in input values&lt;br /&gt;
	schedule = new Schedule (1);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // step&lt;br /&gt;
    // governs what happens at each step&lt;br /&gt;
    public void step(){&lt;br /&gt;
	stepNodes();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ////////////////////////////////////////////////////////////////&lt;br /&gt;
    // stepNodes&lt;br /&gt;
    // Steps each node.&lt;br /&gt;
    //  Has each vote for neighbors, then has each calculation&lt;br /&gt;
    //   own reputation.&lt;br /&gt;
    public void stepNodes(){&lt;br /&gt;
			/*if (opScheme == 2) { // new opinion scheme&lt;br /&gt;
				for(CustomNode node : agentList) { // that&#039;s syntax I don&#039;t know...&lt;br /&gt;
					node.voteAll2();&lt;br /&gt;
				}&lt;br /&gt;
				for(CustomNode node : agentList) {&lt;br /&gt;
					node.calcReputation();&lt;br /&gt;
				}&lt;br /&gt;
			} else {*/&lt;br /&gt;
			for(CustomNode node : agentList){&lt;br /&gt;
	    	node.voteAll();&lt;br /&gt;
			}&lt;br /&gt;
			for(CustomNode node : agentList){&lt;br /&gt;
				node.calcReputation();&lt;br /&gt;
			}&lt;br /&gt;
 			//}&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // addAgent&lt;br /&gt;
    // Input: CustomNode agent&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Adds a new agent to the agent list&lt;br /&gt;
    public void addAgent(CustomNode agent){&lt;br /&gt;
	agentList.add(agent);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // delAgent&lt;br /&gt;
    // Input: CustomNode agent&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Deletes an agent from the agent list&lt;br /&gt;
    public void delAgent(CustomNode agent){&lt;br /&gt;
	agentList.remove(agentList.indexOf(agent));&lt;br /&gt;
	System.gc();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // calcAvgReputation()&lt;br /&gt;
    public double calcAvgReputation(){&lt;br /&gt;
	double sum = 0;&lt;br /&gt;
	for(int i = 0; i &amp;lt; numAgents; i++){&lt;br /&gt;
	    CustomNode node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    sum += (double) node.getReputation();&lt;br /&gt;
	}&lt;br /&gt;
	return sum/(double) numAgents;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // calcTopRepSkills&lt;br /&gt;
    // inputs: int x, the number of top agents include&lt;br /&gt;
    // outputs: double, the reputation of the top x agents&lt;br /&gt;
    //  This calculates the sum of the skils of the top x agents&lt;br /&gt;
		// AS: could be changed to just use numTopAgents directly, &lt;br /&gt;
		// but I&#039;m gonna change it at call time only--&lt;br /&gt;
		// lower impact if I fuck something up.&lt;br /&gt;
    public double calcTopRepSkills(int x){&lt;br /&gt;
	ArrayList&amp;lt;CustomNode&amp;gt; tempList = new ArrayList&amp;lt;CustomNode&amp;gt;();&lt;br /&gt;
	tempList.addAll(agentList);&lt;br /&gt;
	Collections.sort(tempList, compNodes);&lt;br /&gt;
	double skillSum = 0;&lt;br /&gt;
	CustomNode node;&lt;br /&gt;
	for (int i = numAgents -x; i &amp;lt; numAgents; i++){&lt;br /&gt;
	    node = tempList.get(i);&lt;br /&gt;
	    skillSum += node.getSkill();&lt;br /&gt;
	}&lt;br /&gt;
	return skillSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////////&lt;br /&gt;
    // calcRepSkillMatch&lt;br /&gt;
    // inputs: none&lt;br /&gt;
    // outputs: double, the fraction of cases that a Rep and Skill match &lt;br /&gt;
    // (High/Low)&lt;br /&gt;
    public double calcRepSkillMatch(){&lt;br /&gt;
	double count = 0;&lt;br /&gt;
	for(CustomNode node : agentList){&lt;br /&gt;
	    if (node.getReputation() &amp;lt;= 0.5 &amp;amp; node.getSkill() &amp;lt;= 0.5){&lt;br /&gt;
		count ++;&lt;br /&gt;
	    }&lt;br /&gt;
	    else if (node.getReputation() &amp;gt; 0.5 &amp;amp; node.getSkill() &amp;gt; 0.5){&lt;br /&gt;
		count ++;&lt;br /&gt;
	    }&lt;br /&gt;
	}&lt;br /&gt;
	return count / ((double) numAgents); &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // stepReport&lt;br /&gt;
    // each step write out:&lt;br /&gt;
    //   time  expectivity&lt;br /&gt;
    //&lt;br /&gt;
    // Note: update the writeHeaderCommentsToReportFile() to print&lt;br /&gt;
    //       lines of text describing the data written to the report file.&lt;br /&gt;
    &lt;br /&gt;
    public void stepReport () {&lt;br /&gt;
	String s;&lt;br /&gt;
	s = String.format(&amp;quot;%f %f %f&amp;quot;,&lt;br /&gt;
			  schedule.getCurrentTimeDouble(), calcTopRepSkills(numTopAgents),&lt;br /&gt;
			  calcRepSkillMatch());&lt;br /&gt;
&lt;br /&gt;
	//writeLineToReportFile ( &amp;quot;&amp;lt;stepreport&amp;gt;&amp;quot; + s + &amp;quot;&amp;lt;/stepreport&amp;gt;&amp;quot; );&lt;br /&gt;
	writeLineToPlaintextReportFile( s );&lt;br /&gt;
	// flush the buffers so the data is not lost in a &amp;quot;crash&amp;quot;&lt;br /&gt;
	//getReportFile().flush();&lt;br /&gt;
	getPlaintextReportFile().flush();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // writeHeaderCommentsToReportFile&lt;br /&gt;
    // customize to match what you are writing to the report files in &lt;br /&gt;
    // stepReport.&lt;br /&gt;
    &lt;br /&gt;
    public void writeHeaderCommentsToReportFile () {&lt;br /&gt;
	writeLineToReportFile( &amp;quot;&amp;lt;comment&amp;gt;&amp;quot; );&lt;br /&gt;
	writeLineToReportFile( &amp;quot;                        &amp;quot; );&lt;br /&gt;
	writeLineToReportFile( &amp;quot;  time    expectivity   &amp;quot; );&lt;br /&gt;
	writeLineToReportFile( &amp;quot;&amp;lt;/comment&amp;gt;&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	writeLineToPlaintextReportFile( &amp;quot; #time  topSkill  RepSkillMatch&amp;quot; );&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public Schedule getSchedule () {&lt;br /&gt;
        return schedule;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public String getName () {&lt;br /&gt;
        return &amp;quot;Network&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public ArrayList&amp;lt;CustomNode&amp;gt; getAgentList() {return agentList;}&lt;br /&gt;
    &lt;br /&gt;
    public static void main (String[] args) {&lt;br /&gt;
        uchicago.src.sim.engine.SimInit init = new uchicago.src.sim.engine.SimInit ();&lt;br /&gt;
        RepMod model = new RepMod ();&lt;br /&gt;
        init.loadModel (model, null, false);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    // The following are some debugging methods&lt;br /&gt;
    public static void printVector(double[] vector){&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
        for(int i = 0; i &amp;lt; vector.length; i++){&lt;br /&gt;
            System.out.printf(&amp;quot;%f &amp;quot;, vector[i]);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static void printVector(int[] vector){&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
        for(int i = 0; i &amp;lt; vector.length; i++){&lt;br /&gt;
            System.out.printf(&amp;quot;%d &amp;quot;, vector[i]);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public void printAgentList(){&lt;br /&gt;
        System.out.printf(&amp;quot;Printing agentList, size = %d\n&amp;quot;, agentList.size());&lt;br /&gt;
        CustomNode node;&lt;br /&gt;
        CustomNode inode;&lt;br /&gt;
        for(int i = 0; i &amp;lt; (agentList.size()); i++){&lt;br /&gt;
	    node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    ArrayList &amp;lt;CustomNode&amp;gt; outNodes = node.getToNodes();&lt;br /&gt;
	    System.out.printf(&amp;quot;Node %d points to (%d objects): &amp;quot;, node.getID(),&lt;br /&gt;
			      outNodes.size());&lt;br /&gt;
	    for(int j = 0; j &amp;lt; (outNodes.size()); j++){&lt;br /&gt;
		inode = (CustomNode) outNodes.get(j);&lt;br /&gt;
		System.out.printf(&amp;quot; %d &amp;quot;, inode.getID());&lt;br /&gt;
	    }&lt;br /&gt;
	    System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////&lt;br /&gt;
    // nextPajekNetwork&lt;br /&gt;
    // closes the current pajek file and opens the new one.&lt;br /&gt;
    public void nextPajekNetwork(){&lt;br /&gt;
	net.writePajekNetwork(agentList);&lt;br /&gt;
	net.endPajekFile();&lt;br /&gt;
	net.startPajekFile((int) schedule.getCurrentTime()/pajekUpdateInterval + 1);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    /////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // processEndOfRun&lt;br /&gt;
    // ends process&lt;br /&gt;
    public void processEndOfRun ( ) {&lt;br /&gt;
	long finalStep = (long) schedule.getCurrentTime();&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )  &lt;br /&gt;
	    System.out.printf(&amp;quot;\n\n===== Model processEndOfRun =====\n\n&amp;quot; );&lt;br /&gt;
	applyAnyStoredChanges();&lt;br /&gt;
	stepReport();&lt;br /&gt;
	endReportFile(finalStep);&lt;br /&gt;
	net.writePajekNetwork(agentList);&lt;br /&gt;
	net.endPajekFile();&lt;br /&gt;
	this.fireStopSim();&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //*******************************************************************&lt;br /&gt;
    // Inner classes&lt;br /&gt;
&lt;br /&gt;
    private class CompNodeRep implements Comparator{&lt;br /&gt;
	&lt;br /&gt;
	public CompNodeRep(){&lt;br /&gt;
	}&lt;br /&gt;
	public int compare(Object o1, Object o2){&lt;br /&gt;
	    CustomNode nodei = (CustomNode) o1;&lt;br /&gt;
	    CustomNode nodej = (CustomNode) o2;&lt;br /&gt;
	    if (nodei.getReputation() &amp;lt; nodej.getReputation())&lt;br /&gt;
		return -1;&lt;br /&gt;
	    else if (nodei.getReputation() &amp;gt; nodej.getReputation())&lt;br /&gt;
		return 1;&lt;br /&gt;
	    else&lt;br /&gt;
		return 0;&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=WikiPeerCode&amp;diff=3883</id>
		<title>WikiPeerCode</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=WikiPeerCode&amp;diff=3883"/>
		<updated>2006-06-27T04:18:23Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Back to [[WikiPeer Group]]&lt;br /&gt;
&lt;br /&gt;
The code for our model.  Last modifications indicated in green.&lt;br /&gt;
Jack Waddell at June 17, at 5:20pm, for instance, is indicated &amp;lt;font color=green&amp;gt;(JNW:0617-1720)&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* [[RepMod.java.wp]]     : The main model &amp;lt;font color=green&amp;gt;(JNW:0622-1640)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[CustomNode.java.wp]] : The agent class. &amp;lt;font color=green&amp;gt;(JNW:0622-1640)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[CustomEdge.java.wp]] : The edge class. &amp;lt;font color=green&amp;gt;(JNW:0622-1640)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[Network.java.wp]]    : The class that initializes the network. &amp;lt;font color=green&amp;gt;(JNW:0617-1720)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[GUIModel.java.wp]]   : The GUI for the model &amp;lt;font color=green&amp;gt;(APBS:0618-2315)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[BatchModel.java.wp]] : The batch organizer for the model &amp;lt;font color=green&amp;gt;(JNW:0618-1355)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[ModelParameters.java.wp]] :The base for the model (slightly modified from Rick&#039;s) &amp;lt;font color=green&amp;gt;(JNW:0612-0000)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Local (&amp;quot;subjective&amp;quot;) opinion feedback fork:&lt;br /&gt;
&lt;br /&gt;
* [[RepMod.java.2.wp]]  : The main model &amp;lt;font color=green&amp;gt;(APBS:0626-2214)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[CustomNode.java.2.wp]]  : The agent class &amp;lt;font color=green&amp;gt;(APBS:0626-2214)&amp;lt;/font&amp;gt;&lt;br /&gt;
* (rest are the same)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* --CompNodeRep.java--   : Out moded. The comparator for sorting by reputation. Absorbed as inner class into RepMod&lt;br /&gt;
* --GameMaster.java.wp-- : Out moded. The class that organizes the votes. Methods absorbed into CustomNode and RepMod.&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=WikiPeerCode&amp;diff=3780</id>
		<title>WikiPeerCode</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=WikiPeerCode&amp;diff=3780"/>
		<updated>2006-06-22T06:19:59Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Back to [[WikiPeer Group]]&lt;br /&gt;
&lt;br /&gt;
The code for our model.  Last modifications indicated in green.&lt;br /&gt;
Jack Waddell at June 17, at 5:20pm, for instance, is indicated &amp;lt;font color=green&amp;gt;(JNW:0617-1720)&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* [[RepMod.java.wp]]     : The main model &amp;lt;font color=green&amp;gt;(APBS:0622-0016)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[CustomNode.java.wp]] : The agent class. &amp;lt;font color=green&amp;gt;(APBS:0622-0016)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[CustomEdge.java.wp]] : The edge class. &amp;lt;font color=green&amp;gt;(APBS:0622-0016)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[Network.java.wp]]    : The class that initializes the network. &amp;lt;font color=green&amp;gt;(JNW:0617-1720)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[GUIModel.java.wp]]   : The GUI for the model &amp;lt;font color=green&amp;gt;(APBS:0618-2315)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[BatchModel.java.wp]] : The batch organizer for the model &amp;lt;font color=green&amp;gt;(JNW:0618-1355)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[ModelParameters.java.wp]] :The base for the model (slightly modified from Rick&#039;s) &amp;lt;font color=green&amp;gt;(JNW:0612-0000)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* --CompNodeRep.java--   : Out moded. The comparator for sorting by reputation. Absorbed as inner class into RepMod&lt;br /&gt;
* --GameMaster.java.wp-- : Out moded. The class that organizes the votes. Methods absorbed into CustomNode and RepMod.&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=CustomEdge.java.wp&amp;diff=3779</id>
		<title>CustomEdge.java.wp</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=CustomEdge.java.wp&amp;diff=3779"/>
		<updated>2006-06-22T06:19:00Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[WikiPeerCode]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * CustomEdge.java&lt;br /&gt;
 *&lt;br /&gt;
 * Created on January 22, 2005, 5:55 PM&lt;br /&gt;
 * Modified on June 19 2006, 08:50 by Jack&lt;br /&gt;
 * Modified June 22, 2006 00:16 by Andrew&lt;br /&gt;
 * &lt;br /&gt;
 * This class is for the edges in a netwok&lt;br /&gt;
 * It points from a voter to the subject&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
package RepMod;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import uchicago.src.sim.gui.ColorMap;&lt;br /&gt;
&lt;br /&gt;
import uchicago.src.sim.gui.DrawableEdge;&lt;br /&gt;
import uchicago.src.sim.gui.SimGraphics;&lt;br /&gt;
import uchicago.src.sim.network.DefaultEdge;&lt;br /&gt;
import uchicago.src.sim.network.Node;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * @author Jack Waddell&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// DefaultEdge gives us the standard edge methods&lt;br /&gt;
// DrawableEdge lets us draw it in the GUI&lt;br /&gt;
public class CustomEdge extends DefaultEdge implements DrawableEdge {&lt;br /&gt;
    //*************************************************************&lt;br /&gt;
    // Static Parameters&lt;br /&gt;
&lt;br /&gt;
    // These are for drawing the edge in GUI&lt;br /&gt;
    public static GUIModel          guiModel = null;&lt;br /&gt;
    public static ColorMap          redColorMap, blueColorMap;&lt;br /&gt;
    public static final int         colorMapSize = 64;&lt;br /&gt;
    public static final int         colorMapMax = colorMapSize - 1;&lt;br /&gt;
&lt;br /&gt;
    //***********************************************************&lt;br /&gt;
    //Instance parameters&lt;br /&gt;
    &lt;br /&gt;
    private Color  color = Color.red;  // Edge color&lt;br /&gt;
    //public  int    vote = 0;&lt;br /&gt;
		public double vote = 0; // AS for [0-1] voting&lt;br /&gt;
    public  double opinion = 0.5;&lt;br /&gt;
&lt;br /&gt;
    //***********************************************************&lt;br /&gt;
    // Methods&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////&lt;br /&gt;
    // Constructor&lt;br /&gt;
    public CustomEdge() {&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////&lt;br /&gt;
    // Constructor (overloaded)&lt;br /&gt;
    // Inputs: Node from, the (generic class) Node from which the edge emerges&lt;br /&gt;
    //         Node to, the (generic) Node to which the edge points&lt;br /&gt;
    public CustomEdge(Node from, Node to) {&lt;br /&gt;
        super(from, to, &amp;quot;&amp;quot;);   // Calls DefaultEdge constructor&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ////////////////////////////////////////////////////////&lt;br /&gt;
    // draw&lt;br /&gt;
    // Inputs: SimGraphics g&lt;br /&gt;
    //         int fromX, toX, fromY, toY&lt;br /&gt;
    // Outputs: none&lt;br /&gt;
    // Required to implement DrawableEdge.&lt;br /&gt;
    public void draw(SimGraphics g, int fromX, int toX, int fromY, int toY) {&lt;br /&gt;
        g.drawDirectedLink(color, fromX, toX, fromY, toY);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //getters and setters&lt;br /&gt;
    public void setColor(Color c) {color = c;}&lt;br /&gt;
    public Color getColor() {return color;}&lt;br /&gt;
&lt;br /&gt;
    //public void setVote(int i) {vote = i;}&lt;br /&gt;
    //public int  getVote() {return vote;}&lt;br /&gt;
		public void setVote(double i) {vote = i;}&lt;br /&gt;
    public double  getVote() {return vote;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    public void setOpinion(double i) {opinion = i;}&lt;br /&gt;
    public double getOpinion() {return opinion;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //******************************************************&lt;br /&gt;
    // Static Methods&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ////////////////////////////////////////////////////&lt;br /&gt;
    // setUpEdgeDrawing&lt;br /&gt;
    // Inputs: GUIModel m, a pointer to the GUIModel instance&lt;br /&gt;
    // Outputs: none&lt;br /&gt;
    // Prepares the edge to be drawn in the GUI&lt;br /&gt;
    public static void setUpEdgeDrawing (GUIModel m) {&lt;br /&gt;
	//System.out.printf(&amp;quot;Setting up Edge Color Map\n&amp;quot;);&lt;br /&gt;
	guiModel = m;&lt;br /&gt;
	redColorMap = new ColorMap();&lt;br /&gt;
	double minRed = 0.5;&lt;br /&gt;
	&lt;br /&gt;
	for (int i = 0; i &amp;lt; colorMapSize; i++){&lt;br /&gt;
	    double fracR = minRed + ( (1.0-minRed)*i/colorMapMax );&lt;br /&gt;
	    fracR = 1.0 + minRed - fracR;&lt;br /&gt;
	    //System.out.printf(&amp;quot;Edge Color Map: i = %d, fR = %f\n&amp;quot;, i, fracR);&lt;br /&gt;
	    redColorMap.mapColor(i, fracR, 0, 0);		   &lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	blueColorMap = new ColorMap();&lt;br /&gt;
	double minBlue = 0.5;&lt;br /&gt;
	for (int i = 0; i &amp;lt; colorMapSize; i++){&lt;br /&gt;
	    double fracB = minBlue + ( (1.0-minBlue)*i/colorMapMax );&lt;br /&gt;
	    fracB = 1.0 + minBlue - fracB;&lt;br /&gt;
	    //System.out.printf(&amp;quot;Edge Color Map: i = %d, fR = %f\n&amp;quot;, i, fracR);&lt;br /&gt;
	    blueColorMap.mapColor(i, 0, 0, fracB);		   &lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=CustomNode.java.wp&amp;diff=3778</id>
		<title>CustomNode.java.wp</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=CustomNode.java.wp&amp;diff=3778"/>
		<updated>2006-06-22T06:18:08Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[WikiPeerCode]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * CustomNode.java&lt;br /&gt;
 *&lt;br /&gt;
 * Created on January 22, 2005, 2:41 PM&lt;br /&gt;
 * Modified on June 18, 2006, 13:55 by Jack&lt;br /&gt;
 * Modified June 22, 2006 00:16 by Andrew&lt;br /&gt;
 *&lt;br /&gt;
 * This class contains the parameters and methods&lt;br /&gt;
 *  for an agent acting on the network&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
package RepMod;&lt;br /&gt;
import uchicago.src.sim.gui.NetworkDrawable;&lt;br /&gt;
import uchicago.src.sim.network.DefaultDrawableNode;&lt;br /&gt;
import uchicago.src.sim.gui.DrawableNonGridNode;&lt;br /&gt;
import uchicago.src.sim.util.Random;&lt;br /&gt;
import uchicago.src.sim.gui.OvalNetworkItem;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import uchicago.src.sim.gui.ColorMap;&lt;br /&gt;
import uchicago.src.sim.engine.CustomProbeable;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * @author Jack Waddell&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// DefaultDrawableNode lets us draw it in the GUI&lt;br /&gt;
// CustomProbeable lets us define which attributes appear when&lt;br /&gt;
//  probed in the GUI&lt;br /&gt;
public class CustomNode extends DefaultDrawableNode implements CustomProbeable {&lt;br /&gt;
    //***********************************&lt;br /&gt;
    // Static Parameters&lt;br /&gt;
&lt;br /&gt;
    // tracks next unique id&lt;br /&gt;
    public static int                   nextID = 0;      &lt;br /&gt;
    &lt;br /&gt;
    public static GUIModel              guiModel = null;&lt;br /&gt;
    public static RepMod           model;&lt;br /&gt;
&lt;br /&gt;
    // voteType, whether to use democratic or meritocratic votes&lt;br /&gt;
    // 0 = democratic&lt;br /&gt;
    // 1 = meritocratic&lt;br /&gt;
    public static int    voteType; &lt;br /&gt;
&lt;br /&gt;
    // the degree by which the historical opinion is weighted&lt;br /&gt;
    public static double histWeight;&lt;br /&gt;
		// weight of current reputation of focus when assigning new opinion&lt;br /&gt;
		public static double repWeight;     &lt;br /&gt;
&lt;br /&gt;
    // the (negative of) slope of skill vs variance of noise&lt;br /&gt;
    public static double noiseSlope;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //********************************8**&lt;br /&gt;
    // Instance parameters&lt;br /&gt;
&lt;br /&gt;
    // Two colormaps are generated for color-coding the nodes in GUI&lt;br /&gt;
    public static ColorMap              centerColorMap;    &lt;br /&gt;
    public static ColorMap              edgeColorMap;&lt;br /&gt;
    public static final int             colorMapSize = 16;&lt;br /&gt;
    public static final int             colorMapMax = colorMapSize - 1;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    private int   id;                   // uniquely ids node&lt;br /&gt;
    public Color  myColor;              // used to draw color in GUI&lt;br /&gt;
    public String myPajekColor = &amp;quot;Red&amp;quot;; // color to appear in Pajek output&lt;br /&gt;
    public double reputation;              // current wealth or stored reputation&lt;br /&gt;
    public double skill;          // skill parameter&lt;br /&gt;
    //public int    numVotes;              // the number of vote rounds &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
       &lt;br /&gt;
&lt;br /&gt;
    //public double success;              // most recent success&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ///////////////////////////////////////////////////////////////&lt;br /&gt;
    // constructor&lt;br /&gt;
    // Inputs: NetworkDrawable drawable, to draw in GUI&lt;br /&gt;
    //         double skill, the skill parameter&lt;br /&gt;
    public CustomNode (NetworkDrawable drawable, double skill) {&lt;br /&gt;
	super(drawable);&lt;br /&gt;
	id = nextID++;              // set id and iterate to next&lt;br /&gt;
	this.skill = skill;&lt;br /&gt;
	reputation = 0.5;	            // Generalize.  Currently hard-coded&lt;br /&gt;
	if (guiModel != null)&lt;br /&gt;
	    setNodeEdgeColorFromSkill();&lt;br /&gt;
	//numVotes = 0;&lt;br /&gt;
	//success = 0;&lt;br /&gt;
    }&lt;br /&gt;
     &lt;br /&gt;
    ///////////////////////////////////////////////////////////&lt;br /&gt;
    // getProbedProperties&lt;br /&gt;
    // Required to implement CustomProbeable&lt;br /&gt;
    // Inputs: none&lt;br /&gt;
    // Outputs: array of strings holding parameter names&lt;br /&gt;
    public String[] getProbedProperties(){&lt;br /&gt;
	return new String[] {&amp;quot;id&amp;quot;, &amp;quot;reputation&amp;quot;, &amp;quot;skill&amp;quot;};&lt;br /&gt;
    }&lt;br /&gt;
     &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // step&lt;br /&gt;
    // Input:  none&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // (Can be) Called by main model to have nodes execute a single step&lt;br /&gt;
    public void step(){&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // setNodeColorFromReputation&lt;br /&gt;
    // Input:  maxReputation, the highest reputation from all agents&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Sets the node color to the colormap leval depending on reputation&lt;br /&gt;
    public void setNodeColorFromReputation(double maxReputation){&lt;br /&gt;
	int i = (int) Math.round(colorMapMax*(reputation)/ (maxReputation));&lt;br /&gt;
	this.setColor(centerColorMap.getColor(i));&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // setNodeEdgeColorFromSkill&lt;br /&gt;
    // Input:  none&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Sets the node edge color to the colormap level depending on skill&lt;br /&gt;
    public void setNodeEdgeColorFromSkill(){&lt;br /&gt;
	int i = (int) Math.round(colorMapMax*skill);&lt;br /&gt;
	this.setBorderColor(edgeColorMap.getColor(i));&lt;br /&gt;
	this.setBorderWidth(3);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////&lt;br /&gt;
    // getDegree&lt;br /&gt;
    // Input: none&lt;br /&gt;
    // Output: int degree&lt;br /&gt;
    // Calculates the degree of the node (assuming symmetric)&lt;br /&gt;
    public int getDegree(){	&lt;br /&gt;
	return (this.getOutNodes()).size();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////&lt;br /&gt;
    // formOpinion&lt;br /&gt;
    // Input: double success, the focus&#039; real skill&lt;br /&gt;
    // Output: double vote, the voter&#039;s estimate of focus&#039; skill&lt;br /&gt;
    public double formOpinion(double fSkill, double prevOp){&lt;br /&gt;
	double op = fSkill + model.getNormalDouble(0, getNoiseFromSkill(this.skill));&lt;br /&gt;
	op = histWeight*prevOp + (1-histWeight)*op;&lt;br /&gt;
	return op;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
	// new formOpinion&lt;br /&gt;
	public double formOpinion2(double fSkill, double fRep){&lt;br /&gt;
		// opinion = (1- repweight) * (focus&#039; real skill + noise)&lt;br /&gt;
		//  + repweight * focus&#039; reputation&lt;br /&gt;
		double op = fSkill+model.getNormalDouble(0,getNoiseFromSkill(this.skill));&lt;br /&gt;
		op = repWeight*fRep + (1-repWeight)*op;&lt;br /&gt;
		// here I truncate to [0,1] -- this is open to further discussion&lt;br /&gt;
		if (op &amp;gt; 1) op = 1; // must...not...write...Python...&lt;br /&gt;
		if (op &amp;lt; 0) op = 0; // too many languages in one head!&lt;br /&gt;
		return op;		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	// it should /really/ be (arguably, of course):&lt;br /&gt;
	// opinion = (1 - weight) * (focus&#039; real skill + noise)&lt;br /&gt;
	//  + weight * [opinion-weighted average of common nbrs opinions of focus]&lt;br /&gt;
&lt;br /&gt;
    ////////////////////////////////////////////////////////&lt;br /&gt;
    // voteAll&lt;br /&gt;
    public void voteAll(){&lt;br /&gt;
	ArrayList edgeList = this.getOutEdges();&lt;br /&gt;
	double opinion = 0;&lt;br /&gt;
	int vote = 0;&lt;br /&gt;
	for (int i = 0; i &amp;lt; edgeList.size(); i++){&lt;br /&gt;
	    CustomEdge edge = (CustomEdge) edgeList.get(i);&lt;br /&gt;
	    CustomNode node = (CustomNode) edge.getTo();&lt;br /&gt;
	    opinion = formOpinion(node.getSkill(), edge.getOpinion());&lt;br /&gt;
	    edge.setOpinion(opinion);&lt;br /&gt;
	    if (opinion &amp;gt; 0.5)&lt;br /&gt;
		vote = 1;&lt;br /&gt;
	    else&lt;br /&gt;
		vote = 0;&lt;br /&gt;
	    edge.setVote(vote);&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
	// new voteAll&lt;br /&gt;
	public void voteAll2(){&lt;br /&gt;
		ArrayList edgeList = this.getOutEdges();&lt;br /&gt;
		double opinion = 0;&lt;br /&gt;
		int vote = 0;&lt;br /&gt;
		for (int i = 0; i &amp;lt; edgeList.size(); i++){&lt;br /&gt;
		// for each neighbor&lt;br /&gt;
	    CustomEdge edge = (CustomEdge) edgeList.get(i);&lt;br /&gt;
	    CustomNode node = (CustomNode) edge.getTo();&lt;br /&gt;
			// get opinion (truncated 0 to 1)&lt;br /&gt;
			opinion = formOpinion2(node.getSkill(), node.getReputation());&lt;br /&gt;
			// (optionally) locally normalize - omitted for now&lt;br /&gt;
			// set those opinions&lt;br /&gt;
			edge.setOpinion(opinion);&lt;br /&gt;
			// votes are opinions&lt;br /&gt;
			edge.setVote(opinion); // Java lines get semicolons, dipshit.&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
    ////////////////////////////////////////////////////////&lt;br /&gt;
    // calcReputation&lt;br /&gt;
    // Input: none&lt;br /&gt;
    // Ouput: none&lt;br /&gt;
    public void calcReputation(){&lt;br /&gt;
	ArrayList edgeList = this.getInEdges();&lt;br /&gt;
	double repSum = 0;&lt;br /&gt;
	double normSum = 0;&lt;br /&gt;
	for (int i = 0; i &amp;lt; edgeList.size(); i++){&lt;br /&gt;
	    CustomEdge edge = (CustomEdge) edgeList.get(i);&lt;br /&gt;
	    CustomNode node = (CustomNode) edge.getFrom();&lt;br /&gt;
	    if (voteType ==0){&lt;br /&gt;
		repSum += edge.getVote();&lt;br /&gt;
		normSum ++;&lt;br /&gt;
	    }&lt;br /&gt;
	    else if (voteType ==1){&lt;br /&gt;
		repSum += edge.getVote() * node.getReputation();&lt;br /&gt;
		normSum += node.getReputation();&lt;br /&gt;
	    }&lt;br /&gt;
	}&lt;br /&gt;
	reputation = repSum/normSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //***************************************************************&lt;br /&gt;
    // Getters and Setters&lt;br /&gt;
    public int      getID() {return id;}&lt;br /&gt;
&lt;br /&gt;
    public void     setMyPajekColor(String i) {myPajekColor = i;}&lt;br /&gt;
    public String   getMyPajekColor() {return myPajekColor;}&lt;br /&gt;
    &lt;br /&gt;
    public double   getReputation() {return reputation;}&lt;br /&gt;
    public void     setReputation(double i) {reputation = i;}&lt;br /&gt;
&lt;br /&gt;
    public double   getSkill() {return skill;}&lt;br /&gt;
    public void     setSkill(double i) {skill = i;}&lt;br /&gt;
&lt;br /&gt;
    //public double   getSuccess() {return success;}&lt;br /&gt;
    //public void     setSuccess(double i) {success = i;}&lt;br /&gt;
    &lt;br /&gt;
    //***************************************************************&lt;br /&gt;
    // Static Methods&lt;br /&gt;
&lt;br /&gt;
    public static void setModel(RepMod m) {model = m;}&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // setUpNodeDrawing&lt;br /&gt;
    // Input: GUIModel m, a pointer to the GUIModel&lt;br /&gt;
    // Output: none&lt;br /&gt;
    public static void setUpNodeDrawing (GUIModel m) {&lt;br /&gt;
	guiModel = m;&lt;br /&gt;
	centerColorMap = new ColorMap();&lt;br /&gt;
	edgeColorMap   = new ColorMap();&lt;br /&gt;
	double minColor = 0.1;&lt;br /&gt;
	&lt;br /&gt;
	for (int i = 0; i &amp;lt; colorMapSize; i++){&lt;br /&gt;
	    double fracColor = minColor + ( (1.0-minColor)*i/colorMapMax );&lt;br /&gt;
&lt;br /&gt;
	    centerColorMap.mapColor(i, 0, 0, fracColor);&lt;br /&gt;
	    edgeColorMap.mapColor(i, 0, fracColor, 0);&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////////&lt;br /&gt;
    // resetNextID&lt;br /&gt;
    // Inputs:  none&lt;br /&gt;
    // Outputs: none&lt;br /&gt;
    // Resets nextID.  Called when the model is reset, and a &lt;br /&gt;
    //  new set of nodes is generated&lt;br /&gt;
    public static void resetNextID(){&lt;br /&gt;
	nextID = 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////////&lt;br /&gt;
    // getNoiseFromSkill&lt;br /&gt;
    // Inputs: double skill&lt;br /&gt;
    // Outputs: double, the noise variance&lt;br /&gt;
    public static double getNoiseFromSkill(double skill){&lt;br /&gt;
	return (1-skill)*noiseSlope;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    public static int getVoteType() {return voteType;}&lt;br /&gt;
    public static void setVoteType(int i) {voteType = i;}&lt;br /&gt;
&lt;br /&gt;
    public static double getHistWeight() {return histWeight;}&lt;br /&gt;
    public static void   setHistWeight(double i) {histWeight = i;}&lt;br /&gt;
		&lt;br /&gt;
		public static double getRepWeight() {return repWeight;}&lt;br /&gt;
		public static void setRepWeight(double w) {repWeight = w;}&lt;br /&gt;
&lt;br /&gt;
    public static double getNoiseSlope() {return noiseSlope;}&lt;br /&gt;
    public static void   setNoiseSlope(double i) {noiseSlope = i;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=RepMod.java.wp&amp;diff=3777</id>
		<title>RepMod.java.wp</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=RepMod.java.wp&amp;diff=3777"/>
		<updated>2006-06-22T06:17:23Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[WikiPeerCode]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * RepMod.java&lt;br /&gt;
 *&lt;br /&gt;
 * Created on January 22, 2005, 6:11 PM&lt;br /&gt;
 * Modified June 19, 2006 18:20 by Jack&lt;br /&gt;
 * Modified June 22, 2006 00:16 by Andrew&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
package RepMod;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.List;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import java.awt.event.ActionEvent;&lt;br /&gt;
import java.awt.event.ActionListener;&lt;br /&gt;
&lt;br /&gt;
import uchicago.src.sim.engine.BasicAction;&lt;br /&gt;
import uchicago.src.sim.engine.Schedule;&lt;br /&gt;
//import uchicago.src.sim.engine.SimModelImpl;&lt;br /&gt;
//import uchicago.src.sim.gui.DisplaySurface;&lt;br /&gt;
//import uchicago.src.sim.gui.Network2DDisplay;&lt;br /&gt;
import uchicago.src.sim.gui.OvalNetworkItem;&lt;br /&gt;
//import uchicago.src.sim.network.NetworkFactory;&lt;br /&gt;
//import uchicago.src.sim.network.NetworkRecorder;&lt;br /&gt;
//import uchicago.src.sim.network.Node;&lt;br /&gt;
//import uchicago.src.sim.util.Random;&lt;br /&gt;
import uchicago.src.sim.util.SimUtilities;&lt;br /&gt;
//import uchicago.src.sim.network.DefaultDrawableNode;&lt;br /&gt;
//import uchicago.src.sim.network.DefaultDrawableEdge;&lt;br /&gt;
//import uchicago.src.sim.gui.CircularGraphLayout;&lt;br /&gt;
//import uchicago.src.sim.gui.KamadaGraphLayout;&lt;br /&gt;
//import uchicago.src.sim.gui.AbstractGraphLayout;&lt;br /&gt;
//import uchicago.src.sim.space.Object2DGrid;&lt;br /&gt;
//import uchicago.src.sim.gui.Object2DDisplay;&lt;br /&gt;
import uchicago.src.sim.util.*;&lt;br /&gt;
import java.util.Collections;&lt;br /&gt;
import java.util.Comparator;&lt;br /&gt;
&lt;br /&gt;
import uchicago.src.sim.network.NetUtilities;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * @author Jack Waddell&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
public class RepMod extends ModelParameters{&lt;br /&gt;
    &lt;br /&gt;
    // model variables&lt;br /&gt;
    public int numAgents = 16;&lt;br /&gt;
    public ArrayList&amp;lt;CustomNode&amp;gt; agentList = new ArrayList&amp;lt;CustomNode&amp;gt; (numAgents);&lt;br /&gt;
    public int worldXSize = 400;&lt;br /&gt;
    public int worldYSize = 400;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    public Schedule schedule;   // Schedules Events&lt;br /&gt;
    public CompNodeRep compNodes;       // compares node reputations&lt;br /&gt;
    &lt;br /&gt;
    // The P parameter for regular lattice -&amp;gt; small world rewiring   &lt;br /&gt;
    // Also used as the probability in the random network&lt;br /&gt;
    public double reconnectProb;&lt;br /&gt;
&lt;br /&gt;
    // the connection radius of the regular lattice&lt;br /&gt;
    public int    connectRadius;&lt;br /&gt;
&lt;br /&gt;
    // selects which network type to use in Network.java&lt;br /&gt;
    public int    netType;&lt;br /&gt;
&lt;br /&gt;
    // Stores how frequently, in units of time steps, to update...&lt;br /&gt;
    public int updateInterval;          // The report file&lt;br /&gt;
    public int pajekUpdateInterval;     // The pajek files&lt;br /&gt;
&lt;br /&gt;
    Network net;   // The network class&lt;br /&gt;
    &lt;br /&gt;
    // The following class performs calculations on the network&lt;br /&gt;
    NetUtilities netCalculator = new NetUtilities();&lt;br /&gt;
&lt;br /&gt;
    // the degree to weight the voter&#039;s historical opinion vs. new opinion&lt;br /&gt;
    public double histWeight; &lt;br /&gt;
		// weight of current reputation in new opinion&lt;br /&gt;
		public double repWeight;&lt;br /&gt;
&lt;br /&gt;
    // voteType, whether to use democratic or meritocratic votes&lt;br /&gt;
    // 0 = democratic&lt;br /&gt;
    // 1 = meritocratic&lt;br /&gt;
    public int voteType;&lt;br /&gt;
		public int opScheme; // opinion scheme: 1 = old, 2 = new (AS rep feedback)&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    // the (negative of) slope of skill vs variance of noise&lt;br /&gt;
    public double noiseSlope;&lt;br /&gt;
		&lt;br /&gt;
		public int numTopAgents = 5; // Andrew hacking TopRep calculation&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    /** Creates a new instance of RepMod */&lt;br /&gt;
    public RepMod() {&lt;br /&gt;
    }&lt;br /&gt;
	&lt;br /&gt;
    /////////////////////////////////////////////////&lt;br /&gt;
    // begin&lt;br /&gt;
    // builds model-required elements&lt;br /&gt;
    public void begin () {&lt;br /&gt;
        buildModel ();&lt;br /&gt;
        buildSchedule ();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ///////////////////////////////////////////////////////&lt;br /&gt;
    // addModelSpecificParameters&lt;br /&gt;
    // Maps the input parameters.&lt;br /&gt;
    public void addModelSpecificParameters () {&lt;br /&gt;
	parametersMap.put( &amp;quot;size&amp;quot;, &amp;quot;numAgents&amp;quot;);	&lt;br /&gt;
	parametersMap.put( &amp;quot;ui&amp;quot;, &amp;quot;updateInterval&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;rP&amp;quot;, &amp;quot;reconnectProb&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;cR&amp;quot;, &amp;quot;connectRadius&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;nT&amp;quot;, &amp;quot;netType&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;pUI&amp;quot;, &amp;quot;pajekUpdateInterval&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;vT&amp;quot;, &amp;quot;voteType&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;oS&amp;quot;, &amp;quot;opScheme&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;hW&amp;quot;, &amp;quot;histWeight&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;rW&amp;quot;, &amp;quot;repWeight&amp;quot;); // still not sure what this does...&lt;br /&gt;
	parametersMap.put( &amp;quot;nS&amp;quot;, &amp;quot;noiseSlope&amp;quot;);&lt;br /&gt;
        parametersMap.put( &amp;quot;nTA&amp;quot;, &amp;quot;numTopAgents&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////&lt;br /&gt;
    // getInitParam&lt;br /&gt;
    // Controls what appears the the GUI parameter panel&lt;br /&gt;
    public String[] getInitParam () {&lt;br /&gt;
	String[] params = { &amp;quot;numAgents&amp;quot;, &amp;quot;connectRadius&amp;quot;, &lt;br /&gt;
			    &amp;quot;reconnectProb&amp;quot;, &amp;quot;netType&amp;quot;, &amp;quot;voteType&amp;quot;,&lt;br /&gt;
			    &amp;quot;histWeight&amp;quot;, &amp;quot;noiseSlope&amp;quot;,&lt;br /&gt;
					&amp;quot;numTopAgents&amp;quot;, // AS added for top agents param&lt;br /&gt;
					&amp;quot;opScheme&amp;quot;, // AS for new opinion scheme&lt;br /&gt;
					&amp;quot;repWeight&amp;quot;, // AS for new opinion scheme&lt;br /&gt;
			    // these are from the super class:&lt;br /&gt;
			    &amp;quot;rDebug&amp;quot;, &amp;quot;seed&amp;quot;};&lt;br /&gt;
	return params;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // getters and setters&lt;br /&gt;
    // ********************   Note   *************************&lt;br /&gt;
    // Specific format required if using inputted parameters&lt;br /&gt;
    //  (either through batch or gui)&lt;br /&gt;
    public int  getWorldXSize () {return worldXSize;}&lt;br /&gt;
    public void setWorldXSize (int size) {worldXSize = size;}&lt;br /&gt;
    public int  getWorldYSize () {return worldYSize;}&lt;br /&gt;
    public void setWorldYSize (int size) {worldYSize = size;}&lt;br /&gt;
   &lt;br /&gt;
    public int  getNumAgents() {return numAgents;}&lt;br /&gt;
    public void setNumAgents(int i) {numAgents = i;}&lt;br /&gt;
&lt;br /&gt;
    public double getReconnectProb() {return reconnectProb;}&lt;br /&gt;
    public void   setReconnectProb(double i) {reconnectProb = i;}&lt;br /&gt;
    public int  getConnectRadius() {return connectRadius;}&lt;br /&gt;
    public void setConnectRadius(int i) {connectRadius = i;}&lt;br /&gt;
&lt;br /&gt;
    public void setNetType(int i) {netType = i;}&lt;br /&gt;
    public int  getNetType() {return netType;}&lt;br /&gt;
    &lt;br /&gt;
    public void setVoteType(int i) {&lt;br /&gt;
	voteType = i;&lt;br /&gt;
	CustomNode.setVoteType(i);&lt;br /&gt;
    }&lt;br /&gt;
    public int  getVoteType() {return voteType;}&lt;br /&gt;
		&lt;br /&gt;
		public void setOpScheme(int i) {opScheme = i;}&lt;br /&gt;
		public int getOpScheme() { return opScheme;}&lt;br /&gt;
&lt;br /&gt;
    public void   setHistWeight(double i) {&lt;br /&gt;
	histWeight = i;&lt;br /&gt;
	CustomNode.setHistWeight(i);&lt;br /&gt;
    }&lt;br /&gt;
    public double getHistWeight() {return histWeight;}&lt;br /&gt;
		&lt;br /&gt;
		public void setRepWeight(double w) {&lt;br /&gt;
			repWeight = w;&lt;br /&gt;
			CustomNode.setRepWeight(w);&lt;br /&gt;
		}&lt;br /&gt;
		public double getRepWeight() {return repWeight;}&lt;br /&gt;
&lt;br /&gt;
    public void setNoiseSlope(double i) {&lt;br /&gt;
	noiseSlope = i;&lt;br /&gt;
	CustomNode.setNoiseSlope(i);&lt;br /&gt;
    }&lt;br /&gt;
    public double getNoiseSlope() {return noiseSlope;}&lt;br /&gt;
&lt;br /&gt;
    public int    getUpdateInterval() {return updateInterval;}&lt;br /&gt;
    public void  setUpdateInterval(int i) {updateInterval = i;}&lt;br /&gt;
    public int    getPajekUpdateInterval() {return pajekUpdateInterval;}&lt;br /&gt;
    public void  setPajekUpdateInterval(int i) {pajekUpdateInterval = i;}&lt;br /&gt;
		// AS added for top agents param&lt;br /&gt;
		public int getNumTopAgents() {return numTopAgents;}&lt;br /&gt;
		public void setNumTopAgents(int n) {numTopAgents = n;}&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // buildModel&lt;br /&gt;
    // Does what it says&lt;br /&gt;
    public void buildModel(){&lt;br /&gt;
	if(rDebug &amp;gt; 0)&lt;br /&gt;
	    System.out.printf(&amp;quot;Build Model Begin\n&amp;quot;);&lt;br /&gt;
        &lt;br /&gt;
	// CALL FIRST -- defined in super class -- it starts RNG, etc&lt;br /&gt;
	buildModelStart();&lt;br /&gt;
	&lt;br /&gt;
	// set static parameters in node class&lt;br /&gt;
	CustomNode.setHistWeight(histWeight);&lt;br /&gt;
	CustomNode.setRepWeight(repWeight); // AS for new op scheme&lt;br /&gt;
	CustomNode.setVoteType(voteType);&lt;br /&gt;
	CustomNode.setNoiseSlope(noiseSlope);&lt;br /&gt;
&lt;br /&gt;
	// setup the network class&lt;br /&gt;
        net = new Network(numAgents, connectRadius, reconnectProb);&lt;br /&gt;
        net.setModel(this);&lt;br /&gt;
&lt;br /&gt;
	CustomNode.setModel(this);&lt;br /&gt;
&lt;br /&gt;
	// have the network class build the network&lt;br /&gt;
        net.buildAdjacencyMatrix(netType);  // first build the adjacency matrix&lt;br /&gt;
&lt;br /&gt;
	net.buildAgentList();		    // then the agent list&lt;br /&gt;
        agentList = net.getAgentList();&lt;br /&gt;
	&lt;br /&gt;
	// setup the gamemaster&lt;br /&gt;
	compNodes = new CompNodeRep();&lt;br /&gt;
&lt;br /&gt;
	// prepare pajek file&lt;br /&gt;
       	net.startPajekFile(0);&lt;br /&gt;
	&lt;br /&gt;
        System.out.printf(&amp;quot;Build Model End\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// some post-load finishing touches&lt;br /&gt;
        startReportFile();&lt;br /&gt;
	&lt;br /&gt;
	// you probably don&#039;t want to remove any of the following&lt;br /&gt;
	// calls to process parameter changes and write the&lt;br /&gt;
	// initial state to the report file.&lt;br /&gt;
	// NB -&amp;gt; you might remove/add more agentChange processing&lt;br /&gt;
        applyAnyStoredChanges();&lt;br /&gt;
        //stepReport();&lt;br /&gt;
        //getPlaintextReportFile().flush();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // buildSchedule&lt;br /&gt;
    // Sets what is to happen, when.&lt;br /&gt;
    public void buildSchedule () {&lt;br /&gt;
&lt;br /&gt;
	// schedule the current BatchModel&#039;s step() function&lt;br /&gt;
	// to execute every time step starting with time  step 0&lt;br /&gt;
	schedule.scheduleActionBeginning( 0, this, &amp;quot;step&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	// Schedule to stop at a particular time, StopT.  Rem out&lt;br /&gt;
	// to run indefinitely&lt;br /&gt;
	schedule.scheduleActionAt(getStopT(), this, &amp;quot;processEndOfRun&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// Only run every updateInterval steps&lt;br /&gt;
	schedule.scheduleActionAtInterval(updateInterval, new BasicAction() {&lt;br /&gt;
		public void execute() {&lt;br /&gt;
		    System.gc();         // garbage collect&lt;br /&gt;
		    stepReport();        // write step report&lt;br /&gt;
		}&lt;br /&gt;
	    }, Schedule.LAST);&lt;br /&gt;
&lt;br /&gt;
	// Only run every pajekUpdateInterval steps&lt;br /&gt;
	schedule.scheduleActionAtInterval(pajekUpdateInterval, new BasicAction() {&lt;br /&gt;
		public void execute() {&lt;br /&gt;
		    nextPajekNetwork();  // write pajek file and open new one&lt;br /&gt;
		}&lt;br /&gt;
      }, Schedule.LAST);&lt;br /&gt;
					  &lt;br /&gt;
	// Execute at step 1 only&lt;br /&gt;
	schedule.scheduleActionAt(1, new BasicAction() {&lt;br /&gt;
		public void execute() {&lt;br /&gt;
		    stepReport();&lt;br /&gt;
		    nextPajekNetwork();&lt;br /&gt;
		}&lt;br /&gt;
	    }, Schedule.LAST);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // printProjectHelp&lt;br /&gt;
    // this could be filled in with some help to get from running with &lt;br /&gt;
    // -help parameter&lt;br /&gt;
    public void printProjectHelp() {&lt;br /&gt;
	// print project help&lt;br /&gt;
	&lt;br /&gt;
	System.out.printf( &amp;quot;\n%s -- \n&amp;quot;, getName() );&lt;br /&gt;
	&lt;br /&gt;
	System.out.printf( &amp;quot;\n **** Add more info here!! **** \n&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	System.out.printf( &amp;quot;\n&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	printParametersMap();&lt;br /&gt;
	&lt;br /&gt;
	System.exit( 0 );&lt;br /&gt;
	&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
  &lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////////&lt;br /&gt;
    // Setup&lt;br /&gt;
    // Prepares the model, or resets it after the reset button is pressed&lt;br /&gt;
    // in GUI model&lt;br /&gt;
    public void setup () {&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )&lt;br /&gt;
	    System.out.printf( &amp;quot;&amp;lt;== Model setup() done.\n&amp;quot; );&lt;br /&gt;
	// Clean up previous instances&lt;br /&gt;
	schedule = null;&lt;br /&gt;
	System.gc ();&lt;br /&gt;
	&lt;br /&gt;
	// Set default values&lt;br /&gt;
	// These are overwritten by inputted values, if any&lt;br /&gt;
	numAgents              = 64;&lt;br /&gt;
	updateInterval         = 1;&lt;br /&gt;
	pajekUpdateInterval    = 1000000;&lt;br /&gt;
        worldXSize             = 400;&lt;br /&gt;
        worldYSize             = 400;&lt;br /&gt;
&lt;br /&gt;
	netType = 0;&lt;br /&gt;
	connectRadius = 2;&lt;br /&gt;
	reconnectProb = 0.1;&lt;br /&gt;
	&lt;br /&gt;
	voteType = 0;&lt;br /&gt;
	histWeight = 0;&lt;br /&gt;
	noiseSlope = 1;&lt;br /&gt;
&lt;br /&gt;
			// AS added for top agents param&lt;br /&gt;
			numTopAgents = 5;&lt;br /&gt;
		&lt;br /&gt;
        CustomNode.resetNextID();&lt;br /&gt;
        agentList = new ArrayList (numAgents);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        super.setup();	// Reads in input values&lt;br /&gt;
	schedule = new Schedule (1);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // step&lt;br /&gt;
    // governs what happens at each step&lt;br /&gt;
    public void step(){&lt;br /&gt;
	stepNodes();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ////////////////////////////////////////////////////////////////&lt;br /&gt;
    // stepNodes&lt;br /&gt;
    // Steps each node.&lt;br /&gt;
    //  Has each vote for neighbors, then has each calculation&lt;br /&gt;
    //   own reputation.&lt;br /&gt;
    public void stepNodes(){&lt;br /&gt;
			if (opScheme == 2) { // new opinion scheme&lt;br /&gt;
				for(CustomNode node : agentList) { // that&#039;s syntax I don&#039;t know...&lt;br /&gt;
					node.voteAll2();&lt;br /&gt;
				}&lt;br /&gt;
				for(CustomNode node : agentList) {&lt;br /&gt;
					node.calcReputation();&lt;br /&gt;
				}&lt;br /&gt;
			} else {&lt;br /&gt;
				for(CustomNode node : agentList){&lt;br /&gt;
	    		node.voteAll();&lt;br /&gt;
				}&lt;br /&gt;
				for(CustomNode node : agentList){&lt;br /&gt;
	    		node.calcReputation();&lt;br /&gt;
				}&lt;br /&gt;
 			}&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // addAgent&lt;br /&gt;
    // Input: CustomNode agent&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Adds a new agent to the agent list&lt;br /&gt;
    public void addAgent(CustomNode agent){&lt;br /&gt;
	agentList.add(agent);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // delAgent&lt;br /&gt;
    // Input: CustomNode agent&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Deletes an agent from the agent list&lt;br /&gt;
    public void delAgent(CustomNode agent){&lt;br /&gt;
	agentList.remove(agentList.indexOf(agent));&lt;br /&gt;
	System.gc();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // calcAvgReputation()&lt;br /&gt;
    public double calcAvgReputation(){&lt;br /&gt;
	double sum = 0;&lt;br /&gt;
	for(int i = 0; i &amp;lt; numAgents; i++){&lt;br /&gt;
	    CustomNode node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    sum += (double) node.getReputation();&lt;br /&gt;
	}&lt;br /&gt;
	return sum/(double) numAgents;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // calcTopRepSkills&lt;br /&gt;
    // inputs: int x, the number of top agents include&lt;br /&gt;
    // outputs: double, the reputation of the top x agents&lt;br /&gt;
    //  This calculates the sum of the skils of the top x agents&lt;br /&gt;
		// AS: could be changed to just use numTopAgents directly, &lt;br /&gt;
		// but I&#039;m gonna change it at call time only--&lt;br /&gt;
		// lower impact if I fuck something up.&lt;br /&gt;
    public double calcTopRepSkills(int x){&lt;br /&gt;
	ArrayList&amp;lt;CustomNode&amp;gt; tempList = new ArrayList&amp;lt;CustomNode&amp;gt;();&lt;br /&gt;
	tempList.addAll(agentList);&lt;br /&gt;
	Collections.sort(tempList, compNodes);&lt;br /&gt;
	double skillSum = 0;&lt;br /&gt;
	CustomNode node;&lt;br /&gt;
	for (int i = numAgents -x; i &amp;lt; numAgents; i++){&lt;br /&gt;
	    node = tempList.get(i);&lt;br /&gt;
	    skillSum += node.getSkill();&lt;br /&gt;
	}&lt;br /&gt;
	return skillSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////////&lt;br /&gt;
    // calcRepSkillMatch&lt;br /&gt;
    // inputs: none&lt;br /&gt;
    // outputs: double, the fraction of cases that a Rep and Skill match &lt;br /&gt;
    // (High/Low)&lt;br /&gt;
    public double calcRepSkillMatch(){&lt;br /&gt;
	double count = 0;&lt;br /&gt;
	for(CustomNode node : agentList){&lt;br /&gt;
	    if (node.getReputation() &amp;lt;= 0.5 &amp;amp; node.getSkill() &amp;lt;= 0.5){&lt;br /&gt;
		count ++;&lt;br /&gt;
	    }&lt;br /&gt;
	    else if (node.getReputation() &amp;gt; 0.5 &amp;amp; node.getSkill() &amp;gt; 0.5){&lt;br /&gt;
		count ++;&lt;br /&gt;
	    }&lt;br /&gt;
	}&lt;br /&gt;
	return count / ((double) numAgents); &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // stepReport&lt;br /&gt;
    // each step write out:&lt;br /&gt;
    //   time  expectivity&lt;br /&gt;
    //&lt;br /&gt;
    // Note: update the writeHeaderCommentsToReportFile() to print&lt;br /&gt;
    //       lines of text describing the data written to the report file.&lt;br /&gt;
    &lt;br /&gt;
    public void stepReport () {&lt;br /&gt;
	String s;&lt;br /&gt;
	s = String.format(&amp;quot;%f %f %f&amp;quot;,&lt;br /&gt;
			  schedule.getCurrentTimeDouble(), calcTopRepSkills(numTopAgents),&lt;br /&gt;
			  calcRepSkillMatch());&lt;br /&gt;
&lt;br /&gt;
	//writeLineToReportFile ( &amp;quot;&amp;lt;stepreport&amp;gt;&amp;quot; + s + &amp;quot;&amp;lt;/stepreport&amp;gt;&amp;quot; );&lt;br /&gt;
	writeLineToPlaintextReportFile( s );&lt;br /&gt;
	// flush the buffers so the data is not lost in a &amp;quot;crash&amp;quot;&lt;br /&gt;
	//getReportFile().flush();&lt;br /&gt;
	getPlaintextReportFile().flush();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // writeHeaderCommentsToReportFile&lt;br /&gt;
    // customize to match what you are writing to the report files in &lt;br /&gt;
    // stepReport.&lt;br /&gt;
    &lt;br /&gt;
    public void writeHeaderCommentsToReportFile () {&lt;br /&gt;
	writeLineToReportFile( &amp;quot;&amp;lt;comment&amp;gt;&amp;quot; );&lt;br /&gt;
	writeLineToReportFile( &amp;quot;                        &amp;quot; );&lt;br /&gt;
	writeLineToReportFile( &amp;quot;  time    expectivity   &amp;quot; );&lt;br /&gt;
	writeLineToReportFile( &amp;quot;&amp;lt;/comment&amp;gt;&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	writeLineToPlaintextReportFile( &amp;quot; #time  topSkill  RepSkillMatch&amp;quot; );&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public Schedule getSchedule () {&lt;br /&gt;
        return schedule;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public String getName () {&lt;br /&gt;
        return &amp;quot;Network&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public ArrayList&amp;lt;CustomNode&amp;gt; getAgentList() {return agentList;}&lt;br /&gt;
    &lt;br /&gt;
    public static void main (String[] args) {&lt;br /&gt;
        uchicago.src.sim.engine.SimInit init = new uchicago.src.sim.engine.SimInit ();&lt;br /&gt;
        RepMod model = new RepMod ();&lt;br /&gt;
        init.loadModel (model, null, false);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    // The following are some debugging methods&lt;br /&gt;
    public static void printVector(double[] vector){&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
        for(int i = 0; i &amp;lt; vector.length; i++){&lt;br /&gt;
            System.out.printf(&amp;quot;%f &amp;quot;, vector[i]);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static void printVector(int[] vector){&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
        for(int i = 0; i &amp;lt; vector.length; i++){&lt;br /&gt;
            System.out.printf(&amp;quot;%d &amp;quot;, vector[i]);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public void printAgentList(){&lt;br /&gt;
        System.out.printf(&amp;quot;Printing agentList, size = %d\n&amp;quot;, agentList.size());&lt;br /&gt;
        CustomNode node;&lt;br /&gt;
        CustomNode inode;&lt;br /&gt;
        for(int i = 0; i &amp;lt; (agentList.size()); i++){&lt;br /&gt;
	    node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    ArrayList &amp;lt;CustomNode&amp;gt; outNodes = node.getToNodes();&lt;br /&gt;
	    System.out.printf(&amp;quot;Node %d points to (%d objects): &amp;quot;, node.getID(),&lt;br /&gt;
			      outNodes.size());&lt;br /&gt;
	    for(int j = 0; j &amp;lt; (outNodes.size()); j++){&lt;br /&gt;
		inode = (CustomNode) outNodes.get(j);&lt;br /&gt;
		System.out.printf(&amp;quot; %d &amp;quot;, inode.getID());&lt;br /&gt;
	    }&lt;br /&gt;
	    System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////&lt;br /&gt;
    // nextPajekNetwork&lt;br /&gt;
    // closes the current pajek file and opens the new one.&lt;br /&gt;
    public void nextPajekNetwork(){&lt;br /&gt;
	net.writePajekNetwork(agentList);&lt;br /&gt;
	net.endPajekFile();&lt;br /&gt;
	net.startPajekFile((int) schedule.getCurrentTime()/pajekUpdateInterval + 1);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    /////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // processEndOfRun&lt;br /&gt;
    // ends process&lt;br /&gt;
    public void processEndOfRun ( ) {&lt;br /&gt;
	long finalStep = (long) schedule.getCurrentTime();&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )  &lt;br /&gt;
	    System.out.printf(&amp;quot;\n\n===== Model processEndOfRun =====\n\n&amp;quot; );&lt;br /&gt;
	applyAnyStoredChanges();&lt;br /&gt;
	stepReport();&lt;br /&gt;
	endReportFile(finalStep);&lt;br /&gt;
	net.writePajekNetwork(agentList);&lt;br /&gt;
	net.endPajekFile();&lt;br /&gt;
	this.fireStopSim();&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //*******************************************************************&lt;br /&gt;
    // Inner classes&lt;br /&gt;
&lt;br /&gt;
    private class CompNodeRep implements Comparator{&lt;br /&gt;
	&lt;br /&gt;
	public CompNodeRep(){&lt;br /&gt;
	}&lt;br /&gt;
	public int compare(Object o1, Object o2){&lt;br /&gt;
	    CustomNode nodei = (CustomNode) o1;&lt;br /&gt;
	    CustomNode nodej = (CustomNode) o2;&lt;br /&gt;
	    if (nodei.getReputation() &amp;lt; nodej.getReputation())&lt;br /&gt;
		return -1;&lt;br /&gt;
	    else if (nodei.getReputation() &amp;gt; nodej.getReputation())&lt;br /&gt;
		return 1;&lt;br /&gt;
	    else&lt;br /&gt;
		return 0;&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=SFSS_2006_After_Hours&amp;diff=3748</id>
		<title>SFSS 2006 After Hours</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=SFSS_2006_After_Hours&amp;diff=3748"/>
		<updated>2006-06-21T22:52:52Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: /* Farther Away Hiking/Sightseeing trips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{CSSS 2006 Santa Fe}}&lt;br /&gt;
Please keep a roughly chronological order, delete postings after the activity is finished, and post dates and times.&lt;br /&gt;
&lt;br /&gt;
==Music==&lt;br /&gt;
* Bela Fleck and the Flecktones will be in concert in Santa Fe on Wednesday night (21 June). 5 30 PM. Check out the forum [http://www.santafe.edu/forums/showthread.php?t=300 thread]&lt;br /&gt;
Tickets available [http://purchase.tickets.com/buy/TicketPurchase?organ_val=2274&amp;amp;agency=tdc&amp;amp;schedule=list here]&lt;br /&gt;
&lt;br /&gt;
Contact : Ryan Woodard&lt;br /&gt;
&lt;br /&gt;
* Thur. June 22, the group Ferintosh will be in Santa Fe. They play mostly Scottish Baroque and Cape Breton music.&lt;br /&gt;
&lt;br /&gt;
The GiG 8:00 PM&lt;br /&gt;
1808 Second Street (next to the Second Street Brewery)&lt;br /&gt;
Suggested contribution $15 at the door. &lt;br /&gt;
Checkout the forum [http://www.santafe.edu/forums/showthread.php?t=239 thread]&lt;br /&gt;
&lt;br /&gt;
Contact : Ryan Leary&lt;br /&gt;
&lt;br /&gt;
==Basketball==&lt;br /&gt;
* Thursday, 7pm in the gym&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Taos &amp;amp; Corn Dance Festival==&lt;br /&gt;
* June 24th (Saturday) - Taos &amp;amp; Corn Dance Festival&lt;br /&gt;
w/ car: Hana (4)&lt;br /&gt;
&lt;br /&gt;
wo/ car?: Andreaa, Ryan, Elham, Harry, Sam, Sandra, Cornelia, Andrew, Alessandro, Fabrice, Nikhil, Patrick, Valentin, Heinz, Andrea, Jorge, Greg.&lt;br /&gt;
&lt;br /&gt;
==Other trips==&lt;br /&gt;
&lt;br /&gt;
* June 23/24-25th - Grand Canyon (suggested trip) [interested?: let saskia.werners know at wur.nl]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Provisioning==&lt;br /&gt;
* Grocery &amp;amp; Supply run to town&lt;br /&gt;
&lt;br /&gt;
==Farther Away Hiking/Sightseeing trips==&lt;br /&gt;
Sometime in the near future...&lt;br /&gt;
The [http://kevingong.com/Hiking/TentRocks.html Tent Rocks] trip on June 11 was awesome!!! Hiking folks, you would love it! And it is 40min away! (Andreea)&lt;br /&gt;
&lt;br /&gt;
(Andrew would be interested, if anyone with wheels is planning a trip...)&lt;br /&gt;
&lt;br /&gt;
==Hiking locally==&lt;br /&gt;
Recommended:&lt;br /&gt;
&#039;&#039;&#039;Deception Point, Lake Peak &amp;amp; Penitente summit Loop.&#039;&#039;&#039; Starts from Santa Fe ski bowl (car required). Day hike up Winsor trail and Raven&#039;s Ridge with serious views, some scrambling along minimally exposed ridge from Deception to Lake Peak. Various return legs including skipping Lake and direct back down ski slopes, skipping Penitente for off-piste scramble to Nambe Lake and ramble over Penitente summit wildflower meadow then reconnect with the Skyline Trail and on back down an easy cruise through forest shade. Boots strongly recommended for scrambling; 2+ liters minimum water/person.&lt;br /&gt;
&lt;br /&gt;
[16 June 06] &amp;quot;Day Hikes in the Santa Fe Area,&amp;quot; by the Sierra club, is available in the Fireside room...&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=WikiPeerCode&amp;diff=3657</id>
		<title>WikiPeerCode</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=WikiPeerCode&amp;diff=3657"/>
		<updated>2006-06-19T05:17:48Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Back to [[WikiPeer Group]]&lt;br /&gt;
&lt;br /&gt;
The code for our model.  Last modifications indicated in green.&lt;br /&gt;
Jack Waddell at June 17, at 5:20pm, for instance, is indicated &amp;lt;font color=green&amp;gt;(JNW:0617-1720)&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* [[RepMod.java.wp]]     : The main model &amp;lt;font color=green&amp;gt;(APBS:0618-2315)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[CustomNode.java.wp]] : The agent class. &amp;lt;font color=green&amp;gt;(JNW:0618-1355)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[CustomEdge.java.wp]] : The edge class. &amp;lt;font color=green&amp;gt;(JNW:0617-1720)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[Network.java.wp]]    : The class that initializes the network. &amp;lt;font color=green&amp;gt;(JNW:0617-1720)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[GUIModel.java.wp]]   : The GUI for the model &amp;lt;font color=green&amp;gt;(APBS:0618-2315)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[BatchModel.java.wp]] : The batch organizer for the model &amp;lt;font color=green&amp;gt;(JNW:0618-1355)&amp;lt;/font&amp;gt;&lt;br /&gt;
* [[ModelParameters.java.wp]] :The base for the model (slightly modified from Rick&#039;s) &amp;lt;font color=green&amp;gt;(JNW:0612-0000)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* --CompNodeRep.java--   : Out moded. The comparator for sorting by reputation. Absorbed as inner class into RepMod&lt;br /&gt;
* --GameMaster.java.wp-- : Out moded. The class that organizes the votes. Methods absorbed into CustomNode and RepMod.&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=RepMod.java.wp&amp;diff=3656</id>
		<title>RepMod.java.wp</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=RepMod.java.wp&amp;diff=3656"/>
		<updated>2006-06-19T05:16:40Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[WikiPeerCode]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * RepMod.java&lt;br /&gt;
 *&lt;br /&gt;
 * Created on January 22, 2005, 6:11 PM&lt;br /&gt;
 * Modified June 18, 2006 13:55 by Jack&lt;br /&gt;
 * Modified slightly 6-18-06 23:10 by Andrew&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
package RepMod;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.List;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import java.awt.event.ActionEvent;&lt;br /&gt;
import java.awt.event.ActionListener;&lt;br /&gt;
&lt;br /&gt;
import uchicago.src.sim.engine.BasicAction;&lt;br /&gt;
import uchicago.src.sim.engine.Schedule;&lt;br /&gt;
//import uchicago.src.sim.engine.SimModelImpl;&lt;br /&gt;
//import uchicago.src.sim.gui.DisplaySurface;&lt;br /&gt;
//import uchicago.src.sim.gui.Network2DDisplay;&lt;br /&gt;
import uchicago.src.sim.gui.OvalNetworkItem;&lt;br /&gt;
//import uchicago.src.sim.network.NetworkFactory;&lt;br /&gt;
//import uchicago.src.sim.network.NetworkRecorder;&lt;br /&gt;
//import uchicago.src.sim.network.Node;&lt;br /&gt;
//import uchicago.src.sim.util.Random;&lt;br /&gt;
import uchicago.src.sim.util.SimUtilities;&lt;br /&gt;
//import uchicago.src.sim.network.DefaultDrawableNode;&lt;br /&gt;
//import uchicago.src.sim.network.DefaultDrawableEdge;&lt;br /&gt;
//import uchicago.src.sim.gui.CircularGraphLayout;&lt;br /&gt;
//import uchicago.src.sim.gui.KamadaGraphLayout;&lt;br /&gt;
//import uchicago.src.sim.gui.AbstractGraphLayout;&lt;br /&gt;
//import uchicago.src.sim.space.Object2DGrid;&lt;br /&gt;
//import uchicago.src.sim.gui.Object2DDisplay;&lt;br /&gt;
import uchicago.src.sim.util.*;&lt;br /&gt;
import java.util.Collections;&lt;br /&gt;
import java.util.Comparator;&lt;br /&gt;
&lt;br /&gt;
import uchicago.src.sim.network.NetUtilities;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * @author Jack Waddell&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
public class RepMod extends ModelParameters{&lt;br /&gt;
    &lt;br /&gt;
    // model variables&lt;br /&gt;
    public int numAgents = 16;&lt;br /&gt;
    public ArrayList&amp;lt;CustomNode&amp;gt; agentList = new ArrayList&amp;lt;CustomNode&amp;gt; (numAgents);&lt;br /&gt;
    public int worldXSize = 400;&lt;br /&gt;
    public int worldYSize = 400;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    public Schedule schedule;   // Schedules Events&lt;br /&gt;
    public CompNodeRep compNodes;       // compares node reputations&lt;br /&gt;
    &lt;br /&gt;
    // The P parameter for regular lattice -&amp;gt; small world rewiring   &lt;br /&gt;
    // Also used as the probability in the random network&lt;br /&gt;
    public double reconnectProb;&lt;br /&gt;
&lt;br /&gt;
    // the connection radius of the regular lattice&lt;br /&gt;
    public int    connectRadius;&lt;br /&gt;
&lt;br /&gt;
    // selects which network type to use in Network.java&lt;br /&gt;
    public int    netType;&lt;br /&gt;
&lt;br /&gt;
    // Stores how frequently, in units of time steps, to update...&lt;br /&gt;
    public int updateInterval;          // The report file&lt;br /&gt;
    public int pajekUpdateInterval;     // The pajek files&lt;br /&gt;
&lt;br /&gt;
    Network net;   // The network class&lt;br /&gt;
    &lt;br /&gt;
    // The following class performs calculations on the network&lt;br /&gt;
    NetUtilities netCalculator = new NetUtilities();&lt;br /&gt;
&lt;br /&gt;
    // the degree to weight the voter&#039;s historical opinion vs. new opinion&lt;br /&gt;
    public double histWeight; &lt;br /&gt;
&lt;br /&gt;
    // voteType, whether to use democratic or meritocratic votes&lt;br /&gt;
    // 0 = democratic&lt;br /&gt;
    // 1 = meritocratic&lt;br /&gt;
    public int voteType;&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    // the (negative of) slope of skill vs variance of noise&lt;br /&gt;
    public double noiseSlope;&lt;br /&gt;
		&lt;br /&gt;
		public int numTopAgents = 5; // Andrew hacking TopRep calculation&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    /** Creates a new instance of RepMod */&lt;br /&gt;
    public RepMod() {&lt;br /&gt;
    }&lt;br /&gt;
	&lt;br /&gt;
    /////////////////////////////////////////////////&lt;br /&gt;
    // begin&lt;br /&gt;
    // builds model-required elements&lt;br /&gt;
    public void begin () {&lt;br /&gt;
        buildModel ();&lt;br /&gt;
        buildSchedule ();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ///////////////////////////////////////////////////////&lt;br /&gt;
    // addModelSpecificParameters&lt;br /&gt;
    // Maps the input parameters.&lt;br /&gt;
    public void addModelSpecificParameters () {&lt;br /&gt;
	parametersMap.put( &amp;quot;size&amp;quot;, &amp;quot;numAgents&amp;quot;);	&lt;br /&gt;
	parametersMap.put( &amp;quot;ui&amp;quot;, &amp;quot;updateInterval&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;rP&amp;quot;, &amp;quot;reconnectProb&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;cR&amp;quot;, &amp;quot;connectRadius&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;nT&amp;quot;, &amp;quot;netType&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;pUI&amp;quot;, &amp;quot;pajekUpdateInterval&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;vT&amp;quot;, &amp;quot;voteType&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;hW&amp;quot;, &amp;quot;histWeight&amp;quot;);&lt;br /&gt;
	parametersMap.put( &amp;quot;nS&amp;quot;, &amp;quot;noiseSlope&amp;quot;);&lt;br /&gt;
	// Andrew wonders if something needs to go here for top agents param, &lt;br /&gt;
	// but doesn&#039;t know what this is for&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////&lt;br /&gt;
    // getInitParam&lt;br /&gt;
    // Controls what appears the the GUI parameter panel&lt;br /&gt;
    public String[] getInitParam () {&lt;br /&gt;
	String[] params = { &amp;quot;numAgents&amp;quot;, &amp;quot;connectRadius&amp;quot;, &lt;br /&gt;
			    &amp;quot;reconnectProb&amp;quot;, &amp;quot;netType&amp;quot;, &amp;quot;voteType&amp;quot;,&lt;br /&gt;
			    &amp;quot;histWeight&amp;quot;, &amp;quot;noiseSlope&amp;quot;,&lt;br /&gt;
					&amp;quot;numTopAgents&amp;quot;, // AS added for top agents param&lt;br /&gt;
			    // these are from the super class:&lt;br /&gt;
			    &amp;quot;rDebug&amp;quot;, &amp;quot;seed&amp;quot;};&lt;br /&gt;
	return params;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // getters and setters&lt;br /&gt;
    // ********************   Note   *************************&lt;br /&gt;
    // Specific format required if using inputted parameters&lt;br /&gt;
    //  (either through batch or gui)&lt;br /&gt;
    public int  getWorldXSize () {return worldXSize;}&lt;br /&gt;
    public void setWorldXSize (int size) {worldXSize = size;}&lt;br /&gt;
    public int  getWorldYSize () {return worldYSize;}&lt;br /&gt;
    public void setWorldYSize (int size) {worldYSize = size;}&lt;br /&gt;
   &lt;br /&gt;
    public int  getNumAgents() {return numAgents;}&lt;br /&gt;
    public void setNumAgents(int i) {numAgents = i;}&lt;br /&gt;
&lt;br /&gt;
    public double getReconnectProb() {return reconnectProb;}&lt;br /&gt;
    public void   setReconnectProb(double i) {reconnectProb = i;}&lt;br /&gt;
    public int  getConnectRadius() {return connectRadius;}&lt;br /&gt;
    public void setConnectRadius(int i) {connectRadius = i;}&lt;br /&gt;
&lt;br /&gt;
    public void setNetType(int i) {netType = i;}&lt;br /&gt;
    public int  getNetType() {return netType;}&lt;br /&gt;
    &lt;br /&gt;
    public void setVoteType(int i) {&lt;br /&gt;
	voteType = i;&lt;br /&gt;
	CustomNode.setVoteType(i);&lt;br /&gt;
    }&lt;br /&gt;
    public int  getVoteType() {return voteType;}&lt;br /&gt;
&lt;br /&gt;
    public void   setHistWeight(double i) {&lt;br /&gt;
	histWeight = i;&lt;br /&gt;
	CustomNode.setHistWeight(i);&lt;br /&gt;
    }&lt;br /&gt;
    public double getHistWeight() {return histWeight;}&lt;br /&gt;
&lt;br /&gt;
    public void setNoiseSlope(double i) {&lt;br /&gt;
	noiseSlope = i;&lt;br /&gt;
	CustomNode.setNoiseSlope(i);&lt;br /&gt;
    }&lt;br /&gt;
    public double getNoiseSlope() {return noiseSlope;}&lt;br /&gt;
&lt;br /&gt;
    public int    getUpdateInterval() {return updateInterval;}&lt;br /&gt;
    public void  setUpdateInterval(int i) {updateInterval = i;}&lt;br /&gt;
    public int    getPajekUpdateInterval() {return pajekUpdateInterval;}&lt;br /&gt;
    public void  setPajekUpdateInterval(int i) {pajekUpdateInterval = i;}&lt;br /&gt;
		// AS added for top agents param&lt;br /&gt;
		public int getNumTopAgents() {return numTopAgents;}&lt;br /&gt;
		public void setNumTopAgents(int n) {numTopAgents = n;}&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // buildModel&lt;br /&gt;
    // Does what it says&lt;br /&gt;
    public void buildModel(){&lt;br /&gt;
	if(rDebug &amp;gt; 0)&lt;br /&gt;
	    System.out.printf(&amp;quot;Build Model Begin\n&amp;quot;);&lt;br /&gt;
        &lt;br /&gt;
	// CALL FIRST -- defined in super class -- it starts RNG, etc&lt;br /&gt;
	buildModelStart();&lt;br /&gt;
	&lt;br /&gt;
	// set static parameters in node class&lt;br /&gt;
	CustomNode.setHistWeight(histWeight);&lt;br /&gt;
	CustomNode.setVoteType(voteType);&lt;br /&gt;
	CustomNode.setNoiseSlope(noiseSlope);&lt;br /&gt;
&lt;br /&gt;
	// setup the network class&lt;br /&gt;
        net = new Network(numAgents, connectRadius, reconnectProb);&lt;br /&gt;
        net.setModel(this);&lt;br /&gt;
&lt;br /&gt;
	CustomNode.setModel(this);&lt;br /&gt;
&lt;br /&gt;
	// have the network class build the network&lt;br /&gt;
        net.buildAdjacencyMatrix(netType);  // first build the adjacency matrix&lt;br /&gt;
&lt;br /&gt;
	net.buildAgentList();		    // then the agent list&lt;br /&gt;
        agentList = net.getAgentList();&lt;br /&gt;
	&lt;br /&gt;
	// setup the gamemaster&lt;br /&gt;
	compNodes = new CompNodeRep();&lt;br /&gt;
&lt;br /&gt;
	// prepare pajek file&lt;br /&gt;
       	net.startPajekFile(0);&lt;br /&gt;
	&lt;br /&gt;
        System.out.printf(&amp;quot;Build Model End\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////&lt;br /&gt;
    // buildSchedule&lt;br /&gt;
    // Sets what is to happen, when.&lt;br /&gt;
    public void buildSchedule () {&lt;br /&gt;
&lt;br /&gt;
	// schedule the current BatchModel&#039;s step() function&lt;br /&gt;
	// to execute every time step starting with time  step 0&lt;br /&gt;
	schedule.scheduleActionBeginning( 0, this, &amp;quot;step&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	// Schedule to stop at a particular time, StopT.  Rem out&lt;br /&gt;
	// to run indefinitely&lt;br /&gt;
	schedule.scheduleActionAt(getStopT(), this, &amp;quot;processEndOfRun&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// Only run every updateInterval steps&lt;br /&gt;
	schedule.scheduleActionAtInterval(updateInterval, new BasicAction() {&lt;br /&gt;
		public void execute() {&lt;br /&gt;
		    System.gc();         // garbage collect&lt;br /&gt;
		    stepReport();        // write step report&lt;br /&gt;
		}&lt;br /&gt;
	    }, Schedule.LAST);&lt;br /&gt;
&lt;br /&gt;
	// Only run every pajekUpdateInterval steps&lt;br /&gt;
	schedule.scheduleActionAtInterval(pajekUpdateInterval, new BasicAction() {&lt;br /&gt;
		public void execute() {&lt;br /&gt;
		    nextPajekNetwork();  // write pajek file and open new one&lt;br /&gt;
		}&lt;br /&gt;
      }, Schedule.LAST);&lt;br /&gt;
					  &lt;br /&gt;
	// Execute at step 1 only&lt;br /&gt;
	schedule.scheduleActionAt(1, new BasicAction() {&lt;br /&gt;
		public void execute() {&lt;br /&gt;
		    stepReport();&lt;br /&gt;
		    nextPajekNetwork();&lt;br /&gt;
		}&lt;br /&gt;
	    }, Schedule.LAST);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // printProjectHelp&lt;br /&gt;
    // this could be filled in with some help to get from running with &lt;br /&gt;
    // -help parameter&lt;br /&gt;
    public void printProjectHelp() {&lt;br /&gt;
	// print project help&lt;br /&gt;
	&lt;br /&gt;
	System.out.printf( &amp;quot;\n%s -- \n&amp;quot;, getName() );&lt;br /&gt;
	&lt;br /&gt;
	System.out.printf( &amp;quot;\n **** Add more info here!! **** \n&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	System.out.printf( &amp;quot;\n&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	printParametersMap();&lt;br /&gt;
	&lt;br /&gt;
	System.exit( 0 );&lt;br /&gt;
	&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
  &lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////////&lt;br /&gt;
    // Setup&lt;br /&gt;
    // Prepares the model, or resets it after the reset button is pressed&lt;br /&gt;
    // in GUI model&lt;br /&gt;
    public void setup () {&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )&lt;br /&gt;
	    System.out.printf( &amp;quot;&amp;lt;== Model setup() done.\n&amp;quot; );&lt;br /&gt;
	// Clean up previous instances&lt;br /&gt;
	schedule = null;&lt;br /&gt;
	System.gc ();&lt;br /&gt;
	&lt;br /&gt;
	// Set default values&lt;br /&gt;
	// These are overwritten by inputted values, if any&lt;br /&gt;
	numAgents              = 64;&lt;br /&gt;
	updateInterval         = 1;&lt;br /&gt;
	pajekUpdateInterval    = 1000000;&lt;br /&gt;
        worldXSize             = 400;&lt;br /&gt;
        worldYSize             = 400;&lt;br /&gt;
&lt;br /&gt;
	netType = 0;&lt;br /&gt;
	connectRadius = 2;&lt;br /&gt;
	reconnectProb = 0.1;&lt;br /&gt;
	&lt;br /&gt;
	voteType = 0;&lt;br /&gt;
	histWeight = 0;&lt;br /&gt;
	noiseSlope = 1;&lt;br /&gt;
&lt;br /&gt;
			// AS added for top agents param&lt;br /&gt;
			numTopAgents = 5;&lt;br /&gt;
		&lt;br /&gt;
        CustomNode.resetNextID();&lt;br /&gt;
        agentList = new ArrayList (numAgents);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        super.setup();	// Reads in input values&lt;br /&gt;
	schedule = new Schedule (1);&lt;br /&gt;
	&lt;br /&gt;
	// some post-load finishing touches&lt;br /&gt;
        startReportFile();&lt;br /&gt;
	&lt;br /&gt;
	// you probably don&#039;t want to remove any of the following&lt;br /&gt;
	// calls to process parameter changes and write the&lt;br /&gt;
	// initial state to the report file.&lt;br /&gt;
	// NB -&amp;gt; you might remove/add more agentChange processing&lt;br /&gt;
        applyAnyStoredChanges();&lt;br /&gt;
        //stepReport();&lt;br /&gt;
        //getPlaintextReportFile().flush();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // step&lt;br /&gt;
    // governs what happens at each step&lt;br /&gt;
    public void step(){&lt;br /&gt;
	stepNodes();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ////////////////////////////////////////////////////////////////&lt;br /&gt;
    // stepNodes&lt;br /&gt;
    // Steps each node.&lt;br /&gt;
    //  Has each vote for neighbors, then has each calculation&lt;br /&gt;
    //   own reputation.&lt;br /&gt;
    public void stepNodes(){&lt;br /&gt;
	for(CustomNode node : agentList){&lt;br /&gt;
	    node.voteAll();&lt;br /&gt;
	}&lt;br /&gt;
	for(CustomNode node : agentList){&lt;br /&gt;
	    node.calcReputation();&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // addAgent&lt;br /&gt;
    // Input: CustomNode agent&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Adds a new agent to the agent list&lt;br /&gt;
    public void addAgent(CustomNode agent){&lt;br /&gt;
	agentList.add(agent);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // delAgent&lt;br /&gt;
    // Input: CustomNode agent&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Deletes an agent from the agent list&lt;br /&gt;
    public void delAgent(CustomNode agent){&lt;br /&gt;
	agentList.remove(agentList.indexOf(agent));&lt;br /&gt;
	System.gc();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // calcAvgReputation()&lt;br /&gt;
    public double calcAvgReputation(){&lt;br /&gt;
	double sum = 0;&lt;br /&gt;
	for(int i = 0; i &amp;lt; numAgents; i++){&lt;br /&gt;
	    CustomNode node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    sum += (double) node.getReputation();&lt;br /&gt;
	}&lt;br /&gt;
	return sum/(double) numAgents;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // calcTopRepSkills&lt;br /&gt;
    // inputs: int x, the number of top agents include&lt;br /&gt;
    // outputs: double, the reputation of the top x agents&lt;br /&gt;
    //  This calculates the sum of the skils of the top x agents&lt;br /&gt;
		// AS: could be changed to just use numTopAgents directly, &lt;br /&gt;
		// but I&#039;m gonna change it at call time only--&lt;br /&gt;
		// lower impact if I fuck something up.&lt;br /&gt;
    public double calcTopRepSkills(int x){&lt;br /&gt;
	ArrayList&amp;lt;CustomNode&amp;gt; tempList = new ArrayList&amp;lt;CustomNode&amp;gt;();&lt;br /&gt;
	tempList.addAll(agentList);&lt;br /&gt;
	Collections.sort(tempList, compNodes);&lt;br /&gt;
	double skillSum = 0;&lt;br /&gt;
	CustomNode node;&lt;br /&gt;
	for (int i = numAgents -x; i &amp;lt; numAgents; i++){&lt;br /&gt;
	    node = tempList.get(i);&lt;br /&gt;
	    skillSum += node.getSkill();&lt;br /&gt;
	}&lt;br /&gt;
	return skillSum;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////////&lt;br /&gt;
    // calcRepSkillMatch&lt;br /&gt;
    // inputs: none&lt;br /&gt;
    // outputs: double, the fraction of cases that a Rep and Skill match &lt;br /&gt;
    // (High/Low)&lt;br /&gt;
    public double calcRepSkillMatch(){&lt;br /&gt;
	double count = 0;&lt;br /&gt;
	for(CustomNode node : agentList){&lt;br /&gt;
	    if (node.getReputation() &amp;lt;= 0.5 &amp;amp; node.getSkill() &amp;lt;= 0.5){&lt;br /&gt;
		count ++;&lt;br /&gt;
	    }&lt;br /&gt;
	    else if (node.getReputation() &amp;gt; 0.5 &amp;amp; node.getSkill() &amp;gt; 0.5){&lt;br /&gt;
		count ++;&lt;br /&gt;
	    }&lt;br /&gt;
	}&lt;br /&gt;
	return count / ((double) numAgents); &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // stepReport&lt;br /&gt;
    // each step write out:&lt;br /&gt;
    //   time  expectivity&lt;br /&gt;
    //&lt;br /&gt;
    // Note: update the writeHeaderCommentsToReportFile() to print&lt;br /&gt;
    //       lines of text describing the data written to the report file.&lt;br /&gt;
    &lt;br /&gt;
    public void stepReport () {&lt;br /&gt;
	String s;&lt;br /&gt;
	s = String.format(&amp;quot;%f %f %f&amp;quot;,&lt;br /&gt;
			  schedule.getCurrentTimeDouble(), calcTopRepSkills(5),&lt;br /&gt;
			  calcRepSkillMatch());&lt;br /&gt;
&lt;br /&gt;
	//writeLineToReportFile ( &amp;quot;&amp;lt;stepreport&amp;gt;&amp;quot; + s + &amp;quot;&amp;lt;/stepreport&amp;gt;&amp;quot; );&lt;br /&gt;
	writeLineToPlaintextReportFile( s );&lt;br /&gt;
	// flush the buffers so the data is not lost in a &amp;quot;crash&amp;quot;&lt;br /&gt;
	//getReportFile().flush();&lt;br /&gt;
	getPlaintextReportFile().flush();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // writeHeaderCommentsToReportFile&lt;br /&gt;
    // customize to match what you are writing to the report files in &lt;br /&gt;
    // stepReport.&lt;br /&gt;
    &lt;br /&gt;
    public void writeHeaderCommentsToReportFile () {&lt;br /&gt;
	writeLineToReportFile( &amp;quot;&amp;lt;comment&amp;gt;&amp;quot; );&lt;br /&gt;
	writeLineToReportFile( &amp;quot;                        &amp;quot; );&lt;br /&gt;
	writeLineToReportFile( &amp;quot;  time    expectivity   &amp;quot; );&lt;br /&gt;
	writeLineToReportFile( &amp;quot;&amp;lt;/comment&amp;gt;&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	writeLineToPlaintextReportFile( &amp;quot; #time  topSkill  RepSkillMatch&amp;quot; );&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public Schedule getSchedule () {&lt;br /&gt;
        return schedule;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public String getName () {&lt;br /&gt;
        return &amp;quot;Network&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public ArrayList&amp;lt;CustomNode&amp;gt; getAgentList() {return agentList;}&lt;br /&gt;
    &lt;br /&gt;
    public static void main (String[] args) {&lt;br /&gt;
        uchicago.src.sim.engine.SimInit init = new uchicago.src.sim.engine.SimInit ();&lt;br /&gt;
        RepMod model = new RepMod ();&lt;br /&gt;
        init.loadModel (model, null, false);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    // The following are some debugging methods&lt;br /&gt;
    public static void printVector(double[] vector){&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
        for(int i = 0; i &amp;lt; vector.length; i++){&lt;br /&gt;
            System.out.printf(&amp;quot;%f &amp;quot;, vector[i]);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static void printVector(int[] vector){&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
        for(int i = 0; i &amp;lt; vector.length; i++){&lt;br /&gt;
            System.out.printf(&amp;quot;%d &amp;quot;, vector[i]);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public void printAgentList(){&lt;br /&gt;
        System.out.printf(&amp;quot;Printing agentList, size = %d\n&amp;quot;, agentList.size());&lt;br /&gt;
        CustomNode node;&lt;br /&gt;
        CustomNode inode;&lt;br /&gt;
        for(int i = 0; i &amp;lt; (agentList.size()); i++){&lt;br /&gt;
	    node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    ArrayList &amp;lt;CustomNode&amp;gt; outNodes = node.getToNodes();&lt;br /&gt;
	    System.out.printf(&amp;quot;Node %d points to (%d objects): &amp;quot;, node.getID(),&lt;br /&gt;
			      outNodes.size());&lt;br /&gt;
	    for(int j = 0; j &amp;lt; (outNodes.size()); j++){&lt;br /&gt;
		inode = (CustomNode) outNodes.get(j);&lt;br /&gt;
		System.out.printf(&amp;quot; %d &amp;quot;, inode.getID());&lt;br /&gt;
	    }&lt;br /&gt;
	    System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////&lt;br /&gt;
    // nextPajekNetwork&lt;br /&gt;
    // closes the current pajek file and opens the new one.&lt;br /&gt;
    public void nextPajekNetwork(){&lt;br /&gt;
	net.writePajekNetwork(agentList);&lt;br /&gt;
	net.endPajekFile();&lt;br /&gt;
	net.startPajekFile((int) schedule.getCurrentTime()/pajekUpdateInterval + 1);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    /////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // processEndOfRun&lt;br /&gt;
    // ends process&lt;br /&gt;
    public void processEndOfRun ( ) {&lt;br /&gt;
	long finalStep = (long) schedule.getCurrentTime();&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )  &lt;br /&gt;
	    System.out.printf(&amp;quot;\n\n===== Model processEndOfRun =====\n\n&amp;quot; );&lt;br /&gt;
	applyAnyStoredChanges();&lt;br /&gt;
	stepReport();&lt;br /&gt;
	endReportFile(finalStep);&lt;br /&gt;
	net.writePajekNetwork(agentList);&lt;br /&gt;
	net.endPajekFile();&lt;br /&gt;
	this.fireStopSim();&lt;br /&gt;
    }   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //*******************************************************************&lt;br /&gt;
    // Inner classes&lt;br /&gt;
&lt;br /&gt;
    private class CompNodeRep implements Comparator{&lt;br /&gt;
	&lt;br /&gt;
	public CompNodeRep(){&lt;br /&gt;
	}&lt;br /&gt;
	public int compare(Object o1, Object o2){&lt;br /&gt;
	    CustomNode nodei = (CustomNode) o1;&lt;br /&gt;
	    CustomNode nodej = (CustomNode) o2;&lt;br /&gt;
	    if (nodei.getReputation() &amp;lt; nodej.getReputation())&lt;br /&gt;
		return -1;&lt;br /&gt;
	    else if (nodei.getReputation() &amp;gt; nodej.getReputation())&lt;br /&gt;
		return 1;&lt;br /&gt;
	    else&lt;br /&gt;
		return 0;&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=GUIModel.java.wp&amp;diff=3655</id>
		<title>GUIModel.java.wp</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=GUIModel.java.wp&amp;diff=3655"/>
		<updated>2006-06-19T05:14:42Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[WikiPeerCode]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * GUIModel.java&lt;br /&gt;
 *&lt;br /&gt;
 * Created on January 30, 2005, 12:21 PM&lt;br /&gt;
 * Modified June 18, 2006 13:55 by Jack&lt;br /&gt;
 * Modified slightly 6-18-06 23:10 by Andrew&lt;br /&gt;
 * This runs the graphical interface for the RepMod model&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
package RepMod;&lt;br /&gt;
import java.awt.event.ActionEvent;&lt;br /&gt;
import java.awt.event.ActionListener;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.Formatter;&lt;br /&gt;
import java.util.HashSet;&lt;br /&gt;
&lt;br /&gt;
import uchicago.src.sim.engine.Schedule;&lt;br /&gt;
import uchicago.src.sim.engine.SimModelImpl;&lt;br /&gt;
import uchicago.src.sim.engine.*;&lt;br /&gt;
import uchicago.src.sim.util.*;&lt;br /&gt;
import uchicago.src.sim.gui.*;&lt;br /&gt;
import uchicago.src.sim.gui.ColorMap;&lt;br /&gt;
import uchicago.src.sim.gui.DisplaySurface;&lt;br /&gt;
import uchicago.src.sim.gui.Object2DDisplay;&lt;br /&gt;
import uchicago.src.sim.gui.Value2DDisplay;&lt;br /&gt;
import uchicago.src.sim.space.Object2DTorus;&lt;br /&gt;
import uchicago.src.sim.engine.AbstractGUIController;&lt;br /&gt;
import uchicago.src.sim.analysis.*;&lt;br /&gt;
import java.util.Collections;&lt;br /&gt;
import java.util.Comparator;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * @author Jack Waddell&lt;br /&gt;
 */&lt;br /&gt;
public class GUIModel extends RepMod{&lt;br /&gt;
&lt;br /&gt;
    //*******************************************************&lt;br /&gt;
    // Instance Parameters&lt;br /&gt;
&lt;br /&gt;
    // The actual display surface, where things are put on the screen&lt;br /&gt;
    private DisplaySurface              surface;&lt;br /&gt;
    &lt;br /&gt;
    // A layout, which tells the surface where to put nodes and edges&lt;br /&gt;
    private AbstractGraphLayout         layout;&lt;br /&gt;
&lt;br /&gt;
    // A graph of the agreement between rep and skill&lt;br /&gt;
    private OpenSequenceGraph           repSkillGraph;&lt;br /&gt;
&lt;br /&gt;
    // A graph of the running sum of the skill of the top repped agents&lt;br /&gt;
    private OpenSequenceGraph           topSkillGraph;&lt;br /&gt;
&lt;br /&gt;
    // A plot&lt;br /&gt;
    private Plot                        histPlot;&lt;br /&gt;
&lt;br /&gt;
    // A Histogram&lt;br /&gt;
    // private OpenHistogram               wealthHist;&lt;br /&gt;
&lt;br /&gt;
    // A Histogram&lt;br /&gt;
    // private OpenHistogram               degreeHist;&lt;br /&gt;
    &lt;br /&gt;
    //*******************************************************************&lt;br /&gt;
    // Methods&lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // setup&lt;br /&gt;
    //&lt;br /&gt;
    // This runs automatically when the model starts&lt;br /&gt;
    // and when you click the reload button, to &amp;quot;tear down&amp;quot; any &lt;br /&gt;
    // existing display objects, and get ready to initialize &lt;br /&gt;
    // them at the start of the next &#039;run&#039;.&lt;br /&gt;
    //&lt;br /&gt;
    public void setup() {&lt;br /&gt;
	// the super class does conceptual-model setup (RepMod)&lt;br /&gt;
	super.setup();  &lt;br /&gt;
	&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )&lt;br /&gt;
	    System.out.printf( &amp;quot;&amp;lt;== GUIModel setup() begin.\n&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	// NOTE: you may want to set these next two to &#039;true&#039;&lt;br /&gt;
	// if you are on a windows machine.  that would tell repast&lt;br /&gt;
	// to by default send System.out and .err output to&lt;br /&gt;
	// a special repast output window.&lt;br /&gt;
	AbstractGUIController.CONSOLE_ERR = false;&lt;br /&gt;
	AbstractGUIController.CONSOLE_OUT = false;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	// For restart purposes, dispose of any displays&lt;br /&gt;
	if ( surface != null ) surface.dispose();&lt;br /&gt;
	if ( repSkillGraph != null ) repSkillGraph.dispose();&lt;br /&gt;
	if ( topSkillGraph != null ) topSkillGraph.dispose();&lt;br /&gt;
	//if ( wealthHist != null) wealthHist.dispose();&lt;br /&gt;
	//if ( degreeHist != null) degreeHist.dispose();&lt;br /&gt;
&lt;br /&gt;
	// Create and register the abstract surface&lt;br /&gt;
	surface = null;&lt;br /&gt;
	surface = new DisplaySurface( this, &amp;quot;Network Display&amp;quot; );&lt;br /&gt;
	registerDisplaySurface( &amp;quot;Main Display&amp;quot;, surface );&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
	// Add Custom Buttons&lt;br /&gt;
	modelManipulator.init();&lt;br /&gt;
	modelManipulator.addButton(&amp;quot;Layout - Circular&amp;quot;,&lt;br /&gt;
	     new ActionListener(){&lt;br /&gt;
		 public void actionPerformed(ActionEvent evt){&lt;br /&gt;
		     changeLayoutCircular();&lt;br /&gt;
		 }&lt;br /&gt;
	     }&lt;br /&gt;
	);						   &lt;br /&gt;
	modelManipulator.addButton(&amp;quot;Layout - Kamada&amp;quot;,&lt;br /&gt;
	     new ActionListener(){&lt;br /&gt;
		 public void actionPerformed(ActionEvent evt){&lt;br /&gt;
		     changeLayoutKamada();&lt;br /&gt;
		 }&lt;br /&gt;
	     }&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	modelManipulator.addButton(&amp;quot;Print Nodes&amp;quot;,&lt;br /&gt;
	     new ActionListener(){&lt;br /&gt;
		 public void actionPerformed(ActionEvent evt){&lt;br /&gt;
		     printNodes();&lt;br /&gt;
		 }&lt;br /&gt;
	     }&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	modelManipulator.addButton(&amp;quot;Print Rep Sorted Nodes&amp;quot;,&lt;br /&gt;
	     new ActionListener(){&lt;br /&gt;
		 public void actionPerformed(ActionEvent evt){&lt;br /&gt;
		     printRepSortedNodes();&lt;br /&gt;
		 }&lt;br /&gt;
	     }&lt;br /&gt;
	);&lt;br /&gt;
              &lt;br /&gt;
	modelManipulator.addButton(&amp;quot;Kill All Edges&amp;quot;,&lt;br /&gt;
	     new ActionListener(){&lt;br /&gt;
		 public void actionPerformed(ActionEvent evt){&lt;br /&gt;
		     killAllEdges();&lt;br /&gt;
		 }&lt;br /&gt;
	     }           &lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
	modelManipulator.addButton(&amp;quot;Plot Reputation vs. Skill&amp;quot;,&lt;br /&gt;
	     new ActionListener(){&lt;br /&gt;
		 public void actionPerformed(ActionEvent evt){&lt;br /&gt;
		     plotRepSkill();&lt;br /&gt;
		 }&lt;br /&gt;
	     }           &lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )&lt;br /&gt;
	    System.out.printf( &amp;quot;&amp;lt;== GUIModel setup() done.\n&amp;quot; );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // begin&lt;br /&gt;
    //&lt;br /&gt;
    // This runs when you click the &amp;quot;initialize&amp;quot; button&lt;br /&gt;
    // (the button with the single arrow that goes around in a circle)&lt;br /&gt;
    // or at the first step&lt;br /&gt;
    public void begin()	{&lt;br /&gt;
	DMSG(1, &amp;quot;==&amp;gt; enter GUIModel-begin()&amp;quot; );&lt;br /&gt;
	// Set up drawables&lt;br /&gt;
	CustomNode.setUpNodeDrawing(this);&lt;br /&gt;
	CustomEdge.setUpEdgeDrawing(this);&lt;br /&gt;
	&lt;br /&gt;
	buildModel();  // Calls in the base model (RepMod)&lt;br /&gt;
	&lt;br /&gt;
	buildDisplay();  // Constructs the displays&lt;br /&gt;
	if (rDebug &amp;gt; 0)&lt;br /&gt;
	    System.out.printf(&amp;quot;Display Built Successfully. \n&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
	// Constructs the schedule; If defined in GUIModel, ignores buildSchedule in base model&lt;br /&gt;
	buildSchedule(); &lt;br /&gt;
&lt;br /&gt;
	surface.display(); // displays the surface on the display&lt;br /&gt;
&lt;br /&gt;
	writeHeaderCommentsToReportFile();&lt;br /&gt;
	&lt;br /&gt;
	DMSG(1, &amp;quot;&amp;lt;== leave GUIModel-begin() done.&amp;quot; );&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // buildDisplay&lt;br /&gt;
    //&lt;br /&gt;
    // builds the display and display related things&lt;br /&gt;
    //&lt;br /&gt;
    public void buildDisplay() {&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )&lt;br /&gt;
	    System.out.printf( &amp;quot;==&amp;gt; GUIModel buildDisplay...\n&amp;quot; );&lt;br /&gt;
        &lt;br /&gt;
	// Layout specifies the arrangement of nodes and edges&lt;br /&gt;
	// This specifically uses the Kamada-Kawai method&lt;br /&gt;
	layout = new KamadaGraphLayout(agentList, worldXSize, worldYSize);&lt;br /&gt;
	Network2DDisplay display = new Network2DDisplay(layout);&lt;br /&gt;
	&lt;br /&gt;
	layout.updateLayout();  // actually execute the laying out&lt;br /&gt;
&lt;br /&gt;
	// Register the layout with the display surface for drawing&lt;br /&gt;
	surface.addDisplayableProbeable(display, &amp;quot;Network Display&amp;quot;);&lt;br /&gt;
	surface.addZoomable (display);&lt;br /&gt;
	surface.setBackground (java.awt.Color.black);&lt;br /&gt;
	&lt;br /&gt;
	addSimEventListener (surface);&lt;br /&gt;
	&lt;br /&gt;
	// Makes a graph&lt;br /&gt;
	repSkillGraph = new OpenSequenceGraph(&amp;quot;RepSkillMatch&amp;quot;, this); // constructs graph&lt;br /&gt;
	repSkillGraph.setXRange(0, 2000);                     // sets ranges&lt;br /&gt;
	repSkillGraph.setYRange(-1.1, 1.1);&lt;br /&gt;
	repSkillGraph.setAxisTitles(&amp;quot;time&amp;quot;, &amp;quot;frac. match&amp;quot;);         // sets axis lables&lt;br /&gt;
	&lt;br /&gt;
	// This generates a sequence, which is read into the graph&lt;br /&gt;
	// To generalize, change sequence class name, and what it returns&lt;br /&gt;
	class repSkillSequence implements Sequence {&lt;br /&gt;
	    public double getSValue(){&lt;br /&gt;
		return calcRepSkillMatch();&lt;br /&gt;
	    }&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	// Add the above sequence to the graph.&lt;br /&gt;
	// You can add several sequences to plot simultaneously&lt;br /&gt;
	repSkillGraph.addSequence(&amp;quot;frace. match&amp;quot;, new repSkillSequence());&lt;br /&gt;
	// Display the graph.  It will need to be updated in Step&lt;br /&gt;
	repSkillGraph.display();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	topSkillGraph = new OpenSequenceGraph(&amp;quot;Top Rep Skills&amp;quot;, this); // constructs graph&lt;br /&gt;
	topSkillGraph.setXRange(0, 2000);                     // sets ranges&lt;br /&gt;
	topSkillGraph.setYRange(0, 5);&lt;br /&gt;
	topSkillGraph.setAxisTitles(&amp;quot;time&amp;quot;, &amp;quot;Skills&amp;quot;);         // sets axis lables&lt;br /&gt;
	&lt;br /&gt;
	// This generates a sequence, which is read into the graph&lt;br /&gt;
	// To generalize, change sequence class name, and what it returns&lt;br /&gt;
	class topSkillSequence implements Sequence {&lt;br /&gt;
	    public double getSValue(){&lt;br /&gt;
			// AS: changed to use numTopAgents&lt;br /&gt;
			//return calcTopRepSkills(5);&lt;br /&gt;
			return calcTopRepSkills(numTopAgents);&lt;br /&gt;
	    }&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	// Add the above sequence to the graph.&lt;br /&gt;
	// You can add several sequences to plot simultaneously&lt;br /&gt;
	topSkillGraph.addSequence(&amp;quot;Skill of Top Rep Agents&amp;quot;, new topSkillSequence());&lt;br /&gt;
	// Display the graph.  It will need to be updated in Step&lt;br /&gt;
	topSkillGraph.display();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	// Generate a histogram of agent wealth&lt;br /&gt;
	/*&lt;br /&gt;
	wealthHist = new OpenHistogram(&amp;quot;Agent Wealth Distribution&amp;quot;, 10, 0);&lt;br /&gt;
	wealthHist.setYRange(0, 100.0);&lt;br /&gt;
	BinDataSource histSource = new BinDataSource(){&lt;br /&gt;
		public double getBinValue(Object o){&lt;br /&gt;
		    CustomNode node = (CustomNode) o;&lt;br /&gt;
		    return node.getReputation();&lt;br /&gt;
		}&lt;br /&gt;
	    };&lt;br /&gt;
&lt;br /&gt;
	wealthHist.createHistogramItem(&amp;quot;Wealth&amp;quot;, agentList, histSource);&lt;br /&gt;
	wealthHist.display();&lt;br /&gt;
	*/&lt;br /&gt;
&lt;br /&gt;
	// Generate a histogram of agent degree&lt;br /&gt;
	/*&lt;br /&gt;
	degreeHist = new OpenHistogram(&amp;quot;Agent Degree Distribution&amp;quot;, 10, 0);&lt;br /&gt;
	degreeHist.setYRange(0, 100.0);&lt;br /&gt;
	BinDataSource degreeSource = new BinDataSource(){&lt;br /&gt;
		public double getBinValue(Object o){&lt;br /&gt;
		    CustomNode node = (CustomNode) o;&lt;br /&gt;
		    return node.getDegree();&lt;br /&gt;
		}&lt;br /&gt;
	    };&lt;br /&gt;
&lt;br /&gt;
	degreeHist.createHistogramItem(&amp;quot;Degree&amp;quot;, agentList, degreeSource);&lt;br /&gt;
	degreeHist.display();&lt;br /&gt;
	*/&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    ////////////////////////////////////////////////////////////////&lt;br /&gt;
    // buildSchedule&lt;br /&gt;
    // Adds to buildSchedule in main model&lt;br /&gt;
    // Note, model-type changes should also be included in&lt;br /&gt;
    // batchmodel&#039;s buildSchedule if one wants to ever run in batch&lt;br /&gt;
    &lt;br /&gt;
    public void buildSchedule() {&lt;br /&gt;
	&lt;br /&gt;
	schedule = new Schedule(1);&lt;br /&gt;
	super.buildSchedule();  // Get base model schedule&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    //////////////////////////////////////////////////////////////////&lt;br /&gt;
    // step&lt;br /&gt;
    //&lt;br /&gt;
    // Ask the super-class (RepMod) to do its step() method,&lt;br /&gt;
    // and then this does display related activities.&lt;br /&gt;
    public void step() {&lt;br /&gt;
	&lt;br /&gt;
	super.step();	  // the base model does whatever it does&lt;br /&gt;
	&lt;br /&gt;
	// add things after this for all displays (graphs, etc)&lt;br /&gt;
	drawNodes();&lt;br /&gt;
	surface.updateDisplay();&lt;br /&gt;
	repSkillGraph.step();&lt;br /&gt;
	topSkillGraph.step();&lt;br /&gt;
	//wealthHist.step();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    ////////////////////////////////////////////////////////////////&lt;br /&gt;
    // drawNodes&lt;br /&gt;
    // has nodes re-draw themselves based on Reputation&lt;br /&gt;
    public void drawNodes(){&lt;br /&gt;
        CustomNode node;&lt;br /&gt;
	double maxReputation = 0;&lt;br /&gt;
        for(int i = 0; i &amp;lt; numAgents; i++){&lt;br /&gt;
            node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    if (node.getReputation() &amp;gt; maxReputation)&lt;br /&gt;
		maxReputation = node.getReputation();&lt;br /&gt;
        }&lt;br /&gt;
	for(int i = 0; i &amp;lt; numAgents; i++){&lt;br /&gt;
            node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    node.setNodeColorFromReputation(maxReputation);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////////////&lt;br /&gt;
    // processEndOfRun&lt;br /&gt;
    // called once, at end of run.&lt;br /&gt;
    public void processEndOfRun ( ) {&lt;br /&gt;
	long finalStep = (long) schedule.getCurrentTime();&lt;br /&gt;
	if ( rDebug &amp;gt; 0 )  &lt;br /&gt;
	    System.out.printf(&amp;quot;\n\n===== GUIModel processEndOfRun =====\n\n&amp;quot; );&lt;br /&gt;
	applyAnyStoredChanges();&lt;br /&gt;
	endReportFile(finalStep);&lt;br /&gt;
	this.fireStopSim();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // addAgent&lt;br /&gt;
    // Input: CustomNode agent&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Adds a new agent to the agent list&lt;br /&gt;
    public void addAgent(CustomNode agent){&lt;br /&gt;
	super.addAgent(agent);&lt;br /&gt;
	updateLayoutAgentList();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /////////////////////////////////////////////////////////////&lt;br /&gt;
    // delAgent&lt;br /&gt;
    // Input: CustomNode agent&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Deletes an agent from the agent list&lt;br /&gt;
    public void delAgent(CustomNode agent){&lt;br /&gt;
	super.delAgent(agent);&lt;br /&gt;
	updateLayoutAgentList();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ////////////////////////////////////////////////////////////&lt;br /&gt;
    // updateLayoutAgentList&lt;br /&gt;
    // Input: none&lt;br /&gt;
    // Output: none&lt;br /&gt;
    // Update layout&#039;s agentList.  Model&#039;s agentlist&lt;br /&gt;
    //  is updated with gm&#039;s (since they both point to &lt;br /&gt;
    //  the same object).  Layout is dumb, and evidently&lt;br /&gt;
    //  re-stores pointers to objects in list, rather than&lt;br /&gt;
    //  the list.&lt;br /&gt;
    public void updateLayoutAgentList(){&lt;br /&gt;
	&lt;br /&gt;
	layout.setList(agentList); &lt;br /&gt;
	// update the layout, re-executing layout method (e.g. Kamada)&lt;br /&gt;
	layout.updateLayout(); &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    ///////////////////////////////////////////////////////////////////&lt;br /&gt;
    // changeLayoutCircular&lt;br /&gt;
    // Uses circular rather than Kamada layout&lt;br /&gt;
    public void changeLayoutCircular(){&lt;br /&gt;
        layout = new CircularGraphLayout(agentList, worldXSize, worldYSize);&lt;br /&gt;
	layout.updateLayout();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    ///////////////////////////////////////////////////////////////////&lt;br /&gt;
    // changeLayoutKamada&lt;br /&gt;
    // Uses kamada-kawai layout, rather than circular&lt;br /&gt;
    public void changeLayoutKamada(){&lt;br /&gt;
	layout = new KamadaGraphLayout(agentList, worldXSize, worldYSize);&lt;br /&gt;
	layout.updateLayout();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    ///////////////////////////////////////////////////////////////////&lt;br /&gt;
    // printNodes&lt;br /&gt;
    // print node properties to terminal window&lt;br /&gt;
    // Mainly used for debugging&lt;br /&gt;
    public void printNodes(){&lt;br /&gt;
	System.out.printf(&amp;quot;\nAt time = %f\n&amp;quot;, schedule.getCurrentTimeDouble());&lt;br /&gt;
	for(int i = 0; i &amp;lt; agentList.size(); i++){&lt;br /&gt;
	    CustomNode aNode = (CustomNode) agentList.get(i);&lt;br /&gt;
	    String s = String.format(&amp;quot;#%d has %1.3f rep with skill %1.3f.\n&amp;quot;, &lt;br /&gt;
		     aNode.getID(), aNode.getReputation(), aNode.getSkill());&lt;br /&gt;
&lt;br /&gt;
	    System.out.printf(s);&lt;br /&gt;
	}&lt;br /&gt;
	System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    ///////////////////////////////////////////////////////////////////&lt;br /&gt;
    // printRepSortedNodes&lt;br /&gt;
    // print node properties to terminal window&lt;br /&gt;
    // Mainly used for debugging&lt;br /&gt;
&lt;br /&gt;
    public void printRepSortedNodes(){&lt;br /&gt;
	ArrayList&amp;lt;CustomNode&amp;gt; tempList = new ArrayList&amp;lt;CustomNode&amp;gt;();&lt;br /&gt;
	tempList.addAll(agentList);&lt;br /&gt;
	Collections.sort(tempList, compNodes);&lt;br /&gt;
	System.out.printf(&amp;quot;\nAt time = %f\n&amp;quot;, schedule.getCurrentTimeDouble());&lt;br /&gt;
	for(CustomNode agent : tempList){&lt;br /&gt;
	    String s = String.format(&amp;quot;#%d has %1.3f rep with skill %1.3f.\n&amp;quot;, &lt;br /&gt;
		     agent.getID(), agent.getReputation(), agent.getSkill());&lt;br /&gt;
&lt;br /&gt;
	    System.out.printf(s);&lt;br /&gt;
	}&lt;br /&gt;
	System.out.printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    //////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // killAllEdges&lt;br /&gt;
    // deletes all edges&lt;br /&gt;
    // Mainly used for debugging, or being a bastard&lt;br /&gt;
    public void killAllEdges(){&lt;br /&gt;
	for(int i = 0; i &amp;lt; agentList.size(); i++){&lt;br /&gt;
	    CustomNode node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    node.clearInEdges();&lt;br /&gt;
	    node.clearOutEdges();&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // plotRepSkill()&lt;br /&gt;
    public void plotRepSkill(){&lt;br /&gt;
	Plot repSkillPlot = new Plot(&amp;quot;Reputation v. Skill&amp;quot;);&lt;br /&gt;
	repSkillPlot.display();&lt;br /&gt;
	repSkillPlot.setConnected(false);&lt;br /&gt;
	&lt;br /&gt;
	for (int i = 0; i &amp;lt; numAgents; i++) {&lt;br /&gt;
	    CustomNode node = (CustomNode) agentList.get(i);&lt;br /&gt;
	    repSkillPlot.plotPoint(node.getSkill(), node.getReputation(), 0);&lt;br /&gt;
	}&lt;br /&gt;
	repSkillPlot.updateGraph();&lt;br /&gt;
	repSkillPlot.setXRange(0, 1);	&lt;br /&gt;
	repSkillPlot.setYRange(0, 1);&lt;br /&gt;
	//aPlot.fillPlot();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    /////////////////////////////////////////////////////////////////////&lt;br /&gt;
    /////////////////////////////////////////////////////////////////////&lt;br /&gt;
    //   ****  NO NEEd TO CHANGE THE REST OF THIS  *****&lt;br /&gt;
    &lt;br /&gt;
    ////////////////////////////////////////////////////////////////////&lt;br /&gt;
    // main entry point&lt;br /&gt;
    public static void main( String[] args ) {&lt;br /&gt;
	&lt;br /&gt;
	uchicago.src.sim.engine.SimInit init =&lt;br /&gt;
	    new uchicago.src.sim.engine.SimInit();&lt;br /&gt;
	GUIModel model = new GUIModel();&lt;br /&gt;
	&lt;br /&gt;
	//System.out.printf(&amp;quot;==&amp;gt; GUIMOdel main...\n&amp;quot; );&lt;br /&gt;
	&lt;br /&gt;
	// set the type of model class, this is necessary&lt;br /&gt;
	// so the parameters object knows whether or not&lt;br /&gt;
	// to do GUI related updates of panels,etc when a&lt;br /&gt;
	// parameter is changed&lt;br /&gt;
	model.setModelType(&amp;quot;GUIModel&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
        // Do this to set the Update Probes option to true in the&lt;br /&gt;
        // Repast Actions panel&lt;br /&gt;
        Controller.UPDATE_PROBES = true;&lt;br /&gt;
	&lt;br /&gt;
	model.setCommandLineArgs( args );&lt;br /&gt;
	init.loadModel( model, null, false ); // does setup()&lt;br /&gt;
	&lt;br /&gt;
	// this new function calls ProbeUtilities.updateProbePanels() and &lt;br /&gt;
	// ProbeUtilities.updateModelProbePanel()&lt;br /&gt;
	model.updateAllProbePanels();&lt;br /&gt;
	&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /** Creates a new instance of GUIModel */&lt;br /&gt;
    public GUIModel() {&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=Andrew_Stout&amp;diff=3222</id>
		<title>Andrew Stout</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=Andrew_Stout&amp;diff=3222"/>
		<updated>2006-06-10T22:42:21Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:andrewstout.jpg]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
CSSS contact info:&lt;br /&gt;
*Polyhymnia #20, ext 4224&lt;br /&gt;
*[my last name] @ cs.umass.edu&lt;br /&gt;
*cell 413 695 3814 (reception is terrible)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I am a PhD student in Computer Science at the University of Massachusetts.  &lt;br /&gt;
&lt;br /&gt;
The general unifying theme of my research interests is to understand-by-building systems that continually adapt, building on previous adaptations, driven not (or not only) by external pressures, but by forces within the system: systems that display bootstrapping, unbounded, intrinsic adaptation.&lt;br /&gt;
My driving interest is in discovering representations and algorithms for constructive, grounded, long-term, domain-general cognitive development in robots.  I have a sustained secondary interest in evolutionary computation, self-organization, and artificial life.&lt;br /&gt;
&lt;br /&gt;
I have a [http://www.cs.umass.edu/~stout/ webpage], but it&#039;s pretty minimal...&lt;br /&gt;
&lt;br /&gt;
When I&#039;m not pursuing these interests, I enjoy ultimate frisbee and volleyball; I&#039;m a news junkie and a religious watcher of The Daily Show; I&#039;m in for some World Cup watching.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dan&#039;s questions:&lt;br /&gt;
&lt;br /&gt;
# What topics do you have some expertise in and would you be willing to help others learn them?&lt;br /&gt;
#*I&#039;m a competent programmer, although not the code ninja a CS grad student ought to be: my go-to language is Python, I&#039;m learning OCaml, I dabble in Matlab when forced to, and I have less recent experience with Java, C++, and others.  &lt;br /&gt;
#*I&#039;m comfortable at the Unix/Linux command-line.&lt;br /&gt;
#*My graduate background is in Machine Learning, if any of that will be useful.  This semester I took a seminar that examined some ML applications of spectral graph theory, which I can imagine being of interest to others.&lt;br /&gt;
# What do you want to learn?&lt;br /&gt;
#*My formal training in complex systems science has been quite limited, so I&#039;m looking forward to a rigorous treatment of the whole spectrum and finding out what the current state of the art and agenda are.  I&#039;m curious about agent-based modeling, network theory, biology, geosystems, economics, etc.&lt;br /&gt;
#*More specifically, I&#039;m interested in acquiring tools for identifying phase changes and the &amp;quot;edge of chaos&amp;quot; in &amp;quot;learning space&amp;quot;--the fertile region between what an agent has already learned and what it is not yet ready to learn.&lt;br /&gt;
# Do you have any projects that would benefit from interdisciplinary approach?&lt;br /&gt;
#*In addition to the above, I&#039;ve got a reproduction of Fontana&#039;s AlChemy system I&#039;ve been having a little trouble with.  &lt;br /&gt;
#*I&#039;m interested in the role of motivation in learning, which is a topic that could no doubt benefit from conversations with psychologists or anyone else who thinks about such things.  &lt;br /&gt;
#*And I&#039;d love to find ways to apply my skills and ideas to problems people outside of my immediate field would care about.&lt;br /&gt;
# Do you have any ideas for what sort of project you would like to attack this summer?&lt;br /&gt;
#*Not really--I can imagine pursuing something related to one of the topics mentioned above, or something totally different.&lt;br /&gt;
# What&#039;s your favorite &amp;quot;big problem&amp;quot;?&lt;br /&gt;
#*Embodied Intelligence--understanding the mechanisms that allow humans and animals to use such a complicated body so effectively in such a complicated world.  I&#039;m particularly interested in this problem at the computational and algorithmic levels of analysis, although the implementational level is also very interesting, and I&#039;m particularly interested in learning and cognitive development.  &lt;br /&gt;
#*An obvious second &amp;quot;big problem&amp;quot; is self-organization and emergence in complex adaptive systems--that&#039;s why I&#039;m coming to the CSSS, of course, and I don&#039;t think the second is unrelated to the first.&lt;br /&gt;
# If you were given the opportunity to see where we were in one hundred years with respect to progress on one problem/subject, what would it be?&lt;br /&gt;
#*Those mentioned in #5, naturally.  &lt;br /&gt;
#*Although I am also very curious to see how we will deal with the many problems facing society today: alleviating the crushing poverty in much of the world, environmentally sustainable energy demands, combating {race|class|sex|tribal|...}-ism, etc.&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=File:Andrewstout.jpg&amp;diff=2941</id>
		<title>File:Andrewstout.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=File:Andrewstout.jpg&amp;diff=2941"/>
		<updated>2006-05-26T04:56:00Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
	<entry>
		<id>https://wiki.santafe.edu/index.php?title=Andrew_Stout&amp;diff=2940</id>
		<title>Andrew Stout</title>
		<link rel="alternate" type="text/html" href="https://wiki.santafe.edu/index.php?title=Andrew_Stout&amp;diff=2940"/>
		<updated>2006-05-26T04:55:18Z</updated>

		<summary type="html">&lt;p&gt;AndrewStout: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:andrewstout.jpg]]&lt;br /&gt;
&lt;br /&gt;
I am a PhD student in Computer Science at the University of Massachusetts.  &lt;br /&gt;
&lt;br /&gt;
The general unifying theme of my research interests is to understand-by-building systems that continually adapt, building on previous adaptations, driven not (or not only) by external pressures, but by forces within the system: systems that display bootstrapping, unbounded, intrinsic adaptation.&lt;br /&gt;
My driving interest is in discovering representations and algorithms for constructive, grounded, long-term, domain-general cognitive development in robots.  I have a sustained secondary interest in evolutionary computation, self-organization, and artificial life.&lt;br /&gt;
&lt;br /&gt;
I have a [http://www.cs.umass.edu/~stout/ webpage], but it&#039;s pretty minimal...&lt;br /&gt;
&lt;br /&gt;
When I&#039;m not pursuing these interests, I enjoy ultimate frisbee and volleyball; I&#039;m a news junkie and a religious watcher of The Daily Show; I&#039;m in for some World Cup watching.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dan&#039;s questions:&lt;br /&gt;
&lt;br /&gt;
# What topics do you have some expertise in and would you be willing to help others learn them?&lt;br /&gt;
#*I&#039;m a competent programmer, although not the code ninja a CS grad student ought to be: my go-to language is Python, I&#039;m learning OCaml, I dabble in Matlab when forced to, and I have less recent experience with Java, C++, and others.  &lt;br /&gt;
#*I&#039;m comfortable at the Unix/Linux command-line.&lt;br /&gt;
#*My graduate background is in Machine Learning, if any of that will be useful.  This semester I took a seminar that examined some ML applications of spectral graph theory, which I can imagine being of interest to others.&lt;br /&gt;
# What do you want to learn?&lt;br /&gt;
#*My formal training in complex systems science has been quite limited, so I&#039;m looking forward to a rigorous treatment of the whole spectrum and finding out what the current state of the art and agenda are.  I&#039;m curious about agent-based modeling, network theory, biology, geosystems, economics, etc.&lt;br /&gt;
#*More specifically, I&#039;m interested in acquiring tools for identifying phase changes and the &amp;quot;edge of chaos&amp;quot; in &amp;quot;learning space&amp;quot;--the fertile region between what an agent has already learned and what it is not yet ready to learn.&lt;br /&gt;
# Do you have any projects that would benefit from interdisciplinary approach?&lt;br /&gt;
#*In addition to the above, I&#039;ve got a reproduction of Fontana&#039;s AlChemy system I&#039;ve been having a little trouble with.  &lt;br /&gt;
#*I&#039;m interested in the role of motivation in learning, which is a topic that could no doubt benefit from conversations with psychologists or anyone else who thinks about such things.  &lt;br /&gt;
#*And I&#039;d love to find ways to apply my skills and ideas to problems people outside of my immediate field would care about.&lt;br /&gt;
# Do you have any ideas for what sort of project you would like to attack this summer?&lt;br /&gt;
#*Not really--I can imagine pursuing something related to one of the topics mentioned above, or something totally different.&lt;br /&gt;
# What&#039;s your favorite &amp;quot;big problem&amp;quot;?&lt;br /&gt;
#*Embodied Intelligence--understanding the mechanisms that allow humans and animals to use such a complicated body so effectively in such a complicated world.  I&#039;m particularly interested in this problem at the computational and algorithmic levels of analysis, although the implementational level is also very interesting, and I&#039;m particularly interested in learning and cognitive development.  &lt;br /&gt;
#*An obvious second &amp;quot;big problem&amp;quot; is self-organization and emergence in complex adaptive systems--that&#039;s why I&#039;m coming to the CSSS, of course, and I don&#039;t think the second is unrelated to the first.&lt;br /&gt;
# If you were given the opportunity to see where we were in one hundred years with respect to progress on one problem/subject, what would it be?&lt;br /&gt;
#*Those mentioned in #5, naturally.  &lt;br /&gt;
#*Although I am also very curious to see how we will deal with the many problems facing society today: alleviating the crushing poverty in much of the world, environmentally sustainable energy demands, combating {race|class|sex|tribal|...}-ism, etc.&lt;/div&gt;</summary>
		<author><name>AndrewStout</name></author>
	</entry>
</feed>