void LegendItem::contextMenuEvent(QContextMenuEvent* event) { QMenu menu; menu.addAction("Guarantee visibility", this, SIGNAL(GuaranteeVisibility())); menu.addSeparator(); menu.addAction("Select samples", this, SIGNAL(SelectSamples())); menu.addSeparator(); menu.addAction("Change properties", this, SIGNAL(ChangeProperties())); menu.exec(event->globalPos()); }
void DESolver::RandToBest1Exp( int candidate ) { int r1, r2; int n; SelectSamples(candidate, &r1, &r2); n = (int)RandomUniform(0.0, (double)nDim); CopyVector(trialSolution, RowVector(population, candidate)); for (int i = 0; (RandomUniform(0.0,1.0) < probability) && (i < nDim); i++) { trialSolution[n] += scale * (bestSolution[n] - trialSolution[n]) + scale * (Element(population,r1,n) - Element(population,r2,n)); n = (n + 1) % nDim; } return; }
void DESolver::Rand2Bin( int candidate ) { int r1, r2, r3, r4, r5; int n; SelectSamples(candidate, &r1, &r2, &r3, &r4, &r5); n = (int)RandomUniform(0.0, (double)nDim); CopyVector(trialSolution, RowVector(population, candidate)); for (int i = 0; i < nDim; i++) { if ((RandomUniform(0.0,1.0) < probability) || (i == (nDim - 1))) trialSolution[n] = Element(population,r1,n) + scale * (Element(population,r2,n) + Element(population,r3,n) - Element(population,r4,n) - Element(population,r5,n)); n = (n + 1) % nDim; } }
void DESolver::Best1Bin( int candidate ) { int r1, r2; int n; SelectSamples(candidate, &r1, &r2); n = (int)RandomUniform(0.0, (double)nDim); CopyVector(trialSolution, RowVector(population, candidate)); for (int i = 0; i < nDim; i++) { if ((RandomUniform(0.0,1.0) < probability) || (i == (nDim - 1))) trialSolution[n] = bestSolution[n] + scale * (Element(population,r1,n) - Element(population,r2,n)); n = (n + 1) % nDim; } return; }