Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  IBM ILOG CPLEX: CPLEX Error 5002

    Posted 09/03/20 06:39 AM

    Hi all!

    I'm new here.

    I have the following Objective function (minimize) with 3 constraints. After running, I have the following error related to constraint 3: Description Resource Path Location Type Exception from IBM ILOG CPLEX: CPLEX Error 5002: 'constraint3' is not convex.->. user Unknown OPL Problem Marker

    The constraint3 needs to be declared, because, without it, the model/solution is incorrect.

    /*Objective function */ minimize sum (i in vl, j in vll, k in t) ((x[i][j][k])*(dij[i][j])); subject to { forall (k in t) constraint1: sum(i in v) x[0][i][k] <=1; forall (k in t) constraint2: sum(i in v) x[0][i][k] == sum (j in v) x[j][5][k]; forall (i in v) constraint3: u[i] <= sum(k in t) s[i][k]*p[i][k];


    Is there a configuration or a parameter that can be changed/enabled, so that the model can be solved?

    Cplex Optimization Studio 12.9

    Thank you



    ------------------------------
    Cindy Alves
    ------------------------------

    #DecisionOptimization


  • 2.  RE: IBM ILOG CPLEX: CPLEX Error 5002

    Posted 09/03/20 07:03 AM
    No. This is a non-convex quadratic constraint and CPLEX cannot handle this.

    However, did you post your full model? It seems that the variables u, s, p do not appear anywhere else? So you could set them all to 0 and remove the constraint.

    If this is not the full model and you have to keep the constraint, what are the types of u, v, and p? Does any of s or p happen to be a boolean decision variable? In that case you can probably linearize the constraint easily.

    ------------------------------
    Daniel Junglas
    ------------------------------



  • 3.  RE: IBM ILOG CPLEX: CPLEX Error 5002

    Posted 09/03/20 10:22 AM
    Edited by System Admin 01/20/23 04:43 PM

    Hi Daniel,

    Thank you for your answer.

    No, I didn't post the full model. Yes, variables u, s and p appear in other constraints. So, I must keep the constraints.

    Please find below some of the Decision Variables:

    /******Decision variables*******/

    dvar int+ s[w][tl];

    dvar int+ u[v];

    dvar boolean x[vl][vll][t];

    dvar boolean p[v][t];
    dvar boolean bv[v][tl][t];

    /*****Other constraints*******/forall (i in v)
    constraint4:
    sum(k in t) p[i][k] == 1;

    forall (i in vl, j in vll: i!=j, k in t)
    constraint5:
    s[j][k] >= s[i][k]+sti[i]+tij[i][j]-M*(1-x[i][j][k]);

    forall (i in v, k in t)
    contstraint6:
    u[i] >= s[i][k];


    In that case you can probably linearize the constraint easily

    How can I do that? Can you give me some appointments please? 

    Thank you in advance.



    ------------------------------
    Cindy Alves
    ------------------------------



  • 4.  RE: IBM ILOG CPLEX: CPLEX Error 5002

    Posted 09/03/20 10:34 AM
    Ok, you are lucky since one of the variables in question is a boolean variable. The constraint to linearize is
    forall (i in v) constraint3: u[i] <= sum(k in t) s[i][k]*p[i][k];
    The problematic thing in this constraint is the term s[i][k][ * p[i][k]. Given that p is a boolean variable, this term is either equal to 0 or equal to s[i][k]. So you can use the implication operator => and define a new helper variable
    dvar int+ sp[w][tt]; // s[i][k] * p[i][k]
    to add these constraints
    forall (i in v, k in t) {
      (p[i][k] == 0) => (sp[i][k] == 0);
      (p[i][k] == 1) => (sp[i][k] == s[i][k]);
    }
    Then you can write constraint3 as
    forall (i in V) constraint3: u[i] <= sum (k in t) sp[i][k];
    This is now a linear constraint that CPLEX can handle.

    ------------------------------
    Daniel Junglas
    ------------------------------



  • 5.  RE: IBM ILOG CPLEX: CPLEX Error 5002

    Posted 09/06/20 10:36 AM

    Hi! 

    Very appreciated. 

    After your input, the model is running, but the solution that it gave, doesn't make sense.

    I start thinking that some constraints and/or ∑ are wrong implemented, so I kindly ask you for some feedback on what I have done.


    Constraint 20:
    forall (i in r, s in u, t in p: s<t) constraint20: 1 + v[i][s][t] + sum(k in s+1..t-1) w[i][k] >= w[i][s] + w[i][t];​


    Constraint 21:

    forall (i in v, t in l) constraint21: sum(j in vll: j!=i) x[i][j][t] == sum (j in vl: j!=i) x[j][i][t]; ​


    Should I open a new topic regarding this?

    Thank you very much.
    Best regards,
    Cindy Alves


    ------------------------------
    Cindy Alves
    ------------------------------



  • 6.  RE: IBM ILOG CPLEX: CPLEX Error 5002

    Posted 09/07/20 12:53 AM
    Yes, please open a new topic.
    Please also specify what "makes no sense" means. You probably also need to show the full model.
    Before doing that, you could also debug this yourself. For example, if you get a solution that is better than expected/allowed then check the constraints that this solution should violate and check why it does not violate them. Maybe there is something wrong in your model or in your logic.

    ------------------------------
    Daniel Junglas
    ------------------------------



  • 7.  RE: IBM ILOG CPLEX: CPLEX Error 5002

    Posted 09/09/20 04:13 PM
    Hi Daniel,
    Thank you very much for your kind support.
    I have opened a new topic.
    Best regards,
    Cindy Alves


    ------------------------------
    Cindy Alves
    ------------------------------