Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
PRRT
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
26
Issues
26
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LARN
PRRT
Commits
8cb1e572
Commit
8cb1e572
authored
Aug 23, 2019
by
Ashkan Taslimi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test and debug.
parent
2186835b
Pipeline
#3920
failed with stages
in 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
51 deletions
+56
-51
prrt/hec_search.py
prrt/hec_search.py
+4
-4
prrt/search_evaluation.py
prrt/search_evaluation.py
+52
-47
No files found.
prrt/hec_search.py
View file @
8cb1e572
...
...
@@ -84,11 +84,11 @@ class HECSearch:
n_c
*
req_delay
)
/
self
.
prrtSystemParameters
.
source_packet_interval
)
def
get_k_lim
(
self
,
start
,
end
):
if
end
-
start
<=
1
:
return
end
if
end
<
start
:
return
start
mid_point
=
math
.
ceil
((
end
+
start
)
/
2
)
p_r
=
np
.
around
(
self
.
residual_packet_erasure_rate
(
mid_point
,
self
.
n_max
,
self
.
prrtChannelParameters
.
loss_rate_fwd
),
8
)
# Pr(k, n_max)
p_r
=
np
.
around
(
self
.
residual_packet_erasure_rate
(
mid_point
,
self
.
n_max
,
self
.
prrtChannelParameters
.
loss_rate_fwd
),
8
)
# Pr(k, n_max)
if
p_r
==
self
.
prrtApplicationParameters
.
max_residual_loss_rate
:
return
int
(
mid_point
)
elif
p_r
>
self
.
prrtApplicationParameters
.
max_residual_loss_rate
:
...
...
prrt/search_evaluation.py
View file @
8cb1e572
...
...
@@ -6,12 +6,17 @@ import numpy as np
import
pandas
as
pd
from
multiprocessing
import
Pool
ds_basename
=
os
.
listdir
(
"../../hecps/code/ML/data/"
)
#
ds_basename = os.listdir("../../hecps/code/ML/data/")
# ds_basename = ["in_12_param_4_sz_zzatql"]
ds_rel_input_path
=
"../../hecps/code/ML/data/"
ds_rel_result_path
=
"documents/result/"
#
ds_rel_input_path = "../../hecps/code/ML/data/"
#
ds_rel_result_path = "documents/result/"
#['documents/1','documents/2','documents/3','documents/4','documents/5','documents/6']
ds_basename
=
os
.
listdir
(
"documents/debug/"
)
# ds_basename = ["in_12_param_4_sz_zzatql"]
ds_rel_input_path
=
"documents/debug/"
ds_rel_result_path
=
"documents/debug/"
def
get_n_p_max
(
rtt_prop_fwd
,
pkt_length
,
data_rate_btl_fwd
):
return
rtt_prop_fwd
*
data_rate_btl_fwd
/
pkt_length
...
...
@@ -19,7 +24,7 @@ def get_n_p_max(rtt_prop_fwd, pkt_length, data_rate_btl_fwd):
def
evaluate
(
searchAlgorithm
,
appParams
,
channelParams
,
systemParams
):
n_p_min
=
1
n_p_max
=
get_n_p_max
(
channelParams
.
rtt_prop_fwd
,
appParams
.
pkt_length
,
channelParams
.
data_rate_btl_fwd
)
n_p_max
=
np
.
round
(
get_n_p_max
(
channelParams
.
rtt_prop_fwd
,
appParams
.
pkt_length
,
channelParams
.
data_rate_btl_fwd
),
0
)
if
n_p_min
<=
n_p_max
:
start
=
time
.
time
()
search
=
hec_search
.
HECSearch
(
searchAlgorithm
,
n_p_min
,
n_p_max
,
appParams
,
channelParams
,
systemParams
)
...
...
@@ -37,53 +42,53 @@ def test_case(dataset_basename):
for
index
,
row
in
df_in_chunk
.
iterrows
():
appParams
=
prrt
.
PrrtApplicationParameters
(
row
[
'app_max_latency'
],
row
[
'app_max_residual_loss_rate'
],
row
[
'app_data_rate'
],
row
[
'app_pkt_length'
])
chnlParams
=
prrt
.
PrrtChannelParameters
(
row
[
'ch_loss_rate'
],
0
,
row
[
'ch_rtt_prop_fwd'
],
0
,
row
[
'ch_data_rate_btl_fwd'
],
0
)
sysParams
=
prrt
.
PrrtSystemParameters
(
row
[
'sys_block_coding_dly'
],
row
[
'sys_red_pkt_trans_dly'
]
,
row
[
'sys_proc_dly'
],
row
[
'sys_pkt_loss_detection_dly'
],
row
[
'sys_src_pkt_interval'
])
for
searchAlgorithm
in
[
"GreedySearch"
,
"Full
Search"
]:
print
(
str
(
index
))
search_result
=
evaluate
(
searchAlgorithm
,
appParams
,
chnlParams
,
sysParams
)
if
len
(
search_result
)
!=
0
:
config
=
search_result
[
0
]
save_result_to
=
save_result_to
.
append
({
'app_max_latency'
:
row
[
'app_max_latency'
],
'app_max_residual_loss_rate'
:
row
[
'app_max_residual_loss_rate'
],
'app_data_rate'
:
row
[
'app_data_rate'
],
'app_pkt_length'
:
row
[
'app_pkt_length'
],
'ch_loss_rate'
:
row
[
'ch_loss_rate'
],
'ch_rtt_prop_fwd'
:
row
[
'ch_rtt_prop_fwd'
],
'ch_data_rate_btl_fwd'
:
row
[
'ch_data_rate_btl_fwd'
],
'sys_block_coding_dly'
:
row
[
'sys_block_coding_dly'
],
'sys_red_pkt_trans_dly'
:
row
[
'sys_red_pkt_trans_dly'
],
'sys_proc_dly'
:
row
[
'sys_proc_dly'
],
'sys_pkt_loss_detection_dly'
:
row
[
'sys_pkt_loss_detection_dly'
],
'sys_src_pkt_interval'
:
row
[
'sys_src_pkt_interval'
],
'search'
:
searchAlgorithm
,
'config'
:
[
config
.
k
,
len
(
config
.
n_p
),
config
.
n_p
],
'duration'
:
np
.
around
(
search_result
[
1
],
0
)},
ignore_index
=
True
,
sort
=
False
)
else
:
save_result_to
=
save_result_to
.
append
({
'app_max_latency'
:
row
[
'app_max_latency'
],
'app_max_residual_loss_rate'
:
row
[
'app_max_residual_loss_rate'
],
'app_data_rate'
:
row
[
'app_data_rate'
],
'app_pkt_length'
:
row
[
'app_pkt_length'
],
'ch_loss_rate'
:
row
[
'ch_loss_rate'
],
'ch_rtt_prop_fwd'
:
row
[
'ch_rtt_prop_fwd'
],
'ch_data_rate_btl_fwd'
:
row
[
'ch_data_rate_btl_fwd'
],
'sys_block_coding_dly'
:
row
[
'sys_block_coding_dly'
],
'sys_red_pkt_trans_dly'
:
row
[
'sys_red_pkt_trans_dly'
],
'sys_proc_dly'
:
row
[
'sys_proc_dly'
],
'sys_pkt_loss_detection_dly'
:
row
[
'sys_pkt_loss_detection_dly'
],
'sys_src_pkt_interval'
:
row
[
'sys_src_pkt_interval'
],
'search'
:
searchAlgorithm
,
'config'
:
[
"INV_PRM_NPM"
],
'duration'
:
0
},
ignore_index
=
True
,
sort
=
False
)
sysParams
=
prrt
.
PrrtSystemParameters
(
row
[
'sys_block_coding_dly'
],
np
.
round
(
row
[
'sys_red_pkt_trans_dly'
],
5
)
,
row
[
'sys_proc_dly'
],
row
[
'sys_pkt_loss_detection_dly'
],
row
[
'sys_src_pkt_interval'
])
if
index
==
98
:
for
searchAlgorithm
in
[
"Greedy
Search"
]:
print
(
str
(
index
))
search_result
=
evaluate
(
searchAlgorithm
,
appParams
,
chnlParams
,
sysParams
)
if
len
(
search_result
)
!=
0
:
config
=
search_result
[
0
]
save_result_to
=
save_result_to
.
append
({
'app_max_latency'
:
row
[
'app_max_latency'
],
'app_max_residual_loss_rate'
:
row
[
'app_max_residual_loss_rate'
],
'app_data_rate'
:
row
[
'app_data_rate'
],
'app_pkt_length'
:
row
[
'app_pkt_length'
],
'ch_loss_rate'
:
row
[
'ch_loss_rate'
],
'ch_rtt_prop_fwd'
:
row
[
'ch_rtt_prop_fwd'
],
'ch_data_rate_btl_fwd'
:
row
[
'ch_data_rate_btl_fwd'
],
'sys_block_coding_dly'
:
row
[
'sys_block_coding_dly'
],
'sys_red_pkt_trans_dly'
:
row
[
'sys_red_pkt_trans_dly'
],
'sys_proc_dly'
:
row
[
'sys_proc_dly'
],
'sys_pkt_loss_detection_dly'
:
row
[
'sys_pkt_loss_detection_dly'
],
'sys_src_pkt_interval'
:
row
[
'sys_src_pkt_interval'
],
'search'
:
searchAlgorithm
,
'config'
:
[
config
.
k
,
len
(
config
.
n_p
),
config
.
n_p
],
'duration'
:
np
.
around
(
search_result
[
1
],
0
)},
ignore_index
=
True
,
sort
=
False
)
else
:
save_result_to
=
save_result_to
.
append
({
'app_max_latency'
:
row
[
'app_max_latency'
],
'app_max_residual_loss_rate'
:
row
[
'app_max_residual_loss_rate'
],
'app_data_rate'
:
row
[
'app_data_rate'
],
'app_pkt_length'
:
row
[
'app_pkt_length'
],
'ch_loss_rate'
:
row
[
'ch_loss_rate'
],
'ch_rtt_prop_fwd'
:
row
[
'ch_rtt_prop_fwd'
],
'ch_data_rate_btl_fwd'
:
row
[
'ch_data_rate_btl_fwd'
],
'sys_block_coding_dly'
:
row
[
'sys_block_coding_dly'
],
'sys_red_pkt_trans_dly'
:
row
[
'sys_red_pkt_trans_dly'
],
'sys_proc_dly'
:
row
[
'sys_proc_dly'
],
'sys_pkt_loss_detection_dly'
:
row
[
'sys_pkt_loss_detection_dly'
],
'sys_src_pkt_interval'
:
row
[
'sys_src_pkt_interval'
],
'search'
:
searchAlgorithm
,
'config'
:
[
"INV_PRM_NPM"
],
'duration'
:
0
},
ignore_index
=
True
,
sort
=
False
)
counter
+=
1
#print("Chunk round: " + str(counter))
save_result_to
.
to_csv
(
ds_rel_result_path
+
dataset_basename
,
sep
=
','
,
index
=
False
)
save_result_to
.
to_csv
(
ds_rel_result_path
+
dataset_basename
.
replace
(
"in"
,
"out"
,
1
)
,
sep
=
','
,
index
=
False
)
#test_case("documents/5"
)
if
__name__
==
'__main__'
:
pool
=
Pool
(
processes
=
8
)
pool
.
map
(
test_case
,
ds_basename
,
chunksize
=
1
)
test_case
(
ds_basename
[
0
]
)
#
if __name__ == '__main__':
#
pool = Pool(processes=8)
#
pool.map(test_case, ds_basename, chunksize=1)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment