private boolean tryAssign(Environment env, Lecture lecture){
		double minViolation = 1;
		Session bestSession = null;
		int trys = 0;
		for(Session s : env.sessions.objects()){
			// try to assign it.
			if(lecture.examLength > s.length || lecture.students.objects().size() > s.remaingCapacity()) continue;
			
			// Go through all other assigned lectures, get number of students in common
			long totalCommon = 0;
			long maxCommon = 0;
			for(Lecture l : s.lectures.objects()){
				Long common = lecture.inCommon.get(l);
				if(common != null)
				{
					totalCommon += common;
					maxCommon = Math.max(common, maxCommon);
				}
			}
			
			double goodness = 0.0;
			
			env.assign(lecture, s);
			
			goodness -= (totalCommon + maxCommon*maxCommon + 0.1*(s.room.capacity - s.remaingCapacity()));
			
			if(goodness > minViolation || minViolation == 1.0){
				minViolation = goodness;
				bestSession = s;
			}
			
			// unassign session
			env.assign(lecture, null);
			++trys;
			if(trys > 5) break;
		}
		if(bestSession != null){
			env.assign(lecture, bestSession);
			return true;
		}
		return false;
	}