void NeuralNetworkRepresentation::cloneNeurons(std::string oldPartId,
		std::string newPartId, std::map<std::string, std::string> &oldNew) {
	std::vector<boost::weak_ptr<NeuronRepresentation> > neurons =
			getBodyPartNeurons(oldPartId);
	for (unsigned int i = 0; i < neurons.size(); ++i) {
		// remove all weights of the neuron
		boost::shared_ptr<NeuronRepresentation> neuron = neurons[i].lock();
		oldNew[neuron->getId()] = insertNeuron(
				ioPair(newPartId, neuron->getIoPair().second),
				neuron->getLayer(), neuron->getType());
	}
}
void NeuralNetworkRepresentation::removeNeurons(std::string bodyPartId) {
	std::vector<boost::weak_ptr<NeuronRepresentation> > neurons =
			getBodyPartNeurons(bodyPartId);

	for (unsigned int i = 0; i < neurons.size(); ++i) {
		boost::shared_ptr<NeuronRepresentation> neuron = neurons[i].lock();
		assert(neuron);
		removeIncomingConnections(neuron);
		removeOutgoingConnections(neuron);
		// remove the neuron itself
		neurons_.erase(neurons_.find(neuron->getIoPair()));
	}

}
void NeuralNetworkRepresentation::removeNeurons(std::string bodyPartId) {
	std::vector<boost::weak_ptr<NeuronRepresentation> > neurons =
			getBodyPartNeurons(bodyPartId);

	for (unsigned int i = 0; i < neurons.size(); ++i) {
		boost::shared_ptr<NeuronRepresentation> neuron = neurons[i].lock();
		assert(neuron);
		removeIncomingConnections(neuron);
		removeOutgoingConnections(neuron);
		// remove the neuron itself
		NeuronMap::iterator toErase = neurons_.find(neuron->getIoPair());
		if( toErase == neurons_.end()) {
			std::cout << "no neurons to remove for " << neuron->getIoPair().first << "-" << neuron->getIoPair().second;
		}
		neurons_.erase(toErase);
	}

}