/usr/share/doc/glpk-utils/examples/cpp.mod is in glpk-utils 4.65-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | /* CPP, Critical Path Problem */
/* Written in GNU MathProg by Andrew Makhorin <mao@gnu.org> */
/* Note: Reduced costs of auxiliary variables phi[j,k] (see below)
can be only zero or one. The critical path is defined by the
constraints, whose reduced cost is one. */
set J;
/* set of jobs (activities) */
set P{j in J}, in J, default {};
/* P[j] is a subset of jobs that immediately precede job j */
param t{j in J}, >= 0;
/* duration required to perform job j */
var x{j in J}, >= 0;
/* starting time of job j */
s.t. phi{j in J, k in P[j]}: x[j] >= x[k] + t[k];
/* job j can start only after all immediately preceding jobs have been
completely performed */
var z;
/* project makespan */
s.t. fin{j in J}: z >= x[j] + t[j];
/* which is the maximum of the completion times of all the jobs */
minimize obj: z;
/* the objective is make z as small as possible */
data;
/* The optimal solution is 46 */
param : J : t :=
A 3 /* Excavate */
B 4 /* Lay foundation */
C 3 /* Rough plumbing */
D 10 /* Frame */
E 8 /* Finish exterior */
F 4 /* Install HVAC */
G 6 /* Rough electric */
H 8 /* Sheet rock */
I 5 /* Install cabinets */
J 5 /* Paint */
K 4 /* Final plumbing */
L 2 /* Final electric */
M 4 /* Install flooring */
;
set P[B] := A;
set P[C] := B;
set P[D] := B;
set P[E] := D;
set P[F] := D;
set P[G] := D;
set P[H] := C E F G;
set P[I] := H;
set P[J] := H;
set P[K] := I;
set P[L] := J;
set P[M] := K L;
end;
|