I am developing simulation program in Repast Simphony modeling language i have t
ID: 3662351 • Letter: I
Question
I am developing simulation program in Repast Simphony modeling language i have three agent; Sick people, Doctor and Healthy peaple.The sick people agent is an infected person who spreads the disease if the healthy person is near to him and that healthy person will become an infected person this disease is infectous disease. When the infected persons becomes more the docktor agent will move towards the infected persons area and treat them to make them healthy. I want to write a code for each agents behavior, so helpme in writting a code for writting each agents behavour.
Explanation / Answer
// Healthy class developed in Repast symphony
public class Healthypeople{
private Grid<Object> grid;
//[...]
// do operations what is necessary
@Watch(watcheeClassName ="francojrepast.Zombie",
watcheeFieldNames = ''moved",
query = "within_moore 1",
whenToTrigger = WatcherTriggerSchedule.IMMEDIATE)
public void run(){
//[...]
}
}
//Based on this we can develop agent name as sick people
public class SickPeople{
private Grid<Object> grid;
//[...]
// do operations what is necessary
@Watch(watcheeClassName ="francojrepast.Zombie",
watcheeFieldNames = ''moved",
query = "within_moore 1",
whenToTrigger = WatcherTriggerSchedule.IMMEDIATE)
public void run(){
//[...]
}
}
//Based on Doctor people agent we can develop
public class Doctor{
private Grid<Object> grid;
//[...]
// do operations what is necessary
@Watch(watcheeClassName ="francojrepast.Zombie",
watcheeFieldNames = ''moved",
query = "within_moore 1",
whenToTrigger = WatcherTriggerSchedule.IMMEDIATE)
public void run(){
//[...]
}
}
public class CreateBuilder implements ContextBuilder<Object>{
@Override
public Context build(Context<Object> context){
// [....]
// do operations
// In build reads the parameters from the simulator and creates number ohumanf agents.
int humanCount = (Integer)params.getValue("human_count")
for(int i=0;i < humanCount;i++){
int energy = RandomHelper.nextIntFromTo(400,1000);
// create Healthyagent and add
context.add(new Healthypeople(space,grid,energy))
//create SickPeople agent add
context.add(new SickPeople (space,grid,energy))
//create Doctor agent called
context.add(new Doctor(space,grid,energy))
}
//[...]
// do operations
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.