@Override
	public void addJob(State s, Job j) {
		VM vm = null;
		VMType type = null;
		JobType jobType = j.getType();

		double utilization = Double.MAX_VALUE;
		// Find 
		for (Entry<VMType, UtilizationVector> e : jobType.utilizationVector.entrySet()) {
			UtilizationVector v = e.getValue();
			double u = v.CPU.average + Math.exp(v.RAM.average) + v.disk.average / 1.5 + v.network.average / 1.1;
			VMType vmtype = e.getKey();
			double price = s.getVmTypes().get(vmtype.getName()).getPrice();
			double time = jobType.times.get(vmtype).average;
			u = u * time;
			if ( u < utilization){
				type = e.getKey();
				utilization = u;
			}
		}

		boolean foundOne = false;
		for (VM vm2 : vms) {
			if (type == vm2.type) {
				double jobs = 0;
				for (Job j1 : vm2.getJobs()) {
					if (!j1.isFinished()) {
						jobs++;
					}
				}
				if (jobs  < factor) {
					foundOne = true;
					vm = vm2;
					break;
				}
			}
		}

		if (!foundOne) {
			vm = s.addVM(type, s.getTime());
			vms.add(vm);
		}
		if (vm == null) {
			System.err.println("VM cannot be null here.");
			System.exit(1);
		}
		s.log("Job #" + j.getId() + " assigned to VM #" + vm.id);
		j.assignVM(vm);
	}