/**********************************************************************/ /* */ /* (c) Copyright, 1997 by Professor Gabriel Robins */ /* */ /* Department of Computer Science, University of Virginia */ /* Charlottesville, VA 22903-2442 (804) 982-2207 */ /* robins@cs.virginia.edu http://www.cs.virginia.edu/~robins/ */ /* */ /* This code may be freely used for all non-commercial purposes. */ /* All copies/portions of this code must contain this header. */ /* */ /**********************************************************************/ /**********************************************************************/ /* Steiner2.c */ /**********************************************************************/ #include "geometry.h" /**********************************************************************/ int generate_steiner2(void) { struct point SP; int lowest_MST_so_far, original_MST_cost, pre_improvement_mst_cost; int i, j, found_improvement, heuristic_num = 2, actual_number_of_points, nsp = 0; actual_number_of_points = number_of_points; generate_MST2(); pre_improvement_mst_cost = lowest_MST_so_far = original_MST_cost = mst_cost; found_improvement = YES; while(found_improvement == YES) { found_improvement = NO; number_of_points++; for(i=0;i= right) return; m = (left + right) / 2; t = N[left]; N[left] = N[m]; N[m] = t; last = left; for(i=left+1; i <= right; i++) if (N[i] > N[left]) { ++last; t = N[i]; N[i] = N[last]; N[last] = t; } t = N[left]; N[left] = N[last]; N[last] = t; qsort_N(N, left, last - 1); qsort_N(N, last + 1, right); } /**********************************************************************/ /* int compute_mst_cost(void) { int i, j; mst_cost = 0; for(i=0;i