示例#1
0
ChannelUrlSelectorEntry::ChannelUrlSelectorEntry(
        const types::ChannelUrlInformation& urlInformation,
        double punishmentFactor,
        qint64 timeForOneRecouperation) :
    lastUpdate(QDateTime::currentMSecsSinceEpoch()),
    fitness(),
    urlInformation(urlInformation),
    punishmentFactor(punishmentFactor),
    timeForOneRecouperation(timeForOneRecouperation){

    LOG_TRACE(logger, "Created ...");
    initFitness();
}
示例#2
0
void PsoSolver::run(const bool enableGLNPSO, const double minIw) {
	this->enableGLNPSO = enableGLNPSO;
	initFitness();
	gBest        = particles[0].pBest;
	gBestFitness = particles[0].pBestFitness;
	updateGbest();

	for (iteration = 0; iteration < maxIteration; iteration++) {

		if (getDispersionIDX() < convergenceThreshold && getVelocityIDX() < convergenceThreshold) {
			break;
		}

		moveParticles();
		updateFitness();
		updateGbest();

		// linear interia weighting adjustment
		iw = max(iw - 1.0/maxIteration, minIw);
	} // end of iteration
}