Пример #1
0
    void
    Tracker::updateTracks()
    {
      createDistanceMatrix();
      createCostMatrix();

      // Solve Global Nearest Neighbor problem:
      Munkres munkres;
      cost_matrix_ = munkres.solve(cost_matrix_, false);	// rows: targets (tracks), cols: detections

      updateDetectedTracks();
      fillUnassociatedDetections();
      updateLostTracks();
      createNewTracks();
    }
Пример #2
0
void GA::Initialize(std::string filePath){
	std::string fpath(filePath);
	baseCityVector = loadDataFromFile(fpath);
	std::cout << "City vector size: " << baseCityVector.size() << "\n";
	for(const auto& c : baseCityVector)
		std::cout << c << "\n";

	distances = createDistanceMatrix(baseCityVector);
	for(int i = 0; i < populationSize ; i++){
		population.push_back( Candidate(generateRandomCandidate(baseCityVector),distances) );
	}
	maxXPosition = 0;
	maxYPosition = 0;
	for(const auto& city : population[0].getCandidate()){
		if(city.getX() > maxXPosition)
			maxXPosition = city.getX();
		if(city.getY() > maxYPosition)
			maxYPosition = city.getY();
	}
}