43 for (uint32_t i = 0; i < _nrRobots; i++)
58 _collisions.resize(_newSchedule.size(), 0);
74 uint32_t maxCollisions = 0;
75 bool robotFound =
false;
76 _firstRobotToReplan = 0;
78 for (uint32_t i = 0; i < priorityCollidingRobot; i++)
80 uint32_t robot = newSchedule[i];
82 if (_collisions[robot] > maxCollisions)
84 maxCollisions = _collisions[robot];
85 _firstRobotToReplan = i;
93 std::swap(newSchedule[_firstRobotToReplan], newSchedule[priorityCollidingRobot]);
99 for (uint32_t i = 0; i < newSchedule.size(); i++)
101 if (newSchedule[i] != schedule[i])
112 std::swap(newSchedule[_firstRobotToReplan], newSchedule[priorityCollidingRobot]);
113 _collisions[newSchedule[_firstRobotToReplan]] = 0;
119 }
while (count < priorityCollidingRobot && !found);
124 _newSchedule = newSchedule;
void reset(const uint32_t _nrRobots)
resets the Priority schedule with an initial priority schedule
PriorityScheduler(const uint32_t _nrRobots)
constructor
std::vector< uint32_t > actualPrioritySchedule_
bool reschedulePriorities(const uint32_t _collidingRobot, std::vector< uint32_t > _collsisions, std::vector< uint32_t > &_newSchedule, uint32_t &_firstRobotToReplan)
rescedules priorities depending on the ound collisions and allready tried schedules ...
std::vector< std::vector< uint32_t > > checkedSchedules_
const std::vector< uint32_t > & getActualSchedule() const
returns the currently produced speed schedule