% Number of tasks
int: numTasks = 5;
% Number of days available for scheduling
int: numDays = 10;
% Duration of each task (in days)
array[1..numTasks] of int: duration = [2, 3, 1, 4, 2];
% Dependencies between tasks (task 2 depends on task 1, etc.)
array[1..numTasks, 1..numTasks] of bool: dependency = array2d(1..numTasks, 1..numTasks,
[ 0, 1, 0, 0, 0,
0, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 1, 0, 0,
0, 0, 0, 1, 0 ]);
% Decision variables: start day for each task
array[1..numTasks] of var 1..numDays: startDay;
% Constraint: task must finish within the schedule
constraint forall(i in 1..numTasks) (
startDay[i] + duration[i] - 1 <= numDays
);
% Constraint: dependencies between tasks
constraint forall(i in 1..numTasks, j in 1..numTasks) (
if dependency[i,j] then
startDay[j] >= startDay[i] + duration[i]
else
true
endif
);
% Optimization goal: minimize the last finishing day
var int: lastFinish = max(i in 1..numTasks) (startDay[i] + duration[i] - 1);
solve minimize lastFinish;
% Output
output ["Task " ++ show(i) ++ " starts on day " ++ show(startDay[i]) | i in 1..numTasks];
Running TonySched.mzn | 81msec |
TonySched:12-55.17-22: MiniZinc: type error: cannot determine coercion from type array[int,int] of int to type array[int,int] of bool Process finished with non-zero exit code 1. Finished in 81msec. |
I'm not sure yet.ShitGPT?
It's too early to tell David. I have had some clear, quick responses to some questions/subjects, but much less than stellar in others. I asked chatGPT some questions about furnace symptoms and also about car tires/noises and got direct, useful responses. However, I have had some confusing, circuitous responses when dealing with Access/vba/vbe. My experience says that the software (Ver 3.5 that I have used) often makes things up (hallucinations). Several times, different sessions, I get a code snippet response from chatGPT that include s properties that don't exist. I also tried Bing chat with a question I had posed to chatGPT-- similar responses and seemed to be going in a circle. Bing chat seems just another interface to chatGPT, but I haven't pursued it enough to comment one way or the other.ShitGPT?