|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004PathAutoFixer
public class UT2004PathAutoFixer
Use with care! This class automatically watching for PATH-STUCKs removing bad-edges directly from navigation graph.
Works ONLY IF YOU'RE using FloydWarshallMap
... does not alter map inside UT2004.
The class will use UT2004PathExecutor
to sense PathExecutorState.STUCK
s, if the bot stucks and
UT2004PathExecutor.getCurrentLink()
is available, this class will assume that this link is causing problems to
bot's navigation and will start to count failures when navigating through this link.
When number of failures for some link exceeds configured number (removeBadEdgeAfterNFailures, default is: REAMOVE_EDGE_AFTER_N_FAILURES_DEFAULT
),
it will removeLink(NavPointNeighbourLink)
remove it from bot's internal navigation graph.
Note that removal of some links requires recomputation of FloydWarshallMap
, so you can pass some FloydWarshallMap
instance into it to perform auto FloydWarshallMap.refreshPathMatrix()
upon link removal.
Nested Class Summary | |
---|---|
static interface |
UT2004PathAutoFixer.ILinkRemovalListener
|
Field Summary | |
---|---|
NavPointNeighbourLink |
listenerLink
|
boolean |
listenersLinkCanRemove
|
static int |
REAMOVE_EDGE_AFTER_N_FAILURES_DEFAULT
|
Constructor Summary | |
---|---|
UT2004PathAutoFixer(UT2004Bot bot,
IUT2004PathExecutor<? extends ILocated> pathExecutor,
FloydWarshallMap fwMap,
NavigationGraphBuilder navBuilder)
UT2004PathAutoFixer will remove edge whenever bot fails REAMOVE_EDGE_AFTER_N_FAILURES_DEFAULT times to walk through it. |
|
UT2004PathAutoFixer(UT2004Bot bot,
IUT2004PathExecutor<? extends ILocated> pathExecutor,
FloydWarshallMap fwMap,
NavigationGraphBuilder navBuilder,
int removeBadEdgeAfterNFailures)
UT2004PathAutoFixer will remove edge whenever bot fails 'removeBadEdgeAfterNFailures' times to walk through it. |
Method Summary | |
---|---|
void |
addListener(UT2004PathAutoFixer.ILinkRemovalListener listener)
|
protected void |
botDamaged()
|
protected void |
botKilled()
|
protected void |
checkRemove(NavPointNeighbourLink link)
Bot has stuck on 'link', badLinks count has been increased, decide whether to remove the link from the graph. |
cz.cuni.amis.utils.maps.CountIntMap<NavPointNeighbourLink> |
getBadLinks()
Return counts of navigation failures for given links, i.e., map where key == NavPointNeighbourLink , value == how many times bot failed to navigate through the link. |
Set<NavPointNeighbourLink> |
getRemovedLinks()
Returns set with all removed links. |
boolean |
isListener(UT2004PathAutoFixer.ILinkRemovalListener listener)
|
protected void |
pathComputed()
|
protected void |
removeLink(NavPointNeighbourLink link)
Removes link from the graph + recompute fwMap path matrix. |
void |
removeListener(UT2004PathAutoFixer.ILinkRemovalListener listener)
|
protected void |
stuck()
|
protected void |
switchedToNewElement()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int REAMOVE_EDGE_AFTER_N_FAILURES_DEFAULT
public NavPointNeighbourLink listenerLink
public boolean listenersLinkCanRemove
Constructor Detail |
---|
public UT2004PathAutoFixer(UT2004Bot bot, IUT2004PathExecutor<? extends ILocated> pathExecutor, FloydWarshallMap fwMap, NavigationGraphBuilder navBuilder)
REAMOVE_EDGE_AFTER_N_FAILURES_DEFAULT
times to walk through it.
bot
- pathExecutor
- fwMap
- can be null (won't auto-call FloydWarshallMap.refreshPathMatrix()
then)navBuilder
- public UT2004PathAutoFixer(UT2004Bot bot, IUT2004PathExecutor<? extends ILocated> pathExecutor, FloydWarshallMap fwMap, NavigationGraphBuilder navBuilder, int removeBadEdgeAfterNFailures)
bot
- pathExecutor
- fwMap
- can be null (won't auto-call FloydWarshallMap.refreshPathMatrix()
then)navBuilder
- Method Detail |
---|
protected void botDamaged()
protected void botKilled()
protected void switchedToNewElement()
protected void pathComputed()
protected void stuck()
protected void checkRemove(NavPointNeighbourLink link)
badLinks
count has been increased, decide whether to remove the link from the graph.
link
- protected void removeLink(NavPointNeighbourLink link)
link
- public Set<NavPointNeighbourLink> getRemovedLinks()
public cz.cuni.amis.utils.maps.CountIntMap<NavPointNeighbourLink> getBadLinks()
NavPointNeighbourLink
, value == how many times bot failed to navigate through the link.
public void addListener(UT2004PathAutoFixer.ILinkRemovalListener listener)
public void removeListener(UT2004PathAutoFixer.ILinkRemovalListener listener)
public boolean isListener(UT2004PathAutoFixer.ILinkRemovalListener listener)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |