COIN-OR::LEMON - Graph Library

source: glpk-cmake/examples/cpp.mod @ 1:c445c931472f

Last change on this file since 1:c445c931472f was 1:c445c931472f, checked in by Alpar Juttner <alpar@…>, 13 years ago

Import glpk-4.45

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