2.3 Buffers and the Critical Chain

For the next step we first add a new report and gantt chart.
class Crit_Report(report.Critical):
    data = project
    
    def make_report(self, data):
	for t in data: 
	    yield (t.indent_name(), t.start, t.end, t.buffer)


class Crit_Gantt(gantt.Critial):
    data = project
These two objects, highlight the critical tasks by, changing their background colors. After choosing them on the side pane, the new report and the new gantt chart should look like figure 2.4.
Figure 2.4: Critical Gantt Chart and Report 1
\includegraphics[width=\textwidth,height=.4\textheight]{tutorial/third1}
As you can see only module1 has a buffer greater than 0. To increase the buffer we have to move back the finished milestone. Therefore we change the start property of finished in line 31 to start = max(up.installation.end, Date("2005-2-18")). Now the the critical report and gantt look like figure 2.5.
Figure 2.5: Critical Gantt Chart and Report 2
\includegraphics[width=\textwidth,height=.4\textheight]{tutorial/third2}
There is no critical task anymore. Next we change our report and gantt, to also highlight tasks, which may become critical, because their buffer is quite short. We change the new definitions to:
class Crit_Report(report.Critical):
    data = project
    colors = { 0:"red", "5d" : "orange" }
    
    def make_report(self, data):
	for t in data: 
	    yield (t.indent_name(), t.start, t.end, t.buffer)


class Crit_Gantt(gantt.Critial):
    data = project
    colors = { 0:"red", "5d" : "orange" }
The new additions colors = 0:"red", "5d" : "orange" mean: Tasks with a buffer of 0 will be red, Tasks with a buffer less or equal than 5 days will be orange. The result looks like figure 2.6.
Figure 2.6: Critical Gantt Chart and Report 3
\includegraphics[width=\textwidth,height=.4\textheight]{tutorial/third3}