Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Why there is 'no value' in the output

    Posted Mon October 04, 2021 03:39 AM
    Hello and Good day,
    I have a question here.First I tried to run the model with the small data set, and I get the optimal solutions. However, when I used the same model but with the bigger data set, the output for the decision variables are appeared to be 'no values'. What it does means? Is it because of the feasibility? But why the small data set can be solved and get the optimal? Here I attach the model code for the references if there are some mistakes can be detected. Thank you.

    {string} depot=...;
    {string} customer=...;
    {string} vehicle=...;
    {string} node=...;
    int N=card(customer);
    float dist[node][node]=...;
    float fcost[depot]=...;
    float D[customer]=...;
    float VC[vehicle]=...;
    float VD[depot]=...;
    dvar boolean x[node][node][vehicle];
    dvar boolean z[depot];
    dvar boolean y[depot][customer];
    dvar float+ u[customer][vehicle];
    dexpr float facility=sum(i in node, j in node:j!=i, k in vehicle)x[i][j][k]*dist[i][j];
    dexpr float travel=sum(i in depot)fcost[i]*z[i];
    dexpr float cost=facility + travel;

    minimize cost;
    subject to {
    forall(j in customer) sum(i in node, k in vehicle)x[i][j][k]==1;
    forall(k in vehicle) sum(i in depot, j in customer)x[i][j][k]<=1;
    forall(k in vehicle) sum(i in node, j in customer:j!=i)D[j]*x[i][j][k]<=VC[k];
    forall(i in node, k in vehicle) (sum(j in node)x[i][j][k])- (sum(j in node)x[j][i][k])==0;
    forall(i in depot) sum(j in customer)D[j]*y[i][j]<=VD[i]*z[i];
    forall(j in customer) sum(i in depot)y[i][j]==1;
    forall(l in customer, j in customer, k in vehicle) u[l][k]-u[j][k]+N*x[l][j][k]<= N-1;
    forall(i in depot, j in customer, k in vehicle) (sum(h in node)(x[i][h][k]+x[h][j][k]))-y[i][j]<=1;
    }



    ------------------------------
    Farahanim Misni
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Why there is 'no value' in the output

    Posted Mon October 04, 2021 04:06 AM
    If you use named constraints also known as constraint label, then the IDE will automatically launch a feasopt when the model is infeasible to determine which constraint is blocking.

    This debug feature will help you determine if you formulation is bad, if data is bad, or control what CPLEX can relax or not (by default, when OPL uses feasopt, it uses only named constraints).

    A good pointer in the documentation is How relaxation and conflict search works: https://www.ibm.com/docs/en/icos/20.1.0?topic=models-how-relaxation-conflict-search-works

    ------------------------------
    Vincent Beraudier
    ------------------------------



  • 3.  RE: Why there is 'no value' in the output

    Posted Mon October 04, 2021 10:24 AM
    Hi,
    I already tried to check the conflict and the relaxation on the model by referring to the link that you gave to me but it does not appear. I cannot detect which part of the model is in conflict. Is there any other way to find it?
    Thank you. Regards.






  • 4.  RE: Why there is 'no value' in the output

    Posted Mon October 04, 2021 11:11 AM
    Assuming you model is OK, I labelled it like:
    <code>

    forall(j in customer)

    c1: sum(i in node, k in vehicle)x[i][j][k]==1;

    forall(k in vehicle)

    c2: sum(i in depot, j in customer)x[i][j][k]<=1;

    forall(k in vehicle)

    c3: sum(i in node, j in customer:j!=i)D[j]*x[i][j][k]<=VC[k];

    forall(i in node, k in vehicle)

      c4: (sum(j in node)x[i][j][k])- (sum(j in node)x[j][i][k])==0;

    forall(i in depot)

      c5: sum(j in customer)D[j]*y[i][j]<=VD[i]*z[i];

    forall(j in customer)

    c6: sum(i in depot)y[i][j]==1;

    forall(l in customer, j in customer, k in vehicle)

      c7: u[l][k]-u[j][k]+N*x[l][j][k]<= N-1;

    forall(i in depot, j in customer, k in vehicle)

      c8: (sum(h in node)(x[i][h][k]+x[h][j][k]))-y[i][j]<=1;
    </code>

    and use a random .dat:
    <code>
    depot= {"A","B","C"};
    customer={"A","B","C"};
    vehicle={"A","B","C"};
    node={"A","B","C"};
    dist=[[10,20,30], [10,20,30], [10,10,10]];
    fcost=[10,10,20];
    D=[2.5,3.5,4.5];
    VC=[10.5, 20.5,10.5];
    VD=[2.5,3.4,4.5];
    </code>

    Then running it in the IDE, I see in various places that the solve had conflicts and a solution after feasopt.


    If I misunderstand your need, please give more details and data file?

    ------------------------------
    Vincent Beraudier
    ------------------------------



  • 5.  RE: Why there is 'no value' in the output

    Posted Mon October 04, 2021 11:48 AM
    Hi,
    Here is the file.dat

    SheetConnection excelsheet("Exceldata.xlsx");
    depot from SheetRead(excelsheet, "Sheet1!CN86:CN91");
    customer from SheetRead(excelsheet, "Sheet1!CN1:CN85");
    node from SheetRead(excelsheet, "Sheet1!CN1:CN91");
    vehicle={"V1", "V2", "V3", "V4", "V5", "V6"};
    dist from SheetRead(excelsheet, "Sheet1!A1:CM91");
    fcost = [372, 372, 372, 372, 372, 372];
    D from SheetRead(excelsheet, "Sheet1!CO1:CO85");
    VC=[160, 160, 160, 160, 160, 160];
    VD=[850, 850, 850, 850, 850, 850];

    I attach the data file as well. Thank you. Regards.






  • 6.  RE: Why there is 'no value' in the output

    Posted Tue October 05, 2021 04:35 AM
    OPL IDE, as a development tool, is designed to give all debug capabilities by default.
    So, when a model is infeasible, it will run both conflicts refinement and constraint/variable relaxation, which may be very time consuming despite declaring infeasibility may be easy to CPLEX. (the problem here is automatic conflict refiner)
    Meanwhile, the IDE may seem frozen.
    One way to investigate is to disable features via OPL setting file.

    My advice: when the OPL IDE seems inactive give oplrun command line a try.
    oplrun will run less automatic features, and will also put less listeners as no UI views to display.

    oplrun -conflict runs for a very very long time with
    <code>
    Iteration Max Members Min Members
    1 35358 0
    2 29465 0
    3 26519 0
    ...
    </code>

    then ends with
    <code>
    Minimal conflict: 349 linear constraint(s)
    Conflict computation time = 14609.96 sec. Iterations = 609
    Deterministic time = 18359835.81 ticks (1256.67 ticks/sec)
    c1["C2"] at 21:1-22:48 /Users/vberaudi/opl/titi/toto.mod is in conflict.
    c1["C3"] at 21:1-22:48 /Users/vberaudi/opl/titi/toto.mod is in conflict.
    c1["C4"] at 21:1-22:48 /Users/vberaudi/opl/titi/toto.mod is in conflict.
    </code>

    oplrun -relax gives
    <code>
    Total (root+branch&cut) = 60.62 sec. (70777.41 ticks)
    c1["C4"] at 21:1-22:48 /Users/vberaudi/opl/titi/toto.mod
    relax [1,1] to [0,1] value is 0
    ...
    </code>

    So in fine, a good workaround for running in the IDE is to define an opl setting file and unclick the "display conflicts"

    or wait few hours if you really need them in the IDE.

    ------------------------------
    Vincent Beraudier
    ------------------------------