<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Tech blog of  WEN Yang : GCC/DynaMIT/MITSIM</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/category/41.aspx</link><description>GCC/DynaMIT/MITSIM</description><dc:language>en-US</dc:language><generator>CommunityServer 1.1 (Build: 1.1.0.50615)</generator><item><title>Parallel DynaMIT runs on Athena</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2008/03/27/67410.aspx</link><pubDate>Thu, 27 Mar 2008 17:07:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:67410</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/67410.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=67410</wfw:commentRss><description>For a long time I've been searching for more machines to do experiments on parallel simulation for my case studies. Our lab does not have that much PCs, and some of them are heavily used by other researchers. I tried to contact MIT academic computing for help,&amp;nbsp; but my emails have been ignored by far. I keep looking, and finally here comes a chance: the Athena clusters.&lt;br&gt;&lt;br&gt;Athena clusters have many unused machines during this week, the spring
break. On Monday, after some trial-and-error efforts, I managed
to make my &lt;a href="http://web.mit.edu/wenyang/www/tiddlywiki_yw.htm#%5B%5B24%20March%202008%3A%20Test%20DynaMIT%20and%20MPI%20on%20Athena%20clusters%5D%5D"&gt;parallel DynaMIT run on Athena&lt;/a&gt;. If the results are good, I might be able to finish my case studies in time.&amp;nbsp;&amp;nbsp; It is not as convenient as&amp;nbsp; doing experiments in the lab -- one cannot do this remotely; I need to keep an eye on the machines while DynaMIT's running. Anyway, this is better than nothing.&lt;br&gt;&lt;br&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=67410" width="1" height="1"&gt;</description></item><item><title>Google and transportation information</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2008/03/18/67352.aspx</link><pubDate>Tue, 18 Mar 2008 04:06:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:67352</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/67352.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=67352</wfw:commentRss><description>Yesterday I read about two articles on Google's impact on transportation. One was "&lt;a href="http://www.informationweek.com/story/showArticle.jhtml?articleID=206904223&amp;amp;cid=RSSfeed_IWK_All"&gt;Google's Online Maps Gets New Jersey Commuters On Time&lt;/a&gt;", the other, "&lt;a href="http://www.informationweek.com/management/showArticle.jhtml?articleID=206903550"&gt;Observer Sees Google's Future In Transportation Routing&lt;/a&gt;". Both were available on &lt;a href="http://www.informationweek.com"&gt;InformationWeek&lt;/a&gt;.&amp;nbsp; &lt;br&gt;&lt;br&gt;The NJ TRANSIT story is somewhat expected. With the power of Google Maps and Google Earth, Google's providing information on transportation systems is of no surprise to me.&amp;nbsp; If Android becomes more acceptable to handset manufacturers and the
users (which I believe is just a matter of time), more and more
travelers might be able to get (near) real-time information from Google
or maybe other travel information providers (such as TrafficGauge, Inrix,
Traffic.com, SmarTraveler and traditional media companies) as well.&lt;br&gt;&lt;br&gt;Nowadays getting near real-time data is much easier than before. GPS-equipped probe vehicles, for example, have already been used in many places in the US, China, and Europe, etc. Such data is very useful under general conditions. When sufficient historical data is available, it is relatively easy to optimize routing for a normal situation. The chanllange remains, however, when an (unexpected) incident occurs and it changes the traffic pattern significantly. In that case, having real-time information could still be very helpful. But what if most people on the road have access to such information? If all (or a significant fraction) of them change their behavior (e.g., route choice), then the situation might be even worse, and even real-time information may not be able to tell what is the best route because everything is so dynamic -- the road condition at the time one has to make a decision may be different from the condition he/she will eventually experience. In a non-recurrent situation like this, purely statistical methods might not be able to provide accurate and relevant information for travelers. A suitable model (such as DynaMIT) that can generate consistent anticipatory information would be more useful. It has built-in capability to handle drivers' "overaction" to the travel information in this situation.&lt;br&gt;&lt;br&gt;I would say the &lt;a href="http://www.arnoldit.com/lists/google-patents/pat20060149461.pdf"&gt;&lt;span id="articleBody"&gt;transportation routing &lt;/span&gt;patent by Google&lt;/a&gt; is somewhat unexpected. After quickly skimming through the patent, I had the impression that the patent is more about how to process the data and provide it to users via wireless devices. How they obtain the data and what kind of data could be used is not detailed. Anyway, this reminded me a meeting last week with Dr. Ramachandran Ramjee, who is currently a Senior Researcher at Microsoft Research, India. He has some interesting ideas on how to collect traffic data from Smart Phones. &lt;br&gt;&lt;br&gt;I believe in maybe a few years we will be able to collect pretty good (and huge amount of) traffic data from cell phones and use it for travler&amp;nbsp; information.&amp;nbsp; If I know some company is working on this now, I would be very interested to work for them. :-)&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=67352" width="1" height="1"&gt;</description></item><item><title>The DynaMIT runtime figure</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2008/03/11/67311.aspx</link><pubDate>Tue, 11 Mar 2008 20:23:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:67311</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/67311.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=67311</wfw:commentRss><description>For background information about this figure, please see the previous post "&lt;a href="http://blogs.mit.edu/CS/blogs/wenyang/archive/2008/03/09/67298.aspx"&gt;Improving DynaMIT runtime performance&lt;/a&gt;".&lt;br&gt;&amp;nbsp;&lt;a href="http://web.mit.edu/wenyang/www/pics/dynamit_runtime_la_single.png"&gt;&lt;img src="http://web.mit.edu/wenyang/www/pics/dynamit_runtime_la_single.png" alt="DynaMIT runtime  on the Los Angeles network (single CPU)"&gt;&lt;/a&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=67311" width="1" height="1"&gt;</description></item><item><title>Improving DynaMIT runtime performance</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2008/03/09/67298.aspx</link><pubDate>Mon, 10 Mar 2008 03:26:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:67298</guid><dc:creator>wenyang</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/67298.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=67298</wfw:commentRss><description>
&lt;p class="MsoNormal"&gt;In my &lt;a href="http://blogs.mit.edu/CS/blogs/wenyang/archive/2008/03/09/67297.aspx"&gt;previous post&lt;/a&gt;, I mentioned that I had been working on
the case studies lately. Doing profiling experiments could be tedious. One needs
to run many scenarios with different binaries and possibly different sets of parameters;
results also need to be processed and archived. I would usually write a shell
script and let the machines do the batch jobs, and free myself to other works. &lt;/p&gt;



&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;While waiting for some results just now, I went over a log
file of my previous profiling experiments. It was about DynaMIT runtime on a
single processor machine. Then I created a &lt;a href="http://web.mit.edu/wenyang/www/pics/dynamit_runtime_la_single.png"&gt;figure&lt;/a&gt;, and found some interesting
observations. The figure is so simple that I hope the following “text” version would do
the same trick. Here it is:

&lt;/p&gt;&lt;blockquote&gt;
  &lt;p class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;u&gt;&lt;b&gt;Date&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;|&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Runtime&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;u&gt;&lt;b&gt;(seconds)&lt;/b&gt;&lt;/u&gt;&lt;br&gt;
Dec, 2006 &lt;b&gt;|&lt;/b&gt; ************************************ &lt;/font&gt;&lt;font face="Courier New"&gt;(1067)&lt;br&gt;
Mar, 2007 &lt;b&gt;|&lt;/b&gt; ********************&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;(592)&lt;br&gt;
Oct, 2007 &lt;b&gt;|&lt;/b&gt; *************&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;(384)&lt;br&gt;&lt;u&gt;
Jan, 2008 &lt;b&gt;|&lt;/b&gt; *********&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/u&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;u&gt;(265)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;/u&gt;&lt;/font&gt;&lt;/p&gt;
  
&lt;/blockquote&gt;
















&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;&lt;/o:p&gt;For a sophisticated system like &lt;a href="http://web.mit.edu/wenyang/www/#DynaMIT"&gt;DynaMIT&lt;/a&gt;, usually one can
improve its efficiency in two directions. &lt;/p&gt;



&lt;ul&gt;&lt;li&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;One is the “scientific” way, which is to find better models and
algorithms. This part is often difficult, but would bring dramatic changes to
the runtime if we manage to do it. In my research, two major advances were
introduced: utilizing sparse matrices in OD estimation, and use smart algorithms
to get the most out of parallel simulation. Since I have not yet finished all
my case studies, this post is not about it. &lt;/li&gt;&lt;li&gt;The other is the “engineering” way -- use whatever practical
to solve the problem. For example, do profiling studies to find bottlenecks
before doing any optimization, avoid frequently allocating and de-allocating
memory, avoid re-calculation, save intermediate results for future use, and use
hash judiciously. The improvement shown in the figure is primarily due to this part.&lt;/li&gt;&lt;/ul&gt;



&lt;p class="MsoNormal"&gt;The figure indicates a few surprising facts. Back in the end
of 2006, it took about 18 minutes to run this scenario, but at the beginning of
2008, it dropped to four and a half minutes, or about &lt;i&gt;1/4&lt;/i&gt; of the original.
Another interesting observation is also unexpected: I have been able to reduce
the runtime by roughly 1/3 of the original almost every four months for the
past year, taking into account the fact that I did not work on it during the
whole summer of 2007.&lt;/p&gt;



&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;Frankly, I do not expect such a trend would continue for
long.&amp;nbsp; Most of the improvements reflected in those tests were achieved by better
“engineering” approaches. I spent a lot of efforts to revise the bad designs or
inefficient implementations inherited from the old version I took over. There
are still rooms for further improvement, but my hunch is it would probably give
us no more than 20% gain unless somebody spends tremendous effort on it.&lt;/p&gt;





&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;That’s actually one of the reasons why I chose to work on
the scalability issues. Single CPU configurations do not scale well. Parallel
processing may be the way to go. I already have some promising results. Now the
problem is where I can find a cluster with 20 or more machines to finish my
case study.&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;br&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;Here is some background about the figure, only for those who are interested:&lt;br&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;o:p&gt;&lt;/o:p&gt;The figure here shows how much time DynaMIT needs to run a
simulation of the Los Angeles
for a six-hour morning peak period on a typical day. &lt;/li&gt;&lt;li&gt;&lt;o:p&gt;&lt;/o:p&gt;All tests were performed on our server with an Intel Pentium
4 CPU of 3.6 GHz. The server has 2 GB main memory, but it is
not critical here because the simulation would need less than 200 MB for this
network. &lt;/li&gt;&lt;li&gt;&lt;o:p&gt;&lt;/o:p&gt;The server runs on Fedora Core 3 (Heidelberg). In all cases DynaMIT was
compiled by GNU g++ 3.4.4 with “-O3” flag and the debugging and profiling code
was included.&lt;/li&gt;&lt;li&gt;&lt;o:p&gt;&lt;/o:p&gt;The runtime was collected from the “user CPU time” returned
by the “time” command. &lt;span&gt;&lt;/span&gt;(The difference between the
elapsed real time and the user CPU time was generally between 20~25 seconds.)&lt;/li&gt;&lt;li&gt;In each test the run were replicated for at least five times
and the averaged runtime was used. (The deviation was not significant,
though.)&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;o:p&gt;&lt;/o:p&gt;While DynaMIT is a stochastic system and random numbers are
used in the simulation, all these tests have the same fixed seed for the random
number generator. This makes the results replicable.&lt;/li&gt;&lt;li&gt;&lt;o:p&gt;&lt;/o:p&gt;The scenario we used in those tests was the simulation on a
calibrated network of the south park area in downtown LA, California. Archival real sensor data from
the field was used in a simulate environment to mimic the real-time data feed.&lt;/li&gt;&lt;li&gt;&lt;o:p&gt;&lt;/o:p&gt;DynaMIT operates in a rolling-horizon mode for real-time
(on-line) applications. In the runtime tests we chose to use 15-minute
estimation intervals, which were deemed appropriate for this network. Every 15
minutes, sensor data for the past 15 minutes was made available to DynaMIT,
which fused it with historical information and tried to generate an unbiased
estimate of the state of the whole network. While in a real case study we often
use three or more iterations for this state estimation stage, in this run-time
tests we only used one estimation iteration per horizon. For each horizon, when
the state estimation finished, two 30-minute state prediction iterations were
run to generate predictive travel time information and route guidance. Consequently,
for each 15-minute interval in our simulation period, we would need to simulate
15+30*2=75 minutes (combining the estimation and prediction stages).&lt;/li&gt;&lt;li&gt;&lt;a href="http://web.mit.edu/wenyang/www/tiddlywiki_yw.htm#%5B%5BDynaMIT%20at%20LA%5D%5D"&gt;My wiki&lt;/a&gt; has more details about the LA network, and a &lt;a href="http://web.mit.edu/wenyang/www/DynaMIT_LA_new3.htm"&gt;flash demo&lt;/a&gt; made a long time ago (for other purposes).&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;



























&lt;br&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=67298" width="1" height="1"&gt;</description></item><item><title>First build of DynaMIT (exe) on Windows</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2006/06/03/58141.aspx</link><pubDate>Sat, 03 Jun 2006 05:23:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:58141</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/58141.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=58141</wfw:commentRss><description>After spending quite a few efforts on bison++ and flex++, I've come to a successful build of DynaMIT on WinXP, finally.&lt;br&gt;Build with g++ 3.4.2 on mingw. The size of executable is about 22 M (after using "strip", I reduce its size to about 2.8M). &lt;br&gt;&lt;br&gt;I do not have time to test it for now, though.&lt;br&gt;&lt;br&gt;===============================================================&lt;br&gt;Reading specs from D:/MinGW/bin/../lib/gcc/mingw32/3.4.2/specs&lt;br&gt;Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw&lt;br&gt;--enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared&lt;br&gt;--enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug&lt;br&gt;--enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug&lt;br&gt;Thread model: win32&lt;br&gt;gcc version 3.4.2 (mingw-special)&lt;br&gt;===============================================================&lt;br&gt;&lt;br&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=58141" width="1" height="1"&gt;</description></item><item><title>Using SED and AWK to find total demand from an origin for a certain time interval</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2005/09/22/18717.aspx</link><pubDate>Fri, 23 Sep 2005 03:55:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:18717</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/18717.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=18717</wfw:commentRss><description>&lt;p&gt;Example1:&lt;/p&gt;
&lt;p&gt;# sed -n '/&lt;strong&gt;&lt;em&gt;21600 1 4&lt;/em&gt;&lt;/strong&gt;/, /^}/ {/^{/p;}' demand.dat &amp;gt; test1&lt;/p&gt;
&lt;p&gt;# awk '$2 == "11220" { x += $4 } END { print "total flow per interval: " x "\ntotal flow per hour: " x*4}' test1&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Note:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In the first line, &lt;em&gt;21600&lt;/em&gt; is the time stamp, &lt;em&gt;1&lt;/em&gt; is the type, &lt;em&gt;4&lt;/em&gt; is the scale. 
&lt;/li&gt;&lt;li&gt;In the second line, &lt;em&gt;11220&lt;/em&gt; is the Node ID.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Example2:&lt;/p&gt;
&lt;p&gt;# awk -f count_orig.awk orig=11220 Demand/demand_newpath_Xhat_0600.dat&lt;/p&gt;
&lt;p&gt;Use script count_orig.awk, whose contain is the following:&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;br /&gt;$2 == orig { x += $4; print $2 "\t" $3 "\t" $4 }&lt;/p&gt;
&lt;p&gt;END { print "total flow per interval: " x "\ntotal flow per hour: " x*4}&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p dir="ltr" style="MARGIN-RIGHT: 0px"&gt;Note: "Demand/demand_newpath_Xhat_0600.dat" is the demand file for 6am.&lt;/p&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=18717" width="1" height="1"&gt;</description></item><item><title>Open source MITSIMLab</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2005/09/22/18705.aspx</link><pubDate>Thu, 22 Sep 2005 22:24:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:18705</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/18705.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=18705</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://mit.edu/its/MITSIMLabOS.html"&gt;http://mit.edu/its/MITSIMLabOS.html&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=18705" width="1" height="1"&gt;</description></item><item><title>Run matlab in batch mode</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2005/05/17/12701.aspx</link><pubDate>Tue, 17 May 2005 23:56:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:12701</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/12701.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=12701</wfw:commentRss><description>&lt;p&gt;Use option "-r MATLAB_command" to run matlab in batch mode. &lt;/p&gt;
&lt;p&gt;Automatically run the specified MATLAB M-file, either commands supplied with MATLAB or your own M-files, immediately after MATLAB starts. This is also referred to as calling MATLAB in batch mode. Separate multiple commands with commas or semicolons (;). M-files must be on the MATLAB path or in the MATLAB startup directory. Do not include the pathname or a file extension. &lt;/p&gt;
&lt;p&gt;Example: matlab -nojvm -nosplash -r MyCommand &lt;/p&gt;
&lt;p&gt;Reference: &lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/start_q4.html"&gt;MATLAB Documentation - Desktop Tools and Development Environment - Startup Options&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;We can now use "system" (need to include &amp;lt; cstdlib &amp;gt;) to call a shell-script, which in turn calls matlab to do something. &lt;/p&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=12701" width="1" height="1"&gt;</description></item><item><title>[Script] run DynaMIT, check runtime</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2005/05/01/11550.aspx</link><pubDate>Sun, 01 May 2005 23:11:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:11550</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/11550.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=11550</wfw:commentRss><description>&lt;blockquote&gt;&lt;pre&gt;&lt;span class="comment"&gt;#!/bin/&lt;/span&gt;&lt;span class="keyword"&gt;bash&lt;/span&gt;&lt;span class="comment"&gt;
&lt;/span&gt;&lt;span class="builtin"&gt;echo&lt;/span&gt; &lt;span class="string"&gt;'=== Running CorbaFreeDynaMIT from current directory ==='&lt;/span&gt;
&lt;span class="variable-name"&gt;STARTTime&lt;/span&gt;=&lt;span class="string"&gt;`date`&lt;/span&gt;
&lt;span class="builtin"&gt;echo&lt;/span&gt; &lt;span class="string"&gt;'Preparing to delete __* files in current directory and all sub directory'&lt;/span&gt;
ls __e*
&lt;span class="keyword"&gt;if&lt;/span&gt; [ $&lt;span class="variable-name"&gt;?&lt;/span&gt; = 0 ]
&lt;span class="keyword"&gt;then&lt;/span&gt; 
    &lt;span class="builtin"&gt;echo&lt;/span&gt; -n &lt;span class="string"&gt;"Really want to remove these files? (y/n):"&lt;/span&gt;
    &lt;span class="builtin"&gt;read&lt;/span&gt; yesORno
    &lt;span class="keyword"&gt;if&lt;/span&gt; [ $&lt;span class="variable-name"&gt;yesORno&lt;/span&gt; = y -o $&lt;span class="variable-name"&gt;yesORno&lt;/span&gt; = Y ]
        &lt;span class="keyword"&gt;then&lt;/span&gt;
        &lt;span class="builtin"&gt;echo&lt;/span&gt; &lt;span class="string"&gt;'find . -maxdepth 1 -name "__*" -exec rm -v {} \;'&lt;/span&gt;
        find . -maxdepth 1 -name &lt;span class="string"&gt;"__e*"&lt;/span&gt; -exec rm -v {} &lt;span class="string"&gt;\;&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class="builtin"&gt;echo&lt;/span&gt; &lt;span class="string"&gt;"Files removed."&lt;/span&gt;
    &lt;span class="keyword"&gt;else&lt;/span&gt;
        &lt;span class="builtin"&gt;echo&lt;/span&gt; &lt;span class="string"&gt;"You did not choose 'y'. Continue without deleting"&lt;/span&gt;
    &lt;span class="keyword"&gt;fi&lt;/span&gt;
&lt;span class="keyword"&gt;fi&lt;/span&gt;
time ~/CorbaFreeDynaMIT/DynaMIT/DynaMIT dtaparam.dat
&lt;span class="builtin"&gt;echo&lt;/span&gt; &lt;span class="string"&gt;'Script'&lt;/span&gt; $&lt;span class="variable-name"&gt;0&lt;/span&gt; &lt;span class="string"&gt;'started at: '&lt;/span&gt; $&lt;span class="variable-name"&gt;STARTTime&lt;/span&gt;
&lt;span class="builtin"&gt;echo&lt;/span&gt; -n &lt;span class="string"&gt;'Script'&lt;/span&gt; $&lt;span class="variable-name"&gt;0&lt;/span&gt; &lt;span class="string"&gt;'finished at: '&lt;/span&gt;&amp;amp;&amp;amp; date
&lt;span class="builtin"&gt;echo&lt;/span&gt; &lt;span class="string"&gt;'Done.'&lt;/span&gt;

&lt;/pre&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=11550" width="1" height="1"&gt;</description></item><item><title>nohup - run a command immune to hangups, with output to a non-tty</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2005/05/01/11549.aspx</link><pubDate>Sun, 01 May 2005 23:03:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:11549</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/11549.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=11549</wfw:commentRss><description>&lt;p&gt;In bash, use &lt;/p&gt;
&lt;p align="center"&gt;&lt;em&gt;&lt;strong&gt;nohup&lt;/strong&gt; ~/CorbaFreeDynaMIT/DynaMIT/DynaMIT dtaparam.dat 1&amp;gt;log_stdout 2&amp;gt;log_stderr &amp;amp;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=11549" width="1" height="1"&gt;</description></item><item><title>DynaMIT demo steps (By rama, 3/15)</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2005/05/01/11548.aspx</link><pubDate>Sun, 01 May 2005 22:55:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:11548</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/11548.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=11548</wfw:commentRss><description>&lt;p&gt;1. Login as demo &lt;/p&gt;
&lt;p&gt;2. Cd to 'irvine'.&lt;/p&gt;
&lt;p&gt;3. Create another xterm for his directory:&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;em&gt;xterm &amp;amp;&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;4. In one window, run:&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;em&gt;./DynaMIT dtaparam.dat&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;[notice the ./]&lt;/p&gt;&lt;/blockquote&gt;
&lt;p dir="ltr"&gt;5. Wait until DynaMIT starts reading socio-eco file. Then, in the other window, type:&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p dir="ltr"&gt;&lt;em&gt;./xdta -f xdta.ini&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;6. Click clock button first, in the control panel. Then choose density for color and thickness in the network view window. Expand/zoom the time horizon.&lt;/p&gt;
&lt;p&gt;7. Make control panel window the active window (click on the top window bar).&lt;/p&gt;
&lt;p&gt;8. Demo should run now on its own. Explain the basic DynaMIT functions and capabilities.&lt;br /&gt;&lt;/p&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=11548" width="1" height="1"&gt;</description></item><item><title>reopen fstreams, bug?</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2004/04/14/529.aspx</link><pubDate>Wed, 14 Apr 2004 04:12:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:529</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/529.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=529</wfw:commentRss><description>&lt;p&gt;Re-open a fstream may fail... call clear() between close() and open()!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#4_4_iostreamclear"&gt;http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#4_4_iostreamclear&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=529" width="1" height="1"&gt;</description></item><item><title>Suggestions about Improving Efficiency (gcc)</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2004/04/14/528.aspx</link><pubDate>Wed, 14 Apr 2004 04:05:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:528</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/528.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=528</wfw:commentRss><description>&lt;p&gt;During the migration of CorbaFreeDynaMIT, we have noticed that some previous code may more or less decrease the efficiency. We are not talking about the algorithm at this time, though it should be more critical and significant. &lt;/p&gt;
&lt;p&gt;Anyway, here are a few "rules of thumb" to avoid defect. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Remove unnecessary code from loop. For example, making a function call to check the size of a list during the loop can be taken out of the loop if the size is not going to change during the loop. 
&lt;/li&gt;&lt;li&gt;Use header files properly.To minimize the time we have to wait on the compiler, it's good to only include the headers we really need. Many people simply include iostream when they don't need to -- and that can penalize the runtime as well. (&lt;a href="http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10"&gt;http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10&lt;/a&gt;) 
&lt;/li&gt;&lt;li&gt;Use "\n" in output stream other than std::endl whenever possible. std::endl not only sends out a new line, but also flush the stream, sending out the output immediately, and the buffer is lost. The next time we add something to the stream, we have to re-allocate the buffer, which is time-consuming and ususally unnecessary.&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=528" width="1" height="1"&gt;</description></item><item><title>Notes to Migration of CorbaFreeDynaMIT (6)</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2004/04/14/527.aspx</link><pubDate>Wed, 14 Apr 2004 04:03:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:527</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/527.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=527</wfw:commentRss><description>&lt;p&gt;&lt;font size="5"&gt;Iterators&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Iterators are a generalization of pointers: they are objects that point to other objects. In most situations we could instead use a pointer when an iterator is required, and even under some circumstance, the compiler will actually optimize iterators into pointers when creating the object codes. Iterators, however, are not necessarily implemented by pointers. For example, vector&lt;t&gt;::iterator is not T*; string::iterator is not char*. Hence converting iterators to pointers is considered dangerous, and is likely to make our code broken.&lt;/t&gt;&lt;/p&gt;
&lt;p&gt;The STL offers several predefined iterators, with different behavior. For example, the input iterators only guarantee read access. Selecting the correct type of iterators is one of the tasks we must face when migrating CorbaFreeDynaMIT.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Where does it occur? &lt;/strong&gt;Most classes that use STL containers (vectors, pair, etc.) For example, in the getODID member function of class dtaMappingOD, using a writable iterator will cause an error: "invalid conversion from 'const idlOrigDestID* const' to 'idlOrigDestID*'."&lt;/p&gt;
&lt;p&gt;Another example is we should not test whether a iterator is null pointer or not. The following code is invalid:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;std::vector&lt;float dtastlalloc=""&gt;::iterator jIterator;&lt;/float&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;for( jIterator= iIterator-&amp;gt;begin(); jIterator != iIterator-&amp;gt;end(); &lt;/em&gt;&lt;em&gt;jIterator++ ) &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;{&lt;/em&gt;&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p&gt;&lt;em&gt;if( jIterator ) { // i.e., if (jIterator != NULL )&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;// do something...&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;}&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;strong&gt;How to fix:&lt;/strong&gt; Use &lt;em&gt;const_iterator&lt;/em&gt; instead of the default &lt;em&gt;iterator&lt;/em&gt;, and avoid unnecessary type conversion. Make sure we have include the proper header file, i.e., &lt;em&gt;&lt;iterator&gt;&lt;/iterator&gt;&lt;/em&gt;&lt;/p&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=527" width="1" height="1"&gt;</description></item><item><title>Notes to Migration of CorbaFreeDynaMIT (5)</title><link>http://blogs.mit.edu/CS/blogs/wenyang/archive/2004/04/14/526.aspx</link><pubDate>Wed, 14 Apr 2004 04:02:00 GMT</pubDate><guid isPermaLink="false">dea6705e-d99c-4a22-9533-aabb455eb28d:526</guid><dc:creator>wenyang</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.mit.edu/CS/blogs/wenyang/comments/526.aspx</comments><wfw:commentRss>http://blogs.mit.edu/CS/blogs/wenyang/commentrss.aspx?PostID=526</wfw:commentRss><description>&lt;p&gt;&lt;font size="5"&gt;2.4 Stream formatting&lt;br /&gt;&lt;/font&gt;The formating of stream is controled by so-called "flags". In the new c++ library, the data type for flags, defined as "__fmtflags" or "std::_Ios_Fmtflags" by the &lt;em&gt;typedef &lt;/em&gt;statement, is in fact &lt;em&gt;unsigned long&lt;/em&gt; integer.&lt;/p&gt;
&lt;p&gt;For many member functions of the stream classes in STL, such as &lt;em&gt;setf &lt;/em&gt;and &lt;em&gt;flags&lt;/em&gt;, their arguments and/or return values are consequently of &lt;em&gt;unsigned long&lt;/em&gt; type.&lt;/p&gt;
&lt;p&gt;If we want to pass other types of data to those functions, we will have to cast (force type conversion) the data to &lt;em&gt;unsigned long&lt;/em&gt;. In some situation, that might cause a problem.&lt;/p&gt;
&lt;p&gt;Moreover, some functions in the stream classes change their definition. For instance, &lt;em&gt;istream::unsetf&lt;/em&gt; no longer returns any value. We need to modify our code to adapt these changes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Where does it occur?&lt;/strong&gt; class Reader.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to fix:&lt;/strong&gt; We can either stick to our original data type, which is &lt;em&gt;long&lt;/em&gt;, and use cast back and forth wherever it is needed, or change the function definition of our classes.&lt;/p&gt;
&lt;p&gt;Changing public member function definitions for a class is error-prone and seldom suggested because it will change the interface of the class and thus might potentially affect all its clients, which make use of those public member functions.&lt;/p&gt;
&lt;p&gt;Therefore currently we choose the first approach. We admit that conversion between &lt;em&gt;unsigned long&lt;/em&gt; to &lt;em&gt;long&lt;/em&gt; integers may cause some problem. In the long run we might still consider using the second approach.&lt;/p&gt;&lt;img src="http://blogs.mit.edu/CS/aggbug.aspx?PostID=526" width="1" height="1"&gt;</description></item></channel></rss>