Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

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 )

  • 1.  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 )

    Posted Mon January 08, 2024 04:32 PM
      |   view attached

    #

    @



    ------------------------------
    Yassine TAHIRI
    ------------------------------

    Attachment(s)

    txt
    doc.txt   2 KB 1 version


  • 2.  RE: 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 )

    Posted Tue January 09, 2024 12:30 PM

    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]
    ------------------------------



  • 3.  RE: 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 )

    Posted Tue January 09, 2024 02:10 PM

    Hello, 

    Thank you so much for your reply ! 

    It actualy works when i made the variables positive. 




    ------------------------------
    Yassine TAHIRI
    ------------------------------