feat: implement PERTMethod class with three-point estimation (O, M, P) - #5 - #10
Open
rajesh-puripanda wants to merge 2 commits into
Open
Conversation
- Add optimistic, most_likely, pessimistic fields to Node class with computed expected_time, variance, and std_deviation properties - Create PERTMethod class extending CriticalPathMethod with: - add_activity(name, optimistic, most_likely, pessimistic) - add_activities_relations bulk method for three-point estimates - get_expected_time, get_variance, get_std_deviation per activity - get_project_variance, get_project_std_deviation for critical path - display_pert_distribution() for Beta-PERT bar chart visualization - Overridden network_summary with PERT details - Fix off-by-one bug in CriticalPathMethod.add_activities_relations (durations[i+1] -> durations[i]) - Add 20 unit tests covering formulas, pathfinding, project stats - Add smoke tests for end-to-end PERT workflow - Update __init__.py exports
Owner
|
Great work on this implementation, Rajesh! The visual distribution chart is fantastic, and the base Expected Time calculations are solid. However, I ran this locally against a test network with multiple critical paths and caught a crashing bug in find_critical_path.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements core PERT (Program Evaluation and Review Technique) three-point estimation as described in issue #5.
Changes
Core PERT Logic (
networkdiagram/networkdiagram.py):Nodeclass withoptimistic,most_likely,pessimisticfields, plus computedexpected_time,variance, andstd_deviationpropertiesPERTMethodclass extendingCriticalPathMethodwith:add_activity(name, optimistic, most_likely, pessimistic)— automatically computes Expected Time TE = (O + 4M + P) / 6add_activities_relations(activities, O_list, M_list, P_list, predecessors)— bulk add with three-point estimatesget_expected_time(),get_variance(),get_std_deviation()per activityget_project_variance(),get_project_std_deviation()— summed along critical pathfind_critical_path()— uses expected times for critical path determinationnetwork_summary()— displays O/M/P/TE/Variance/StdDev for each activitydisplay_pert_distribution()— grouped bar chart comparing O, M, P, and TE estimates via matplotlibCriticalPathMethod.add_activities_relations()—durations[i+1]→durations[i](first duration was previously skipped)Exports (
__init__.py):PERTMethodandNodeto package exportsTests (
tests/):test_pert.py— 20 unit tests covering PERT formulas, variance/stddev calculations, critical path finding, project variance aggregation, and backward compatibilitytest_smoke.py— end-to-end integration testsOther:
.gitignorefor Python cache (__pycache__/) and build artifactsUsage Example
Verification
All 20 unit tests pass:
python -m unittest tests/test_pert.py -v
Existing CriticalPathMethod API is fully backward-compatible.
Closes #5