Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************
- * CompareFitness: Sort the vector by fitness
- * @author: Kelsey Scheurich
- * @parameter: tNode _tX : node to compare
- * tNode _tY : node to compare
- * @return: bool
- ********************/
- bool CGenetic::CompareFitness(tNode _tX, tNode _tY)
- {
- return(_tX.m_dFitness < _tY.m_dFitness);
- }
- /***********************
- * SortFitness: Sort the vector by fitness
- * @author: Kelsey Scheurich
- * @parameter: std::vector<tNode>& _vPopulation : vector to sort
- ********************/
- void CGenetic::SortFitness(std::vector<tNode>& _rvPopulation)
- {
- // Use sort algorithm to sort vector by fitness
- std::sort(&_rvPopulation.begin(), &_rvPopulation.end(), CompareFitness);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement