ACS::ACS(ParamMap &v) : m_beta(2), m_Q(0.9), m_NC(2500), m_coeff(0.1), m_saveFre(1500), m_num(0), Population<CodeVInt, Ant>(int(v[param_popSize])), \ m_globalBest(), m_isHaveGlobalBest(false), m_impRadio(0) { mvv_phero.resize(int(v[param_numDim])); for (int i = 0; i<int(v[param_numDim]); i++) mvv_phero[i].resize(int(v[param_numDim])); m_stopCriterion = MIN_COVER; m_t = getLenOfNN(); m_t = 1.0 / (int(v[param_numDim]) * m_t); if (m_stopCriterion == MIN_COVER){ m_term.reset(new TermMean(v)); } else if (m_stopCriterion == MAX_GEN){ m_term.reset(new TermMaxGen(v)); } }
void MMAS::setDefaultParameters() { m_alpha = 1.0; m_beta = 2.0; m_length = 20; m_rho = 0.02; m_branchFrc = 1.00001; m_lambda = 0.05; m_uGB = LONG_MAX; m_iter = 1; m_restartFoundBest = 0; TravellingSalesman * ptr = dynamic_cast<TravellingSalesman*>(Global::msp_global->mp_problem.get()); double temp = getLenOfNN(); m_pheroMax = 1. / (m_rho * temp); m_pheroMin = m_pheroMax / (2. * m_globalBest.getNumDim()); }
ACS::ACS(double beta, double Q, int Popsize, int NC, int numDim, double coeff) :m_beta(beta), m_Q(Q), m_isHaveGlobalBest(false), \ m_NC(NC), m_coeff(coeff), m_saveFre(1500), m_num(0), Population<CodeVInt, Ant>(Popsize), m_globalBest(), m_impRadio(0) { mvv_phero.resize(numDim); for (int i = 0; i<numDim; i++) mvv_phero[i].resize(numDim); m_stopCriterion = MIN_COVER; m_t = getLenOfNN(); m_t = 1.0 / (numDim * m_t); if (m_stopCriterion == MIN_COVER){ m_term.reset(new TermMean(Global::g_arg)); } else if (m_stopCriterion == MAX_GEN){ m_term.reset(new TermMaxGen(Global::g_arg)); } }