bool GP_Hedge::checkIfBest(vectord& best, std::string& name, int& error_code) { if (mIndex < mCriteriaList.size()) { loss_(mIndex) = computeLoss(best); mBestLists.push_back(best); error_code = 0; ++mIndex; if (mIndex < mCriteriaList.size()) mCurrentCriterium = mCriteriaList[mIndex]; return false; } else { int optIndex = update_hedge(); if (optIndex >= 0) { name = mCriteriaList[optIndex]->name(); best = mBestLists[optIndex]; error_code = 0; } else { name = mCriteriaList[0]->name(); best = mBestLists[0]; FILE_LOG(logERROR) << "Error updating Hedge algorithm. Selecting " << name; error_code = optIndex; } return true; } };
std::string GP_Hedge::getBestCriteria(vectord& best) { int optIndex = update_hedge(); best = mBestLists[optIndex]; return mCriteriaList[optIndex].name(); };