Closed colinhanrahan closed 8 months ago
The egoist model works differently because the agent really only cares about the consequences (so, utility) for itself. We figure out which neighbors can reach the cell under consideration (different from the size of the neighborhood) to figure out how many agents will be affected if the agent currently moving goes to this cell, but we don't care how those other agents will be affected. So, there is no indentation issue. Instead, it's a logical issue. All those references to neighbor
should be references to self
instead.
It's also worth noting the Egoist
class will likely be deleted soon pending verification that the selfishnessFactor
mechanism works accordingly.
That makes way more sense, thank you. It doesn't make sense for egoists to take others into consideration. I was comparing the code of the different findEthicalValueOfCell()
functions to see what would need to happen for them to be merged into one that just uses selfishnessFactor
. I'll fix the logic in this function and then maybe you can test to see if the behavior better matches a Bentham
with a selfishnessFactor
of 1.
New commit should properly fix the function, but I might've missed a few neighbor-related calculations or specifics related to the utility equation.
Deprecated by 82647de. Fixes to Egoist class here helped verify that using the Bentham class with an agent's selfishnessFactor
set to 1 produces (nearly) the same behavior.
This change is purely based on the fact that
Egoist findEthicalValueOfCell()
is callingneighbor
outside of thefor neighbor in self.neighborhood
loop, which doesn't seem right to me. I put thecanSee
sum in a separate loop because it seems like it's only supposed to be used in the main loop after it's fully calculated.canSee
is used for calculatingextent
for eachneighbor
, but to be honest, I'm not sure whatextent
is doing inside of the loop. I thought it was indicated by the summing of eachneighborValueOfCell
intocellValue
.canSee
is one of the only differences between thefindEthicalValueOfCell()
inEgoist
and the one inBentham
, which just useslen(self.neighborhood)
to calculateextent
.