A Smallest Example for Multithreading in Python with Event and Lock
Thanks to Jacob Zhong’s help. This is quite useful!
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061from flask import Flaskimport threadingimport timeimport randomdata = []signal = threading.Event()lock = threading.Lock()class Random(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): while True: n = random.random() # print("Produces", n) lock.acquire() data.append(n) lock.release() if len(data) >= 10: signal.set() time.sleep(0.1)class Sum(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): while True: signal.wait() with lock: # print("\nConsumes", sum(data)) data.clear() time.sleep(0.1) signal.clear()# create new produce = Random()consume = Sum()# s
...
Transportation Research Board 2019
Topic:
What proportion of the vehicles with known trajectories is sufficient to estimate the complete information?
Journal Club 02 Introduction to Convex Optimization
The slides are from the Journal club 02.
Questions remain to be solved:
What is the difference between p1 norm and the p2 norm in the linear regression weight decay?
Why the dual Lagrangian problem always convex?
Need to know more about the VCdimension.
Realtime Signal Control System using Trajectories
Posted on

Edited on

In
Research Related

Symbols count in article:
244

Reading time ≈
1 mins.
A real time signal control system using the trajectories data.
2018 Christmas Trip in Los Angeles, Las Vegas, Grand Canyon and Antelope Canyon
2018 Christmas trip with Laixi, Ruxing, Zihan from 23th to 27th Decemember, 2018.
The complete version of the video:
If you can not get access to YouTube, you can find the video in Bilibili [here]:
Day 1: Disneyland
Day 2: From LA to Las Vegas
Day 3: Grand Canyon
Day 4: Antelope Canyon
CEE 553 Infrastructure System Optimization Finalterm Exam Review
This post is the continued part of [link].
Constrained OptimizationInterpretation of Lagrangian MultipliersConsider the family of problems:
$$\min f(x)  h(x)=u.$$
For each $u$, $x^*(u)$ and $\lambda ^*$ are the corresponding regular local minimum and Lagrangian multiplier respectively. Denote $p(u)=f(x^*(u))$, then:
$$\nabla p(u) =  \lambda ^* (u)$$
where the $\lambda ^*$ can be interpreted as shadow price.
Here gives a brief proof:
Assume the original constrained optimization problem is: $$\min f(x), s.t.\quad h(x)=u,u=Const$$ then according to the KKT condition: $$\nabla f(x(u))+\lambda \nabla h(x(u))=0$$ $$ \frac{dx(u)^T}{du}(\nabla f(x(u))+\lambda \nabla h(x(u)))=0$$ where for the $h(x(u))$: $$h(x(u))=u\rightarrow \frac{dh(x(u))}{du}=\frac{dx(u)^T}{du}\cdot \nabla h(x(u)) =1$$ then finally: $$\frac{f(x^*(u))}{du}=\frac{dx(u)^T}{du}\cdot \nabla f(x(u))=\lambda$$
Solving Constrained OptimizationOnedimension ConditionFor the onedimension constrained optimization problem,
$$\m
...
2018 Michigan Traffic Lab ThanksGiving Day Dinner at Dr. Feng's Home
感恩节晚上我们整个实验室在冯毅恒老师家里组织了感恩节晚餐。
大家聚在一起一起吃火锅，玩游戏，可以说是相当热闹了。
Hidden Markov Map Matching  Method and Experiment
Posted on

Edited on

In
Research Related

Symbols count in article:
3.2k

Reading time ≈
3 mins.
ReferenceThis essay is based on the following paper:
Newson, Paul, and John Krumm. “Hidden Markov map matching through noise and sparseness.” Proceedings of the 17th ACM SIGSPATIAL international conference on advances in geographic information systems. ACM, 2009. [pdf]
IntroductionMatching GPS points to roads is the foundation of all kinds of traffic measurement using trajectories data as the input. This essay will give a brief introduction to the trajectories map matching method and I also write a project based on Python to use this method to match the data.
Here is a description of the map matching problem, the grey lines in the figure are the road of Ann Arbor while the light blue lines are trajectories data (GPS points). However, we cannot determine which road the GPS point belonged to without map matching and this is what map matching can do.
I have put the project in my GitLab account, this project is open for everyone in Michigan Traffic Lab, feel free to request the right t
...