2

1) I was wondering if it is possible to integrate different heuristic solvers like GA and PSO available as python packages to solve a pyomo model.

2) Also, I want to know how to integrate a heuristic algorithm written completely by me (i.e. not available as python packages) to solve the pyomo model

Thank you.

  • Heuristic procedures like GA and PSO have to be implemented specifically for a problem. While there are commercial heuristic black box solvers, you will have to implement your own problem specific code of e. g. GA for best performance. You could maybe use a GA "skeleton" to manage your population and the general algorithm, while you define neighborhoods and solution structures. But I would advise to implement the procedure on your own, especially if you are learning about heuristic procedures. – Tristan Aug 14 '18 at 13:53

1 Answers1

0

Short answer is yes.

As for how you would accomplish this, you are welcome to look at the pyomo.contrib.gdpopt package, which provides the ability to call SolverFactory('gdpopt').solve(model) in Pyomo. You can write your own solve() function, which is passed the Pyomo model object, along with any optional keyword arguments. Within the solve() function, you are welcome to integrate external heuristic solvers or write your own logic.

There is also the question of how to interrogate the Pyomo model, but the scope of that is question is too broad to answer here. You may wish to consult the advanced elements of the Pyomo documentation.

Qi Chen
  • 1,648
  • 1
  • 10
  • 19
  • If I understand your answer correctly, it seems like changing the source code of pyomo or one of its components, itself. I was hoping for a modular framework where I can plug my solver after properly configuring its arguments. If there isnt any framework like this, is it under development or atleast a priority of the developer group? – Curious Iitian Aug 20 '18 at 10:51
  • `pyomo.contrib` is designed to host user contributions like the one that you describe: see [contributions guide](https://pyomo.readthedocs.io/en/latest/contribution_guide.html). You can also hook in to the plugin system without putting your code in pyomo.contrib. There's a rework of that system currently underway: https://github.com/Pyomo/pyomo/pull/661 – Qi Chen Aug 22 '18 at 17:39