Hi,
you could make your decision variables positive. That could help.
The following model works.
int N = 3; // Nombre total d'opérateurs
int M = 4; // Nombre total de tâches
int Di[1..N] = [40, 50, 45]; // Temps de disponibilité des opérateurs
int tj[1..M] = [10, 15, 12, 8]; // Temps nécessaire pour faire la tâche j
int W[1..M] = [3, 2, 4, 5]; // Criticité de la tâche j
int DateLimite[1..M] = [100, 120, 110, 90]; // Date limite de la tâche j
int Aj[1..M] = [30, 40, 35, 25]; // Moment où la panne survient pour la tâche j
int Nmax[1..M] = [2, 1, 2, 1]; // Nombre maximum d'opérateurs pour la tâche j
int C[1..N][1..M] = [
[1, 0, 1, 0], // Opérateur 1
[0, 1, 0, 1], // Opérateur 2
[1, 0, 1, 0] // Opérateur 3
];
range Operateurs = 1..N; // Opérateurs
range Taches = 1..M; // Tâches
dvar boolean X[Operateurs][Taches];
dvar boolean Y[Taches];
dvar float+ R[Taches];
dvar float+ T[Taches];
dvar float+ DateDebut[Taches]; // Date de début de la tâche j
dvar float+ DateFin[Taches]; // Date de fin de la tâche j
dexpr float Retards = sum(i in Operateurs, j in Taches) W[j] * R[j] * X[i][j] + sum(j in Taches) W[j] * T[j];
minimize Retards;
subject to {
forall(j in Taches) ct1:sum(i in Operateurs) X[i][j] <= 1;
forall(i in Operateurs) ct2:sum(j in Taches) X[i][j] <= 1;
forall(i in Operateurs, j in Taches) ct3:Di[i] <= DateDebut[j];
forall(j in Taches) ct4:DateFin[j] == DateDebut[j] + tj[j];
forall(j in Taches) ct5:R[j] == maxl(0 , DateFin[j] - DateLimite[j]);
forall(j in Taches) ct6: sum(i in Operateurs) X[i][j] == Y[j];
forall(i in Operateurs) ct7:sum(j in Taches) W[j] * Y[j] == max(j in Taches) W[j];
forall(i in Operateurs, j in Taches) ct8:X[i][j] <= C[i][j];
forall(j in Taches) ct9:T[j] <= DateDebut[j] - Aj[j];
}
execute
{
writeln(Retards);
}
------------------------------
[Alex] [Fleischer]
[Data and AI Technical Sales]
[IBM]
------------------------------
Original Message:
Sent: Mon January 08, 2024 01:45 PM
From: Yassine TAHIRI
Subject: Error 5002: 'q1' is not convex.- Hi everyone, I am currently trying to solve this problem but I always got error. Could anyone please help me to solve the problem! i just need a first solution (not necessary the optimal solution )
#
@
------------------------------
Yassine TAHIRI
------------------------------