コード例 #1
0
ファイル: aco.c プロジェクト: CarlaNL/Projeto
static void initialize_data(char *namefilein) {/*{{{*/

	int i;

	read_instance(namefilein);

	//dist = malloc(sizeof(int)*N*N);
	nn_list = malloc(sizeof(int)*N);
	pheromone = malloc(sizeof(float)*N);
	choice_info = malloc(sizeof(float)*N);
	ant = malloc(sizeof(single_ant_t)*M);
	for (i = 0; i < N; i++) {
		pheromone[i] = malloc(sizeof(int)*N);
		choice_info[i] = malloc(sizeof(int)*N);
		nn_list[i] = malloc(sizeof(int)*NN);
	}

	//compute_distances();
	compute_nearest_neighbor_lists();
	initialize_pheromone();
	compute_choice_information();
	initialize_ants();
	initialize_statistics();

}/*}}}*/
コード例 #2
0
void ThreadLocalAllocBuffer::initialize() {
  initialize(NULL,                    // start
             NULL,                    // top
             NULL);                   // end

  set_desired_size(initial_desired_size());

  // Following check is needed because at startup the main (primordial)
  // thread is initialized before the heap is.  The initialization for
  // this thread is redone in startup_initialization below.
  if (Universe::heap() != NULL) {
    size_t capacity   = Universe::heap()->tlab_capacity(myThread()) / HeapWordSize;
    double alloc_frac = desired_size() * target_refills() / (double) capacity;
    _allocation_fraction.sample(alloc_frac);
  }

  set_refill_waste_limit(initial_refill_waste_limit());

  initialize_statistics();
}