fermenreq / TSP-VRP-GENETICS-ALGORITHM

Implementation of TSP and VRP algorithms using a Genetic Algorithm
GNU General Public License v3.0
62 stars 22 forks source link

Only two routes? #1

Open olushako opened 6 years ago

olushako commented 6 years ago

I am trying to test the model with more trucks with limited capacity, but the model continuously separating optimization for two parts: truck1 and rest. Can we somehow generate more routes for more trucks?

fermenreq commented 6 years ago

Hi @olushako,

VRP algorithm generates routes that should be adjusted to the available fleet of trucks in order to get minimum costs. I set up the VRP algorithm in order to generates two routes only:

L325

def VRP(k):
    VRP_PROBLEM = Problem_Genetic([(0,10),(1,10),(2,10),(3,10),(4,10),(5,10),(6,10),(7,10),
                                   (trucks[0],capacity_trucks)],
len(cities), lambda x : decodeVRP(x), lambda y: fitnessVRP(y))

So you can set up the environments here:

capacity_trucks = 60
trucks = ['truck','truck']
num_trucks = len(trucks)
frontier = "---------"
olushako commented 6 years ago

thanks Fernando for your reply. I have added additional 4 trucks (like example), but still this is dividing it only for two routes... until and after frontier.. maybe because of trucks[0]...

or do you mean to to execute VRP_PROBLEM for all trucks? but it will not balanced in the system and synchronized...

fermenreq commented 6 years ago

Hi @olushako ,

Yes , you are on right. If you want you could improve the code adding new functionality, as you comment. For that, I just created a new branch develop.

Thanks!