[Qgis-developer] Advice on VRP plugin development

Martin Dobias wonder.sk at gmail.com
Thu Mar 17 14:55:59 EDT 2011


On Wed, Mar 16, 2011 at 6:43 PM, cremat0rio
<davidsantospinheiro at gmail.com> wrote:
> Hi all!
>
> I would like to create a QGis plugin to solve the Vehicle Routing Problem
> (VRP) using Evolutionary Computation techniques (Genetic Algorithms and
> stuff like that).
> I have some initial questions, so if someone can help-me, I'll appreciate it
> very much.
>
> 1. What programming language should i use? I know that there's the
> possibility to create plugins in Python or C++, but the Python Plugin
> Installer, as the name states, can only be used for python plugins.
> The problem of using python is about speed/performance, because VRP is a
> very hard problem, especially when is solved using Evolutionary Computation
> techniques.
> There seems that i have 3 options:
> a) Do all the work in python, using some libraries to speed up the thing
> (like scipy).

This is a preferable approach.

> b) Build the interface in python and the core library in C++. I don't know
> if python and C++ can integrate well. I don't know either if this can be
> done, because C++ has to be compiled for the client machine (that can be
> windows, linux, ...)

Python and C++ integrate well, it's relatively easy to build python
modules in C/C++. There's also 'ctypes' module which allows you to
access shared libraries with C API directly from Python. Several years
ago I have done a simple routing application [1] using PyQt and
PyQGIS: the routing backend has been done in C++, the GUI in Python.
The downside is that you have to build the library for each platform
separately.

> c) Build the interface in python and the core library in java. I don't know
> if python and java can integrate well too, but java can run in almost every
> platform and is fast.

I wouldn't recommend that since java means a bunch of more dependencies.


> 2. For the plugin to work, i need to find the shortest path between any two
> points on a POINT layer, using a LINESTRING layer for the road network. In
> the new QGis development version there's a plugin/tool named "shortest
> path". Can i use it to calculate this distances from a python plugin?

As commented by Sergey, this is not currently possible.

Martin

[1] http://mapserver.sk/~wonder/qnavigator/


More information about the Qgis-developer mailing list