Learn R Programming

criticalpath (version 0.2.1)

Schedule: R6 Class Representing a Schedule

Description

This class is a representation of Precedence Diagramming Method (PDM). PDM is a technique used for constructing a schedule model in which activities are represented by nodes and are graphically linked by one or more logical relationships to show the sequence in which the activities are to be performed.

A schedule has activities and relations data-frames. With this class, it is possible to apply critical path method

Arguments

Active bindings

title

A project title for identification. It depends on user of the class. Its use are:

  • Sechedule$title <- "A title"

    • sets a title for a project.

  • Sechedule$title

    • gets the title of the project.

reference

A reference from project origin, for example, a book, a paper, a corporation, or nothing. Its uses are:

  • Sechedule$reference <- "A reference"

    • sets a reference for a project.

  • Sechedule$title

    • gets the reference of the project.

has_any_activity

A logical value that indicates if the schedule has any activity. A TRUE value means that the schedule has some activity; a FALSE, means that the schedule is empty.

  • Usage: Schedule$has_any_activity

nr_activities

Number of activities in a schedule as an integer value.

  • Usage: Schedule$nr_activities

activities

Return a data frame with all activities of a schedule in an activity id order. This is the main information calculated by CPM. The data frame is formed by following structure:

  • id: Activity id.

  • name: The name of activity.

  • duration: A number that represents the activity's duration.

  • milestone: A milestone is an activity with zero duration. This property indicates if an activity is a milestone or not: TRUE indicates it is a milestone; FALSE indicates it is not.

  • critical: A critical activity is one with total float minor or equal to zero. This property indicates if an activity is critical: TRUE indicates it is critical; FALSE indicates it is not critical.

  • ES: Early Start: is the earliest start period an activity can begin after its predecessors without violating precedence relation.

  • EF: Early Finish: is the early start plus activity duration.

  • LS: Late Start: is the late finish minus activity duration.

  • LF: Late Finish: is the latest finish an activity can finish before their successors without violating precedence relation.

  • total_float: It is the amount of period an activity can be delayed without violating the project duration. Its formula is: LS - ES or LF - EF.

  • free_float: It is the amount of period an activity can be delayed without violating the start time of the successors activities.

  • progr_level: Progressive level is the rank of activities counted from begin. The level of the activities that don't have predecessor is one; the level of the other activities, is one plus the maximal level of their predecessor.

  • regr_level: Regressive level is the rank of activities counted from the end. The level of the activities that don't have successor is the maximal progressive level; the level of the other activities, is one minus the minimal level of their successor.

  • topo_float: It is the difference between progressive level and regressive level.

  • Usage: Schedule$activities

has_any_relation

A logical value that indicates if the schedule has any relation. A TRUE value means that the schedule has some relation; a FALSE, means that the schedule does not have any relation.

  • Usage: Schedule$has_any_relation

nr_relations

Number of relations in a schedule as an integer value.

  • Usage: Schedule$nr_relations

relations

Return a data frame with all relations of a schedule in topological order. This is the main information calculated by CPM. The data frame is formed by following structure:

  • from: Predecessor activity id from a relation.

  • to: Successor activity id from a relation.

  • type: The type of relation between activities. Its value may be: FS, FF, SS, SF.

  • lag: The time period between activity predecessor and activity successor activity

  • critical: A critical relation formed by two activity critical: predecessor and successor. TRUE indicates it is critical; FALSE indicates it is not critical.

  • ord: Indicates de order that the relation was added in the schedule.

  • i_from: It is the index of predecessor activity in the activities data frame.

  • i_to: It is the index of successor activity in the activities data frame.

  • Usage: Schedule$relations

duration

An integer value that indicates the duration of a schedule.

Methods

Public methods

Method new()

Make a schedule with activities and relations between activities. The method Schedule$new(activities, relations) creates an schedule object from two data frames, one containing activities lists and the other the precedence relations between activities. After creation, it is applied the Critical Path Method (CPM).

It is possible to create a empty schedule, without any activity or relation with the constructor Schedule$new(). After that, it is possible to add activity with add_activity and relation with add_relation methods.

Usage

Schedule$new(activities = NULL, relations = NULL)

Arguments

activities

Data frame with activities. If it is not informed, the schedule will be created without any activity. Its structure is:

  • id: Activity id. It is an integer number that must be unique within a schedule.

  • name: Activity name. It may be empty.

  • duration: Activity duration. It is integer number without unit time. It may be zero.

relations

Data frame with precedence relations between activities. If it is informed, the activities has to be informed too. If it is not informed, the schedule will be created without any relation. It is formed by predecessor activity e successor activity. Its structure is:

  • from: The id of predecessor activity. Must exist an activity with from id.

  • to: The id of successor activity. Must exist an activity with to id.

  • type: Specifies the type of relation between activities. The default type is FS and its value may be: FS, FF, SS, SF, that means:

    • FS: Finish-Start relation. Activity to_id can only start after the finish of activity from_id.

    • FF: Finish-Finish relation. Activity to_id must finish together with activity from_id.

    • SS: Start-Start relation. Activity to_id must start together with activity from_id.

    • SF: Start-Finish relation. Activity to_id must finish when activity from_id starts.

  • lag: The time period between activities that the successor activity must be advanced, or lated, after activity from_id. It must be an integer, less than, equal or greater than zero.

Returns

A Schedule object with CPM parameters calculated.

Method add_activity()

Add an activity to a schedule.

Usage

Schedule$add_activity(id, name = "", duration = 0L)

Arguments

id

Activity id that will be used to make relation between activities. It must be unique.

name

The name of activity. The default is an empty string.

duration

A number that represents the activity's duration. It must be equal or greater than zero. The default value is zero.

Returns

A Schedule object with an activity added and the critical path calculated.

Method add_activities()

Add activities from a data frame to a schedule.

Usage

Schedule$add_activities(activities)

Arguments

activities

A data frame with the activities to be added.

Returns

A Schedule object with activities added and CPM calculated.

Method get_activity()

Gets an activity by id. It returns a data frame with one line about activity.

Usage

Schedule$get_activity(id)

Arguments

id

An activity id as defined by the user.

Returns

A data frame with one line with the activity, or an error if activity id doesn't exist.

Method add_relation()

Add a relation to a schedule.

Usage

Schedule$add_relation(from, to, type = "FS", lag = 0L)

Arguments

from

The id of predecessor activity. Must exist an activity with from.

to

The id of successor activity. Must exist an activity with to.

type

Specifies the type of relation between activities. The default type is FS and its value may be: FS, FF, SS, SF, that means: If type is not defined, it is assumed to be FS.

FS: Finish-Start relation. Activity 'to' id can only start after the finish of activity 'from' id.

FF: Finish-Finish relation. Activity 'to' id must finish together with activity 'from' id.

SS: Start-Start relation. Activity 'to' id must start together with activity 'from' id.

SF: Start-Finish relation. Activity 'to' id must finish when activity 'from' id starts.

lag

The time period between activities that the successor activity 'to' must be advanced after activity 'from' has been finished. The value may be negative, in such case, the activity 'to' will be anticipated 'lag' time periods. It must be an integer, less than, equal or greater than zero. If lag is not defined, it is assumed to be zero.

Returns

A Schedule object with CPM parameters calculated.

Method add_relations()

Add relations between activities from a data frame to a schedule.

Usage

Schedule$add_relations(relations)

Arguments

relations

A data frame with the relations to be added.

Returns

A Schedule object with relations added and CPM calculated.

Method add_act_rel()

Add an activity and her relations to a schedule.

Usage

Schedule$add_act_rel(
  id,
  name,
  duration,
  relations_id = c(),
  direction = "succ"
)

Arguments

id

Activity id. The id will be used to make relation between activities.

name

The name of activity.

duration

A number that represents the activity's duration. It must be equal or greater than zero.

relations_id

A vector of ids such that will be linked with activity id. It may be relations of successor or predecessors.

direction

Direction of relations_id: It may be "succ" or "pred". If dir="succ" the relations_id will be the successor of the activity. If dir="pred" the relations_id will be the predecessor of the activity.

Returns

A Schedule object.

Method print()

Print a description of the class

Usage

Schedule$print(...)

Arguments

...

Variable parameters

Returns

A String .

Method all_successors()

List all successors from an activity: direct and indirect successors.

Usage

Schedule$all_successors(id, ign_to = NULL)

Arguments

id

Activity id to be listed.

ign_to

A relation to be ignored: id -> ign_to. Activities from this relation will be ignored.

Returns

A vector whith all activities ids.

Method all_predecessors()

List all predecessors from an activity: direct or indirect predecessors.

Usage

Schedule$all_predecessors(id, ign_from = NULL)

Arguments

id

Activity id to be listed.

ign_from

A relation to be ignored: ign_from -> id. Activities from this relation will be ignored.

Returns

A vector with all activities ids.

Method is_redundant()

Verify if a relation between two activities is redundant. A relation A->C is redundant if there are A->C, A->B, B->C relations.

Usage

Schedule$is_redundant(id_from, id_to)

Arguments

id_from

From activity id.

id_to

To activity id.

Returns

A logical TRUE if an arc is redundant; FALSE if it is not.

Method change_durations()

Change activities duration and calculate critical path. This way is faster than creating a new schedule with new durations.

Usage

Schedule$change_durations(new_durations)

Arguments

new_durations

A vector with new activities' duration.

Returns

A Schedule object.

Method gantt_matrix()

Create a matrix that represents a Gantt chart, a matrix where "1" indicates that an activity is planned to be in execution.

In this matrix, the rows represent activities, whereas the columns represents the activity execution period. So, the number of columns is equal to project duration.

Usage

Schedule$gantt_matrix()

Returns

A matrix where "1" indicates that an activity is in execution.

Method xy_gantt_matrix()

Transform a Gantt matrix in x, y coordinates and the weight one. Each point greater than zero in a Gantt matrix becomes a x, y coordinate.

Usage

Schedule$xy_gantt_matrix(gantt = NULL)

Arguments

gantt

A Gantt Matrix. If it is not informed, it will use gantt_matrix() before this function.

Returns

A matrix x, y and weight.

Method topoi_sp()

SP Serial or Parallel Topological Indicator: It shows the closeness of a network to a serial or parallel graph. As the network becomes serial, the SP increase, until one, when the network totally serial.

Usage

Schedule$topoi_sp()

Returns

A number between 0 and 1, inclusive.

Method topoi_ad()

AD Activity Distribution Topological Indicator: Measures the distribution of the activities over the levels. If AD is approximately equal zero, each level has same numbers of activities. Otherwise, if AD is equal one, the quantity of each level is not uniformly distributed.

Usage

Schedule$topoi_ad()

Returns

A number between 0 and 1, inclusive.

Method topoi_la()

LA Length of Arcs Topological Indicator: Measures the presence of long arcs based on the difference between the progressive level of the end activity and the start node of each relation. If LA is approximately equal zero, the progressive level between activities is as far as possible. Otherwise, if LA is equal one, the relation distance are one.

Usage

Schedule$topoi_la()

Returns

A number between 0 and 1, inclusive.

Method topoi_tf()

TF Topological Float Indicator: Measures the topological float of each activity. If TF = 0, there is no float between activities. If TF = 1, there is float between activities and they be shift without affecting other activities.

Usage

Schedule$topoi_tf()

Returns

A number between 0 and 1, inclusive.

Method clone()

The objects of this class are cloneable with this method.

Usage

Schedule$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

References

Csardi, G. & Nepusz, T. (2005). The Igraph Software Package for Complex Network Research. InterJournal. Complex Systems. 1695.

Project Management Institute (2017) A Guide to the Project Management Body of Knowledge (PMBOK Guide). Sixth Edition.

Project Management Institute (2017) PMI Lexicon of Project Management Terms: Version 3.2.

Vanhoucke, M. (2009) Measuring Time: Improving Project Performance Using Earned Value Management. Springer-Verlag US.

Vanhoucke, M. (2013) Project Management with Dynamic Scheduling: Baseline Scheduling, Risk Analysis and Project Control. Springer-Verlag Berlin Heidelberg.

Vanhoucke, M. (2014) Integrated Project Management and Control: First Comes the Theory, then the Practice. Springer International Publishing Switzerland.

See Also

On vignette package there is more information with examples about:

  • Critical Path Method Package criticalpath.

  • How to create a schedule:

    • Add activities and relations together to an schedule.

    • Add activities to a schedule.

    • Add relations to a schedule.

    • Create a schedule object from data frames.

  • How to get schedule information:

    • Title, Reference and Schedule Duration.

  • How to get activities properties:

    • Activity Properties.

    • Gantt Matrix.

  • How to change activities duration:

    • Change Activities Duration.

  • How to get relations properties:

    • Relation Properties

    • Successors and Predecessors.

  • How to get topological properties:

    • Topological Indicators.