Open Craig44 opened 6 years ago
Yes, yes, yes from me :) It's something that I was hoping would get added sometime.
Your initial thoughts match my initial thinking on this.
Add two new attributes to fish (Lat, Long)
Yep, two float
attributes, or could consider using two short int
to save memory.
add a new class/perhaps new source file that manages layers of environmental variables e.g. sst and npp etc
The class Environ
was intended for exactly that :) I was thinking of having different environmental layers stored in there (structured for fast look up according to lat/lon) These layers might vary by period but should at least vary by season.
and generates an overall 'preference' layer
The actual generation of a preference should probably live in the Fish
or Fishes
class in a method that takes the Environ
as an argument.
which would describe the probability to moving to a lat long bin. Thoughts on how you would draw from this distribution efficiently so that when you iterate over your population you have the spread expected with large numbers?
In a previous SNA 1 model we used an advection-diffusion approach based on a preference function. You just move the individual fish according to the advection-diffusion model, you don't have to draw from a spatial distribution, the spatial distribution emerges from the process.
@nokome do you happen to have code for moving a fish/particle along the habitat preference layer? I am looking at the diffusion-advection equation and am struggling a bit, I have found the following referencewhich uses biased random walk. Or is there an easier implementation, I have attached some R code that I am using to consider how to implement the movement of an individual through the advection-diffusion case.
Hi Craig I have emailed you the following paper it might be useful.
"An individual-based model of skipjack tuna (Katsuwonus pelamis) movement in the tropical Pacific ocean"
Cheers
Jeremy
Jeremy.
Cool cheers for that, that is interesting and far more advanced that I am currently thinking. Tthe best paper that I have found for implementing these models is here if anyone is interested for future. I have simple bias random walk up and running in R so will start to transfer this stuff into the codebase. You can ignore my earlier comment, I have had a breakthrough today
I thought I would document the way I am currently thinking of implementing environmental preference movement.
These folders will contain a matrix of numbers for example for SST with 6 longitude bins and 3 latitude bins it would look like this. 22 22 22 21 20 21 21 22 21 20 19 21 18 19 17 19 16 18
So I have been playing around with this spec and have got to a point where it is starting to do what I think it should be doing. Along the way there are a few things that I have done that I should have asked before hand but let me know thoughts especially @nokome from a development perspective. To view the changes you can see my dev branch here. Let me know what you think about the points below.
I have put the source code in folder src,
have also split the code into headers and source files, I found it difficult to navigate around header files with inline declarations
I have changed fish -> agent and fishes -> agents I think this is a better generalization.
I have also changed some of the syntax to allign with google C++ standard class member variables have a trailing _ in name declaration
Hi all,
I am looking at adding preference movement into the IBM and thought I would open up a discussion with you all.
My initial thoughts
Then the movement process could be just drawing from that distribution and updating lat and long based on the new cell.
It would get complicated later on if you wanted to add some density dependence into the preference calculation because then that preference distribution would have to be calculated on the fly, but perhaps park that for now