protected void setup() {
		System.out.println("This is patient agent called " + getLocalName());
		Object[] arg = getArguments();

		try {

			int preference = 1;
			for (Object o : arg) {
				if (o.toString().equals("-")) {
					preference++;
				} else {
					preferences.put(Integer.parseInt(o.toString()), preference);
				}
			}

			// Build the description used as template for the subscription
			DFAgentDescription dfd = new DFAgentDescription();
			ServiceDescription sd = new ServiceDescription();
			sd.setType("allocate-appointments");
			// templateSd.addProperties(new Property("country",
			// "United Kingdom"));
			dfd.addServices(sd);
			
			DFAgentDescription[] descriptions = DFService.search(this, dfd);
			if(descriptions.length != 0){
				setHospitalAgent(descriptions[0]);
			}

			addBehaviour(new RequestAppointment());
			
		} catch (NumberFormatException e) {
			System.out.println("Invalid input");
		} catch (FIPAException e) {
			e.printStackTrace();
		}
		
		// Make this agent terminate
		 //doDelete();
	}