@Override public void step(SimState s) { SimpactII state = (SimpactII) s; state.addAttribute("HIVTest", false); // System.out.println("----------------------------HIV Test Campaign " + // state.schedule.getTime() + "----"); for (int i = 0; i < numberOfTests; i++) { Agent target = findAgent(state); target.attributes.put("HIVTest", test(target)); // if positive, counsel them to have fewer partners, but don't reduce infectivity if (test(target)) target.DNP = partnersAfterTest; // note this might actually increase some individuals DNP } }
// int agentCount = 0; //DEBUG private Agent findAgent(SimpactII state) { // this is a random targeting implementation // this may find same person twice -- for now this is okay and reflects // the reality in which it is sometimes difficult to recruit new individuals return (Agent) state.network.allNodes.get( state.random.nextInt( state.getPopulation())); // note: must pull from network not myAgents }