float CompositeBenchmarkTechniquePLE::getAgentBenchmarkScore(unsigned int agentIndex, SimulationMetricsCollector * simulationMetrics) { 
	AgentMetricsCollector * agentMetrics = simulationMetrics->getAgentCollector(agentIndex);
	return _alpha * (float)agentMetrics->getNumThresholdedCollisions(0.0f, 0.0f) +
		_beta * agentMetrics->getCurrentMetrics()->totalTimeEnabled +
		_gamma * agentMetrics->getCurrentMetrics()->sumTotalOfInstantaneousKineticEnergies +
		_delta * agentMetrics->getCurrentMetrics()->sumTotalOfInstantaneousAcceleration;
}
float CompositeBenchmarkTechniquePLE::_computeTotalBenchmarkScore(SimulationMetricsCollector * simulationMetrics) {


	if (_benchmarkScoreComputed) return _totalBenchmarkScore;

	_numCollisionsOfAllAgents = 0.0f;
	_totalTimeOfAllAgents = 0.0f;
	_totalEnergyOfAllAgents = 0.0f;
	_numAgents = (float)simulationMetrics->getNumAgents();

	if (_numAgents == 0.0f)
		return 0.0f; 


	// compute the "total" values over all agents
	AgentMetricsCollector * agentMetrics;
	for (unsigned int i = 0; i < simulationMetrics->getNumAgents(); i++) {
		agentMetrics = simulationMetrics->getAgentCollector(i);
		_numCollisionsOfAllAgents += (float)agentMetrics->getNumThresholdedCollisions(0.0f, 0.0f);
		_totalTimeOfAllAgents += agentMetrics->getCurrentMetrics()->totalTimeEnabled;
		_totalEnergyOfAllAgents += agentMetrics->getCurrentMetrics()->sumTotalOfInstantaneousKineticEnergies;
		_totalInstantaneousAcceleration += agentMetrics->getCurrentMetrics()->sumTotalOfInstantaneousAcceleration;
	}

	_totalBenchmarkScore = 
		_alpha * (_numCollisionsOfAllAgents / _numAgents) 
		+ _beta * (_totalTimeOfAllAgents / _numAgents) 
		+ _gamma * (_totalEnergyOfAllAgents / _numAgents)
		+ _delta * (_totalInstantaneousAcceleration / _numAgents);

	_benchmarkScoreComputed = true;
	return _totalBenchmarkScore;
}
void CompositeBenchmarkTechnique01::printAgentScoreDetails(unsigned int agentIndex, SimulationMetricsCollector * simulationMetrics, std::ostream & out) {

    float score = getAgentBenchmarkScore(agentIndex,simulationMetrics);
    AgentMetricsCollector * agentMetrics = simulationMetrics->getAgentCollector(agentIndex);
    float numCollisions = (float)agentMetrics->getNumThresholdedCollisions(0.0f, 0.0f);

    out << "\n";
    out << "number of collisions for the agent: " << numCollisions << "\n";
    out << "     total time spent by the agent: " << agentMetrics->getCurrentMetrics()->totalTimeEnabled << "\n";
    out << "   total energy spent by the agent: " << agentMetrics->getCurrentMetrics()->sumTotalOfInstantaneousKineticEnergies << "\n";
    out << "      (alpha, beta, gamma) weights: (" << _alpha << "," << _beta << "," << _gamma << ")\n";
    out << "                      weighted sum: " << _alpha << "*" << numCollisions << " + " << _beta << "*" << agentMetrics->getCurrentMetrics()->totalTimeEnabled << " + " << _gamma << "*" << agentMetrics->getCurrentMetrics()->sumTotalOfInstantaneousKineticEnergies << " = " << score << "\n";
    out << "                       final score: " << score << "\n";

}