Author: Stephen Woodbridge
Date: 2013-03-30
Updated: 2013-09-01

#--------------------------- TODO -----------------------------------

[ ] Version the libraries so multiple versions can be installed
    * apply a version number to the library files
    * modify the sql to reference the versioned library

[ ] rewrite driving distance to use postgis delaney triangles
[X] integrate my tsp solver
[X] refactor tsp to use my solver
[ ] add assign_vertex_id_3d
[X] refactor the sql api to be more consistent
[X] prefix all functions (and types?) with pgr_
[X] integrate APSP into tree (2 versions)
    https://github.com/pgRouting/pgrouting/wiki/APSP
    https://github.com/pgRouting/pgrouting/tree/gsoc-tdsp/core/src
    https://github.com/pgRouting/pgrouting/tree/apsp-johnson/core/src
[X] add bidirectional sp and A* functions
    https://github.com/zibon/pgrouting
[ ] compute route between multiple way points using a single graph
[ ] implement driving distance with concave hull
    https://github.com/mbasa/pgrouting
[ ] implement driving distance with deluaney triangles and intersect Z planes
[X] kdijkstra implementation?
    https://github.com/pgRouting/pgrouting/wiki/One_to_many-Dijkstra---To-review


----------------------------------------------------------
This file contains various notes related to building pgRouting in
MinGW/MSYS 32/64 bit environments.

Here are some reference links I have collected from various places:

http://pgrouting.org/docs/howto/build_on_windows.html
https://github.com/sanak/pgrouting4w
http://stackoverflow.com/questions/5299468/unable-to-build-boost-libraries-with-gcc
https://github.com/sanak/pgrouting4w/commit/6ec1672f79f7070c60fb6095342d7d0b55cf2659
http://trac.osgeo.org/postgis/ticket/1820
http://trac.osgeo.org/postgis/wiki/DevWikiWinMingW64

http://www.bostongis.com/postgisstuff/ming32.zip
http://www.bostongis.com/postgisstuff/ming64.zip

http://sourceforge.net/apps/trac/mingw-w64/wiki/Compile%20pthreads

-----------------------------------------------------------

cd /c/ming64/projects

wget ftp://sources.redhat.com/pub/pthreads-win32/pthreads-w32-2-9-1-release.tar.gz
tar xzf pthreads-w32-2-9-1-release.tar.gz
cd pthreads-w32-2-9-1-release


wget http://prdownloads.sourceforge.net/gaul/gaul-devel-0.1849-0.tar.bz2?download
tar xjf gaul-devel-0.1849-0.tar.bz2
cd gaul-devel-0.1849-0
./configure --enable-slang=no


# -------------------------- boost libraries ----------------------------
#### boost_1_51 does NOT work with pgrouting use 1_46_1 below
cd /c/ming64/projects
wget http://sourceforge.net/projects/boost/files/boost/1.51.0/boost_1_51_0.tar.bz2/download
tar xjf boost_1_51_0.tar.bz2
cd boost_1_51_0
start cmd
bootstrap.bat mingw
b2.bat
exit
./bjam toolset=gcc address-model=64 define=BOOST_USE_WINDOWS_H link=static threading=multi --with-thread --prefix=/usr/local install

cd /c/ming64/projects
wget http://sourceforge.net/projects/boost/files/boost/1.46.1/boost_1_46_1.tar.bz2/download
tar xjf boost_1_46_1.tar.bz2
cd boost_1_46_1
start cmd
bootstrap.bat gcc
b2.bat
exit
./bjam toolset=gcc address-model=64 define=BOOST_USE_WINDOWS_H link=static threading=multi --with-thread --prefix=/usr/local install

# ------------------------- miscellaneous ----------------------------

# you can regenerate trsp-test-image.png with the command
shp2img -m trsp-test-image.map -o trsp-test-image.png -i agg_qn

#--------------------------------------------------------------------

How To debug postgresql back-end?

The main problem in doing this is that you have to compile progresql
with --enable-debug and optimize flags off.

#
BINDIR=`pg_config --bindir`

echo "run --single -E -d 3 -D /etc/postgresql/9.2/main/ test_apsp"
echo "select (r).vertex_id, (r).edge_id, round((r).cost::numeric, 6) from ( select pgr_bd_dijkstra('select * from bdd_ways'::text, 6585, 8247, true, true) as r ) as foo;"

sudo -u postgres gdb $BINDIR/postgres
