Sharks and Fish The sh are p oin ts with masses mo - - PDF document

sharks and fish the sh are p oin ts with masses mo ving
SMART_READER_LITE
LIVE PREVIEW

Sharks and Fish The sh are p oin ts with masses mo - - PDF document

Sharks and Fish The sh are p oin ts with masses mo ving accord f ishm i ing to Newtons la ws F ma sub ject to an external force curren t The curren t dep ends on p


slide-1
SLIDE 1 Sharks and Fish
  • The
sh are p
  • in
ts with masses f ishm i mo ving accord ing to Newtons la ws F
  • ma
sub ject to an external force curren t The curren t dep ends
  • n
p
  • sition
  • Use
Eulers metho d to in tegrate
  • Accum
ulate the meansquarev elo cit y
  • f
all the sh
  • f
ish X i v el
  • city
  • i
f ish
  • and
plot it as a function
  • f
time
  • Cho
  • se
the time step dt in the in tegrator see the mat lab co de for details small enough to k eep the sim ulation accurate dt
  • max
if ish jv el
  • city
i j max if ish jaccel er ation i j
  • Complete
matlab implemen tation in usrcastlesharepro jshortcoursew ator probmatlabshm
  • lines
long
  • excluding
commen ts graphics
slide-2
SLIDE 2 Sharks and Fish
  • As
in Problem
  • the
sh are p
  • in
ts with masses f ish m mo ving according to Newtons la ws F
  • ma
sub ject to an external force gra vit y
  • In
tegrate using Eulers metho d as in Problem
  • Accum
ulate and plot the meansquarev elo cit y
  • f
all the sh as in Problem
  • Cho
  • se
the time step dt in the in tegrator as in Problem
  • Complete
matlab implemen tation in usrcastlesharepro jshortcoursew ator probmatlabshm
  • lines
long
  • lines
excluding commen ts graphics
slide-3
SLIDE 3 Sharks and Fish
  • ak
a Game
  • f
Life
  • Fish
  • ccup
y a db yd p erio dic grid with at most
  • ne
sh p er grid cell
  • The
rules for deciding whether a sh
  • ccupies
a cell during the next time step are
  • A
new sh is b
  • rn
at a grid cell if it is curren tly empt y and exactly three
  • f
its eigh t neigh b
  • ring
cells are nonempt y
  • A
sh dies
  • f
loneliness if it has
  • r
  • neigh
b
  • rs
  • A
sh dies
  • f
  • v
ercro wding if it has
  • r
more neigh b
  • rs
  • Other
cell congurations are stable
  • P
arallel execution
  • f
these rules are relativ ely simple b ecause the next state is purely a function
  • f
  • cells
at the previous state and do es not dep end
  • n
  • ther
state c hanges at the same step
  • Complete
matlab implemen tation in usrcastlesharepro jshortcoursew ator probmatlabshm
  • line
inner lo
  • p
slide-4
SLIDE 4 Sharks and Fish
  • Fish
  • ccup
y a db yd p erio dic grid with at most
  • ne
sh p er grid cell
  • Eac
h sh c ho
  • ses
a random direction to mo v e at eac h time step either Up Do wn Left
  • r
Righ t
  • T
  • resolv
e the conict
  • f
sh w an ting to mo v e to the same grid p
  • in
t at the same time w e rst mo v e those sh Righ t that w an t to mo v e righ t then Up then Left and then Do wn Fish cannot mo v e if a cell is
  • ccupied
A sh ma y mo v e at most
  • nce
during a time step
  • Complete
matlab implemen tation in usrcastlesharepro jshortcoursew ator probmatlabshm
  • lines
  • f
matlab
  • min
us graphics and commen ts
slide-5
SLIDE 5 Sharks and Fish
  • Sharks
and Fish
  • ccup
y a db yd grid
  • f
D
  • cean
mo v ing breeding eating and dying according to rules
  • Sharks
and Fish ma y
  • nly
  • ccup
y grid p
  • in
ts and ma y
  • nly
mo v e at discrete clo c k tic ks
  • The
square region is p erio dic meaning the righ t and left edges are connected and the top and b
  • ttom
re gions are connected
  • Only
  • ne
shark
  • r
  • ne
sh ma y
  • ccup
y a grid p
  • in
t at
  • ne
time
  • Eac
h sh c ho
  • ses
a direction to mo v e at eac h time step b y computing a v ector as the sum
  • f
the follo wing com p
  • nen
ts and then trying to mo v e up U do wn D left L
  • r
righ t R dep ending
  • n
the v ector
  • a
random v ector eac h comp
  • nen
t indep enden t Normal
  • an
external force curren t whic h is a function
  • f
p
  • sition
and
  • a
gra vitational repulsion from all sharks ie a distance la w with gra vitational constan t F I S H R E P E L sh do not attract
  • r
rep el sh
  • If
the age
  • f
a sh exceeds F B R E E D
  • and
it mo v es it lea v es a new sh b ehind
slide-6
SLIDE 6 Sharks and Fish
  • con
t
  • Eac
h sharks also c ho
  • ses
a direction v ector whic h is a sum
  • f
  • a
random v ector eac h comp
  • nen
t indep enden t Normal
  • an
external force same curren t as for sh whic h is a function
  • f
p
  • sition
  • a
gra vitational attraction to all sh ie a distance la w with gra vitational constan t S H AR K AT T R AC T sharks do not attract
  • r
rep el sharks and
  • a
strong lo cal attraction to nearb y sh equal to E AT N O W times the sum
  • f
randomlength v ectors p
  • in
ting to an y sh whic h are immediate U D L
  • r
R nearest neigh b
  • rs
  • Sharks
breed at random the same w a y sh do with probabilit yofbreeding constan t P r
  • b
br eed shar k
  • If
the age
  • f
a shark exceeds S B R E E D
  • and
it mo v es it lea v es a new shark b ehind
  • A
shark mo ving in to the space
  • ccupied
b y a sh eats the sh
  • Sharks
whic h ha v e not eaten for S T AR V E time steps die
slide-7
SLIDE 7 Sharks and Fish
  • con
t Conict Resolutio n
  • If
t w
  • sh
  • r
t w
  • sharks
w an t to mo v e in to the same lo cation in a time step w e ha v e a conict
  • T
  • resolv
e the conict w e imp
  • se
a priorit y sc heme A t eac h time step w e do the follo wing steps sequen tially
  • The
sharks who w an t to mo v e L get to mo v e
  • The
sharks who w an t to mo v e R get to mo v e
  • The
sharks who w an t to mo v e U get to mo v e
  • The
sharks who w an t to mo v e D get to mo v e
  • The
sh who w an t to mo v e L get to mo v e
  • The
sh who w an t to mo v e R get to mo v e
  • The
sh who w an t to mo v e U get to mo v e
  • The
sh who w an t to mo v e D get to mo v e
  • It
is forbidden to mo v e in to an
  • ccupied
lo cation ex cept for sharks mo ving in to lo cations
  • ccupied
b y sh and eating them
  • Eac
h shark
  • r
sh ma y mo v e at most
  • nce
p er step
  • Other
less biased priorit y sc heme are p
  • ssible
suc h as randomization
  • Complete
matlab implemen tation in usrcastlesharepro jshortcoursew ator probmatlabshm
slide-8
SLIDE 8 Sharks and Fish
  • Sharks
and Fish
  • ccup
y a db yd region
  • f
D
  • cean
mo ving breeding eating and dying according to rules
  • The
square region is p erio dic meaning the righ t and left edges are connected and the top and b
  • ttom
re gions are connected
  • Fish
and Sharks are p erfect disks
  • f
radius
  • ne
and m ust b e disjoin t
  • Eac
h sh has mass f ishm and eac h shark mass shar k m
  • Fish
mo v e according to Newtons la ws F
  • ma
under a force F whic h is the sum
  • f
  • an
external force curren t whic h is a function
  • f
p
  • sition
and
  • a
gra vitational repulsion from all sharks ie a distance la w with gra vitational constan t F I S H R E P E L sh do not attract
  • r
rep el sh
  • Fish
colliding with sh b
  • unce
p erfectly elastically
  • con
serving kinetic energy and momen tum
  • Fish
breed at random with the probabilit y
  • f
a sh splitting in to t w
  • new
iden tical sh during t t
  • equal
to P r
  • b
br eed f ish
  • for
  • small
The new sh mo v e with equal and
  • pp
  • site
relativ e random v elo cities from the place
  • f
birth Mass momen tum and energy are not conserv ed
slide-9
SLIDE 9 Sharks and Fish
  • con
t
  • Sharks
also mo v e according to Newtons la ws F
  • ma
under a force whic h is the sum
  • f
  • an
external force same curren t as for sh whic h is a function
  • f
p
  • sition
  • a
gra vitational attraction to all sh ie a distance la w with gra vitational constan t S H AR K AT T R AC T sharks do not attract
  • r
rep el sharks and
  • a
strong lo cal attraction to nearb y sh prop
  • rtional
to distance
  • Sharks
colliding with Sharks b
  • unce
p erfectly elasti cally
  • conserving
kinetic energy and momen tum
  • Sharks
breed at random the same w a y sh do with probabilit yofbreeding constan t P r
  • b
br eed shar k
  • Sharks
colliding with sh eat the sh Mass momen tum and energy are not conserv ed
  • Sharks
whic h ha v e not eaten for a time S T AR V E die