public double minet() {
		sortClass();
		calculateWeight();

		dmMinminCost = new double[iSite][iCPUMaxNum];
		dmMinminTime = new double[iSite][iCPUMaxNum];

		double[] daMinminTimeBySite = new double[iSite];
		// find the current cheapest site for the acitvities.
		boolean lastActivity;
		
		while (getRestLength() > 0) {
			for (int k = 0; k < iClass; k++) {
				iMinClass = k;
				for (int i = 0; i < iaTask[k]; i++) {
					findFastestMachine();
					iaQueuedTask[k]--;
					if (iaQueuedTask[k] == 0) {
						lastActivity = true;
					} else {
						lastActivity = false;
					}
					updateMin();
					iStage++;
					registerStorage(lastActivity);// must do it after

				}
			}
		}
		
		double sumTime = 0, sumCost = 0;
		int xMaxTime = 0, yMaxtime = 0;
		double tmpTime = -1;
		for (int i = 0; i < iSite; i++) {

			for (int j = 0; j < iaCPU[i]; j++) {
				daMinminTimeBySite[i] += dmMinminTime[i][j];
				// find cpu with the maximum execution time
				if (tmpTime < dmMinminTime[i][j]) {
					xMaxTime = i;
					yMaxtime = j;
					tmpTime = dmMinminTime[i][j];
				}

				sumTime += dmMinminTime[i][j];
				sumCost += dmMinminCost[i][j];
			}
		}
		// for (int i = 0; i < iClass; i++)
		// {
		// System.out.print(iStage + "Distribution[" + i + "]");
		// for (int j = 0; j < iSite; j++)
		// {
		// System.out.print(dmDistribution[i][j] + ", ");
		// }
		// System.out.println();
		// }
		System.out.println("MET Fairness = " + calculateFairness());
		System.out.println("MET Time     = " + sumTime);
		System.out.println("MET Cost     = " + sumCost);
		System.out.println("MET Makespan = " + tmpTime);
		System.out.println("MET Stage    = " + iStage);
		dFinalMakespan = tmpTime;
		dCost = sumCost;
		dTime = sumTime;
		return sumTime;

	}