public void minOLBCost() {
		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.
		int k = 0;
		while (getRestLength() > 0) {
			k = Math.round(Math.round(Math.random() * (iClass + 1))) % iClass;
			if (iaQueuedTask[k] > 0) {
				iMinClass = k;
				findFirstAvailableCPU();
				// System.out.println("MINCLASS= "+ iMinClass+ "; MINSITE= "+
				// iMinSite+ "; MINCPU= "+ iMinCPU);
				if (!bDeadline) {
					return;
				}
				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 (dmMinminTime[i][j] > tmpTime) {
					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("CostOLB Time = " + sumTime);
		println("CostOLB Cost = " + sumCost);
		println("CostOLB MakeSpan = " + tmpTime);
		dCost = sumCost;
		dTime = sumTime;
		dFinalMakespan = tmpTime;
		if (dFinalMakespan > dDeadline) {
			System.out.println("CostOLB: CANNOT MEET DEADLINE!!!");
		}

	}