public double minETCost() {
		sortResources();
		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.

		while (getRestLength() > 0) {
			for (int k = 0; k < iClass; k++) {
				iMinClass = k;
				for (int i = 0; i < iaTask[k]; i++) {
					// findFastestMachine();
					findMinCompleteCostCPU();
					if (iMinClass < 0 | iMinSite < 0 | iMinCPU < 0) {
						System.out.println("CostMET: CANNOT MEET DEADLINE!!");
						return 0;
					}
					updateMin();
					iStage++;
					iaQueuedTask[k]--;
				}
			}
		}
		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();
		// }
		calculateOtherSchedulingEfficiency();
		calculateOtherSchedulingCostEfficiency();
		println("CostMET Time     = " + sumTime);
		println("CostMET Cost     = " + sumCost);
		println("CostMET Makespan = " + tmpTime);
		println("CostMET Stage    = " + iStage);
		dFinalMakespan = tmpTime;
		if (dFinalMakespan > dDeadline) {
			System.out.println("CostMET: CANNOT MEET DEADLINE!!!");
		}
		dCost = sumCost;
		dTime = sumTime;
		return sumTime;

	}