Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
autumn_rrs
autumn_agent_2023
Commits
f9f134f9
Commit
f9f134f9
authored
Nov 07, 2023
by
k20066
Browse files
analysis allocate
parent
41657e3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/autumn_2023/centralized/CentralizedControlCommandExecutorFire.java
View file @
f9f134f9
...
@@ -74,6 +74,7 @@ public class CentralizedControlCommandExecutorFire extends CommandExecutor<Comma
...
@@ -74,6 +74,7 @@ public class CentralizedControlCommandExecutorFire extends CommandExecutor<Comma
@Override
@Override
public
CommandExecutor
setCommand
(
CommandFire
command
)
{
public
CommandExecutor
setCommand
(
CommandFire
command
)
{
EntityID
agentID
=
this
.
agentInfo
.
getID
();
EntityID
agentID
=
this
.
agentInfo
.
getID
();
System
.
out
.
println
(
"time:"
+
this
.
agentInfo
.
getTime
()+
" fbid:"
+
this
.
agentInfo
.
getID
()+
" commandAction:"
+
command
.
getAction
()+
" commandTarget:"
+
command
.
getTargetID
()+
" commanderID:"
+
command
.
getSenderID
());
if
(!
this
.
commandCompleted
)
return
this
;
if
(!
this
.
commandCompleted
)
return
this
;
if
(
command
.
isToIDDefined
()
&&
Objects
.
requireNonNull
(
command
.
getToID
()).
getValue
()
==
agentID
.
getValue
())
{
if
(
command
.
isToIDDefined
()
&&
Objects
.
requireNonNull
(
command
.
getToID
()).
getValue
()
==
agentID
.
getValue
())
{
this
.
commandType
=
command
.
getAction
();
// 司令で出された行動内容
this
.
commandType
=
command
.
getAction
();
// 司令で出された行動内容
...
...
src/main/java/autumn_2023/module/complex/CentralizedControlFBAllocator.java
View file @
f9f134f9
...
@@ -165,7 +165,7 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
...
@@ -165,7 +165,7 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
if
(
allocate
[
i
]
==
-
1
)
continue
;
if
(
allocate
[
i
]
==
-
1
)
continue
;
this
.
fireBrigadeInfoMap
.
get
(
rowlist
.
get
(
i
)).
target
=
collist
.
get
(
allocate
[
i
]);
this
.
fireBrigadeInfoMap
.
get
(
rowlist
.
get
(
i
)).
target
=
collist
.
get
(
allocate
[
i
]);
}
}
//
this.printAllocate(allocate, rowlist, collist, row);
this
.
printAllocate
(
allocate
,
rowlist
,
collist
,
row
);
return
this
;
return
this
;
}
}
...
@@ -181,33 +181,42 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
...
@@ -181,33 +181,42 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
super
.
updateInfo
(
messageManager
);
super
.
updateInfo
(
messageManager
);
Set
<
EntityID
>
recievetasks
=
messageManager
.
getReceivedMessageList
(
MessageCivilian
.
class
).
stream
()
Set
<
EntityID
>
recievetasks
=
messageManager
.
getReceivedMessageList
(
MessageCivilian
.
class
).
stream
()
.
map
(
e
->
{
.
map
(
e
->
{
MessageCivilian
mesciv
=
(
MessageCivilian
)
e
;
MessageCivilian
mesciv
=
(
MessageCivilian
)
e
;
MessageUtil
.
reflectMessage
(
this
.
worldInfo
,
mesciv
);
MessageUtil
.
reflectMessage
(
this
.
worldInfo
,
mesciv
);
return
(
mesciv
);
return
(
mesciv
);
})
})
.
map
(
MessageCivilian:
:
getAgentID
)
.
map
(
MessageCivilian:
:
getAgentID
)
.
filter
(
e
->
this
.
isNeedRescueHuman
(
this
.
worldInfo
.
getEntity
(
e
)))
.
filter
(
e
->
this
.
isNeedRescueHuman
(
this
.
worldInfo
.
getEntity
(
e
)))
.
filter
(
e
->
!(
finishEntityIDs
.
contains
(
e
)))
.
filter
(
e
->
!(
finishEntityIDs
.
contains
(
e
)))
.
collect
(
Collectors
.
toSet
());
.
collect
(
Collectors
.
toSet
());
System
.
out
.
println
(
"time:"
+
this
.
agentInfo
.
getTime
()+
" centerid:"
+
this
.
agentInfo
.
getID
()+
" recievetasks:"
+
recievetasks
);
this
.
taskSet
.
addAll
(
recievetasks
);
this
.
taskSet
.
addAll
(
recievetasks
);
// 消防隊の情報をリセット
for
(
EntityID
fbid
:
this
.
fireBrigadeInfoMap
.
keySet
()){
FireBrigadeInfo
fbi
=
this
.
fireBrigadeInfoMap
.
get
(
fbid
);
fbi
.
resetInfo
();
}
List
<
EntityID
>
fblist
=
new
ArrayList
<>();
List
<
CommunicationMessage
>
mesfblist
=
messageManager
.
getReceivedMessageList
(
MessageFireBrigade
.
class
);
List
<
CommunicationMessage
>
mesfblist
=
messageManager
.
getReceivedMessageList
(
MessageFireBrigade
.
class
);
for
(
CommunicationMessage
mes
:
mesfblist
){
for
(
CommunicationMessage
mes
:
mesfblist
){
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
();
fblist
.
add
(
fbID
);
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
());
}
}
System
.
out
.
println
(
"time:"
+
this
.
agentInfo
.
getTime
()+
" centerid:"
+
this
.
agentInfo
.
getID
()+
" fblist:"
+
fblist
);
List
<
EntityID
>
reportlist
=
messageManager
.
getReceivedMessageList
(
MessageReport
.
class
).
stream
()
List
<
EntityID
>
reportlist
=
messageManager
.
getReceivedMessageList
(
MessageReport
.
class
).
stream
()
.
map
(
MessageReport
.
class
::
cast
)
.
map
(
MessageReport
.
class
::
cast
)
.
filter
(
MessageReport:
:
isDone
)
.
filter
(
MessageReport:
:
isDone
)
.
map
(
MessageReport:
:
getFromID
)
.
map
(
MessageReport:
:
getFromID
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
this
.
finishEntityIDs
.
addAll
(
reportlist
);
this
.
finishEntityIDs
.
addAll
(
reportlist
);
this
.
taskSet
.
removeAll
(
reportlist
);
this
.
taskSet
.
removeAll
(
reportlist
);
...
@@ -294,5 +303,16 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
...
@@ -294,5 +303,16 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
this
.
canNewAction
=
canNewAction
;
this
.
canNewAction
=
canNewAction
;
this
.
commandTime
=
commandTime
;
this
.
commandTime
=
commandTime
;
}
}
/**
* 消防隊に関する情報をリセットするメソッド
*/
public
void
resetInfo
(){
prevtarget
=
null
;
position
=
null
;
buriedness
=
-
1
;
target
=
null
;
canNewAction
=
true
;
commandTime
=
-
1
;
}
}
}
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment