Skip to main content



      Home
Home » Archived » AMP » Agent having dynamic structures
Agent having dynamic structures [message #760272] Thu, 01 December 2011 12:59 Go to next message
Eclipse UserFriend
Hello,

I would like to ask how I could model an agent having some dynamic structures. More particular I would like each of my agents to have its own Vector in order to store some objects. Say for example that there is an agent named Buyer. I have done the following :
I have created a new class named AgentVector

public class AgentVector {

private Vector vector;
private long id;


public AgentVector(long id){

this.id = id;
vector = new Vector();

}

public Vector getVector(){
return vector;
}

public long getId(){
return id;
}


}

Then inside the class Buyer (and outside any method) I have written the command
private AgentVector BuyerRatingVector;

And then in an initialize method of Buyer I have put the command
BuyerRatingVector = new AgentVector(getUID());

All these work, because in this way I create a unique vector for each agent.
However, every time I change something in the model I have to put by hand in the Buyer class the command
private AgentVector BuyerRatingVector;
How can I do this through the model?
I have noticed that there is a choice in the attributes to create dynamic variables but I have not understood how this works.

Re: Agent having dynamic structures [message #764751 is a reply to message #760272] Mon, 12 December 2011 14:37 Go to previous message
Eclipse UserFriend
Hi,

First, ignore the dynamic variables bit -- that's from the SD integration and will probably eventually change.

Integrating custom code isn't currently as seamless as it should be. Using the Method rule is a good general solution, but as you discovered it doesn't help when you want to add new state. The idea here would be to create an Agent for the Vector and then set the "Load" option to true using the Implementation "Mode" menu accessible form the property editor.
Previous Topic:AMP contains non IP-approved content?!
Next Topic:distance between agents
Goto Forum:
  


Current Time: Thu Mar 20 21:49:03 EDT 2025

Powered by FUDForum. Page generated in 0.02380 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top