Last active
December 4, 2024 00:32
-
-
Save bokner/7cf35bd5b2aedbf6076311c74af4a6d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include "globals.mzn"; | |
int: N; | |
int: T; | |
set of int: WORKERS = 1..N; | |
set of int: TASKS = 1..T; | |
array[TASKS, WORKERS] of int: costs; | |
array[TASKS] of var WORKERS: task_assignments; | |
constraint alldifferent(task_assignments); | |
solve minimize sum(w in WORKERS)(costs[task_assignments[w], w]); | |
%%%%%% Results %%%%%%%%%%%%%%%%%% | |
% worker: [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, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100] | |
% task: [14, 36, 49, 23, 34, 98, 2, 60, 53, 9, 89, 66, 97, 13, 32, 78, 51, 6, 11, 83, 96, 30, 63, 17, 79, 47, 88, 67, 41, 3, 73, 8, 43, 94, 71, 90, 50, 45, 68, 4, 69, 64, 75, 65, 95, 31, 57, 62, 48, 80, 70, 91, 92, 52, 84, 25, 85, 18, 58, 40, 81, 87, 86, 55, 22, 42, 16, 99, 93, 27, 15, 82, 38, 56, 29, 5, 77, 1, 54, 59, 19, 26, 46, 28, 7, 10, 37, 76, 44, 74, 33, 72, 12, 24, 20, 21, 61, 35, 39, 100] | |
%% total cost: 305 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment