Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » AMP » Agent having dynamic structures
Agent having dynamic structures [message #760272] Thu, 01 December 2011 12:59 Go to next message
giorgos  is currently offline giorgos
Messages: 6
Registered: October 2011
Junior Member
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
Miles Parker is currently offline Miles Parker
Messages: 1338
Registered: July 2009
Senior Member
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: Fri Jul 25 19:06:50 EDT 2014

Powered by FUDForum. Page generated in 0.02377 seconds