@Override
	public P<NeuronStorage, List<Integer>> processAlg(Void _v) {
		Main.print("VectorQuantizer start " + new Date());

		List<Integer> indexes = new ArrayList<Integer>();
		for (int i = 0; i < blocks.size(); i++) {
			ColoredBlock cb = blocks.get(i);
			NeuronSeq history = new NeuronSeq();
			for (int j = 0; j < ns.getNeuronsCount(); j++) {
				Neuron n = ns.getNeuronByIndex(j);
				double diff = getDiff(n.getLinks(), cb.block);
				history.put(diff, j);
			}

			
			if (study) {
				
//				int NEURON_COUNTS_FOR_STUDY = 5;
//				Double minDiff = history.keys().iterator().next();
//				for(Double cdiff : history.keys() ){
//					List<Integer> nindexes = history.get(cdiff);
//					if(NEURON_COUNTS_FOR_STUDY-- == 0){
//						break;
//					}
//					for(Integer indx : nindexes){
//						Neuron n = ns.getNeuronByIndex(indx);
//						double ss = minDiff / cdiff;
//						List<Color> newIndexes = new ArrayList<Color>();
//						for (int l = 0; l < CoderAlg.BLOCK_SIZE * CoderAlg.BLOCK_SIZE; l++) {
//							Color oldColor = n.getLinkColor(l);
//							Color newColor = changeValue(cb.block.get(l), oldColor, (L * ss) /2);
//							newIndexes.add(newColor);
//						}
//						n.setLinks(newIndexes);
//						ns.setNeuron(indx, n);
//					}
//					
//				}
				
				
				int minInx = -1;
				boolean outerBreak = false;
				for (List<Integer> currLst : history.values()) {
					for (Integer indx : currLst) {
						Neuron n = ns.getNeuronByIndex(indx);
						if (n.getActive() == 0) {
							minInx = indx;
							outerBreak = true;
							break;
						} else {
							n.setActive(n.getActive() - 1);
							ns.setNeuron(indx, n);
						}
					}
					if (outerBreak) {
						break;
					}
				}

				if (minInx == -1) {
					Main.print("\n\n\nrandom minIndex choosing\n\n");
					minInx = history.getRandomIndex();
				}

				Neuron n = ns.getNeuronByIndex(minInx);
				n.setActive(Neuron.SLEEP_COUNT);
				List<Color> newIndexes = new ArrayList<Color>();
				for (int l = 0; l < CoderAlg.BLOCK_SIZE * CoderAlg.BLOCK_SIZE; l++) {
					Color oldColor = n.getLinkColor(l);
					Color newColor = changeValue(cb.block.get(l), oldColor, L);
					newIndexes.add(newColor);
				}
				n.setLinks(newIndexes);
				ns.setNeuron(minInx, n);
			}

			indexes.add(history.values().iterator().next().get(0));
		}

		Main.print("VectorQuantizer ends " + new Date());
		return new P<NeuronStorage, List<Integer>>(ns, indexes);
	}