From 54120ceade9ef6ce5421e24ac6caa2b10d38449b Mon Sep 17 00:00:00 2001 From: Wouter Geraedts Date: Sun, 24 Jan 2016 11:33:43 +0100 Subject: [PATCH] --- Corvee assignments | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Corvee assignments diff --git a/Corvee assignments b/Corvee assignments new file mode 100644 index 0000000..3e57b18 --- /dev/null +++ b/Corvee assignments @@ -0,0 +1,81 @@ +/* Number of people */ +param P_count, integer, > 0; + +/* Number of jobs */ +param J_count, integer, > 0; + +/* Number of days */ +param D_count, integer, > 0; + +param WL, integer, > 0; +param WH, integer, > 0; + +set P := 1..P_count; +set J := 1..J_count; +set D := 1..D_count; + +/* Person p likes to solve jobs j */ +param L{p in P, j in J} default 0, binary; + +/* Person p hates to solve jobs j */ +param H{p in P, j in J} default 0, binary; + +/* Person p is capable to perform job j */ +param C{p in P, j in J} default 1, binary; + +/* How many jobs need to be done on what day */ +param R{j in J, d in D}, integer, >= 0; + +/* Person p is allocated to do job j on day d */ +var A{p in P, j in J, d in D}, binary; + +/* A person only has one task per day, at most */ +s.t. max_load_person{p in P, d in D}: sum{j in J} A[p,j,d] <= 1; + +/* A person has at least D-1 tasks */ +s.t. min_load_person{p in P}: sum{j in J, d in D} A[p,j,d] >= D_count-1; + +/* A person does not perform the same job on all days */ +s.t. duplicate_jobs{p in P, j in J}: sum{d in D} A[p,j,d] <= D_count-1; + +/* Each task is allocated */ +s.t. all_allocated{j in J, d in D}: sum{p in P} A[p,j,d] == R[j, d]; + +/* A person only performs what (s)he is capable of */ +s.t. capability_person{p in P, j in J, d in D}: A[p,j,d] <= C[p,j]; + +/* Maximize enjoyment */ +maximize enjoyment: sum{p in P, d in D, j in J} A[p,j,d] * (L[p, j] * WL - H[p, j] * WH); + +solve; + +printf "Sum %d\n", enjoyment; +printf{p in P, d in D, j in J : A[p,j,d] > 0} "%d %d %d %d\n", p, d, j, A[p,j,d] * (L[p, j] * WL - H[p, j] * WH); + +data; + +/* Test example */ + +param P_count := 3; +param J_count := 2; +param D_count := 2; +param WL := 3; +param WH := 9; + +param L : 1 2 := + 1 0 1 + 2 1 0 + 3 0 0; + +param H : 1 2 := + 1 1 0 + 2 0 1 + 3 0 1; + +param R : 1 2 := + 1 1 2 + 2 2 1; + +param C[3,2] := 0; + +end; \ No newline at end of file