Skip to content

Instantly share code, notes, and snippets.

@jamiecook
Created January 19, 2015 06:21
Show Gist options
  • Save jamiecook/d0a319a01f873917601d to your computer and use it in GitHub Desktop.
Save jamiecook/d0a319a01f873917601d to your computer and use it in GitHub Desktop.
for (int col = 0; col < numCentroids; ++col)
{
float skim_value = skim_row[col];
if (attractions.at(col) == 0 || skim_value == 99999)
{
utilities.at(col) = 99999;
continue;
}
float cost_based_utility = alpha * log_skim_row[col] + beta * adj_skim_row[col] - min_utility;
utilities.at(col) = (cost_based_utility < 0) ? 99999 : log_attractions.at(col) + cost_based_utility;
if (utilities.at(col) != 99999 && utilities.at(col) > maxV)
{
maxV = utilities.at(col);
destinationWithMaxV = col;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment