1

i'm developing some kind of heuristics for a variation of the vehicle-routing-problem in C++.

After generating a solution, i want to plot this solution. The solution is a composite of various tours, all starting and ending at a common depot. Therefore i have a vertex-set with all the coordinates and edges defined by two vertex-id's each. Furthermore i have all the distances between vertex-pairs of course.

It would be helpful to plot this in an extra-window opening in my program, but writing a plot to a graphics-file should be okay too.

What is an easy way to plot this? How would you tackle this?

First i tried to look for common graph-visualization packages (graphviz, tulip, networkx (python)), but i realized that all of them are specialized at graph-layouting (when there are no coordinates). Correct me when i'm wrong. I don't know if it is possible to tell these packages that i already have the coordinates, helping the layouting-algorithms.

Next thing i tried is the CGAL library with geomview output -> no luck until now -> ubuntu crashes geomview.

One more question: Is it a better idea to use some non-layouting 2d-plot-libraries risking a plot, which isn't really good to view at (is there more to do than scaling?) or to use some layout-algorithm-based-libraries (e.g. graphviz, tulip, networkx), feed them with the distances between the vertices and hope the layouting-algorithms are keeping the distances while plotting in a good-to-view-at way?

  • If non-layouting-plotting is the way to do it: which library do you recommend?
  • If layout-based-plotting is the way to do it: how can i make use of the distances/coordinates in these libraries? And which library do you recommend?

Thanks for all your input!

Sascha

EDIT: I completed a prototype implementation using the PLplot library (http://plplot.sourceforge.net/). The results are nice and should be enough for the moment. I discovered and chosed this library because a related project (VRPH Software Package / Groer) used this plot and the source code was distributed. So the implementation was done in a short amount of time. The API is in my opinion bit awkward and low-level. Maybe there are some more modern (maybe not a c-based library) libraries out there? MathGL? Dislin? Maybe i will try them too.

The nice thing about drawing multiple tours in a vehicle routing problem is that "not so bad" algorithms tend to discover nice non-overlapping and divergent tours which is really good for the eye ;-)

sascha
  • 32,238
  • 6
  • 68
  • 110
  • 2
    If you know the coordinates then just draw the graph. – Dialecticus Nov 01 '10 at 16:06
  • any library recommendations for doing that? – sascha Nov 01 '10 at 16:09
  • I had a project student working on this with boost graph library this summer. If you're interested (and it's not too frowned upon) I can make the repository world-readable somewhere and post a url. – Flexo Nov 01 '10 at 16:47
  • I'm always interested in code which is using the boost graph library. Maybe using this library for this purpose is a little bit too much (because its a quite big library and for me it is hard to learn), but having a graph-view of my solution could be helpful in later steps. It would be nice if you could upload the code anywhere, when it isn't too much work. Thanks anyway. – sascha Nov 01 '10 at 16:57
  • There's a youtube video at: http://www.youtube.com/watch?v=7b5lE8AZOGc and I'm trying to get anon SVN access sorted tomorrow. The video is a trivial graph being rendered for display on a twin projector "hemispherium" device we have here. – Flexo Nov 01 '10 at 17:19

2 Answers2

2

It is not quite clear what you are trying to archive, but if I understand your question correctly, then you could do it using OpenGL. Having vertex coordinates, it should be fairly easy.

BЈовић
  • 62,405
  • 41
  • 173
  • 273
  • The thing i wanted to achieve is a simple but viewable plot of my tours, but without investing too much work (unless there are some positive side-effects; e.g. a graph-view in the boost graph-library). I'm no expert in Plotting and/or GUI stuff and don't want to be one (especially GUI's). Therefore i'm a bit biased towards stuff like OpenGL which is powerful, but i think it isn't really learned in a short amount of time. And i expect to be not as important as it should in my future programming work. But thanks anyway for your post. – sascha Nov 01 '10 at 21:39
0

You can use Gnuplot with a input text file that contains your solution. It is convenient to draw the points (vertex) then lines (agents paths) than link them. To make the plot script easy, you can have a separate file for each vehicle, if the number of vehicles is known. check out: http://www.cleveralgorithms.com/nature-inspired/advanced/visualizing_algorithms.html

hmitcs
  • 343
  • 4
  • 11