# Can I formulate a green vehicle routing problem with pyomo model then solve it with metaheuristics algorithms e.g. GA,HS rather than pyomo solver?

I want to use pyomo to formulate MILP problems in python such as Green Vehicle Routing Problem and others but use metaheuristics algorithms (GA, Harmony search, etc.) to solve those problems instead of using pyomo solvers, its part of my PhD project and can not use derivative-based solvers such as Gurobi and cplex etc. at all; If the answer that I can not, what is the alternative to formulate the problems in python then solve them with metaheuristics algorithms because I found pyomo easy and time saving to be used in formulating the problems.

I think what you want is a meta-heuristic you can use without relying on all the work necessary to code one from the ground. If this is the case, I would recommend you to use the Biased Random Key Genetic Algorithm (BRKGA). Suffices to have in mind the basic notations of Genetic Algorithms, specifically the notion of chromosome and decode function, and there we go. In the section 8.5 of this paper, you can find a decode function applied for a G-VRP variant.

If you are interested to write the problem as a standard formulation, like mixed-integer linear programming, you can use Pyomo as a framework and solve the problem in an exact manner with your favorite solver.

About the (meta)heuristic, it is somewhat different from the exact method. In this case either you should already write your own algorithm or use some package/libraries to do it. Also, the flowing package and thread might be helpful.

• Thank you for answering, in that case exact methods will not help me, but for now I'm looking for a mean to formulate the problem alone then focus on solving it with metaheuristics algorithms Commented Aug 3, 2022 at 11:20
• most of the time, when you use metaheuristics, you want to verify or evaluate the solution using exact solver like gurobi or cplex. Hi Ahmed, i did my thesis research in vrp time windows too Commented Aug 3, 2022 at 14:09
• i wanna discuss more about vrp, maybe if you are open, we can have a nice discussion about it Commented Aug 3, 2022 at 14:11
• @AhmedAbdulmunem, you're welcome. Almost all of the VRP variants are changing problems and solving them in the large-scale data with an exact method would be a complicating task. One of the interesting python packages to do is vrpy. Also, by a little search on GitHub, you could find some useful repositories to check and benchmark. Commented Aug 3, 2022 at 17:26
• @overboxed , I would love to Commented Aug 3, 2022 at 18:43

Another option is to solve your problem with a hybrid approach, a math-heuristic. For example, you could use a metaheuristic to define some of the variables (maybe, the integer ones) and then solve the parametrized problem using MILP solver. For example, several ideas can be found here, here, here, here, and here.