jsgantt-improved icon indicating copy to clipboard operation
jsgantt-improved copied to clipboard

Critical Path

Open Akhil3991 opened this issue 4 years ago • 4 comments

JS file shows the critical path code and it's not working.

Tried using JSGantt.criticalPath(jsonObj) after g.Draw().

Akhil3991 avatar Apr 20 '20 06:04 Akhil3991

Yes, this is just an initial code to try to calculate the critical path

Do you have any suggestions on how to implement this function?

mariohmol avatar May 03 '20 20:05 mariohmol

  1. Calculate the backward and forward pass of all the activities. The link below shows how to do that. https://2020projectmanagement.com/resources/project-planning/what-is-the-critical-path

  2. Find the last finishing activity and its dependent activities. If the float is zero, that's the critical path, else find the previous finishing activity and its dependent activities. The process will continue until the float is zero condition is true. If there is no zero float, then there is no critical path.

Thanks, Akhil Solminds Technologies Pvt Ltd J-9, Heavenly Plaza, Vazhakkala, Kochi 682021 (Kerala, INDIA)

Akhil3991 avatar May 06 '20 07:05 Akhil3991

THank you so much for this information, could you provide a function that does it?

Check out this https://github.com/jsGanttImproved/jsgantt-improved/blob/c621987763ba2191223bd3959a7cd2050ba1236c/src/utils/general_utils.ts#L516

You can activate this uncommenting this line https://github.com/jsGanttImproved/jsgantt-improved/blob/3c3ad0c43f4168b197812fae4e21cae316d27658/docs/index.js#L171

mariohmol avatar Sep 07 '20 21:09 mariohmol

Hey there and thank you for this amazing foss project! We are using in the IfcOpenShell + BlenderBIM Add-on to generate construction sequencing gantt charts from IFC open data. (e.g. this).

I recently wrote code (in Python, but the logic will be the same) to calculate the critical path, as well as the forward/backward pass calculations for early start/finish, and late start/finish, and total / free float. The code is here: https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.6.0/src/ifcopenshell-python/ifcopenshell/api/sequence/recalculate_schedule.py#L15 - I am happy to walk through it with you to see if something can be implemented in jsgantt.

However, it is a bit trickier than it sounds, as well as how to do it efficiently (the projects we are working on can have 2,000 tasks). The biggest thing to consider is that durations aren't elapsed time - durations in projects are "working days" (i.e. dependant on the calendar being used for that activity). Therefore, calculation of the critical path needs to consider the calendar per activity. With this constraint, one could argue that it is not jsgantt's responsibility to calculate it except for very simple scenarios where calendars are disregarded.

Nevertheless, happy to discuss further if interested :)

Moult avatar Jun 06 '21 00:06 Moult