Question: Particle Swarm - - - Part One - - - You are trying to simulate a particle swarm for an AI project. You have access
Particle Swarm
Part One
You are trying to simulate a particle swarm for an AI project.
You have access to a text file with each particle in order starting with particle then particle
particle and so on For each particle, it provides the X Y and Z coordinates for the particle's
position p velocity v and acceleration a each in the format
Each tick, all particles are updated simultaneously. A particle's properties are updated in the following
order:
Increase the X velocity by the X acceleration.
Increase the Y velocity by the Y acceleration.
Increase the Z velocity by the Z acceleration.
Increase the X position by the X velocity.
Increase the Y position by the Y velocity.
Increase the Z position by the Z velocity.
You would like to know which particle will stay closest to position in the long term.
Measure this using the Manhattan distance, which in this situation is simply the sum of the absolute
values of a particle's X Y and Z position.
For example, suppose you are only given two particles, both of which stay entirely on the Xaxis for
simplicity Drawing the current states of particles and in that order with an adjacent a number
line and diagram of current X positions marked in parentheses the following would take place:
p v a
p v a
p v a
p v a
p v a
p v a
p v a
p v a
At this point, particle will never be closer to than particle and so in the long run,
particle will stay closest.
Which particle will stay closest to position in the long term?
Part Two
To simplify the problem further, you would like to remove any particles that collide. Particles collide if
their positions ever exactly match. Because particles are updated simultaneously, more than two
particles can collide at the same time and place. Once particles collide, they are removed and cannot
collide with anything else after that tick.
For example:
p v a
p v a
p v a
p v a
p v a
p v a
p v a
p v a
p v a
p v a
p v a X
p v a
destroyed by collision
destroyed by collision
destroyed by collision
p v a
In this example, particles and are simultaneously destroyed at the time and place marked X On
the next tick, particle passes through unharmed.
How many particles are left after all collisions are resolved?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
