GLNS.solver
— MethodMain GTSP solver, which takes as input a problem instance and some optional arguments
GLNS.Power
— TypeA struct to store each insertion/deletion method using its power, its weight, and its score on the last segment
GLNS.Tour
— Typetour type that stores the order array and the length of the tour
GLNS.accepttrial
— Methoddecide whether or not to accept a trial based on simulated annealing criteria
GLNS.accepttrial_noparam
— Methoddecide whether or not to accept a trial based on simple probability
GLNS.degree_minutes
— MethodComputing degrees and minutes for GEO instances
GLNS.distance_removal!
— Methodpick a random vertex, and delete its closest neighbors
GLNS.extract_tour
— Methodextracting a tour from the prev pointers.
GLNS.initial_tour!
— Methodbuild tour from scratch on a cold restart
GLNS.initialize_noise
— Methodinitialize four noise values, none, low, med, and high
GLNS.initialize_powers
— Methodinitialize the insertion methods. Use powers between -10 and 10 the spacing between weights is chosen so that when you increase the weight, the probability of selecting something that is a given distance farther is cut in half.
GLNS.insert_cost_lb
— Methodcompute the cost of inserting vertex v into position i of tour
GLNS.insert_lb
— MethodGiven a tour and a set, this function finds the vertex in the set with minimum insertion cost, along with the position of this insertion in the tour. If best_position is i, then vertex should be inserted between tour[i-1] and tour[i].
GLNS.min_set
— MethodFind the set with the smallest number of vertices
GLNS.min_setv
— MethodFind the set with the smallest number of vertices
GLNS.moveopt!
— MethodSequentially moves each vertex to its best point on the tour. Repeats until no more moves can be found
GLNS.nint
— Methodinit function defined by TSPLIB http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/TSPFAQ.html
GLNS.opt_cycle!
— Methodrepeatedly perform moveopt and reopt_tour until there is no improvement
GLNS.parameter_settings
— MethodThree different parameter settings for the GTSP solver default – moderate runtime. ~ 10-20 seconds for 100 sets fast – very quick, lower quality solution slow – slower, but potentially higher quality solution
GLNS.pdf_select
— Methodselecting a random k in 1 to length(weights) according to power and then selecting the kth smallest element in weights
GLNS.pivot_tour!
— Methodsome insertions break tie by taking first minimizer – this randomization helps avoid getting stuck choosing same minimizer
GLNS.power_select
— Methodfunction takes in a set of bins and a weights array of the same length and selects a bin with probability equal to weight
GLNS.power_update!
— MethodUpdate both insertion and deletion powers along with the total weights if we are a multiple of param[:adaptive_iter] iterations in trial
GLNS.power_weight_update!
— MethodUpdate only at the end of each trial – update based on average success over the trial
GLNS.prev_tour
— Methodreturn the vertex before tour[i] on tour
GLNS.print_best
— Methodprint best cost so far
GLNS.print_cold_trial
— Methodprint statement at the beginning of a cold trial
GLNS.print_params
— Methodprint the main parameter settings
GLNS.print_powers
— MethodPrint the powers in an easy-to-read format for debugging the adaptive weights
GLNS.print_summary
— Methodprint tour summary at end of execution
GLNS.print_warm_trial
— Methodprint details at the end of each warm trial
GLNS.progress_bar
— Methoda string representing the progress bar
GLNS.rand_select
— Methodrand_select for randomize over all minimizers
GLNS.random_initial_tour!
— MethodRandomly shuffle the sets, and then insert the best vertex from each set back into the tour where sets are considered in shuffled order.
GLNS.random_insertion!
— MethodRandomly shuffle the sets, and then insert the best vertex from each set back into the tour where sets are considered in shuffled order.
GLNS.randpdf_insertion!
— Methodchoose set with pdf_select, and then insert in best place with noise
GLNS.read_file
— Methodparse the problem instance file given as a text file with the following format: N: int M: int Symmetric: true/false Triangle: true/false 1 5 5 1 8 9 10 11 8 2 3 4 6 7 12 13 14 DISTANCE_MATRIX
Note: the line 5 1 8 9 10 11 shows that the second set contains 5 vertices: 1,8,9,10,11.
TSPLIB Parser defined by: http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/TSPFAQ.html
GLNS.relax
— Methodoutputs the new cost and prev for vertex v2 after relaxing does not actually update the cost
GLNS.relax_in!
— Methodrelaxes the cost of each vertex in the set set2 in-place.
GLNS.removal_cost
— Methoddetermine the cost of removing the vertex at position i in the tour
GLNS.remove_insert
— MethodSelect a removal and an insertion method using powers, and then perform removal followed by insertion on tour. Operation done in place.
GLNS.reopt_tour
— MethodGiven an ordering of the sets, this alg performs BFS to find the optimal vertex in each set
GLNS.segment_removal!
— Methodremoving a single continuos segment of the tour of size num_remove
GLNS.select_k
— MethodSelect an integer between 1 and num according to and exponential distribution with lambda = power
goes from left of array if power is positive
and right of array if it is negative
GLNS.total_power_weight
— Methodsums the weights for all the powers (i.e., the insertion or deletion methods)
GLNS.tour_cost
— MethodCompute the length of a tour
GLNS.tour_feasibility
— MethodChecks if a tour is feasible in that it visits each set exactly once.
GLNS.worst_removal!
— MethodRemove the vertices randomly, but biased towards those that add the most length to the tour. Bias is based on the power input. Vertices are then selected via pdf select.
GLNS.worst_vertices
— Methoddetermine the cost of removing each vertex from the tour, given that all others remain.