aimacode / aima-java

Java implementation of algorithms from Russell And Norvig's "Artificial Intelligence - A Modern Approach"
MIT License
1.56k stars 795 forks source link

Program aima-gui-RouteFindingAgentApp.jnlp Hanging with no feedback #55

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Select From Arad to Eforie 
2. Depth First search with Tree serach
3. Click on Run 

What is the expected output? What do you see instead?
 > Program should report error or Give some msg in GUI. Not get hanged

What version of the product are you using? On what operating system?
 > Downloaded aima-gui-RouteFindingAgentApp.jnlp

Please provide any additional information below.

Original issue reported on code.google.com by param.co...@gmail.com on 15 Dec 2010 at 4:59

GoogleCodeExporter commented 9 years ago
- Have reproduced, thanks param.cool2008

Original comment by ctjoreilly@gmail.com on 15 Dec 2010 at 5:25

GoogleCodeExporter commented 9 years ago
Ruediger, shooting this one over to you for now in order to get your thoughts 
on this. I've an idea of what's happening - i.e. its caught in a cycle doing a 
tree search but thought the GUI was set up to be able to cancel these search 
calls. It may also make some sense to add some form of feedback that the system 
is thinking. Let me know what you think.

Thanks

Ciaran

Original comment by ctjoreilly@gmail.com on 16 Dec 2010 at 4:48

GoogleCodeExporter commented 9 years ago
Ciaran, yes - your idea is just what happens. In my point of view, what happens 
is just the intended behavior. The application is not a route planning 
application but a simulator for testing agents with different search 
strategies. Not all of them terminate. In this situation, it is in general 
impossible to decide from outside, whether further search makes sense. So the 
decision is left to the user. The enabled cancel button indicates that 
computations are performed which can be aborted if desired. From the user's 
point of view, a status bar text saying something like "performing search..." 
would be fine, but I'm not sure, whether agents should have access to the 
status bar. If more information is needed for the user (I am still not sure), 
we could add an output to the action log on the right-hand side of the 
environment view. What do you think?

Original comment by Ruediger.Lunde@googlemail.com on 16 Dec 2010 at 5:45

GoogleCodeExporter commented 9 years ago
Hi Ruediger,

I agree, the behavior of the Search is as expected in this scenario, i.e. it 
keeps going on forever. The problem is that when this occurs in this case, you 
are unable to Cancel or Pause the running Agent, which you can normally. This I 
think is because the Agent is consuming all available memory on its Thread. 
Example, when you run from within Eclipse you'll see something like this 
getting output to the Console:

2010-12-16 17:14:51.076 java[5747:903] java.lang.OutOfMemoryError: Java heap 
space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap 
space
    at java.lang.Object.clone(Native Method)
    at sun.java2d.SunGraphics2D.clone(SunGraphics2D.java:433)
    at sun.java2d.SunGraphics2D.create(SunGraphics2D.java:467)

and the whole thing locks up. Not sure of the best way to manage this, any 
ideas?

Thanks

Ciaran

Original comment by ctjoreilly@gmail.com on 17 Dec 2010 at 1:21

GoogleCodeExporter commented 9 years ago
Hi Ciaran,

ok - cancel works in this case, but only if you don't wait too long... I see 
the following options:
- Extend all search algorithms so that they check the available storage and 
exit before the overflow happens (don't like this option).
- Adding an observer mechanism to all search algorithms so that their progress 
can be monitored (would be fine also for debugging and demo). A special monitor 
could check the available space and cancel the simulation thread if necessary 
(Some work to do, especially since not all search algorithms currently support 
a clean stop. Sometimes you need to press cancel twice which causes an unsave 
exit from the thread!).
- The MapFunctionFactory (aima.core.environment.map) could be tuned. For 
example, the ACTIONS function could stop to provide further actions after 
noticing that storage becomes rare (But then, we need this tuning also for 
other search agents, e.g. in the aimax-osm project.).

I am still not sure, whether we should do one of this options. If, I would 
perhaps choose the last one. What do you think?

Original comment by Ruediger.Lunde@googlemail.com on 17 Dec 2010 at 7:07

GoogleCodeExporter commented 9 years ago
Hi Ruediger,

Yes its tricky. I think option 2 is more general and we could possibly 
implement using an Aspect Oriented Programming approach so that the underlying 
aima-core code does not get bloated - just an idea currently. For the moment 
lets just think about it for a bit.

Thanks

Ciaran

Original comment by ctjoreilly@gmail.com on 17 Dec 2010 at 6:25