Skip to content
This repository was archived by the owner on Aug 2, 2019. It is now read-only.

Conversation

@AMN3I
Copy link

@AMN3I AMN3I commented Apr 17, 2018

Pseudo Code
of a local optimization routine
vector<int> localOptimize(const vector<int>& initialGuess) { const int nParams = initialGuess.size(); double bestE = E(initialGuess); vector<int> bestParValues = initialGuess; bool improved = true; while ( improved ) { improved = false; for (int pi = 0; pi < nParams; pi++) { vector<int> newParValues = bestParValues; newParValues[pi] += 1; double newE = E(newParValues); if (newE < bestE) { bestE = newE; bestParValues = newParValues; improved = true; } else { newParValues[pi] -= 2; newE = E(newParValues); if (newE < bestE) { bestE = newE; bestParValues = newParValues; improved = true; } } } } return bestParValues; }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant