public void calculate() {

		for(int i = 0 ; i < numberOfAnts_ ; i++){
			ants_.add(new Ant(numberOfElements_, numberOfValues_, pK_));
		}
		for(int j = 0; j < numberOfIteration_ ; j++){
			for(int i = 0; i < numberOfAnts_; i++){
				ants_.get(i).generatePermutation(cPI_);
				if(j == 0){
					cPI_.generate();
				}
				else{
					cPF_.calculateProbability();
				}
				permutation_ = ants_.get(i).getPermutation().clone();
				bestResult_ = MeanValueCalculator.calculate(matrix_, permutation_);
				notifyall();
			}
			System.out.println("nowa tura " +  (j+1));
			cPF_.calculateFeromon(ants_);
			cPF_.calculateProbability();
		}
		try {
			PrintWriter printWriter = new PrintWriter(new File("wynikantcolony.txt"));
			
			String string = new String();
			for(int z = 0; z < 16; z++){
				for(int j = 0; j < permutation_.getPermutation().get(z).size(); j++)
				string += "{" + z + " " + permutation_.getPermutation().get(z).get(j) + "} ";
			}
			string += " " + bestResult_;
			printWriter.print(string);
			printWriter.close();
		} catch (IOException e) {
		}
	}