ant.h
来自「蚁群算法C程序」· C头文件 代码 · 共 36 行
H
36 行
/*
ANT-CYCLE ALGORITHM FOR TSP
File: ant.h
Purpose: ant strcuture definition and some functions
*/
#ifndef __ANT_H__
#define __ANT_H__
typedef struct
/*
cur: the current city which ant is at
tabu: tabu list ,it also used to record a tour which ant found
allow: contains cities that can be choosed
allow[N+1] initialize to 0;
if city i has been visited , then set allow[i] to 1.
length: length of the tour which current ant found
*/
{
int cur;
int *tabu;
int *allow;
double length;
} Ant;
void initial_ant(Ant *pant);
void destroy_ant(Ant *pant);
double caculate_tour_length(Ant ant);
int choose_next_city(Ant* pant);
void print_ant_tour(Ant ant);
#endif /* __ANT_H__ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?