Regarding the current implementation of Negative-first in Noxim: Packets headed South-East are routed using XY, i.e. Positive then negative, which violates the rules of Negative-first and may induce deadlocks.
Possible fix:
if (destination.x < current.x || destination.y > current.y) // check negative directions first
{
if (destination.x < current.x) directions.push_back(DIRECTION_WEST);
if (destination.y > current.y) directions.push_back(DIRECTION_SOUTH);
} else if (destination.x > current.x || destination.y < current.y) {
if (destination.x > current.x) directions.push_back(DIRECTION_EAST);
if (destination.y < current.y) directions.push_back(DIRECTION_NORTH);
} else
directions.push_back(DIRECTION_LOCAL);
Hello,
Regarding the current implementation of Negative-first in Noxim: Packets headed South-East are routed using XY, i.e. Positive then negative, which violates the rules of Negative-first and may induce deadlocks.
Possible fix:
if (destination.x < current.x || destination.y > current.y) // check negative directions first { if (destination.x < current.x) directions.push_back(DIRECTION_WEST); if (destination.y > current.y) directions.push_back(DIRECTION_SOUTH); } else if (destination.x > current.x || destination.y < current.y) { if (destination.x > current.x) directions.push_back(DIRECTION_EAST); if (destination.y < current.y) directions.push_back(DIRECTION_NORTH); } else directions.push_back(DIRECTION_LOCAL);
Best regards