v.net.salesman

Langue: en

Autres versions - même langue

Version: 369808 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)

NAME

v.net.salesman - Creates a cycle connecting given nodes (Traveling salesman problem).
Note that TSP is NP-hard, heuristic algorithm is used by this module and created cycle may be sub optimal

KEYWORDS

vector, networking

SYNOPSIS

v.net.salesman
v.net.salesman help
v.net.salesman [-g] input=name output=name [type=string[,string,...]] [alayer=integer] [nlayer=integer] [acolumn=string] ccats=range [--overwrite] [--verbose] [--quiet]

Flags:

-g

Use geodesic calculation for longitude-latitude locations
--overwrite

Allow output files to overwrite existing files
--verbose

Verbose module output
--quiet

Quiet module output

Parameters:

input=name

Name of input vector map
output=name

Name for output vector map
type=string[,string,...]

Type
Arc type
Options: line,boundary
Default: line,boundary
alayer=integer

Layer number
Arc layer
Default: 1
nlayer=integer

Layer number
Node layer (used for cities)
Default: 2
acolumn=string

Arcs' cost column (for both directions)
ccats=range

Category values
Categories of points ('cities') on nodes (layer is specified by nlayer)

DESCRIPTION

v.net.salesman calculates the optimal route to visit nodes on a vector network.

EXAMPLE

Traveling salesman for 6 digitized nodes (Spearfish):
g.copy vect=roads,myroads
v.db.addcol myroads col="cost double precision"

# define traveling costs as inverse of speed limit:
v.db.update myroads col=cost val=1/50
v.db.update myroads col=cost val=1/75 where="label='interstate'"
v.db.update myroads col=cost val=1/5 where="label='unimproved road'"
v.db.update myroads col=cost val=1/25 where="label='light-duty road, improved surface'"
v.db.select myroads

# we have 6 locations to visit on our trip
echo "1|601653.5|4922869.2|a
2|608284|4923776.6|b
3|601845|4914981.9|c
4|596270|4917456.3|d
5|593330.8|4924096.6|e
6|598005.5|4921439.2|f" | v.in.ascii cat=1 x=2 y=3 out=centers col="cat integer, rs

                         east double precision, north double precision, label varchar(43)"

v.db.select centers
v.category centers op=report
# type count min max
# point 6 1 6


#create lines map connecting points to network (on layer 2)
v.net myroads points=centers out=myroads_net op=connect thresh=500
v.category myroads_net op=report
# Layer / table: 1 / myroads_net
# type count min max
# line 837 1 5
#
# Layer: 2
# type count min max
# point 6 1 5

# The network is now prepared.
g.region vect=myroads_net
d.mon x0
d.vect myroads_net
d.vect -c centers icon=basic/triangle
d.font verdana
d.vect centers col=red disp=attr attrcol=label lsize=12

# due to the costs (?, TODO), the result looks like a Steiner tree:
# v.net.salesman myroads_net acol=cost ccats=1-6 out=mysalesman

# run without traveling costs
v.net.salesman myroads_net ccats=1-6 out=mysalesman
d.vect mysalesman col=green width=2
d.vect centers col=red disp=attr attrcol=label lsize=12

SEE ALSO

d.path, v.net, v.net.alloc, v.net.iso, v.net.path, v.net.steiner

AUTHOR

Radim Blazek, ITC-Irst, Trento, Italy
Documentation: Markus Neteler

Last changed: $Date: 2007-08-03 14:21:50 +0200 (Fri, 03 Aug 2007) $

Full index

© 2003-2008 GRASS Development Team