Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  please help for a model VRP

    Posted 09/04/17 11:00 PM

    Originally posted by: MachexC


    Hi Alex,

    I am modeling for 4 constraints, but the results of Xij is no value. Please help me.

    {string} N = ...;
    {string} M = ...;
    //{string} D = ...;
    //int      T=  ...;
    //range    Time=1..T;

    tuple vehicle_flow{
    string vehicle;
    string nodei;
    string nodej;
    }
    {vehicle_flow} sub_vehicle_flow=...;
    dvar boolean X[sub_vehicle_flow];

    // demand
    tuple demand {
    string nodei;
    }
    {demand} sub_demand=...;
    float D[sub_demand]=...;

    // capacity
    tuple capacity{
    string vehicle;
    }
    {capacity} sub_capacity=...;
    float q[sub_capacity]=...;   

    subject to
    {
    // constraint(1)
    forall (k  in  M ){
    sum(<k1,"CT",j1> in sub_vehicle_flow:k1==k && 01==0 ) X[<k1,"CT",j1>] <= 1;
    }
    // constraint(2)
    forall (k  in  M, i in N ){
    sum(<k1,i1,j1> in sub_vehicle_flow:k1==k && i1==i ) X[<k1,i1,j1>]- sum(<k1,j1,i1> in sub_vehicle_flow) X[<k1,j1,i1>] == 0;
    }
    // constraint(3)
    forall (i in N ){
    sum(<k1,i1,j1> in sub_vehicle_flow:i1==i) X[<k1,i1,j1>]== 1;
    }
    // consatraint(4)
    forall (k  in  M ){
    sum(<i> in sub_demand ) D[<i>] * sum(<k1,i1,j1> in sub_vehicle_flow) X[<k1,i1,j1>]<= q[<k>];
    }
    }

    Thanks,

    Mac


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: please help for a model VRP

    Posted 09/05/17 03:48 AM

    Hi,

    if you label your constraints

    subject to
    {
    // constraint(1)
    forall (k  in  M ){
    ct1:sum(<k1,"CT",j1> in sub_vehicle_flow:k1==k && 01==0 ) X[<k1,"CT",j1>] <= 1;
    }
    // constraint(2)
    forall (k  in  M, i in N ){
    ct2:sum(<k1,i1,j1> in sub_vehicle_flow:k1==k && i1==i ) X[<k1,i1,j1>]- sum(<k1,j1,i1> in sub_vehicle_flow) X[<k1,j1,i1>] == 0;
    }
    // constraint(3)
    forall (i in N ){
    ct3:sum(<k1,i1,j1> in sub_vehicle_flow:i1==i) X[<k1,i1,j1>]== 1;
    }
    // consatraint(4)
    forall (k  in  M ){
    ct4:sum(<i> in sub_demand ) D[<i>] * sum(<k1,i1,j1> in sub_vehicle_flow) X[<k1,i1,j1>]<= q[<k>];
    }
    }

    then CPLEX will give a relaxation

    Line    Original    Relaxed    Element (4)
    46    [1,1]    [0,1]    ct3["CT"]
    46    [1,1]    [0,1]    ct3["VL"]
    46    [1,1]    [0,1]    ct3["TG"]
    46    [1,1]    [0,1]    ct3["TP.HCM"]

    and some conflicts that will help you

    Line    In conflict    Element (2)
    42    Yes    ct2["truckA"]["VL"]
    46    Yes    ct3["CT"]

    NB:

    In documentation I suggest

    Relaxing infeasible models

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: please help for a model VRP

    Posted 09/05/17 07:04 AM

    Originally posted by: MachexC


    Hi Alex,

    I do not know how to fix it to have the results, Xij; maybe the constraints from OPL are not true. Please help me fix the constraints to give  results, Xij, you can fix the data from Excel file.

    Thank you,

    Bests,

    Mac


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: please help for a model VRP

    Posted 09/05/17 09:43 AM

    Hi,

    if you change the constraint

    // constraint(3)
    forall (i in N ){
    ct3:sum(<k1,i1,j1> in sub_vehicle_flow:i1==i) X[<k1,i1,j1>]== 1;

    into

    // constraint(3)
    forall (i in N ){
    ct3:0<=sum(<k1,i1,j1> in sub_vehicle_flow:i1==i) X[<k1,i1,j1>]<= 1;

    then you ll get a solution

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


Global message icon