CPM (Critical Path Method) for Delphi and FreePascal

CPM (Critical Path Method) for Delphi and FreePascal

Version: 1.1

Authors: Robert Sedgewick, Kevin Wayne

and Amine Moulay Ramdane

Email: aminer68@gmail.com

Description:

The Critical Path Method or Critical Path Analysis, is a mathematically based algorithm for scheduling a set of project

activities, it is an important tool for effective project management, commonly used with all forms of projects, including construction, software development, research projects, product development, engineering, and plant maintenance, among others. Any project with interdependent activities can apply this method of scheduling

CPM calculates:

- The longest path of planned activities to the end of the project

- The earliest and latest that each activity can start and finish without making the project longer

- Determines “critical” activities (on the longest path)

- Prioritize activities for the effective management and to shorten the planned critical path of a project by:

- Pruning critical path activities

- “Fast tracking" (performing more activities in parallel)

- “Crashing the critical path" (shortening the durations of critical path activities by adding resources)

This CPM algorithm uses Topological sorting to render it a linear-time algorithm for finding the critical path of the project, so it's fast.

You have to have a java compiler, and you have first to compile the java libraries with the batch file compile.bat, and after that compile the Delphi and Freepascal test.pas program.

Here is the procedure to call:

procedure solveCPM(filename:string;var info:TCPMInfo;var finishTime:system.double);

The arguments are:

The filename: is the file to pass, it's organized as:

The first line is the number of jobs, the rest of each of the lines are: the time that takes the job and after that the number of precedence constraints and after that the precedence constraints that specify that the job have to be completed before certain other jobs are begun.

info: is the returned information, you can get the job number and the start and finish time of the job in info[i].job and info[i].start and info[i].finish, please look at the test.pas example to understand.

finishTime: is the finish time.

Have fun with it !

You can go to download the zip files by clicking on the following web link:

https://drive.google.com/drive/folders/1aDL1hZ-hO6bheRc4vdH7PPUUMqmLNwLc?usp=sharing

Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/

Operating Systems: Windows,

Required FPC switches: -O3 -Sd

-Sd for delphi mode....

Required Delphi switches: -$H+ -DDelphi

For Delphi XE-XE7 use the -DXE switch