metametascape
Welcome, Guest
Please Login or Register.
Lost Password?
Set and forced use of attributes (1 viewing)
_GEN_GOTOBOTTOM Post Reply

TOPIC: Set and forced use of attributes

#88
ecasotti (User)
Expert Boarder
Posts: 38
graphgraph
Set and forced use of attributes 2008/01/23 15:54 Karma: 0  
I believe the Set should allow use of literals. Other areas, such
as several of the logical operators allow use of literals. I have
a case where I want an attribute that is an array to be set to
an attribute array found on another agent. The problem is the set
is not allowing me to access the array of the other agent. I am
forced to set it to Unit (more as a reminder to modify it later)
and then manually go into the code and set it to what I would like.

If you look at the included model's Person rule for Search For Food,
I would like the set to be for Food Center's Coordinate attribute.
However, the set does not allow me to select that. So instead I
set it to unit and then manually change it to

setFoodLocation(foodCenter.getCoordinates());

If I had a literal, I could set the literal on the set to

foodCenter.getCoordinates()

ev
File Attachment:
File name: Intersection-26e33e5a40586c1cc032bede2650c802.metaabm
File size:47391 bytes
  The administrator has disabled public write access.
#90
miles (Admin)
Admin
Posts: 59
graphgraph
Re:Set and forced use of attributes 2008/01/24 00:34 Karma: 1  
You couldn't, because there is no coordinate literal nor anywhere to set it. You should be using queries to obtain coordinate information in order to keep execution general -- I can't think of a use case where you it would be appropriate to have an attribute with a coordinate value. If you want to explain the use case I can explain how I think it should be accomplished, or perhaps I'll change my mind.

re: Set, literals as part of equations was already a bit of a stretch for me. Even in conventional programming it is not good practice to have values hard coded. In equations it seemed reasonable as you might have a one-time usage of a value for example when defining a particular RGB color. But again, I can't think of a case where you would want to set some attribute to a particular undefined state. What you should be doing instead is defining an Attribute in the base model (so it doesn't need to be stored or defined more than once) and set it to immutable. that ensures that all important values in your model are defined in a central consistent way.
  The administrator has disabled public write access.
#91
ecasotti (User)
Expert Boarder
Posts: 38
graphgraph
Re:Set and forced use of attributes 2008/01/24 12:27 Karma: 0  
Miles

What I am trying to do is have a Person move toward a FoodCenter. The
Person can look around their neighborhood and see if they have one. If
they do, they keep the coordinate info for future reference. A Person will
ask the FoodCenter for it's coordinates, and they can ask another Person
if they know where a FoodCenter is, thus getting the coordinates from
some other Person.

But honestly, forget that this is about coordinates, and focus on the
fact that there are two differently typed Agents, both with arrays, and one Agent
wants to get the array information from the other Agent
. The arrays
are of the same length.

I have stored coordinates in an array. If you look at Search For Food
Center Location rule on the Person, I eventually get to some Sets. The
Sets will not allow me to set from one array to another. They are the
same type, but the filter that creates the lists is not generating the
To list with the available arrays. So as a workaround I have to set to
Unit and then manually change that later to make it work. The Set is
not making available to me the array on the FoodCenter (regardless of
what I choose for Selection). That, to me is the problem. If this
were available, I wouldn't have to then change it manually.

And remember, literals are indeed a not good, BUT, I am not using a literal,
I used foodCenter.getCoordinates(). It is the variable generated
by Metascape that Metascape is not allowing me to get at right now.
  The administrator has disabled public write access.
#92
ecasotti (User)
Expert Boarder
Posts: 38
graphgraph
Re:Set and forced use of attributes 2008/01/24 12:34 Karma: 0  
And also, how do you get coordinates in Metascape. I have tried all of the Spacial functions that seems to make sense, and not one of them seems to generate code that will get the coordinates. But this is again likely a lack of understanding of how to use the tools available.
  The administrator has disabled public write access.
#93
ecasotti (User)
Expert Boarder
Posts: 38
graphgraph
Re:Set and forced use of attributes 2008/01/24 15:23 Karma: 0  
BTW, I scraped those rules for now and am just simply moving toward the nearest FoodCenter. I think this should suffice for now, but I still think we should be able to pass round AttributeArrays like we can Attributes. But again, perhaps I am not doing that properly.



Post edited by: ecasotti, at: 2008/01/24 15:27
  The administrator has disabled public write access.
#98
miles (Admin)
Admin
Posts: 59
graphgraph
Re:Set and forced use of attributes 2008/01/30 01:31 Karma: 1  
OK, a bunch of stuff here -- let me know if I miss anything.

It is actually quite deliberate that higher level data structures/objects like "Coordinate" are not supported as attribute types and thus you don't have functions that explicitly return say "my coordinate". Instead, the idea is that these concepts should be implicit features of the model components. So for example the location of an agent within some projection (space) is implicit. Then you can do something like "distance" between two agents. metaABM thus enforces the idea that there cannot be some physical relationship between entities that is not explicitly and transparently represented n the model.

It sounds like you found a good short term solution and I would just enlarge on that. Essentially you want to use networks as specifying generic relationhips between model components. So in this case you want a "food centers" Network that has a disconnected directed graph for each agent that has as its neighbor(s) some FoodCell. Agents can select their target food center(s) in their network and move toward them, add them to their friends food networks and so on. Does this make sense?

For the last, I'm not sure exactly what you mean by "pass around" and how that works with Attribute Arrays but not Attributes --perhaps the above addresses this but let me know...
  The administrator has disabled public write access.
_GEN_GOTOTOP Post Reply
© Copyright 2007 Best of Joomla, Powered by FireBoardget the latest posts directly to your desktop