Not a problem! In terms of setting up PotatoDistributors, it's going to depend a bit upon what your model is going to do. If the producers just need to "contact" them to have an action take place and the decision making doesn't change, then you might be able to use a Singleton pattern along with dependency injection to pass the current SimState for anything that the distributor might need. This is the same pattern that I followed in a recent ABM I wrote (in preparation for peer review, email me directly if you want a link to the source code).

In terms of displaying information in MASON - that is a bit trickier, but depending upon what you are trying to display then sometimes you can get away with inheritance or just defining an interface so you only have to sort out the display once. So far my ABMs tend to follow some of the OOP patterns that I picked up over the years and have two layers to them. The first layer is the material that you would expect to see discussed in an ODD write-up while the second layer tends to be more technical aspects that just manage the simulation and capture data from the agents. Getting comfortable with abstract classes and interfaces helps since that tends to be necessary to separate the the ABM concepts from the more "administrative" aspects such as displaying information.

Robert Zupko

On Wed, Jun 12, 2019 at 7:02 PM Randall Boone <[log in to unmask]> wrote:
Thanks Sean and Robert.   I appreciate your reply.   I think I'm dealing with a learning curve for a FORTRAN era programmer, messing up OOP and without the opportunity for a deep dive to yield better understanding.

I only want one interface, with (eventually) multiple displays.  I didn't realize that is what the second line you cite did.  Isn't that the line in Student Cliques that actually creates the students?  Or put another way, in my drafty model, how do i call the procedure to create the second type of agents?  If I don't have "PotatoDistributors potatoDistributors = (PotatoDistributors) state;" it seems to act as if potato distributors do not exist.

My goal (and my error I think, in so far as I am mistakenly following a pathway that assumes inheritance) is to add two unrelated agent types.  I don't need them to inherit attributes.  Is there a tutorial available that includes in a single interface and single display with two unrelated agent types?

Or put one last way, do all agents go into a single class in these models?  Maybe that's my mistake.

Thanks again,

P.S.  Not being shy, I am happy to share any code, but just don't want to be a bother.