summaryrefslogtreecommitdiff
path: root/glpk-5.0/examples/cpp.mod
diff options
context:
space:
mode:
authorPasha <pasha@member.fsf.org>2023-01-27 00:54:07 +0000
committerPasha <pasha@member.fsf.org>2023-01-27 00:54:07 +0000
commitef800d4ffafdbde7d7a172ad73bd984b1695c138 (patch)
tree920cc189130f1e98f252283fce94851443641a6d /glpk-5.0/examples/cpp.mod
parentec4ae3c2b5cb0e83fb667f14f832ea94f68ef075 (diff)
downloadoneapi-ef800d4ffafdbde7d7a172ad73bd984b1695c138.tar.gz
oneapi-ef800d4ffafdbde7d7a172ad73bd984b1695c138.tar.bz2
simplex-glpk with modified glpk for fpgaHEADmaster
Diffstat (limited to 'glpk-5.0/examples/cpp.mod')
-rw-r--r--glpk-5.0/examples/cpp.mod67
1 files changed, 67 insertions, 0 deletions
diff --git a/glpk-5.0/examples/cpp.mod b/glpk-5.0/examples/cpp.mod
new file mode 100644
index 0000000..af3f120
--- /dev/null
+++ b/glpk-5.0/examples/cpp.mod
@@ -0,0 +1,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;