NavigationUser login |
Traveling Salesman Approach to Visiting Data-loggersSubmitted by dylan on Sat, 2008-12-20 06:44.
# generate simple network connecting all points v.delaunay --o -l in=temperature_sites_maybe out=tri # densify line segments v.split --o in=tri out=tri_2 length=5 # add categories v.category --o in=tri_2 out=tri_3 option=add type=line # convert to 3d, using our elevation model v.drape --o in=tri_3 out=tri_4 rast=rtk_elev_var_smooth@rtk # add a table v.db.addtable map=tri_4 columns="cat integer, cost double" # use the slope between line segments as the cost v.to.db map=tri_4 type=line layer=1 option=slope columns=cost # make all slopes positive echo "UPDATE tri_4 set cost = cost * cost" | db.execute # connect table from 3D map to original 2D map: v.db.connect map=tri_3 table=tri_4 # make a copy, which brings over a copy of the linked table g.copy --o vect=tri_3,triangulation # clean-up g.remove vect=tri,tri_2,tri_3,tri_4 # make a network v.net --o in=triangulation points=temperature_sites_maybe out=net --o operation=connect thresh=10 # check network-- has categories? v.category net op=report # solve traveling salesman problem # does not work with 3D maps (ticket # 406) v.net.salesman --o in=net out=salesman acol=cost ccats=1-33 ( categories: )
Reply |