-
Notifications
You must be signed in to change notification settings - Fork 0
Parallelisation
Visualisation is by nature parallelised, as it needs to be responsive in real-time. This parallelisation is handled by the visualisation framework (JavaFX).
Runs a single pass greedy algorithm, as such only needs to run on one core.
The basis of the A* algorithm can be found here. The parallel version of this algorithm runs the exact same sequential logic on multiple threads, which each share a reference to a single state manager. This means that there are more cores processing states at any given time, resulting in more efficient use of multicore systems. As such, the state manager and the states themselves are threadsafe, through the use of the synchronized keyword on any methods which could incur concurrent access on state (for read/write).
On termination, due to the first thread finding a complete schedule not guaranteeing optimality, the parallel algorithm terminates by firstly shutting down the FixedThreadPool which is managing the threads processing state, before also checking the state manager to see if any of the other states are complete with a more optimal time. This guarantees that what the parallel algorithm returns is still the optimal schedule, rather than simply a valid schedule.