Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Vehicle Routing Problem with Time Windows - VRPTW

    Posted Tue May 15, 2018 03:27 PM

    Originally posted by: Rafaf


    Hello,

    I am trying to replicate the algorithm (figure) in OPL, it is VRPTW, and I can not seem to get out of the place. If someone can send a template or help in the construction of this code.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Vehicle Routing Problem with Time Windows - VRPTW



  • 3.  Re: Vehicle Routing Problem with Time Windows - VRPTW

    Posted Wed May 16, 2018 08:11 AM

    Originally posted by: Rafaf


    Hi, Mr. Alex,

    
    The initial processing I understood how to do ... but now in the objective part I'm lost, 
    could you help me outline how that algorithm would look?
    
    //Parâmetros
    int n = 49;
    range cidades = 1..n;
    

    float x[cidades]=...;
    float y[cidades]=...;
    string notas[cidades]=...;
    float Dij[cidades][cidades];
    float Radianlat[cidades];
    float Radianlong[cidades];
    float PI = 3.14159265358979;
    float Earth = 6376.5;

    //Processamento dados de entrada
    execute Fase1{

    function Dist(i,j){

     
     Radianlat[i]=x[i]*PI/180;
     Radianlong[i]=y[i]*PI/180;
     
     return Earth*Math.acos(Math.sin(Radianlat[i])*Math.sin(Radianlat[j])+
     Math.cos(Radianlat[i])*Math.cos(Radianlat[j])*Math.cos(Radianlong[i]-Radianlong[j]));
     
     }
         
    for (var i in cidades)
     for (var j in cidades)
      if (i!=j){
     
       Dij[i][j]=Dist(i,j);
          
      }
    }


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Vehicle Routing Problem with Time Windows - VRPTW

    Posted Wed May 16, 2018 08:17 AM


  • 5.  Re: Vehicle Routing Problem with Time Windows - VRPTW

    Posted Wed May 16, 2018 08:48 AM

    Originally posted by: Rafaf


    
    Hi Sir Alex,
    
    Goal is that I have to visit 49 clients, and each point has a service time, so I have 3 vehicles 
    to carry out the visits. The capacity of each one is to carry out 10 visits in an 8-hour working day. 
    So my remarks would be due to time and capacity. The code above is an example of what I have already done, 
    I was able to import the coordinates of each client and calculate the distances.
    
    Thank you
    

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Vehicle Routing Problem with Time Windows - VRPTW



  • 7.  Re: Vehicle Routing Problem with Time Windows - VRPTW

    Posted Wed May 16, 2018 10:01 AM

    Originally posted by: Rafaf


    Thanks Sir Alex!!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer