0

Here is mathemetical model. enter image description here

Here are the details: depot: 1, truck: 10, capacity is 20, Customers: 50, Customers demand: 30

here is what I have tried so far:

{string} k = ...;  // vehicles
{string} i = ...;  // nodes
{string} j = ...; // depot


int demand[i]= ...; // demand at node i
int cap[k]= ...; // capacity of the vehicle
int dist[i][j]=...; //distance from node i to j

dvar float x[i][j];


minimize 
    sum(nodes in i, depot in j)
      dist[i][j];
      
      
subject to {
  

forall (nodes in i)
      demand_must_be_met:
      sum(vehicle in k)
        x[k][i]==demand[i];
}  
.dat:

k = {k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,k14,k15};

i = {Taubenmarkt,Landstrasse,LLenaupark,LLandstrasse,Industriezeile,LentiaCity,LLeonding,LInterspar,KarlSteigerStrasse,Kornstrasse,Traunerkreuzung,PlusKaufStrasse,FMZ,Haid,Marchtrenk,EferdingPupping,Walding,Rohrbach,BadLeonfelden,LAltenbergerstrasse,Gallneukirchen,Unterweitersdorf,FMZNord,Mauthausen,Furnpark,FMZEnnspark,NaarerStrasse,Steyr,SteyrResthofstrasse,SteyrHaagerStrasse,Sierning,LHartheimeerstrasse,BadHall,Micheldorf,Vorchdorf,WelsBäckergasse,Dalistrasse,WelsOberfeldstrasse,MaxCenter,GrieskirchenSchlüsselberg,DruckereistrasseSEP,Laakirchen,Schwanenstadt,Ampflwang,RiedTumeltshamFMZ,Weberzeile,Schärding,BadIschlFMZ,BadIschlZentrum,VöcklabruchZentrum,Varena,FMZTimelkam,StGeorgen,Mondsee,CityCenter,Mattighofen
};

j = {Enns};

cap = [17,17,17,17,17,17,17,17,17,17,17,17,17,17,17];

demand = [2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
];

dist = [23,22,22,24,12,24,19,18,22,23,23,16,20,33,41,35,68,52,28,37,42,63,10,4,3,17,22,21,21,28,11,36,63,52,43,37,38,43,55,75,64,64,90,82,81,106,111,108,77,76,80,87,110,123,117
];
HnM
  • 1
  • Have you had a look at https://stackoverflow.com/questions/72679328/i-am-looking-for-an-code-for-the-vehicle-routing-problem-solved-in-the-cplex-opl ? – Alex Fleischer Apr 11 '23 at 15:18
  • I have! But the problem is I am not being able to implent the drone in the solved problem you gave as I am new in cplex and coding as well. Really thanks for your comment. – HnM Apr 12 '23 at 11:21

0 Answers0