Friday, 30 November 2012
Friday, 17 August 2012
Strategy Simulation
Strategy Simulation is to solve:
(1) Predictable Congestion
(2) Unpredictable Incidents
=================
WHY Congestions?
(1) Drivers' decisions conflict with each other.
Mode Choice, Departure Time, Route Choice.
(2) Capacity is limited.
Speed - Density - Function => Low Speed & Low Flow
(3) What should be done.
Gradually guide people outside.
Something:
(1) We know WHY Congestion Happen.
(2) Number of Vehicles - << Estimation Function -<< Simulation Prove;
(3) Balance between Level-of-Service and Diverge-Count;
(4) Both Sources (More) & Destinations
================
WHY Incidents?
(1) Something wrong happen?
Something:
================
(1) There are some delays, things already happen.
(2) Both Sources & Destinations (More)
(1) Predictable Congestion
(2) Unpredictable Incidents
=================
WHY Congestions?
(1) Drivers' decisions conflict with each other.
Mode Choice, Departure Time, Route Choice.
(2) Capacity is limited.
Speed - Density - Function => Low Speed & Low Flow
(3) What should be done.
Gradually guide people outside.
Something:
(1) We know WHY Congestion Happen.
(2) Number of Vehicles - << Estimation Function -<< Simulation Prove;
(3) Balance between Level-of-Service and Diverge-Count;
(4) Both Sources (More) & Destinations
================
WHY Incidents?
(1) Something wrong happen?
Something:
================
(1) There are some delays, things already happen.
(2) Both Sources & Destinations (More)
Sunday, 12 August 2012
GIT
1. 三种状态
代码态: -> git add
索引态: -> git commit
仓库态:
2. 对比修改
1. git diff: 查看 代码态 和 索引态 的不同;
回答:有什么修改的东西,还不在跟踪行列
2. git status: 获取整体改动的信息
Changed but not updated
已经修改了但还未 git add 的内容
Changes to be committed
已经 git add 但还未 git commit 的内容
Untracked files
增加了新文件或者在某个子目录下增加了新文件
3. 提交 git commit -a
git commit -a,这个命令可以直接提交所有修改,省去了你 git add 和 git diff 和 git
commit 的工序,可谓一条龙服务。
但是,此处有一点应该注意,那就是 git commit -a 无法把新增文件或文件夹加入进来,所以,如果你新增了文件或文件夹,那么就要老老实实的先 git add .,再 git commit 喽
4. 版本控制
git checkout experimental
复制当前branch,命名为experimental
5.合并
确保自己处于master branch
git merge XXX
6. 冲突
CONFLICT
注意:即时有冲突,实际的merge也已经结束;
需要做的是,修改master上的冲突;
然后,提交commit;
7. 删除分支
git branch -d experimental Check 是否merge
git branch -D experimental 强制删除
8. 新建GIT
#cd myproject
#git init
#git add .
#git commit
9. 小结
按我的认识,更清楚且通俗的解释就是:git 维护的代码分成三部分,“当前工作目录”<->“index file”<->git 仓库。
git commit 会将 index file 中的改变写到 git 仓库;git add 会将“当前工作目录”的改变写到“index file”;“commit -a”则
会直接将“当前工作目录”的改动同时写到“index file”和“git 仓库”。
而 git diff 的使用稍微有些复杂,大家可以看看 Lee.MaRS 对于这个命令非常精彩的分析(蓝色字部分):(在此非常
感谢 Lee.MaRS)
将 Current working directory 记为 (1)
将 Index file 记为 (2)
将 Git repository 记为 (3)
他们之间的提交层次关系是 (1) -> (2) -> (3)
git add 完成的是(1) -> (2)
git commit 完成的是(2) -> (3)
git commit -a 两者的直接结合
从时间上看,可以认为(1)是最新的代码,(2)比较旧,(3)更旧
按时间排序就是 (1) <- (2) <- (3)
git diff 得到的是从(2)到(1)的变化
git diff –cached 得到的是从(3)到(2)的变化
git diff HEAD 得到的是从(3)到(1)的变化
代码态: -> git add
索引态: -> git commit
仓库态:
2. 对比修改
1. git diff: 查看 代码态 和 索引态 的不同;
回答:有什么修改的东西,还不在跟踪行列
2. git status: 获取整体改动的信息
Changed but not updated
已经修改了但还未 git add 的内容
Changes to be committed
已经 git add 但还未 git commit 的内容
Untracked files
增加了新文件或者在某个子目录下增加了新文件
3. 提交 git commit -a
git commit -a,这个命令可以直接提交所有修改,省去了你 git add 和 git diff 和 git
commit 的工序,可谓一条龙服务。
但是,此处有一点应该注意,那就是 git commit -a 无法把新增文件或文件夹加入进来,所以,如果你新增了文件或文件夹,那么就要老老实实的先 git add .,再 git commit 喽
4. 版本控制
git checkout experimental
复制当前branch,命名为experimental
5.合并
确保自己处于master branch
git merge XXX
6. 冲突
CONFLICT
注意:即时有冲突,实际的merge也已经结束;
需要做的是,修改master上的冲突;
然后,提交commit;
7. 删除分支
git branch -d experimental Check 是否merge
git branch -D experimental 强制删除
8. 新建GIT
#cd myproject
#git init
#git add .
#git commit
9. 小结
按我的认识,更清楚且通俗的解释就是:git 维护的代码分成三部分,“当前工作目录”<->“index file”<->git 仓库。
git commit 会将 index file 中的改变写到 git 仓库;git add 会将“当前工作目录”的改变写到“index file”;“commit -a”则
会直接将“当前工作目录”的改动同时写到“index file”和“git 仓库”。
而 git diff 的使用稍微有些复杂,大家可以看看 Lee.MaRS 对于这个命令非常精彩的分析(蓝色字部分):(在此非常
感谢 Lee.MaRS)
将 Current working directory 记为 (1)
将 Index file 记为 (2)
将 Git repository 记为 (3)
他们之间的提交层次关系是 (1) -> (2) -> (3)
git add 完成的是(1) -> (2)
git commit 完成的是(2) -> (3)
git commit -a 两者的直接结合
从时间上看,可以认为(1)是最新的代码,(2)比较旧,(3)更旧
按时间排序就是 (1) <- (2) <- (3)
git diff 得到的是从(2)到(1)的变化
git diff –cached 得到的是从(3)到(2)的变化
git diff HEAD 得到的是从(3)到(1)的变化
Wednesday, 11 July 2012
Wednesday, 4 July 2012
Search VIM
1
2.
3.
dd or :d Delete the current line. Again, you don't need to highlight it first.
4.
Vim command | Action |
/pattern | Search the file for pattern. |
n | Scan for next search match in the same direction. |
N | Scan for next search match but opposite direction. |
2.
Replace | |
Vim command | Action |
:rs/foo/bar/a | Substitute foo with bar. r determines the range and a determines the arguments. |
The range (r) can be | |
nothing | Work on current line only. |
number | Work on the line whose number you give. |
% | The whole file. |
Arguments (a) can be | |
g | Replace all occurrences in the line. Without this, Vim replaces only the first occurrences in each line. |
i | Ignore case for the search pattern. |
I | Don't ignore case. |
c | Confirm each substitution. You can type y to substitute this match, n to skip this match, a to substitute this and all the remaining matches ("Yes to all"), and q to quit substitution. |
Examples | |
:452s/foo/bar/ | Replace the first occurrence of the word foo with bar on line number 452. |
:s/foo/bar/g | Replace every occurrence of the word foo with bar on current line. |
:%s/foo/bar/g | Replace every occurrence of the word foo with bar in the whole file. |
:%s/foo/bar/gi | The same as above, but ignore the case of the pattern you want to substitute. This replaces foo, FOO, Foo, and so on. |
:%s/foo/bar/gc | Confirm every substitution. |
:%s/foo/bar/c | For each line on the file, replace the first occurrence of foo with bar and confirm every substitution. |
3.
dd or :d Delete the current line. Again, you don't need to highlight it first.
4.
VIM
:w filename | Save changes to a file. If you don't specify a file name, Vim saves as the file name you were editing. For saving the file under a different name, specify the file name. |
:q | Quit Vim. If you have unsaved changes, Vim refuses to exit. |
:q! | Exit Vim without saving changes. |
:wq | Write the file and exit. |
Sunday, 1 July 2012
Tuesday, 26 June 2012
CMake
CMake is a sophisticated, cross-platform, open-source build system
developed by Kitware in 2001. CMake is the name used to refer to the
entire family of tools: CMake, CTest, CDash, and CPack. These tools are
used to…
http://mathnathan.com/2010/07/11/getting-started-with-cmake/
CMake simplifies the potentially monstrous build system into a few easy to write files. It is targeted towards C and C++ and is usable with various compiler/OS support. At the risk of over simplifying things, CMake looks at your project and sees a ‘file system’. You tell it where all your files are at, what you want it to do with them, and it does it. In a nut shell it’s really that easy. More elaborately however, CMake is wonderful for it’s design to support complex directory hierarchies. When you use CMake it will locate include files, libraries, executables, other optional build directives, then link everything for you. No more messy Makefiles.
CMake basically requires one thing, a CMakeLists.txt file. We’ll start with a simple example.
Here is a very simple program I wrote in C called fib.c which lists the Fibonacci Sequence up to a given value. That value is passed to the main function when it is called.
- CMake – An intelligent build system used to build simple, to very elaborate projects.
- CTest, CDash – These are used to test and debug your projects.
- CPack – A packaging tool that finalizes your project for distribution.
http://mathnathan.com/2010/07/11/getting-started-with-cmake/
CMake simplifies the potentially monstrous build system into a few easy to write files. It is targeted towards C and C++ and is usable with various compiler/OS support. At the risk of over simplifying things, CMake looks at your project and sees a ‘file system’. You tell it where all your files are at, what you want it to do with them, and it does it. In a nut shell it’s really that easy. More elaborately however, CMake is wonderful for it’s design to support complex directory hierarchies. When you use CMake it will locate include files, libraries, executables, other optional build directives, then link everything for you. No more messy Makefiles.
CMake basically requires one thing, a CMakeLists.txt file. We’ll start with a simple example.
Here is a very simple program I wrote in C called fib.c which lists the Fibonacci Sequence up to a given value. That value is passed to the main function when it is called.
# include "stdio.h" # include "stdlib.h" int main( int argc, char** argv) { if ( argc > 2 || argc == 1 ) { printf("Fibonacci takes one postitive integer greater\ than two as it's argument\n"); return EXIT_SUCCESS; } int a, b; a = 0; b = 1; printf( "%d", b ); for( int i = 0; i + a <= atof( argv[1] ); b = i ) { i = a + b; a = b; printf( ", %d", i ); } printf("\n"); return EXIT_SUCCESS; }So let's say you'd like to compile this and give it a go. We could just compile it directly with one line...
gcc -std=c99 fib.cNotice we need a -std flag. We set it to c99 because loop initial declarations are only allowed in c99 mode. Alternatively you could just change that in your gcc compiler to use by default. Another option would be to use a Makefile..... Nah... Or we could use CMake. I declare the winner to be CMake.
Download
Let's make sure we have CMake on our systems, I'm using Ubuntu 10.04.sudo apt-get install cmake cmake-curses-guiThe cmake-curses-gui provides a somewhat-helpful-gui (a lot like the Windows version) if that's what you're into. There is pretty much no setup required here, we just need to make our CMakeLists.txt file in the main directory of our project, then run CMake from our build folder.
Setup Project
fib is the name of the folder/main directory, where the fib.c file is, as well as the soon to be disclosed CMakeLists.txt file. It's a good programming practice to do all of your builds in a build folder. Not doing so clutters your project folder with a bunch of confusing files. You'll see this after we run cmake. So let's set this up.mkdir /where/you/want/your/project/fib cd fib mkdir buildSo this is what your project file system looks like.
fib / buildNow use your favorite text editor (should be vim ) to create your own fib.c file, as well as a CMakeLists.txt file in your fib directory.
CMake Syntax
Here is the CMakeLists.txt file used to compile the fib.c program.#Specify the version being used aswell as the language cmake_minimum_required(VERSION 2.6 C) #Name your project here project(fibonacci) #Sends the -std=c99 flag to the gcc compiler add_definitions(-std=c99) #This tells CMake to fib.c and name it fibonacci add_executable(fibonacci fib.c)The basic syntax of CMake consists of three things; comments, commands, and white spaces. A comment is made by beginning a line with the '#' character
#Chocolate Curry is my favoriteAnd a command is constructed with the command name, opening parenthesis, whitespace separated arguments, and a closing parenthesis.
command(arg1 agr2 agr3 ...)The basic data type in CMake is a string. You can even create lists of strings using the set command.
set(VAR a b c)This creates variable VAR which is composed of three strings a, b, and c. Referencing a variable should look familiar to most of you. ${VAR} is the correct syntax to refer to the list of strings VAR at a later time. For instance these three command calls are the same.
command(${VAR}) command(a b c) command(a;b;c)You can also separate strings with semicolons. Placing quotations around anything will allow it to be read as a string. For instance, the following command
command("${VAR}")will read in "${VAR}" not "a b c". CMake syntax also provides some useful flow control options. First is the if else logic structure.
# some_command will be called if the variable's value is not: # empty, 0, N, NO, OFF, FALSE, NOTFOUND, or -NOTFOUND. if(var) some_command(...) endif(var)They also provide looping commands, foreach and while.
set(VAR a b c) # loop over a, b,c with the variable f foreach(f ${VAR}) message(${f}) endforeach(f)Simple function and macro constructions are also supported.
# define a macro hello macro(hello MESSAGE) message(${MESSAGE}) endmacro(hello) # call the macro with the string "hello world" hello("hello world") # define a function hello function(hello MESSAGE) message(${MESSAGE}) endfunction(hello)Lastly CMake also supports all of your common Regular Expressions
- ^ Matches at beginning of a line or string
- $ Matches at end of a line or string
- . Matches any single character other than a newline
- [ ] Matches any character(s) inside the brackets
- [^ ] Matches any character(s) not inside the brackets
- [-] Matches any character in range on either side of a dash
- * Matches preceding pattern zero or more times
- + Matches preceding pattern one or more times
- ? Matches preceding pattern zero or once only
- () Saves a matched expression and uses it in a later replacement
Building The Project
So back to the CMakeLists.txt file to build our example#Specify the version being used aswell as the language cmake_minimum_required(VERSION 2.6 C) #Name your project here project(fibonacci) #Sends the -std=c99 flag to the gcc compiler add_definitions(-std=c99) #This tells CMake to fib.c and name it fibonacci add_executable(fibonacci fib.c)CMake is case insensitive, thus it does not distinguish between command() and COMMAND(). I prefer all lowercase because it is faster to type. so here is the breakdown of the CMakeLists.txt
- cmake_minimum_required(VERSION 2.6 C) - This signifies the version of CMake that you're using and allows you to pass the language into documentation.
- project(fibonacci) - This allows you to name your project and you can later on refer to the project as a whole using this string.
- add_definitions(-std=c99) - This command sends arguments to the compiler, which CMake will choose for you unless otherwise told so.
- add_executable(fibonacci fib.c) - This does the magic. Here CMake takes fib.c, and using all of the libraries it was handed (none in this simple example) compiles it into the output file named fibonacci.
cmake ..The ' .. ' argument is the same as the one used in BASH, it tells CMake to execute from the CMakeLists.txt in the previous directory. This call just produced your Makefile, so let's finish it off with the last command.
makeNow if you ls into the build folder you'll see all kinds of stuff.
- CMakeCache.txt - Think of this as a configuration file. It has many advanced settings to optimize the build process for large projects. (Such as building the Linux Kernel! )
- CMakeFiles (directory) - This has a lot of the stuff CMake uses under the hood to build your project. I recommend you poke around through there and take a look at stuff...
- cmake_install.cmake - Your install file. We didn't use one in this program.
- fibonacci - Hooray it's our program!
- Makefile - remember your last command 'make'? This is the Makefile produced by Cmake, this is really what it all came down to.
Monday, 25 June 2012
Make
1. 组成部分:
注释,依赖,命令,(循环依赖),宏定义,宏定义外置;
2. Example:
http://www.opussoftware.com/tutorial/TutMakefile.htm
注释,依赖,命令,(循环依赖),宏定义,宏定义外置;
2. Example:
http://www.opussoftware.com/tutorial/TutMakefile.htm
# This makefile compiles the project listed in the PROJ macro # PROJ = project # the name of the project OBJS = main.obj io.obj # list of object files# Configuration: # MODEL = s # memory model CC = bcc # name of compiler# Compiler-dependent section # %if $(CC) == bcc # if compiler is bcc CFLAGS = –m$(MODEL) # $(CFLAGS) is –ms LDSTART = c0$(MODEL) # the start-up object file LDLIBS = c$(MODEL) # the library LDFLAGS = /Lf:\bc\lib # f:\bc\lib is library directory %elif $(CC) == cl # else if compiler is cl CFLAGS = –A$(MODEL,UC) # $(CFLAGS) is –AS LDSTART = # no special start-up LDLIBS = # no special library LDFLAGS = /Lf:\c6\lib; # f:\c6\lib is library directory %else # else % abort Unsupported CC==$(CC) # compiler is not supported %endif # endif# The project to be built # $(PROJ).exe : $(OBJS) tlink $(LDSTART) $(OBJS), $(.TARGET),, $(LDLIBS) $(LDFLAGS)$(OBJS) : incl.h
Thursday, 21 June 2012
Show the List of Installed Packages on Ubuntu or Debian
Show the List of Installed Packages on Ubuntu or Debian
While working on the instructions for compiling MonoDevelop from source, I relied heavily on the dpkg and apt-cache commands to tell me what was already installed vs what packages were available in the repository. After completing that article it occurred to me that I should explain how to show what packages are currently installed… so here we are.
The command we need to use is dpkg –get-selections, which will give us a list of all the currently installed packages.
$ dpkg --get-selections adduser install alsa-base install alsa-utils install apache2 install apache2-mpm-prefork install apache2-utils install apache2.2-common install apt install apt-utils install
The full list can be long and unwieldy, so it’s much easier to filter through grep to get results for the exact package you need. For instance, I wanted to see which php packages I had already installed through apt-get:
dpkg --get-selections | grep phplibapache2-mod-php5 install php-db install php-pear install php-sqlite3 install php5 install php5-cli install php5-common install php5-gd install php5-memcache install php5-mysql install php5-sqlite install php5-sqlite3 install php5-xsl install
For extra credit, you can find the locations of the files within a package from the list by using the dpkg -L command, such as:
dpkg -L php5-gd /. /usr /usr/lib /usr/lib/php5 /usr/lib/php5/20060613 /usr/lib/php5/20060613/gd.so /usr/share /usr/share/doc /etc /etc/php5 /etc/php5/conf.d /etc/php5/conf.d/gd.ini /usr/share/doc/php5-gd
Now I can take a look at the gd.ini file and change some settings around…
Wednesday, 20 June 2012
How to read code
1. Target: In order to read Code DynaMIT.
2. Tools: Source Insight
3. Understand: Wiki
4. Target Today: Understand the work flow and answer questions related with performance
2. Tools: Source Insight
3. Understand: Wiki
4. Target Today: Understand the work flow and answer questions related with performance
Sunday, 17 June 2012
Design and Implementation of Large-Scale Distributed Agent-based Transportation Simulation
0. Introduction
1. Agent-based Structure
2. Road Network Partitioning
3. Boundary Processing
4. Communication and Synchronization
Rules:
(1) Based on MPI&Cluster
(2) Group Discussion > one-by-one
(3) Proxy and Buffer
(4) Off-line Storage & Communication
5. Experiments and Analysis
6. Conclusion
1. Agent-based Structure
2. Road Network Partitioning
3. Boundary Processing
4. Communication and Synchronization
Rules:
(1) Based on MPI&Cluster
(2) Group Discussion > one-by-one
(3) Proxy and Buffer
(4) Off-line Storage & Communication
5. Experiments and Analysis
6. Conclusion
Thursday, 14 June 2012
Monday, 4 June 2012
Saturday, 2 June 2012
男士服装学习
第一个:佐丹奴(GIORDANO)
休闲,中等价格
比较喜欢,裤子休闲,价格在20-50新币左右
休闲,中等价格
比较喜欢,裤子休闲,价格在20-50新币左右
第二个:G2000 (U2)
都市生活,活力干练
中等价格
心态而非年龄,追求品位,中高档价位
款式设计风格并非适合我;
第四个:JACK&JONES 杰克琼斯
流行度,中等价位
很好,可以看看新加坡有没有;
另外,需要认识一些奢侈品品牌,知道自己的位置:
Hugo Boss,GianFranco Ferre, W< (无性别主义),GUCCI (奢侈品), Gabbana,
comme des garcons (日本品牌),PRADA (意大利时尚), Armani, Christian Dior (古典).
Monday, 14 May 2012
How to write one research paper
Step 1: Make a structure of the paper.
I Introduction
Introduce the problem. (in a system way)
II ITS Applications
Introduce the message broadcast way
III Partitioning Solutions
Proposed Solution and the Old Solution
IV Experiment I: partitioning without ITS
V Experiment II: partitioning with ITS models
partitioning with estimated ITS models
VI TBD
VII Conclusion
contributions:
1: hyper graph based problem modeling.
2: propose to use hMETIS, in order to solve the problem.
3: experiments:
4: improvements.
The research solution can be directly used in current distributed transportation simulations.
Step 2: Title Discussion
Offline Road Network Partitioning in Distributed Transportation Simulation
Step 3: Introduction
Distributed Transportation Simulation
Offline Road Network Partitioning (offline)
Structure of Off-line Road Network Partitioning
Measurement
METIS-based solution
Controbution of this paper
Outline
Step 4: ITS Applications
Definition
Classification
Decentralized Information Control
Vehicle-2-Vehicle System
Advanced Signal Control System
Centralized Information Control
NextBus
Parking Control
Introduce Two Cases
Step 5: Partitioning Solutions
Graph-based
HyperGraph-based solution
Step 6: Experiments I
Step 7: Experiments II
Step 8: Improvement
Step 9: Conclusion
I Introduction
Introduce the problem. (in a system way)
II ITS Applications
Introduce the message broadcast way
III Partitioning Solutions
Proposed Solution and the Old Solution
IV Experiment I: partitioning without ITS
V Experiment II: partitioning with ITS models
partitioning with estimated ITS models
VI TBD
VII Conclusion
contributions:
1: hyper graph based problem modeling.
2: propose to use hMETIS, in order to solve the problem.
3: experiments:
4: improvements.
The research solution can be directly used in current distributed transportation simulations.
Step 2: Title Discussion
Offline Road Network Partitioning in Distributed Transportation Simulation
Step 3: Introduction
Distributed Transportation Simulation
Offline Road Network Partitioning (offline)
Structure of Off-line Road Network Partitioning
Measurement
METIS-based solution
Controbution of this paper
Outline
Step 4: ITS Applications
Definition
Classification
Decentralized Information Control
Vehicle-2-Vehicle System
Advanced Signal Control System
Centralized Information Control
NextBus
Parking Control
Introduce Two Cases
Step 5: Partitioning Solutions
Graph-based
HyperGraph-based solution
Step 6: Experiments I
Step 7: Experiments II
Step 8: Improvement
Step 9: Conclusion
Subscribe to:
Posts (Atom)