Commit ea76c045 authored by k20066's avatar k20066
Browse files

comment delete

parent f9623601
...@@ -77,7 +77,6 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF ...@@ -77,7 +77,6 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
this.commandType = command.getAction(); this.commandType = command.getAction();
this.target = command.getTargetID(); this.target = command.getTargetID();
this.commanderID = command.getSenderID(); this.commanderID = command.getSenderID();
//System.out.println("[FireBrigade] recievecommand time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" tagID:"+this.target+" commandType:"+this.commandType);
} }
return this; return this;
} }
...@@ -94,7 +93,6 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF ...@@ -94,7 +93,6 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
this.actionExtMove.updateInfo(messageManager); this.actionExtMove.updateInfo(messageManager);
this.commandCompleted = this.isCommandCompleted(this.commandType); this.commandCompleted = this.isCommandCompleted(this.commandType);
//System.out.println("[FireBrigade] isCommandCompleted ["+this.commandCompleted+"] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" tagID:"+this.target+" commandType:"+this.commandType);
if (this.commandCompleted) { if (this.commandCompleted) {
if (this.commandType != ACTION_UNKNOWN) { if (this.commandType != ACTION_UNKNOWN) {
messageManager messageManager
...@@ -195,7 +193,6 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF ...@@ -195,7 +193,6 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
return this; return this;
case ACTION_AUTONOMY: case ACTION_AUTONOMY:
if (this.target == null) { if (this.target == null) {
System.out.println("[FireBrigade] excutor notarget time:"+this.agentInfo.getTime()+" id:"+this.commanderID+" tagID:"+this.target+" commandType:"+this.commandType);
return this; return this;
} }
StandardEntity targetEntity = this.worldInfo.getEntity(this.target); StandardEntity targetEntity = this.worldInfo.getEntity(this.target);
...@@ -205,72 +202,11 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF ...@@ -205,72 +202,11 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
} else if (targetEntity instanceof Human) { } else if (targetEntity instanceof Human) {
this.result = this.actionFireRescue.setTarget(this.target).calc() this.result = this.actionFireRescue.setTarget(this.target).calc()
.getAction(); .getAction();
System.out.println("[FireBrigade] excutor "+this.result+" time:"+this.agentInfo.getTime()+" id:"+this.commanderID+" tagID:"+this.target+" commandType:"+this.commandType);
} }
} }
return this; return this;
} }
/*private Action computeCommand(int commandType, EntityID target, EntityID commanderID){
Action action = null;
switch (commandType) {
case ACTION_REST:
EntityID position = this.agentInfo.getPosition();
if (target == null) {
Collection<
EntityID> refuges = this.worldInfo.getEntityIDsOfType(REFUGE);
if (refuges.contains(position)) {
action = new ActionRest();
} else {
this.pathPlanning.setFrom(position);
this.pathPlanning.setDestination(refuges);
List<EntityID> path = this.pathPlanning.calc().getResult();
if (path != null && path.size() > 0) {
action = new ActionMove(path);
} else {
action = new ActionRest();
}
}
return action;
}
if (position.getValue() != target.getValue()) {
List<EntityID> path = this.pathPlanning.getResult(position,
target);
if (path != null && path.size() > 0) {
action = new ActionMove(path);
return action;
}
}
action = new ActionRest();
return action;
case ACTION_MOVE:
if (target != null) {
action = this.actionExtMove.setTarget(target).calc()
.getAction();
}
return action;
case ACTION_RESCUE:
if (target != null) {
action = this.actionFireRescue.setTarget(target).calc()
.getAction();
}
return action;
case ACTION_AUTONOMY:
if (target == null) {
return action;
}
StandardEntity targetEntity = this.worldInfo.getEntity(target);
if (targetEntity instanceof Area) {
action = this.actionExtMove.setTarget(target).calc()
.getAction();
} else if (targetEntity instanceof Human) {
action = this.actionFireRescue.setTarget(target).calc()
.getAction();
}
}
return action;
}*/
private boolean isCommandCompleted(int commandType) { private boolean isCommandCompleted(int commandType) {
Human agent = (Human) this.agentInfo.me(); Human agent = (Human) this.agentInfo.me();
switch (commandType) { switch (commandType) {
...@@ -303,23 +239,7 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF ...@@ -303,23 +239,7 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
commandType = ACTION_MOVE; commandType = ACTION_MOVE;
return this.isCommandCompleted(commandType); return this.isCommandCompleted(commandType);
} else if (targetEntity instanceof Human) { } else if (targetEntity instanceof Human) {
//commandType = ACTION_MOVE;
//if(!this.isCommandCompleted(commandType)) return false;
Human h = (Human) targetEntity;
EntityID position = h.getPosition();
/*if (this.agentInfo.getPosition().getValue() != position.getValue()) {
return false;
}*/
commandType = ACTION_RESCUE; commandType = ACTION_RESCUE;
/*if ((h.isHPDefined() && h.getHP() == 0)) {
return true;
}
//commandType = h.getStandardURN() == CIVILIAN ? ACTION_RESCUE : null;
if (h.getStandardURN() == CIVILIAN) {
commandType = ACTION_RESCUE;
}*/
return this.isCommandCompleted(commandType); return this.isCommandCompleted(commandType);
} }
} }
......
...@@ -140,7 +140,6 @@ public class ComplimentTacticsExtActionFireRescue extends ExtAction { ...@@ -140,7 +140,6 @@ public class ComplimentTacticsExtActionFireRescue extends ExtAction {
if(this.result != null){ if(this.result != null){
Class<? extends Action> actionClass = this.result.getClass(); Class<? extends Action> actionClass = this.result.getClass();
if (actionClass == ActionRescue.class) { if (actionClass == ActionRescue.class) {
//System.out.println("[FireRescue time:"+this.agentInfo.getTime()+" myid:"+this.agentInfo.getID());
this.mm.addMessage(new MessageFireBrigade(true, agent, MessageFireBrigade.ACTION_RESCUE, this.target)); this.mm.addMessage(new MessageFireBrigade(true, agent, MessageFireBrigade.ACTION_RESCUE, this.target));
} }
} }
......
...@@ -152,12 +152,6 @@ public class CentralizedControlMessageCoordinator extends MessageCoordinator { ...@@ -152,12 +152,6 @@ public class CentralizedControlMessageCoordinator extends MessageCoordinator {
numChannels); numChannels);
} }
String a = "isPlatoon:"+isPlatoon;
for(int i = 0;i < channels.length; i++){
a += " channels["+i+"]:"+channels[i];
}
//System.out.println("time:"+agentInfo.getTime()+" myid:"+agentInfo.getID()+a);
return channels; return channels;
} }
......
...@@ -57,20 +57,7 @@ public class CentralizedControlATHumanDetector extends HumanDetector { ...@@ -57,20 +57,7 @@ public class CentralizedControlATHumanDetector extends HumanDetector {
public HumanDetector updateInfo(MessageManager messageManager) { public HumanDetector updateInfo(MessageManager messageManager) {
logger.debug("Time:" + agentInfo.getTime()); logger.debug("Time:" + agentInfo.getTime());
super.updateInfo(messageManager); super.updateInfo(messageManager);
int time = this.agentInfo.getTime();
Action action = this.agentInfo.getExecutedAction(time - 1);
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" -1step action:"+action);
int[] chan = messageManager.getChannels();
String str = "";
for(int i=0; i<chan.length; i++){
str+=" getChannels["+i+"]:"+chan[i]+" chan_len:"+chan.length;
}
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" channelCount:"+scenarioInfo.getCommsChannelsCount()+str);
//List<CommunicationMessage> mes = messageManager.getReceivedMessageList(MessageCivilian.class);
Set<EntityID> changes = this.worldInfo.getChanged().getChangedEntities(); Set<EntityID> changes = this.worldInfo.getChanged().getChangedEntities();
for(EntityID id : changes){ for(EntityID id : changes){
StandardEntity entity = this.worldInfo.getEntity(id); StandardEntity entity = this.worldInfo.getEntity(id);
...@@ -81,13 +68,7 @@ public class CentralizedControlATHumanDetector extends HumanDetector { ...@@ -81,13 +68,7 @@ public class CentralizedControlATHumanDetector extends HumanDetector {
continue; continue;
} }
StandardMessagePriority level = StandardMessagePriority.HIGH; StandardMessagePriority level = StandardMessagePriority.HIGH;
//MessageCivilian civ_mes = new MessageDamageCivilian(true, level, civ);
MessageCivilian civ_mes = new MessageCivilian(true, level, civ); MessageCivilian civ_mes = new MessageCivilian(true, level, civ);
//Building building = (Building) this.worldInfo.getPosition(id);
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" civ:"+civ.getID()+" level:"+civ_mes.getSendingPriority());
//messageManager.addMessage(building_mes,true);
messageManager.addMessage(civ_mes,true); messageManager.addMessage(civ_mes,true);
} }
......
...@@ -145,13 +145,13 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator { ...@@ -145,13 +145,13 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
} }
allocate = reverse_list; allocate = reverse_list;
} }
String str = " allocate";
for(int i = 0; i<row; i++){ for(int i = 0; i<row; i++){
if(allocate[i] == -1) continue; if(allocate[i] == -1) continue;
str += "\n["+i+"]:"+allocate[i]+" fbID:"+rowlist.get(i)+" tagID:"+collist.get(allocate[i]);
this.fireBrigadeInfoMap.get(rowlist.get(i)).target = collist.get(allocate[i]); this.fireBrigadeInfoMap.get(rowlist.get(i)).target = collist.get(allocate[i]);
} }
System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+str); //this.printAllocate(allocate, rowlist, collist, row);
return this; return this;
} }
...@@ -178,7 +178,6 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator { ...@@ -178,7 +178,6 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
MessageFireBrigade mesfb = (MessageFireBrigade) mes; MessageFireBrigade mesfb = (MessageFireBrigade) mes;
MessageUtil.reflectMessage(this.worldInfo, mesfb); MessageUtil.reflectMessage(this.worldInfo, mesfb);
EntityID fbID = mesfb.getAgentID(); EntityID fbID = mesfb.getAgentID();
System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" fbID:"+fbID+" posi:"+mesfb.getPosition()+" Action:"+mesfb.getAction()+" level:"+mesfb.getSendingPriority()+" size:"+mesfb.getByteArraySize());
FireBrigadeInfo fbi = this.fireBrigadeInfoMap.get(fbID); FireBrigadeInfo fbi = this.fireBrigadeInfoMap.get(fbID);
fbi.setInfo(mesfb.getTargetID(), mesfb.getPosition(), mesfb.getBuriedness(), fbi.setInfo(mesfb.getTargetID(), mesfb.getPosition(), mesfb.getBuriedness(),
(mesfb.getAction() == MessageFireBrigade.ACTION_RESCUE) ? false : true, this.agentInfo.getTime()); (mesfb.getAction() == MessageFireBrigade.ACTION_RESCUE) ? false : true, this.agentInfo.getTime());
...@@ -221,6 +220,15 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator { ...@@ -221,6 +220,15 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
return true; return true;
} }
private void printAllocate(int[] allocate, List<EntityID> rowlist, List<EntityID> collist, int row){
String str = " allocate";
for(int i = 0; i<row; i++){
if(allocate[i] == -1) continue;
str += "\n["+i+"]:"+allocate[i]+" fbID:"+rowlist.get(i)+" tagID:"+collist.get(allocate[i]);
}
System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+str);
}
private class FireBrigadeInfo { private class FireBrigadeInfo {
EntityID agentID; EntityID agentID;
......
...@@ -63,15 +63,6 @@ public class CentralizedControlFBHumanDetector extends HumanDetector { ...@@ -63,15 +63,6 @@ public class CentralizedControlFBHumanDetector extends HumanDetector {
this.mm = messageManager; this.mm = messageManager;
int time = this.agentInfo.getTime();
int[] chan = messageManager.getChannels();
String str = "";
for(int i=0; i<chan.length; i++){
str+=" getChannels["+i+"]:"+chan[i]+" chan_len:"+chan.length;
}
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" channelCount:"+scenarioInfo.getCommsChannelsCount()+str);
Set<EntityID> changes = this.worldInfo.getChanged().getChangedEntities(); Set<EntityID> changes = this.worldInfo.getChanged().getChangedEntities();
for(EntityID id : changes){ for(EntityID id : changes){
StandardEntity entity = this.worldInfo.getEntity(id); StandardEntity entity = this.worldInfo.getEntity(id);
...@@ -84,8 +75,6 @@ public class CentralizedControlFBHumanDetector extends HumanDetector { ...@@ -84,8 +75,6 @@ public class CentralizedControlFBHumanDetector extends HumanDetector {
StandardMessagePriority level = StandardMessagePriority.HIGH; StandardMessagePriority level = StandardMessagePriority.HIGH;
MessageCivilian civ_mes = new MessageCivilian(true, level, civ); MessageCivilian civ_mes = new MessageCivilian(true, level, civ);
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" civ:"+civ.getID()+" level:"+civ_mes.getSendingPriority());
messageManager.addMessage(civ_mes,true); messageManager.addMessage(civ_mes,true);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment