This document contains code for parsing GPS data, road network data, and ground truth data to perform hidden Markov modeling (HMM) for vehicle trajectory estimation. It defines functions for calculating spherical distances and probabilities. It parses the input data files, initializes the HMM variables and road list states. It then performs analysis by running the Viterbi algorithm to estimate the most likely trajectory through the road network given the observed GPS points.
imager package in R and example
References:
http://dahtah.github.io/imager/
http://dahtah.github.io/imager/imager.html
https://cran.r-project.org/web/packages/imager/imager.pdf
imager package in R and example
References:
http://dahtah.github.io/imager/
http://dahtah.github.io/imager/imager.html
https://cran.r-project.org/web/packages/imager/imager.pdf
Some R Examples[R table and Graphics] -Advanced Data Visualization in R (Some...Dr. Volkan OBAN
Some R Examples[R table and Graphics]
Advanced Data Visualization in R (Some Examples)
References:
http://zevross.com/blog/2014/08/04/beautiful-plotting-in-r-a-ggplot2-cheatsheet-3/
http://www.cookbook-r.com/
http://moderndata.plot.ly/trisurf-plots-in-r-using-plotly/
I hope that it would ne useful for UseRs.
Umarım; R programı ile ilgilenen herkes için yararlı olur.
Volkan OBAN
Data visualization with R.
Mosaic plot .
---Ref: https://www.stat.auckland.ac.nz/~ihaka/120/Lectures/lecture17.pdf
http://www.statmethods.net/advgraphs/mosaic.html
https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/mosaicplot.html
BPFtrace is a high level tracing language for Linux Berkeley Packet Filter (BPF) available in recent Linux kernels. Built on top of LLVM and BCC (https://github.com/iovisor/bcc), BPFtrace provides an easier way of writing BPF programs for interacting with Linux tracing capabilites, such as kprobes, uprobes, kernel tracepoints, USDT and hardware events.
We'll go over Linux BPF itself and how BPFtrace fits in, followed by some demonstrations of new performance and monitoring tools written with BPFtrace.
https://github.com/iovisor/bpftrace
Being a slow interpreter, Python may drive a system to deliver utmost speed if some guidelines are followed. The key is to treat programming languages as syntactic sugar to the machine code. It expedites the workflow of timing, iterative design, automatic testing, optimization, and realize an HPC system balancing the time to market and quality of code.
Speed is the king. 10x productive developers change business. So does 10x faster code. Python is 100x slower than C++ but it only matters when you really use Python to implement number-crunching algorithms. We should not do that, and instead go directly with C++ for speed. It calls for strict disciplines of software engineering and code quality, but it should be noted that here the quality is defined by the runtime and the time to market.
The presentation focuses on the Python side of the development workflow. It is made possible by confining C++ in architecture defined by the Python code, which realizes most of the software engineering. The room for writing fast C++ code is provided by pybind11 and careful design of typed data objects. The data objects hold memory buffers exposed to Python as numpy ndarrays for direct access for speed.
Some R Examples[R table and Graphics] -Advanced Data Visualization in R (Some...Dr. Volkan OBAN
Some R Examples[R table and Graphics]
Advanced Data Visualization in R (Some Examples)
References:
http://zevross.com/blog/2014/08/04/beautiful-plotting-in-r-a-ggplot2-cheatsheet-3/
http://www.cookbook-r.com/
http://moderndata.plot.ly/trisurf-plots-in-r-using-plotly/
I hope that it would ne useful for UseRs.
Umarım; R programı ile ilgilenen herkes için yararlı olur.
Volkan OBAN
Data visualization with R.
Mosaic plot .
---Ref: https://www.stat.auckland.ac.nz/~ihaka/120/Lectures/lecture17.pdf
http://www.statmethods.net/advgraphs/mosaic.html
https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/mosaicplot.html
BPFtrace is a high level tracing language for Linux Berkeley Packet Filter (BPF) available in recent Linux kernels. Built on top of LLVM and BCC (https://github.com/iovisor/bcc), BPFtrace provides an easier way of writing BPF programs for interacting with Linux tracing capabilites, such as kprobes, uprobes, kernel tracepoints, USDT and hardware events.
We'll go over Linux BPF itself and how BPFtrace fits in, followed by some demonstrations of new performance and monitoring tools written with BPFtrace.
https://github.com/iovisor/bpftrace
Being a slow interpreter, Python may drive a system to deliver utmost speed if some guidelines are followed. The key is to treat programming languages as syntactic sugar to the machine code. It expedites the workflow of timing, iterative design, automatic testing, optimization, and realize an HPC system balancing the time to market and quality of code.
Speed is the king. 10x productive developers change business. So does 10x faster code. Python is 100x slower than C++ but it only matters when you really use Python to implement number-crunching algorithms. We should not do that, and instead go directly with C++ for speed. It calls for strict disciplines of software engineering and code quality, but it should be noted that here the quality is defined by the runtime and the time to market.
The presentation focuses on the Python side of the development workflow. It is made possible by confining C++ in architecture defined by the Python code, which realizes most of the software engineering. The room for writing fast C++ code is provided by pybind11 and careful design of typed data objects. The data objects hold memory buffers exposed to Python as numpy ndarrays for direct access for speed.
A scrupulous code review - 15 bugs in C++ codePVS-Studio LLC
A close look at 15 problems one can find when reviewing C++ code.
Offers code examples.
Covers indexed loops, tainted data, copy and paste errors, problems with comparisons, exceptions, etc.
You can use static code analysis tools to make code review easier. Code analyzers find errors and potential vulnerabilities in code, while saving the developers' time and the companies' money.
Manual code review is expensive - a group of programmers get together regularly to review the code.
One can run static analysis tools regularly to find mistakes and vulnerabilities early.
Questions has 4 parts.1st part Program to implement sorting algor.pdfapexelectronices01
Questions has 4 parts.
1st part: Program to implement sorting algorithms:
#include
#include
#include
using namespace std;
void swap(std::vector & data, int i, int j)
{
int tmp = data[i];
data[i] = data[j];
data[j] = tmp;
}
void print(std::vector const & data)
{
std::vector::const_iterator iter = data.begin();
for (; iter != data.end(); ++iter)
{
cout << *iter << \" \";
}
if (data.size() > 0)
{
cout << endl;
}
}
int generateRandom(int low, int high);
void Shuffle(std::vector & data)
{
int length = data.size();
for (int i = 0; i < length-1; ++i)
{
swap(data, i, generateRandom(i+1, length-1));
}
print(data);
}
int generateRandom(int low, int high)
{
srand(low);
int gen = 0;
gen = rand() % (high - low + 1) + low;
return gen;
}
//useful for small lists, and for large lists where data is
//already sorted
void BubbleSort(std::vector & data)
{
int length = data.size();
for (int i = 0; i < length; ++i)
{
bool swapped = false;
for (int j = 0; j < length - (i+1); ++j)
{
if (data[j] > data[j+1])
{
swap(data, j, j+1);
swapped = true;
}
}
if (!swapped) break;
}
}
//useful for small lists and where swapping is expensive
// does at most n swaps
void SelectionSort(std::vector & data)
{
int length = data.size();
for (int i = 0; i < length; ++i)
{
int min = i;
for (int j = i+1; j < length; ++j)
{
if (data[j] < data[min])
{
min = j;
}
}
if (min != i)
{
swap(data, i, min);
}
}
}
//useful for small and mostly sorted lists
//expensive to move array elements
void InsertionSort(std::vector & data)
{
int length = data.size();
for (int i = 1; i < length; ++i)
{
bool inplace = true;
int j = 0;
for (; j < i; ++j)
{
if (data[i] < data[j])
{
inplace = false;
break;
}
}
if (!inplace)
{
int save = data[i];
for (int k = i; k > j; --k)
{
data[k] = data[k-1];
}
data[j] = save;
}
}
}
void Merge(std::vector & data, int lowl, int highl, int lowr, int highr);
void MergeSort(std::vector & data, int low, int high)
{
if (low >= high)
{
return;
}
int mid = low + (high-low)/2;
MergeSort(data, low, mid);
MergeSort(data, mid+1, high);
Merge(data, low, mid, mid+1, high);
}
void Merge(std::vector & data, int lowl, int highl, int lowr, int highr)
{
int tmp_low = lowl;
std::vector tmp;
while (lowl <= highl && lowr <= highr)
{
if (data[lowl] < data[lowr])
{
tmp.push_back(data[lowl++]);
}
else if (data[lowr] < data[lowl])
{
tmp.push_back(data[lowr++]);
}
else
{
tmp.push_back(data[lowl++]);
tmp.push_back(data[lowr++]);
}
}
while (lowl <= highl)
{
tmp.push_back(data[lowl++]);
}
while (lowr <= highr)
{
tmp.push_back(data[lowr++]);
}
std::vector::const_iterator iter = tmp.begin();
for(; iter != tmp.end(); ++iter)
{
data[tmp_low++] = *iter;
}
}
int Partition(std::vector & data, int low, int high);
void QuickSort(std::vector & data, int low, int high)
{
if (low >= high) return;
int p = Partition(data, low, high);
QuickSort(data, low, p-1);
QuickSort(data, p+1, high);
}
int Partition(std::vector & data, int low, int high)
{
int p = low;
for (int i = p+1; i <= high; ++i)
{
if (data[i] < data[p])
{
swap.
Gentle Introduction to Functional ProgrammingSaurabh Singh
This slide is basically aimed at professionals and students to introduce them with functional programming.
I haven't used much functional programming terminologies because I personally feel they could be overwhelming to people getting introduced to FP for the first time. For similar reasons I have deliberately avoided using any functional programming language and kept the discussions programming language agnostic as far as possible.
Program to display heart rate and heart beat waveform based on photoplethysmography (PPG). It reads values from a sensor made of photodiode and LED and displays the corresponding heart rate and waveform on an LCD screen
1sequences and sampling. Suppose we went to sample the x-axis from X.pdfrushabhshah600
1sequences and sampling. Suppose we went to sample the x-axis from Xmin to Xmax using a
step size of step
A)Draw a picture of what is going on.
B) Write a expression for n the total number of samples involved (in terms of Xmin, Xmax and
step)
C) Write out the sequence of x-samples
D) Write a direct and general expression for xi that captures the sequence
E) Write a recursive expression for the sequence
F) Write a program to compute and store the x-samples over the range -5x5 using a step size of
0.1 do everything in main ()
2 . We talked about the following string functions that are available in C (as long as you include
string.h):
int strlen(char str[])
void strcpy(char str1[], char str2[])
void strcat(char str1[], str2[])
Write your own versions of these functions; for example: int paul_strlen(int char str[]). Hint: for
your version of the strlen function, start at the first character in the array and keep counting until
you find the ‘\\0’ character (use a while loop for this). Note: Use your version of the strlen
function in the strcpy and strcat functions.
9. We want to insert a number into an array.
(a) Formulate the problem mathematically with two sequences: x and y. (b) Write a function of
the form:
insertNumIntoArray(int n, int array[], int num, int index)
The function inserts num into the array at the specified index. The rest of the array then follows.
For example, if num = 9 and index = 3 and array = [7 2 8 8 3 1 2] then the function will produce:
array = [7 2 8 9 8 3 1 2]
Note: assume that array is properly dimensioned to have at least 1 extra space for storage.
10. Repeat #2 by for the delete operation; that is, we want to delete a single element (at a
specified index) from an array; for example, suppose index = 3 and array = [50 70 10 90 60 20],
then the result will be
array: [50 70 10 60 20]
11. Repeat #2 by for an insert operation where we are inserting several values into the array. The
function should be of the form:
int insertArrayIntoArray(int n, int inArray[],
int nInsert, int insertArray[], int outArray[], int index)
The dimension of outArray is returned (explicitly). For example:
inArrayarray: [7 2 8 6 3 9]
insertArray: [50 60 70]
index: 2
outArray: [7 2 50 60 70 8 6 3 9]
Assume that outArray is large enough to hold all n + nInsert values.
Solution
#include
//Simulates strlen() library function
int paul_strlen(char str[])
{
int l;
for(l = 0; str[l] != \'\\0\'; l++) ;
return l;
}
//Simulates strcpy() library function
void paul_strcpy(char str1[], char str2[])
{
int c;
for(c = 0; str1[c] != \'\\0\'; c++)
str2[c] = str1[c];
str2[c] = \'\\0\';
printf(\"\ Original String: %s\", str1);
printf(\"\ Copied String: %s\", str2);
}
//Simulates strcat() library function
void paul_strcat(char str1[], char str2[])
{
int i, j;
for(i = 0; str1[i] != \'\\0\'; i++) ;
for (j = 0; str2[j] != \'\\0\'; i++, j++)
{
str1[i] = str2[j];
}
str1[i] = \'\\0\';
printf(\"\ Concatenated String: %s\", str1);
}
int main()
{
char data1[20], data2[20];
pri.
Memorandum Of Association Constitution of Company.pptseri bangash
www.seribangash.com
A Memorandum of Association (MOA) is a legal document that outlines the fundamental principles and objectives upon which a company operates. It serves as the company's charter or constitution and defines the scope of its activities. Here's a detailed note on the MOA:
Contents of Memorandum of Association:
Name Clause: This clause states the name of the company, which should end with words like "Limited" or "Ltd." for a public limited company and "Private Limited" or "Pvt. Ltd." for a private limited company.
https://seribangash.com/article-of-association-is-legal-doc-of-company/
Registered Office Clause: It specifies the location where the company's registered office is situated. This office is where all official communications and notices are sent.
Objective Clause: This clause delineates the main objectives for which the company is formed. It's important to define these objectives clearly, as the company cannot undertake activities beyond those mentioned in this clause.
www.seribangash.com
Liability Clause: It outlines the extent of liability of the company's members. In the case of companies limited by shares, the liability of members is limited to the amount unpaid on their shares. For companies limited by guarantee, members' liability is limited to the amount they undertake to contribute if the company is wound up.
https://seribangash.com/promotors-is-person-conceived-formation-company/
Capital Clause: This clause specifies the authorized capital of the company, i.e., the maximum amount of share capital the company is authorized to issue. It also mentions the division of this capital into shares and their respective nominal value.
Association Clause: It simply states that the subscribers wish to form a company and agree to become members of it, in accordance with the terms of the MOA.
Importance of Memorandum of Association:
Legal Requirement: The MOA is a legal requirement for the formation of a company. It must be filed with the Registrar of Companies during the incorporation process.
Constitutional Document: It serves as the company's constitutional document, defining its scope, powers, and limitations.
Protection of Members: It protects the interests of the company's members by clearly defining the objectives and limiting their liability.
External Communication: It provides clarity to external parties, such as investors, creditors, and regulatory authorities, regarding the company's objectives and powers.
https://seribangash.com/difference-public-and-private-company-law/
Binding Authority: The company and its members are bound by the provisions of the MOA. Any action taken beyond its scope may be considered ultra vires (beyond the powers) of the company and therefore void.
Amendment of MOA:
While the MOA lays down the company's fundamental principles, it is not entirely immutable. It can be amended, but only under specific circumstances and in compliance with legal procedures. Amendments typically require shareholder
Digital Transformation and IT Strategy Toolkit and TemplatesAurelien Domont, MBA
This Digital Transformation and IT Strategy Toolkit was created by ex-McKinsey, Deloitte and BCG Management Consultants, after more than 5,000 hours of work. It is considered the world's best & most comprehensive Digital Transformation and IT Strategy Toolkit. It includes all the Frameworks, Best Practices & Templates required to successfully undertake the Digital Transformation of your organization and define a robust IT Strategy.
Editable Toolkit to help you reuse our content: 700 Powerpoint slides | 35 Excel sheets | 84 minutes of Video training
This PowerPoint presentation is only a small preview of our Toolkits. For more details, visit www.domontconsulting.com
The world of search engine optimization (SEO) is buzzing with discussions after Google confirmed that around 2,500 leaked internal documents related to its Search feature are indeed authentic. The revelation has sparked significant concerns within the SEO community. The leaked documents were initially reported by SEO experts Rand Fishkin and Mike King, igniting widespread analysis and discourse. For More Info:- https://news.arihantwebtech.com/search-disrupted-googles-leaked-documents-rock-the-seo-world/
What are the main advantages of using HR recruiter services.pdfHumanResourceDimensi1
HR recruiter services offer top talents to companies according to their specific needs. They handle all recruitment tasks from job posting to onboarding and help companies concentrate on their business growth. With their expertise and years of experience, they streamline the hiring process and save time and resources for the company.
What is the TDS Return Filing Due Date for FY 2024-25.pdfseoforlegalpillers
It is crucial for the taxpayers to understand about the TDS Return Filing Due Date, so that they can fulfill your TDS obligations efficiently. Taxpayers can avoid penalties by sticking to the deadlines and by accurate filing of TDS. Timely filing of TDS will make sure about the availability of tax credits. You can also seek the professional guidance of experts like Legal Pillers for timely filing of the TDS Return.
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...BBPMedia1
Marvin neemt je in deze presentatie mee in de voordelen van non-endemic advertising op retail media netwerken. Hij brengt ook de uitdagingen in beeld die de markt op dit moment heeft op het gebied van retail media voor niet-leveranciers.
Retail media wordt gezien als het nieuwe advertising-medium en ook mediabureaus richten massaal retail media-afdelingen op. Merken die niet in de betreffende winkel liggen staan ook nog niet in de rij om op de retail media netwerken te adverteren. Marvin belicht de uitdagingen die er zijn om echt aansluiting te vinden op die markt van non-endemic advertising.
[Note: This is a partial preview. To download this presentation, visit:
https://www.oeconsulting.com.sg/training-presentations]
Sustainability has become an increasingly critical topic as the world recognizes the need to protect our planet and its resources for future generations. Sustainability means meeting our current needs without compromising the ability of future generations to meet theirs. It involves long-term planning and consideration of the consequences of our actions. The goal is to create strategies that ensure the long-term viability of People, Planet, and Profit.
Leading companies such as Nike, Toyota, and Siemens are prioritizing sustainable innovation in their business models, setting an example for others to follow. In this Sustainability training presentation, you will learn key concepts, principles, and practices of sustainability applicable across industries. This training aims to create awareness and educate employees, senior executives, consultants, and other key stakeholders, including investors, policymakers, and supply chain partners, on the importance and implementation of sustainability.
LEARNING OBJECTIVES
1. Develop a comprehensive understanding of the fundamental principles and concepts that form the foundation of sustainability within corporate environments.
2. Explore the sustainability implementation model, focusing on effective measures and reporting strategies to track and communicate sustainability efforts.
3. Identify and define best practices and critical success factors essential for achieving sustainability goals within organizations.
CONTENTS
1. Introduction and Key Concepts of Sustainability
2. Principles and Practices of Sustainability
3. Measures and Reporting in Sustainability
4. Sustainability Implementation & Best Practices
To download the complete presentation, visit: https://www.oeconsulting.com.sg/training-presentations
Putting the SPARK into Virtual Training.pptxCynthia Clay
This 60-minute webinar, sponsored by Adobe, was delivered for the Training Mag Network. It explored the five elements of SPARK: Storytelling, Purpose, Action, Relationships, and Kudos. Knowing how to tell a well-structured story is key to building long-term memory. Stating a clear purpose that doesn't take away from the discovery learning process is critical. Ensuring that people move from theory to practical application is imperative. Creating strong social learning is the key to commitment and engagement. Validating and affirming participants' comments is the way to create a positive learning environment.
Premium MEAN Stack Development Solutions for Modern BusinessesSynapseIndia
Stay ahead of the curve with our premium MEAN Stack Development Solutions. Our expert developers utilize MongoDB, Express.js, AngularJS, and Node.js to create modern and responsive web applications. Trust us for cutting-edge solutions that drive your business growth and success.
Know more: https://www.synapseindia.com/technology/mean-stack-development-company.html
Falcon stands out as a top-tier P2P Invoice Discounting platform in India, bridging esteemed blue-chip companies and eager investors. Our goal is to transform the investment landscape in India by establishing a comprehensive destination for borrowers and investors with diverse profiles and needs, all while minimizing risk. What sets Falcon apart is the elimination of intermediaries such as commercial banks and depository institutions, allowing investors to enjoy higher yields.
RMD24 | Retail media: hoe zet je dit in als je geen AH of Unilever bent? Heid...BBPMedia1
Grote partijen zijn al een tijdje onderweg met retail media. Ondertussen worden in dit domein ook de kansen zichtbaar voor andere spelers in de markt. Maar met die kansen ontstaan ook vragen: Zelf retail media worden of erop adverteren? In welke fase van de funnel past het en hoe integreer je het in een mediaplan? Wat is nu precies het verschil met marketplaces en Programmatic ads? In dit half uur beslechten we de dilemma's en krijg je antwoorden op wanneer het voor jou tijd is om de volgende stap te zetten.
LA HUG - Video Testimonials with Chynna Morgan - June 2024Lital Barkan
Have you ever heard that user-generated content or video testimonials can take your brand to the next level? We will explore how you can effectively use video testimonials to leverage and boost your sales, content strategy, and increase your CRM data.🤯
We will dig deeper into:
1. How to capture video testimonials that convert from your audience 🎥
2. How to leverage your testimonials to boost your sales 💲
3. How you can capture more CRM data to understand your audience better through video testimonials. 📊
LA HUG - Video Testimonials with Chynna Morgan - June 2024
Python hmm
1. import re
import time
import math
# --- Parameter ---
FREQUENCY = 60 # (Hz)
DECIMAL = 3 # 2nd decimal place (About 70km)
ALPHA = 4.07 # Standard deviation of GPS measurement
'''
BETA value
'''
BETA = 1 # Exponential distribution parameter
# --- Structure ---
gps_data = [] # [(Latitude, Longitude) ...]
road_network = {} # {Edge ID: (From Node ID, To Node ID, Two Way, Speed
(m/s))}
road_list = [] # [(Edge ID, Segment ID, Latitude, Longitude, Status) ...] Status
0 - skip, 1 - do HMM
road_map = {} # {(Latitude(2nd decimal place), Longitude(2nd decimal
place)): [Edge ID, Segment ID, Latitude, Longitude ...])
ground_true = [] # (Edge, Traverse)
# --- Function ---
def deg2rad(d): # degree to radian
return d * math.pi / 180.0
EARTH_RADIUS_METER = 6378137.0
def spherical_distance(f, t): # caculate the spherical distance of two points
flat = deg2rad(f[0])
flon = deg2rad(f[1])
tlat = deg2rad(t[0])
tlon = deg2rad(t[1])
con = math.sin(flat) * math.sin(tlat)
con += math.cos(flat) * math.cos(tlat) * math.cos(flon - tlon)
return math.acos(con) * EARTH_RADIUS_METER # (m)
2. def route_distance(f, t):
'''
route algo
'''
return 0
def measure_probability(f, t):
return 1 / (math.sqrt(2 * math.pi) * ALPHA) * math.exp(-0.5 *
math.pow(spherical_distance(f, t) / ALPHA, 2))
def transition_probability(z1, z2, x1, x2):
return 1 / BETA * math.exp(-1 * (spherical_distance(z1, z2) - route_distance(x1,
x2)) / BETA)
'''
def viterbi(obs, states, start_p, trans_p, emit_p):
V = [{}]
path = {}
# Initialize base cases (t == 0)
for y in states:
V[0][y] = start_p[y] * emit_p[y][obs[0]]
path[y] = [y]
# Run Viterbi for t > 0
for t in range(1, len(obs)):
V.append({})
newpath = {}
for y in states:
(prob, state) = max((V[t-1][y0] * trans_p[y0][y] * emit_p[y][obs[t]], y0)
for y0 in states)
V[t][y] = prob
newpath[y] = path[state] + [y]
# Don't need to remember the old paths
path = newpath
n = 0 # if only one element is observed max is sought in the
3. initialization values
if len(obs)!=1:
n = t
print_dptable(V)
(prob, state) = max((V[n][y], y) for y in states)
return (prob, path[state])
'''
#====================================================================
=========================================#
# --- Parsing ---
print('Parsing...')
tStart = time.time() # (ms)
# [GPS data]
gps_data_file = open('gps_data.txt', 'r', encoding = 'UTF-8')
info = gps_data_file.readline() # [(Date (UTC), Time (UTC), Latitude, Longitude)
counter = 0
for line in gps_data_file:
counter += 1
if(counter == 60 / FREQUENCY):
temp = line.split()
gps_data.append((float(temp[2]), float(temp[3])))
counter = 0
print("GPS data (number): ", len(gps_data))
gps_data_file.close()
# [Road network data]
road_network_file = open('road_network.txt', 'r', encoding = 'UTF-8')
info = road_network_file.readline()
for line in road_network_file:
temp = line.split()
temp_dic_network = {int(temp[0]): ((int(temp[1]), int(temp[2]), int(temp[3]),
float(temp[4])))}
road_network.update(temp_dic_network) # (Edge ID, From Node ID, To
4. Node ID, Two Way, Speed (m/s))
for i in range(int(temp[5])):
temp_num_lati = float(re.sub('[^-.0-9]', '', temp[(i * 2 + 1) + 6])) #
Latitude
temp_num_longi = float(re.sub('[^-.0-9]', '', temp[(i * 2) + 6])) #
Longitude
# [Road Map]
if((round(temp_num_lati, DECIMAL), round(temp_num_longi, DECIMAL))
not in road_map):
temp_dic_map = {(round(temp_num_lati, DECIMAL),
round(temp_num_longi, DECIMAL)): [(int(temp[0]), i, temp_num_lati,
temp_num_longi)]}
road_map.update(temp_dic_map)
else:
road_map.get((round(temp_num_lati, DECIMAL),
round(temp_num_longi, DECIMAL))).append([int(temp[0]), i, temp_num_lati,
temp_num_longi])
# [Road List]
road_list.append([int(temp[0]), i, temp_num_lati, temp_num_longi], 0)
print("Road segment (number): ", len(road_list))
road_network_file.close()
# [Ground true data]
ground_true_file = open('ground_truth_route.txt', 'r', encoding = 'UTF-8')
info = ground_true_file.readline() # (Edge ID, Traversed From to To)
for line in ground_true_file:
temp = line.split()
ground_true.append((int(temp[0]), temp[1]))
print("Ground true (number): ", len(ground_true))
ground_true_file.close()
print('Elapsed time = ', round(time.time() - tStart, 2))
# --- Analysising ---
print('Analysising...')
tStart = time.time() # (ms)
5. V = [{}]
path = {}
# Need valid HMM states
# Initialize base cases (t == 0)
for y in road_list:
# Search road map
for i in range(3):
for j in range(3):
if ((round(y[0], DECIMAL) + i, round(y[1], DECIMAL) + j) in road_map):
temp = road_map.get(round(y[0], DECIMAL) + i, round(y[1],
DECIMAL) + j)
'''
Set status and count propability
'''
prev = (0, 0)
for t in range(len(gps_data)):
if(t == 0):
prev = gps_data[t]
elif(spherical_distance(prev, gps_data[t]) > 2 * ALPHA):
'''
do something
'''
prev = gps_data[t]
'''
1. Removing points that are within 2 * Standard Deviation of the previous point
2. HMM Breaks
2.1 More than (200m)
2.2 Route more than great circle (2000m)
2.3 Vehicle speed 3x in route or more than 50 m/s
'''
print('Elapsed time = ', round(time.time() - tStart, 2))
# --- Evaluation ---