def greedy_val(task): name, order = task from pygrout import VrptwSolution, VrptwTask, build_first VrptwTask.sort_order = order sol = VrptwSolution(VrptwTask(name)) build_first(sol) return sol.val()
def mfsavings_val(task): """The mapping function for savings heuristic.""" name, waitlimit, mi = task from pygrout import VrptwSolution, VrptwTask, build_by_mfsavings print "Should process", name sol = VrptwSolution(VrptwTask(name)) build_by_mfsavings(sol, waitlimit, mi) return sol.val()