OR-Notes

J E Beasley

OR-Notes are a series of introductory notes on topics that fall under the broad heading of the field of operations research (OR). They were originally used by me in an introductory OR course I give at Imperial College. They are now available for use by any students and teachers interested in OR subject to the following conditions.

A full list of the topics available in OR-Notes can be found here.


Network analysis - integer programming tutorial solution

Variables

We need to decide whether to use an investment opportunity or not so let xj = 1 if we use investment opportunity j (j=1,...,10), 0 otherwise

Constraints

SUM{j=1,...,10}Cjxj <= Q

x3 + x4 <= 1
x5 + x6 <= 1

x5 <= x3+ x4
x6 <= x3+ x4

2 <= x1 + x2 + x7 + x8 + x9 + x10 <= 4

Objective

The objective is to maximise the total estimated long-run profit i.e.

maximise SUM{j=1,...,10}Pjxj

Note here that sometimes it is possible to correctly represent the problem, but using different constraints. For example for this problem we could replace

x5 <= x3+ x4
x6 <= x3+ x4

by the single constraint

x5 + x6 <= x3+ x4

since we have x5 + x6 <= 1


Solution

The network diagram is shown below. Note the introduction of a dummy activity I with a duration of zero to represent the end of the project.

Let Ei represent the earliest start time for activity i such that all its preceding activities have been finished. We calculate the values of the Ei (i=A,B,...,I) by going forward, from left to right, in the network diagram.

To ease the notation let Ti be the activity completion time associated with activity i (e.g. TB = 3). Then the Ei are given by:

EA = 0 (assuming we start at time zero)
EB = 0 (assuming we start at time zero)
EC = EA + TA = 0 + 2 =2
ED = max[EA + TA, EB + TB] = max[0 + 2, 0 + 3] = 3
EE = max[EC + TC, ED + TD] = max[2 + 4, 3 + 3] = 6
EF = EC + TC = 2 + 4 = 6
EG = EE + TE = 6 + 8 = 14
EH = max[EF + TF, EG + TG] =max[6 + 3, 14 + 2] = 16
EI = EH + TH = 16 + 3 = 19

Hence the minimum possible completion time for the entire project is 19 weeks i.e. 19 (weeks) is the minimum time needed to complete all the activities.

We now need to calculate the latest times for each activity.

Let Li represent the latest start time we can start activity i and still complete the project in the minimum overall completion time. We calculate the values of the Li (i=A,B,...,I) by going backward, from right to left, in the network diagram. Hence:

LI = 19
LH= LI - TH = 19 - 3 = 16
LG = LH - TG = 16 - 2 = 14
LF = LH - TF = 16 - 3 = 13
LE = LG - TE = 14 - 8 = 6
LD = LE - TD = 6 - 3 = 3
LC = min[LE - TC, LF - TC] = min[6 - 4, 13 - 4] = 2
LB = LD - TB = 3 - 3 = 0
LA = min[LC - TA, LD - TA] = min[2 - 2, 3 - 2] = 0

Note that as a check all latest times are >=0 at least one activity has a latest start time value of zero.

As we know the earliest start time Ei, and latest start time Li, for each activity i it is clear that the amount of slack or float time Fi available is given by Fi = Li - Ei which is the amount by which we can increase the time taken to complete activity i without changing (increasing) the overall project completion time. Hence we can form the table below:

Activity   Li          Ei           Float Fi 
A          0           0             0
B          0           0             0
C          2           2             0
D          3           3             0
E          6           6             0
F         13           6             7
G         14          14             0
H         16          16             0

Any activity with a float of zero is critical. Note here that, as a check, all float values should be >= 0.

Hence the critical activities are A,B,C,D, E,G and H and the float for the only non-critical activity F is 7 weeks.

In order to formulate the problem of deciding the completion time for C, D and E so as to ensure that the project is completed within 17 weeks we make use of integer programming.

Let the x variables (suitably subscripted) represent feasible start times for each activity (>=0 and integer). Note here that we deal with feasible start times in formulating this program rather than (as above) with earliest start times.

Introduce zero-one variables:
Ci = 1 if a completion time of i (i=4,3,2,1) is chosen for activity C, 0 otherwise
Di = 1 if a completion time of i (i=3,2,1) is chosen for activity D, 0 otherwise
Ei = 1 if a completion time of i (i=8,7,6) is chosen for activity E, 0 otherwise

then the constraints relating to the choice of completion time are:

C4 + C3 + C2 + C1 =1
D3 + D2 + D1 = 1
E8 + E7 + E6 = 1

i.e. exactly one completion time must be chosen for C, D and E respectively.

The constraints relating to the network logic are:

xC >= xA + 2
xD >= xB + 3
xD > = xA + 2
xE >= xC + 4C4 + 3C3 + 2C2 +1C1

where 4C4 + 3C3 + 2C2 +1C1 is the completion time for activity C (remember C4, C3, C2 and C1 are zero-one variables).

xE >= xD + 3D3 + 2D2 +1D1
xF >= xC + 4C4 + 3C3 + 2C2 +1C1
xG >= xE + 8E8 + 7E7 + 6E6
xH >= xF + 3
xH >= xG + 2
xI >= xH +3

xI <= 17 (to complete within 17 weeks)

and the objective is:

minimise 3C4 + 7C3 + 10C2 +15C1 + 12D3 + 16D2 +25D1 + 5E8 + 9E7 +14E6

Note here that essentially in this question we have extended cost/time tradeoff which we considered before from involving a linear assumption to the situation we we can have a diverse range of possible completion times, and any associated costs we wish.