@Override
    public void learn(){
		
		int examples = 0;
		int max_neuron = Options.getOptions().getMaxNeurons();
	
		while (( neurons.get(0).size() < max_neuron) && (examples < epochs) && !Options.getOptions().getStopped())  {
			
			//We check the pause
			checkPause();
			
			//We print the current state
		    printState(new Object[]{examples, epochs, neurons.size(), max_neuron});
		    
		    //We choose a new piece of data for the example
		    int index_data = (int) (Math.random()*Data.getData().size());
		    examples ++;
		    
		    //We search for the two neurons which are the nearest of the piece of data
		     Neuron[] nearest = getNearest(index_data);
		     Neuron winner1  = nearest[0];
			 Neuron winner2  = nearest[1];
		     double distance_to_the_data = winner1.distance(Data.getData().get(index_data));
		    
		    //We increase the error of the winner
		    int index_1 = neurons.get(0).indexOf(winner1);
		    erreurs.set(index_1, erreurs.get(index_1) + distance_to_the_data); 
	
		    //We update the state of links
		    updateConnection(winner1, winner2);
		    
		    //We approach the winner to the piece of data
		    winner1.setPoids(Options.getOptions().getWinnerDistGng(), Data.getData().get(index_data));
	
		    //We also approach its direct neighbors
		    for (Neuron neighbor : winner1.getNeighbors()) {
		    	neighbor.setPoids(Options.getOptions().getNeighborhoodGng(), Data.getData().get(index_data));
		    }
		    
		    //We delete wrong connections and neurons
		    deleteWrong();
	
		    //If it's time to, we add a new neuron
		    if ((examples % Options.getOptions().getTimeNew()) == 0)
		    	addNewNeuron();
		    
		    //We manage the speed
		    sleep();
	
		    world.change();
		}
		
		world.change();
	}