我有个问题:
我尝试在 python 上编写一个 ANT 算法,但我有一个 C++ 代码,我不知道如何编写这部分:
typedef struct {
int x;
int y;
} cityType;
typedef struct {
int curCity;
int nextCity;
//MAX_CITIES
unsigned char tabu[15];
int pathIndex;
//MAX_CITIES
unsigned char path[15];
double tourLength;
} antType;
我对此进行编程,但我不确定
class CityType:
def __init__(self):
self.x = arange(MAX_CITIES)
self.y = arange(MAX_CITIES)
# Class AntType
class AntType:
def __init__(self):
self.curCity = arange(MAX_ANTS)
self.nextCity = arange(MAX_ANTS)
self.tabu = arange(MAX_ANTS)
self.pathIndex = arange(MAX_ANTS)
self.path = arange(MAX_ANTS)
self.tourLength = arange(MAX_ANTS)
谢谢