Example #1
0
func (g *GridNeighbor) ProcessEntry(pos int, current *Grid, grids RawGridList) {
	started := time.Now()
	for _, grid := range grids {
		current.CalculateCost(grid)
	}
	tsputil.ElapsedTime(started, fmt.Sprintf("Processed %d %s %s", pos,
		current, current.CostTable))
}
Example #2
0
func (w *World) ParseFile(fileName string) *TSPCoordList {
	parseStart := time.Now()
	w.FileName = tsputil.GetWorldFileName(fileName)
	coords := ParseFile(fileName)
	tsputil.ElapsedTime(parseStart, fmt.Sprintf("Parsed %d coordinates",
		coords.Len()))
	return coords
}
Example #3
0
func (w *World) GetTerminalGrids() {
	filterStart := time.Now()
	w.TerminalGrids = w.FilterGrids(func(g *Grid) bool {
		return !g.Subdivided && g.Len() > 0
	})
	tsputil.ElapsedTime(filterStart, fmt.Sprintf("Generated %d terminal grids",
		w.TerminalGrids.Len()))
}
Example #4
0
func (w *World) LoadPoints(coords *TSPCoordList) {
	loadStart := time.Now()
	for _, c := range coords.Coordinates() {
		w.AppendCoordinate(c)
	}
	tsputil.ElapsedTime(loadStart,
		fmt.Sprintf("Generated %d grids and %d coordinates", w.GridLen(),
			w.PointsLen()))
}
Example #5
0
func (w *World) GridNeighborSearchComplete() {
	tsputil.ElapsedTime(w.gridNeighborSearchStart, "Neighbor search complete")
	w.StartShell()
}