Created on Mon Jun 10 21:39:13 2019 @author: mauri """ # -*- coding: utf-8 -*- """ Created on Wed Jun 5 15:24:40 2019 @author: mauri """ import numpy as np from modelos.CFLPProblem import CFLPProblem from algoritmos.TabuSearch import TabuSearch prob1 = CFLPProblem() prob1.loadTransportCost("datos/cflp/TC.csv") prob1.loadFacilityCost("datos/cflp/FC.csv") prob1.loadDemand("datos/cflp/dem.csv") prob1.loadCapacity("datos/cflp/cap.csv") algorithmT = TabuSearch(prob1, maximize=False, numIter=100) print("comienzo optimizacion") algorithmT.optimize(winSize=0.2, epochs=2, maxRetry=10) print("fin optimizacion") totalCostT = algorithmT.getBestCost() solutionT = algorithmT.bestState execTimeT = algorithmT.execTime iterationsT = algorithmT.iterations print("fin de ejecución") print("costo total cflp tabu: {}".format(totalCostT))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 10 19:49:30 2019 @author: mauri """ from modelos.CFLPProblem import CFLPProblem from algoritmos.HillClimbing import HillClimbing import numpy as np cflp = CFLPProblem() cflp.loadTransportCost("datos/cflp/TC.csv") cflp.loadFacilityCost("datos/cflp/FC.csv") cflp.loadDemand("datos/cflp/dem.csv") cflp.loadCapacity("datos/cflp/cap.csv") algorithmH = HillClimbing(cflp, maximize=False, numIter=50) print("comienzo optimizacion") algorithmH.optimize(winSize=0.5) print("fin optimizacion") totalCost = algorithmH.getBestCost() solution = algorithmH.bestState execTime = algorithmH.execTime iterations = algorithmH.iterations print("costo total cflp hill climbing: {}".format(totalCost))