public CAnt1 m_cBestAnt; //定义一个蚂蚁变量,用来保存搜索过程中的最优结果 //该蚂蚁不参与搜索,只是用来保存最优结果 public CTsp() { Common.Init(); m_cAntAry = new CAnt1[Common.N_ANT_COUNT]; for (int i = 0; i < Common.N_ANT_COUNT; i++) { m_cAntAry[i] = new CAnt1(); } m_cBestAnt = new CAnt1(); }
public MTsp() { Common.Init(); m_cAntAry_1 = new CAnt1[Common.N_ANT_COUNT]; m_cAntAry_2 = new CAnt2[Common.N_ANT_COUNT]; for (int i = 0; i < Common.N_ANT_COUNT; i++) { m_cAntAry_1[i] = new CAnt1(); } for (int i = 0; i < Common.N_ANT_COUNT; i++) { m_cAntAry_2[i] = new CAnt2(); } localBest_1 = new CAnt1(); localBest_2 = new CAnt2(); m_cBestAnt = new CAnt1(); m_cBestAnt_1 = new CAnt1(); m_cBestAnt_2 = new CAnt2(); }