Skip to content

Commit

Permalink
fix logic on when to update weights
Browse files Browse the repository at this point in the history
  • Loading branch information
yuluntian committed Feb 11, 2023
1 parent 1b07169 commit 4410f92
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/PGOAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,17 +989,17 @@ bool PGOAgent::shouldUpdateMeasurementWeights() const {
if (mParams.robustCostParams.costType == RobustCostParameters::Type::L2)
return false;

if (mWeightUpdateCount >= mParams.robustOptNumWeightUpdates) {
LOG_IF(INFO, mParams.verbose) << "Reached maximum weight update steps.";
return false;
}

// Return true if number of inner iterations exceeds threshold
if (mRobustOptInnerIter >= mParams.robustOptInnerIters) {
LOG_IF(INFO, mParams.verbose) << "Exceeds max inner iterations. Update weights.";
return true;
}

if (mWeightUpdateCount >= mParams.robustOptNumWeightUpdates) {
LOG_IF(INFO, mParams.verbose) << "Reached maximum weight update steps.";
return false;
}

// Only update if all agents sufficiently converged
bool should_update = true;
for (size_t robot_id = 0; robot_id < mParams.numRobots; ++robot_id) {
Expand Down

0 comments on commit 4410f92

Please sign in to comment.