Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Conflict error

    Posted 10/29/18 11:39 AM

    Originally posted by: 88Simon88


    Hello everyone,

    When I run the model, I face with a conflict error, but I cannot find the conflict. Find the model and data files in the attachment. Is there anyone who can help me in this regard?

    In the model, the decision variable X is binary. I is the inventory and L is the volume which cut from trees. At each time period, there is two choice to cut the cell (the whole trees in that cell of the forest) or not. If X=1, it means that it cuts, but note that constraints of wood allocation loss (between lines 157 and 177) express that if the cell is going to be cut, the whole amount of trees should be cut not part of it. The first cell of the forest has 100 from type 1 and cell 2 has 125 of type 2. The demand for time period one and two is 200. CPLEX chooses an obvious incorrect solution such as follows:
    X[1][1][1][1]=1
    X[1][1][2][1]=1
    It means that it is going to cut the whole trees from cell one and two, so the L[1][1][1][1] and L[1][1][2][1] should be equal to 100 and 125, respectively, but L[1][1][1][1]=100 and L[1][1][2][1] = 100. Could please let me know why CPLEX choose this solution?
    Note: Z[t][s] is the amount of woods which can be bought from the market and AAC is the limit for cutting at each time period and constant.
    According to the aforementioned note, the CPLEX should choose one of the following:
    X[1][1][1][1]=1
    X[1][1][2][1]=0
    Z[s][1]=100
     
    X[1][1][1][1]=0
    X[1][1][2][1]=1
    Z[s][1]=75 
     
    X[1][1][1][1]=0
    X[1][1][2][1]=0
    Z[s][1]=200
    I am really confused of CPLEX !!!! I would deeply appreciate if you could help me in this regard.

    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Conflict error

    Posted 10/29/18 12:40 PM

    Are you sure CPLEX claims that the solution is feasible/optimal for your model? Could it be that this is a relaxed solution?

    What happens if you disable relaxations in the settings?

    Your model is infeasible and this is what CPLEX thinks is a minimal conflict:

    Subject To
     Balance_control_t1p1_2(3)(2):   1000000 X(3)(1)(2) + I#2#0#1#0 >= 125
     Balance_control_t1p1_1(4)(2):   - 1000000 X(4)(1)(2) + I#3#0#1#0 <= 0
     Balance_control_t1p1_3(4)(2):   1000000 X(4)(1)(2) + I#3#0#1#0 <= 1000000
     Balance_control_t1p1_2(6)(1):   1000000 X(6)(1)(1) + I#5#0#0#0 >= 100
     Balance_control_t1p1_1(9)(1):   - 1000000 X(9)(1)(1) + I#8#0#0#0 <= 0
     Balance_control_t1_1(8)(1)(3):  - 1000000 X(8)(1)(1) + I#7#0#0#2 <= 0
     Balance_control_t1_3(8)(1)(3):  1000000 X(8)(1)(1) + I#7#0#0#2 <= 1000000
     Balance_control_t1_2(9)(1)(2):  1000000 X(9)(1)(1) + I#8#0#0#1 >= 100
     Balance_control_1(8)(2)(1)(3):  - 1000000 X(8)(2)(1) - I#7#0#0#2 + I#7#1#0#2
                                     <= 0
     Balance_control_3(8)(2)(1)(3):  1000000 X(8)(2)(1) + I#7#1#0#2 <= 1000000
     Balance_control_2(9)(2)(1)(3):  1000000 X(9)(2)(1) - I#8#0#0#1 + I#8#1#0#2
                                     >= 0
     Wood_allocation_loss_t1_2(3)(2)(2): - 1000000 X(3)(1)(2) + L#2#0#1#1
                                     >= -999875
     Wood_allocation_loss_t1_2(6)(1)(1): - 1000000 X(6)(1)(1) + L#5#0#0#0
                                     >= -999900
     Wood_allocation_loss_t1_2(9)(1)(1): - 1000000 X(9)(1)(1) + L#8#0#0#0
                                     >= -999900
     Wood_allocation_loss_2(7)(2)(1)(1): - 1000000 X(7)(2)(1) - I#6#0#0#0
                                     + L#6#1#0#0 >= -1000000
     Wood_allocation_loss_3(7)(2)(1)(2): - 1000000 X(7)(2)(1) + L#6#1#0#1 <= 0
     Wood_allocation_loss_1(9)(2)(1)(1): 1000000 X(9)(2)(1) - I#8#0#0#0 + L#8#1#0#0
                                     <= 1000000
     Wood_allocation_loss_2(9)(2)(1)(2): - 1000000 X(9)(2)(1) - I#8#0#0#1
                                     + L#8#1#0#1 >= -1000000
     Harvesting_limitation(1)(1):    L#0#0#0#0 + L#0#0#0#1 + L#0#0#0#2 + L#0#0#0#3
                                     + L#0#0#1#0 + L#0#0#1#1 + L#0#0#1#2
                                     + L#0#0#1#3 <= 200
     c939:                           - I#2#0#1#0 + I#3#0#1#0  = 0
     c959:                           - I#5#0#0#0 + I#6#0#0#0  = 0
     c1025:                          - I#7#1#0#2 + I#8#1#0#2  = 0
     c1031:                          - L#0#0#0#0 + L#1#0#0#0  = 0
     c1036:                          - L#0#0#1#1 + L#1#0#1#1  = 0
     c1039:                          - L#1#0#0#0 + L#2#0#0#0  = 0
     c1044:                          - L#1#0#1#1 + L#2#0#1#1  = 0
     c1047:                          - L#2#0#0#0 + L#3#0#0#0  = 0
     c1055:                          - L#3#0#0#0 + L#4#0#0#0  = 0
     c1063:                          - L#4#0#0#0 + L#5#0#0#0  = 0
     c1071:                          - L#5#0#0#0 + L#6#0#0#0  = 0
     c1079:                          - L#6#0#0#0 + L#7#0#0#0  = 0
     c1087:                          - L#7#0#0#0 + L#8#0#0#0  = 0
     c1127:                          - L#6#1#0#0 + L#7#1#0#0  = 0
     c1128:                          - L#6#1#0#1 + L#7#1#0#1  = 0
     c1135:                          - L#7#1#0#0 + L#8#1#0#0  = 0
     c1136:                          - L#7#1#0#1 + L#8#1#0#1  = 0
    \Sum of equality rows in the conflict:
    \ sum_eq: - I#2#0#1#0 + I#3#0#1#0 - I#5#0#0#0 + I#6#0#0#0 - I#7#1#0#2
    \         + I#8#1#0#2 - L#0#0#0#0 - L#0#0#1#1 + L#2#0#1#1 + L#8#0#0#0
    \         - L#6#1#0#0 - L#6#1#0#1 + L#8#1#0#0 + L#8#1#0#1  = 0
    Bounds
     0 <= X(6)(1)(1) <= 1
     0 <= X(7)(2)(1) <= 1
     0 <= X(8)(1)(1) <= 1
     0 <= X(8)(2)(1) <= 1
     0 <= X(9)(1)(1) <= 1
     0 <= X(9)(2)(1) <= 1
     0 <= X(3)(1)(2) <= 1
     0 <= X(4)(1)(2) <= 1
          I#2#0#1#0 Free
          I#3#0#1#0 Free
          I#5#0#0#0 Free
          I#6#0#0#0 Free
          I#8#0#0#0 Free
          I#7#0#0#2 Free
          I#8#0#0#1 Free
          I#7#1#0#2 Free
          I#8#1#0#2 Free
          L#0#0#0#0 Free
          L#0#0#1#1 Free
          L#1#0#0#0 Free
          L#1#0#1#1 Free
          L#2#0#0#0 Free
          L#2#0#1#1 Free
          L#3#0#0#0 Free
          L#4#0#0#0 Free
          L#5#0#0#0 Free
          L#6#0#0#0 Free
          L#7#0#0#0 Free
          L#8#0#0#0 Free
          L#6#1#0#0 Free
          L#6#1#0#1 Free
          L#7#1#0#0 Free
          L#7#1#0#1 Free
          L#8#1#0#0 Free
          L#8#1#0#1 Free
    Binaries
     X(6)(1)(1)  X(7)(2)(1)  X(8)(1)(1)  X(8)(2)(1)  X(9)(1)(1)  X(9)(2)(1)
     X(3)(1)(2)  X(4)(1)(2)
    End

    You know the model better than us, so maybe you can make more of that than I. Did you check the tutorials about handling infeasible models and analyzing infeasibility?

    I also see that you use big-M formulations. In general this may introduce numerical issues that result in incorrect declaration of infeasibility (although this does not seem to be the case here at first glance). It would be better to use logical constraints instead.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Conflict error

    Posted 10/29/18 12:42 PM

    Originally posted by: 88Simon88


    Thanks for your response,

    CPLEX: solution (feasible relaxed sum of infeasibilities) with objective ...

    Now I am going to use indicator constraints instead of Big M. I will let you know the results.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Conflict error

    Posted 10/29/18 01:10 PM

    Ok, so CPLEX did not claim this solution feasible. It is a solution for the relaxed model. If your model is still infeasible with indicators then you should run the conflict refiner to figure out why CPLEX thinks your model is infeasible.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Conflict error

    Posted 10/29/18 01:15 PM

    Originally posted by: 88Simon88


    I changed the constraints to indicator constraints. Find the attachment to this reply please.

    Now there is no conflict, no relaxation, and no solution. What is the problem now?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Conflict error

    Posted 10/29/18 02:26 PM

    Originally posted by: 88Simon88


    I changed all constraints to indicator constraints, but I have forgot to name the constraint, so I didn't find any conflict, relaxation, and solution. Having named them (Find the attachments please), I faced again with many conflicts and relaxation. I cannot change the reality. Why is there too many relaxation?

    If we cut the tree, the inventory for the next time period should be equal to zero, and all the cut inventory would go to L. If we don't cut them, the L would be zero. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Conflict error

    Posted 10/30/18 09:07 AM

    Without looking at your model: if you think your model is correct then one way to pinpoint the problem is to force a solution that you think is correct: add explicit constraints that fix the values of the variables to what you think is correct. Then run the conflict refiner and analyze the resulting conflict.

    Maybe the error is in your data (not enough capacity) or some of your constraints are wrong. Usually things become pretty obvious if you fix a solution that is assumed to be feasible.


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Conflict error

    Posted 10/30/18 10:12 AM

    Originally posted by: 88Simon88


    Thanks for your answer, I am sure that it is helpful, but I am not that much professional in CPLEX.

    Could you please tell me how can I run the conflict refiner? How should I write the code for that? any website or video or example?

     

    In the below formulation, X is binary and I don't want to use Big M.

    Istip = (1 - Xsti) * (aps * Is(t-1)i(p-1) + bps * Is(t-1)ip + cps * Is(t-1)i(p+1))

    therefore, I used the following code:

        (X[s][t][i] == 0) == (I[s][t][i][p] == a[p][s] * I[s][t-1][i][p-1] + a[p][s] * I[s][t-1][i][p] + a[p][s] * I[s][t-1][i][p+1]);
        (X[s][t][i] == 1) == (I[s][t][i][p] == 0);

    Are they correct?


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Conflict error

    Posted 11/12/18 04:37 AM

    Uff, your constraint is hard to read. What about writing this as a logical constraint? That is much easier to read but essentially gives the same:

    (X[s][t][i] == 0) => (I[s][t][i][p] == a[p][s] * I[s][t-1][i][p-1] + a[p][s] * I[s][t-1][i][p] + a[p][s] * I[s][t-1][i][p+1]);

    (X[s][t][i] == 1) => (I[s][t][i][p] == 0);

    About handling infeasiblity, did you read the relevant chapter in the user manual? For the IDE that would be here.


    #CPLEXOptimizers
    #DecisionOptimization