Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan authored Jul 27, 2023
1 parent 5016012 commit 6bb385b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions nQuantCpp/APNsgaIII.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ namespace nQuantGA

int cur = 0, next = 1;
while(_currentGeneration < _max_iterations)
{
auto best = this->getResult();
{
if(_currentGeneration > 0) {
double difference = abs(best->getFitness() - lastBestFit);
auto best = this->getResult();
auto difference = abs(best->getFitness() - lastBestFit);
if (difference <= 1e-6)
++bestNotEnhance;
else {
Expand Down
4 changes: 2 additions & 2 deletions nQuantCpp/PnnLABGAQuantizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ namespace PnnLABQuant
}

static double rotateLeft(double u, double v, double delta) {
auto theta = M_PI * randrange(minRatio, maxRatio);
auto theta = M_PI * randrange(minRatio, maxRatio) / exp(delta);
auto result = u * sin(theta) + v * cos(theta);
if (result <= minRatio || result >= maxRatio)
result = rotateLeft(u, v, delta + .5);
return result;
}

static double rotateRight(double u, double v, double delta) {
auto theta = M_PI * randrange(minRatio, maxRatio);
auto theta = M_PI * randrange(minRatio, maxRatio) / exp(delta);
auto result = u * cos(theta) - v * sin(theta);
if (result <= minRatio || result >= maxRatio)
result = rotateRight(u, v, delta + .5);
Expand Down

0 comments on commit 6bb385b

Please sign in to comment.