Warning: Table 'watchdog' is read only query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>Table &amp;#039;cache_filter&amp;#039; is read only\nquery: LOCK TABLES cache_filter WRITE</em> in <em>/home01/vsp_access/matsimwww/includes/database.mysql.inc</em> on line <em>174</em>.', 2, '', 'http://matsim.org/node/468', '', '38.107.179.232', 1328351244) in /home01/vsp_access/matsimwww/includes/database.mysql.inc on line 174

Warning: Table 'watchdog' is read only query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>Table &amp;#039;cache_filter&amp;#039; is read only\nquery: UPDATE cache_filter SET data = &amp;#039;&amp;lt;h3&amp;gt;The short story&amp;lt;/h3&amp;gt;\\n&amp;lt;p&amp;gt;Idea: Attach an events listener to the running iterations, and use the events data flow for any kind of analysis.&amp;lt;/p&amp;gt;\\n&amp;lt;h3&amp;gt;The slightly longer story&amp;lt;/h3&amp;gt;\\n&amp;lt;pre class=\\&amp;quot;listing\\&amp;quot;&amp;gt;\\npublic final class MyControler {\\n public static void main(String[] args) {\\n Controler controler = new Controler( args ) ;\\n final Scenario sc = controler.getScenario() ;\\n ControlerListener startupListener = new StartupListener() {\\n @Override\\n public void notifyStartup(StartupEvent event) {\\n EventHandler in /home01/vsp_access/matsimwww/includes/database.mysql.inc on line 174
Case 5: On-the-fly analysis | MATSim

Case 5: On-the-fly analysis

  • user warning: Table 'cache_filter' is read only query: LOCK TABLES cache_filter WRITE in /home01/vsp_access/matsimwww/includes/database.mysql.inc on line 174.
  • user warning: Table 'cache_filter' is read only query: UPDATE cache_filter SET data = '<h3>The short story</h3>\n<p>Idea: Attach an events listener to the running iterations, and use the events data flow for any kind of analysis.</p>\n<h3>The slightly longer story</h3>\n<pre class=\"listing\">\npublic final class MyControler {\n public static void main(String[] args) {\n Controler controler = new Controler( args ) ;\n final Scenario sc = controler.getScenario() ;\n ControlerListener startupListener = new StartupListener() {\n @Override\n public void notifyStartup(StartupEvent event) {\n EventHandler myEventHandler = new MyEventHandler() ;\n event.getControler().getEvents().addHandler(myEventHandler);\n }\n };\n controler.addControlerListener(startupListener);\n controler.run();\n }\n}\n</pre><p>and then</p>\n<pre class=\"listing\">\nclass MyEventHandler implements ActivityEndEventHandler {\n public void handleEvent( ActivityEndEvent ev ) {\n // do any kind of api-based analysis with the event\n }\n} \n</pre><p>This second part is fully api-based (except that some material is still under core.api.experimental) .</p>\n<h3>The long story</h3>\n<p>Some material (not fully consistent with the above) is under <code>src/tutorial/programming/example6EventsHandling</code>.&nbsp; This should also be used to obtain hints with respect to the correct syntax ... since it is automatically part of all refactorings.</p>\n', created = 1328351244, expire = 1328437644, headers = '' WHERE cid = '1:45c91028d7e06f00fcbdee2c82379c8b' in /home01/vsp_access/matsimwww/includes/database.mysql.inc on line 174.

The short story

Idea: Attach an events listener to the running iterations, and use the events data flow for any kind of analysis.

The slightly longer story

public final class MyControler {
	public static void main(String[] args) {
		Controler controler = new Controler( args ) ;
		final Scenario sc = controler.getScenario() ;
		ControlerListener startupListener = new StartupListener() {
			@Override
			public void notifyStartup(StartupEvent event) {
				EventHandler myEventHandler = new MyEventHandler() ;
				event.getControler().getEvents().addHandler(myEventHandler);
			}
		};
		controler.addControlerListener(startupListener);
		controler.run();
	}
}

and then

class MyEventHandler implements ActivityEndEventHandler {
    public void handleEvent( ActivityEndEvent ev ) {
        // do any kind of api-based analysis with the event
    }
}    

This second part is fully api-based (except that some material is still under core.api.experimental) .

The long story

Some material (not fully consistent with the above) is under src/tutorial/programming/example6EventsHandling.  This should also be used to obtain hints with respect to the correct syntax ... since it is automatically part of all refactorings.


Warning: Table 'watchdog' is read only query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '<em>Table &amp;#039;sessions&amp;#039; is read only\nquery: UPDATE sessions SET uid = 0, cache = 0, hostname = &amp;#039;38.107.179.232&amp;#039;, session = &amp;#039;&amp;#039;, timestamp = 1328351244 WHERE sid = &amp;#039;e972b2ab7dd755a2094beea8ac708f02&amp;#039;</em> in <em>/home01/vsp_access/matsimwww/includes/database.mysql.inc</em> on line <em>174</em>.', 2, '', 'http://matsim.org/node/468', '', '38.107.179.232', 1328351244) in /home01/vsp_access/matsimwww/includes/database.mysql.inc on line 174