Author Topic: simulation fish population evolution  (Read 8994 times)

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
simulation fish population evolution
« on: December 03, 2008, 07:32:39 PM »
 This might be an intresting thought

recently in the newscientist there was this article http://www.newscientist.com/article/dn2505  
about fish populations, that fish adapt and become smaller fish if we catch the big ones.
it would be better to leave out the big ones.

From a darwinbots view, this makes sense, we all know bigberta bots can reproduce lots of ciblings.
Now the article mentioned they used some simple kind of software (it didnt mention what kind).
Dough it might be intresting to simulate this, maybe find some proofs or find other new things about fish population control.

To setup something like it, I think a sim would look something like this..
There are fisherman ships, they multiply slowly and depending on the fish population.
If they catch to little they have to dye (by shooting at no target, loosing energy).. in real live it would be the ship lost its work and was removed from sea.
But maybe they dye simply and such extra dye trick isnt needed.

Then the fish, they should have an age system
Below a certain age not allowed to reproduce.
Here is species specification, because its DNA must some how evolve to find an optimal birth rate.
Maybe sex repro ?, or a in out system, to talk about repro its age.
Fish feed on a few vegies only, it would be nice if fish would swarm in groups from about the same age a bit like in real life.
I'm not sure if fish prefer to do repro with someone from the same age, maybe use a %= there to match. or by math get it to 60% or 70% or so... maybe that number itself might change too.
Also bigger fish lead to bigger offspring
while smaller fish lead to smaller offspring.
To keep it simple at first the number of childs shouldnt be depend on fish size.
(so use a counter for example to create 10 ciblings, and try to keep their seize equal)


fishing ships cannt feed on veggies, (for example using in out communication system, to detect)
some where in the ship script you should be able to set, which fish age range they catch

To make it slightly more realistic perhaps work with seizons for reproduction, I'm not sure if fish keep track of it but I do think so.
I think this can be done using the mem range 971 or so they go to ciblings, and so then you can use a mod counter on it
so while day mod 365 <50 or so

oh and there might be also a natural fish enemy, using slightly the same rules, a shark.
It does feat only on fish, not on ships not on algey, it does this on any size fish
maybe the ships should also be allowed to catch them/ but first try without it.
Sharks are a bit bigger, and they shouldnt be able to kill all fish since that would mean the end of their population too.
it could be achieved by for example test the number of total species compared to its own; keep a ratio of 10 : 2 or so.
A fish who gets to close to a shark should stop moving, and feeding (sharks always win from fish)
Like ships always win from fish.







Offline jknilinux

  • Bot Destroyer
  • ***
  • Posts: 468
    • View Profile
simulation fish population evolution
« Reply #1 on: December 03, 2008, 09:45:25 PM »
I don't mean to be unhelpful or something, but why would we want to run this sim? Fish adaptation makes sense, so why should we simulate it if we know what the outcome will be?
« Last Edit: December 03, 2008, 09:52:05 PM by jknilinux »

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
simulation fish population evolution
« Reply #2 on: December 04, 2008, 06:20:35 AM »
Quote from: jknilinux
I don't mean to be unhelpful or something, but why would we want to run this sim? Fish adaptation makes sense, so why should we simulate it if we know what the outcome will be?


a chalenge to make a reasonable simulation of the problem.
Then it would show that

1) Darwin bots could be used for simulating real world problems (like a scientific tool).*
2) Some claimed darwinbots is poor because it doesnt deal wit species specification, this would result in an ideal year for making offspring, (species size)
3) Also it will show coders the effect of population size, species size, compared to the environment.
4) Its a sim with canrivores and herbivores, and an often discussed outside pressure on the evolution (ships)
      the nice thing is the ships dont evolve, they just eat (fish nearby will stop moving and let them be eaten).
5) And Well I think its cool if it would be able to simulate a real life problem



(3) >> I just finished w6.txt this week because I used tactics as in above point 3 and it became tehrfore quite powerfull
           most bots have quite simple rules in reproduction area, I had some advanced rulles.
           So this is a nice thing to discover for a coder, what would be good growth rates, wat to do when you become extinct etc..




Offline jknilinux

  • Bot Destroyer
  • ***
  • Posts: 468
    • View Profile
simulation fish population evolution
« Reply #3 on: December 04, 2008, 10:05:26 AM »
EDIT:

Okay, I originally thought there was no way to get it to work, hence my latest reply. However, it might just be possible:

We could make it non-torroidal, set gravity to "huge", set buoyancy up to make all the big bots go to the top, and make the fishermen non-mutating veggies. The regular veggies will keep themselves small, while the fishermen veggies keep themselves huge to stay at the top, turn on gravity, and whenever a fish gets too big, it will float to the top and get killed by the fishermen instantly (because they're huge, they have huge shots). Turn mutations off, make the fish use only sexrepro, and start with a fish population that has high genetic diversity, at least in relation to body size. Sharks aren't necessary, but if you want to include them, do the same to them. Then, if the fishermen kill only big fish, they'll evolve to become small, and vice versa.. It might just work.

I appreciate your ideas, keep them coming! IMO it's just not as fecund as figuring out how to get our regular evosims working.. That's the big thing.

Anyway, this does give me an idea- maybe in evosims we could have a fisherman-like "veggy" with mutations disabled which just goes around trying to somehow encourage intelligent behaviors to come out from the evolved bots... Is that what everyone refers to when they say "shepard"-bots?
« Last Edit: December 04, 2008, 11:51:49 AM by jknilinux »

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
simulation fish population evolution
« Reply #4 on: December 04, 2008, 11:58:06 AM »
Quote from: jknilinux
Well, even though I don't think you specifically said it, I'm assuming mutations are turned on. If so, this is what will happen-

Within  a few hundred cycles, the fish-stopping-when-near-a-predator and the sharks-eat-no-algae behaviors will be the first to break. Assuming their code is otherwise the same, one of the two species will randomly go extinct soon. Pretty soon, they'll break all discrimination abilities, and will also eat the fishermen. The fishermen probably won't have mutations enabled, so they'll stay the same, and might even go extinct before the fish vs. sharks battle is through. Ultimately, just one species, either fish or shark, will remain, and will continue to slowly devolve...

Anyway, this does give me an idea- maybe in evosims we could have a fisherman-like "veggy" with mutations disabled which just goes around trying to somehow encourage intelligent behaviors to come out from the evolved bots... Maybe that's what people refer to when they talk about "sheperd" bots.


Ofcourse no mutations should be enabled,
Any kind of adaption should come from in out communictation with the species.
So for example fishA age 8, says to fishB age 2 do you want to repro with me ?
If so their ofspring would repro for example at (8 + 2 ) / 2 = age 5 + a favour of going to near to one of the parents like  5 + sgn (2-5) = 4 (the one that does do the repro)

Well maybe differently but something like that, so it will addapt and adjust its age for doing repro


Of course it could also be that if 2 was to young for doing repro the fish would not perform repro
Depending on age perhaps a little bit on body seize (dough not to much repro will happen, you cannt stop nature)

maybe use an extra in out command to say if a certain fish is male or female...
maybe use a memory var for sperm or egss, and fertilezed.
maybe ... something else ...
Anyway it might look like sexrepro but it is different

In effect you get better working self tuning DNA, without the total randomnez of using sexrepro.
As sex repro also adds some randomizition its effect would be like having mutations enabled.
What you would get here is a way to find a way to tune DNA
Maybe if the trick isnt too complex it could be used to improve regular bots as well ....


I sheperd bot has a influence on its environment I think like a dogy sheperd, in this scenario the fisherboots are like that.
« Last Edit: December 04, 2008, 12:03:25 PM by peterb »

Offline d-EVO

  • Bot Destroyer
  • ***
  • Posts: 125
    • View Profile
simulation fish population evolution
« Reply #5 on: December 04, 2008, 04:46:30 PM »
Quote from: peterb
To keep it simple at first the number of childs shouldnt be depend on fish size.
(so use a counter for example to create 10 ciblings, and try to keep their seize equal)

you know you could just start off with more fish and reduce how much energy they have
Im gonna give this a shot. al ready written the boat. half of the fish is done, just figuring out the repro system.
1:      2 is true
2:      1 is false

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
simulation fish population evolution
« Reply #6 on: December 04, 2008, 05:19:44 PM »
Quote from: d-EVO
Quote from: peterb
To keep it simple at first the number of childs shouldnt be depend on fish size.
(so use a counter for example to create 10 ciblings, and try to keep their seize equal)

you know you could just start off with more fish and reduce how much energy they have
Im gonna give this a shot. al ready written the boat. half of the fish is done, just figuring out the repro system.


Great, I think it would be handy to have the last out, out8 or so for identification use.
= 0 its a boat
if its below 50 or so its fish
higher then 50 its a shark or other fish eater

If we all do it we can then use eachothers boats fish sharks

So each bot uses a ID and bots would now what they deal with.

Offline jknilinux

  • Bot Destroyer
  • ***
  • Posts: 468
    • View Profile
simulation fish population evolution
« Reply #7 on: December 04, 2008, 05:34:59 PM »
Sorry I misunderstood you.  

Buoyancy might help with killing all the big bots. As far as I know, it makes bot with a bigger body float, right? So, keep the fishermen at the top, and they don't even have to move- the fish will float upwards when they get too big.

Anyway, I see what you're doing now, and it's a neat idea. I don't think you mentioned the no-mutations before, though. If you did, sorry I didn't see it. Pretty cool!

Offline d-EVO

  • Bot Destroyer
  • ***
  • Posts: 125
    • View Profile
simulation fish population evolution
« Reply #8 on: December 04, 2008, 07:06:26 PM »

Quote from: peterb
Great, I think it would be handy to have the last out, out8 or so for identification use.
= 0 its a boat
if its below 50 or so its fish
higher then 50 its a shark or other fish eater

If we all do it we can then use eachothers boats fish sharks

So each bot uses a ID and bots would now what they deal with.

I am using in and out 1 for ID
8041 =
BOAT

4157 =
FISH

57486 =
SHARK

my little fishies are swimming like fish !!!
Will be finished soon.
I had to change some things
Like I made it so a male can only repro with a female that is bigger than him so he doesnt rape her to death !!  



Quote
We could make it non-torroidal, set gravity to "huge", set buoyancy up to make all the big bots go to the top, and make the fishermen non-mutating veggies. The regular veggies will keep themselves small, while the fishermen veggies keep themselves huge to stay at the top, turn on gravity, and whenever a fish gets too big, it will float to the top and get killed by the fishermen instantly (because they're huge, they have huge shots). Turn mutations off, make the fish use only sexrepro, and start with a fish population that has high genetic diversity, at least in relation to body size. Sharks aren't necessary, but if you want to include them, do the same to them. Then, if the fishermen kill only big fish, they'll evolve to become small, and vice versa.. It might just work.

thought about this but I thought it was better to make it with a view from above.
thought it would be more dinamic .

when I am finished I will try it that way though
« Last Edit: December 04, 2008, 07:07:20 PM by d-EVO »
1:      2 is true
2:      1 is false

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
simulation fish population evolution
« Reply #9 on: December 04, 2008, 07:43:46 PM »
some comments I had not had time to script yet
bussy work days

* Well I dont think pond mode would be required for this, (boats might also catch only big fish, or small fish its a rule we can set to ships)


* Its true I didnt mention "disable mutations", it was abvious to me.
  I personaly always disable it, altough nice for some true dna evolution acka darwin bots, starting from a zero veg, I dont like its polution.
  If you realy want that then use mrepro it has the same effect.

* its okay it has now been decided what out to use for species ID it think the next
  out1 could be used for for ships lets say anything between 8000 and 9000 can be a ship
  between 8000 and 9000 a ship
  between 4000 and 5000 a fish
  between 5000 and 6000 a shark

  Or simply if the number is higher then just stop bad luck let them eat you (more simple logic the same effect)
  Or if you loose me out of your sight I escaped and I continou   (combine eye5 and in1)
 

* I dont think males should eat females especialy fish (who only should eat veggies), both are required
  dough it does happen in nature like spiders etc, most fish dont do that

* there is allready refage
   But maybe its more handy to create an out2 wich turns on
   1 for to young to repro
   2 for male who is ready for mating     (at the same time we could avoid eating each here)
   3 for female who is ready for mating
   4 to old for repro ? or maybe some other state ? hungry ? (so a friendly species might feed it?) ...
   5 ....
   6 ..
 

I wonder how realistic we could make it
Maybe like salmon or so a species might dye after reproduction ? (keep it locked in place eventualy a shark will find it and eat it)
of example
   7 .. (I'm an algey but not only that I'm a place where fish mate)...  (we might do that later)



* there earlier math I explained (8+2) /2 + (sgn ( 2 - (8+2)/2)) , wasnt good I believe as rate for mating age would never be able to get lower.
   something else is needed, it has to be in the spirit of our fish.. it has a live it grows it reproduces at some age this simulation will gonna decide that age.
   If we can put it insight some smart singel gene or so this desicion process..
   Then that might be handy to also later test fine tuning for other valeus.

* therefore  lets reserve Out3 & out4  & out5 & out6  for any other things we might like to focus on later.
  (for example what would be the best eyes? or whatever...)
 
 





Offline d-EVO

  • Bot Destroyer
  • ***
  • Posts: 125
    • View Profile
simulation fish population evolution
« Reply #10 on: December 09, 2008, 03:52:23 PM »
Finaly finished!!

the fish reproduce by storing the bots body in a memory shot.
The female will realize that she is pregnent and produce about 10 egs depending on here size.
those fish will then grow up to be the average size of their parents
dont ask me how I did that
It produces a very interesting sustainable sim

interesting observations
the more overpopulated the sim becomes, the smaller the fish
the more boats there are the smaller the fish.
when their are to many boats and to few fish, half the boats go out of business and the fish return to a larger size. cycle repeats

no sharks or swarming though.
think of one fish as a school.
« Last Edit: December 09, 2008, 03:55:20 PM by d-EVO »
1:      2 is true
2:      1 is false

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
simulation fish population evolution
« Reply #11 on: December 09, 2008, 06:57:02 PM »
 Great d-EVO !!  

Your the first showing Darwin bots can be used for species who evolve by finetuning an atribute.
This is the roadway of generating species  in bioligy I believe.
No longer it happens due to randomization of DB genetics.

It was argued at wikipedia not darwinbots pedia, this was something DB didnt do.
Your the first to show it can be done congratulations !  


I will look at the code later, your fish makes nice swiming paterns
Sometimes they go a bit to fast it seams, dough that maybe a setting of me which is wrong.

I saw sometimes the fishingboat nets clog with too many fish and then they stop functioning.
I will look at the fishboat code and put in the 360 degree auto aiming formula's I used in w6.txt
thats independent of a bots heading, and will always hit the 2 most nearby bots.

Its realy impressive you know, I'm impressed.
Also you have set a standard for these type of simulations, people can write fish based on it or other boats
Or people can change other mating atributes for example also take a look at body size etc.
It will go I think more to behaviour programing of species.

Offline d-EVO

  • Bot Destroyer
  • ***
  • Posts: 125
    • View Profile
simulation fish population evolution
« Reply #12 on: December 10, 2008, 10:08:42 AM »
Quote from: peterb
I will look at the code later, your fish makes nice swiming paterns
Sometimes they go a bit to fast it seams, dough that maybe a setting of me which is wrong.

I saw sometimes the fishingboat nets clog with too many fish and then they stop functioning.
I will look at the fishboat code and put in the 360 degree auto aiming formula's I used in w6.txt
thats independent of a bots heading, and will always hit the 2 most nearby bots.

I must admit there are some bugs but they can easily be fixed. will get to it now

another thing to note is that changing the ratio between boats and fish you can increse or decrease population fluctuation.
This could in theory be used to find a stable fish-boat ratio in reality.

will post the more functional sim when I am done
1:      2 is true
2:      1 is false

Offline d-EVO

  • Bot Destroyer
  • ***
  • Posts: 125
    • View Profile
simulation fish population evolution
« Reply #13 on: December 10, 2008, 02:49:53 PM »
Ok here is the updated sim

Most of the bigs are fixed
Fish still swim very fast but just increase liquid resistance. should solve it.

I also noticed that as the fish get smaller it becomes harder for the boats to get energy from fish. So the boat pop drops. the fish get bigger and the the bout pop climbs
 so if the ratios are not to extreme ,it eventualy will stabalize itself.
here are the bots and the sim.

I took the self destruct gene out and instead inserted an incresead shootval. that way, if the fish get to small it becomes economicly inviable and ships go out of business.
This way you can see true stabalization (or destabilization) of the environment.

the atached sim is of 2 boats inserted into relitivly stable nateral environment. se the chaos caused and how the fish handle it.
To give the boats more of an upper hand, reduce its shootval, gives it an advantage over smaller fish

theise followin pics are graphs of a sim showing pop and total nrg.
The fish let themselves get eten but they controle their pop so well not even big mean boats can stop them
just shows that the fish are going to win in the end.

P.S. yay im a bot MASTER !!! <---
       and the rar file contains the new fish and boat
1:      2 is true
2:      1 is false

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
simulation fish population evolution
« Reply #14 on: December 10, 2008, 05:14:00 PM »
Note there is also a graph for average age.

If it all works well, the fishing boats can be programmed to only eat small fish (like the science article) (based on refbody or refage ??)
Or in another sim to eat the big fish, I think its nice to see the system can be stable but also can be verry chaotic
That reflects is I asume the real fishing problem.

I'm running your sim now its nice

I often see the fishing boats swarming.. hmm maybe they multiply a bit to fast or so I'm not sure its hard to balance.
As otherwise the the algey loose from the fish... (we could let the algey eat fishing boats but nah thats aint realistic)

(edit) I now run it in a larger sim size 10 (runs faster) started with 30 algey (max 200) 15 fish and 5 boats..
 I seee now swinging population graph as you described, intresting as long there are algey the species come back wonder dough what it does over a longer period I keep it running for a while
« Last Edit: December 10, 2008, 05:32:06 PM by peterb »