cut_tour: Cut a tour to form a path

Description Usage Arguments Author(s) See Also Examples

View source: R/cut_tour.R

Description

Cuts a tour at a specified city to form a path.

Usage

1
cut_tour(x, cut, exclude_cut = TRUE)

Arguments

x

an object of class TOUR.

cut

the index or label of the city to cut the tour.

exclude_cut

exclude the city where we cut? If FALSE, the city at the cut is included in the path as the first city.

Author(s)

Michael Hahsler

See Also

TOUR.

Examples

1
2
3
4
5
6
7
8
9
data("USCA50")

tsp <- insert_dummy(USCA50, label = "cut")
tour <- solve_TSP(tsp)

## cut tour into path at the dummy city
path <- cut_tour(tour, "cut")

labels(path)

Example output

 [1] "Albuquerque, NM"   "Amarillo, TX"      "Abilene, TX"      
 [4] "Austin, TX"        "Beaumont, TX"      "Baton Rouge, LA"  
 [7] "Biloxi, MS"        "Birmingham, AL"    "Atlanta, GA"      
[10] "Augusta, GA"       "Asheville, NC"     "Bowling Green, KY"
[13] "Ashland, KY"       "Baltimore, MD"     "Allentown, PA"    
[16] "Atlantic City, NJ" "Central Islip, NY" "Bridgeport, CT"   
[19] "Brockton, MA"      "Boston, MA"        "Cambridge, MA"    
[22] "Augusta, ME"       "Bangor, ME"        "Burlington, VT"   
[25] "Brattleboro, VT"   "Albany, NY"        "Binghamtom, NY"   
[28] "Belleville, ON"    "Buffalo, NY"       "Burlington, ONT"  
[31] "Brantford, ON"     "Canton, OH"        "Akron, OH"        
[34] "Ann Arbor, MI"     "Bay City, MI"      "Battle Creek, MI" 
[37] "Bloomington, IL"   "Cedar Rapids, IA"  "Bismarck, ND"     
[40] "Brandon, MB"       "Billings, MT"      "Butte, MT"        
[43] "Boise, ID"         "Carson City, NV"   "Bakersfield, CA"  
[46] "Berkeley, CA"      "Bellingham, WA"    "Calgary, AB"      
[49] "Anchorage, AK"     "Alert, NT"        

TSP documentation built on May 23, 2019, 1:03 a.m.