-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making COMOKIT Individual species extendable #40
Comments
RBD. First comment: we should never ever use strings to specify this kind of things. Do not forget that So:
I have committed a possible solution. Please check if it works (didn't try it with another species than Individual) and if it corresponds to your needs. |
Thanks Alexis ! I even did not think of using generic species ... This is nice. I'll try asap and get feedback here |
Hey @AlexisDrogoul ! first, creation of requested species does work as the actual Individual species of my model is define by
|
Hi @AlexisDrogoul with the help of @DAM-Philippon we (he) finally found the bug : |
Nice job ! No time to dig this now but an issue in gama would be important to make (if possible with a simpler example)... |
@AlexisDrogoul Unfortunately, I have not been able to reproduce the bug on a simpler model. @DAM-Philippon intuition is that it comes from the fact that both species are from separated Gama project ... I'll try to reproduce it, but not guaranteed to be able to do so with a "simpler" example |
How does the bug manifest itself exactly ? You see a nil value somewhere ? The state is initialised after your own variables are ? |
From what I remember when helping Kevin, both attributes state and states (the list of possible states) were set to nil. (I've tried to get a simple case for debugging, with two different projects, having different species inheriting in two different levels, but I didn't get the bug) I don't know what we would get by adding |
OK. I'm sorry, but there is a lot of confusion here and I don't really get what goes wrong. @chapuisk tells that the new species doesn't |
The control of parent species may not have been correctly initialized before child species try to determine theirs. The finalization of control is now enforced in parent species.
As far as I can see running my models, the child species now inherit control architecture as expected. I then close the issue. Thx @AlexisDrogoul ! |
Is your feature request related to a problem? Please describe.
Currently there is no way to extends
Individual
to add new attributes, action and reflexes without changing the code from COMOKITDescribe the solution you'd like
It should be possible to define an
Individual
subspecies to be used as it is Individual from the model. It should be possible adding a parameter of the modelstring main_agent <- my_own_individual
withspecies my_own_individual parent:Individual
and creating COMOKIT main agent this way:create species(main_agent.name)
. After that, all dynamic that callIndividual
species (e.g. a ask statement) should be replaced withIndividual+(Individual.subspecies accumulate each.population)
Describe alternatives you've considered
The alternative I currently work on implies encapsulating
Individual
into another external species that will have other attributes, action and reflexes and share all necessary things with their _inner_individual. However, it double the number of agent and makes initialization not an easy task (i.e. COMOKIT creates Individual with homeplaces, agendas, friends and so on, and after that you create you own species possibly relocating them, changing agendas and so on)Additional context
The request will be useful to make COMOKIT even easier to extende
The text was updated successfully, but these errors were encountered: