ant.h
来自「C语言版本的蚁群系统算法」· C头文件 代码 · 共 37 行
H
37 行
/*
ANT-CYCLE ALGORITHM FOR TSP
File: ant.h
Author: ehui928
Purpose: ant strcuture definition and some functions
Date: 2007-01-18
*/
#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 + -
显示快捷键?