My simulation model contains agents on a surface. Agent's are represented by class Agent
, their locations by class Point
, and the surface itself by class Surface
. Each point is really just a pair of numbers.
To model an agent's movement, I need to know which surface he's on (e.g., on a torus, he would never hit a land's end, but on a cylinder, he will.)
My question is whether I should add to class Point
, as an instance attribute, a reference to the Surface
object.
If I do, class Point
becomes more complicated, and efficiency suffers (instead of dealing with pairs of numbers, I'll be dealing with pairs of numbers plus a reference). This is especially annoying since there's only one instance of class Surface
ever instantiated in a single program run.
If I don't, I would not be able to give class Agent
a move
method. Instead I'd have to model agents' movement from an outer class that is aware of both the surface and individual agents. This approach seems logically less appealing.