Commit a2397db2 authored by Ashkan's avatar Ashkan

Update.

parent a3a0761a
Pipeline #4482 failed with stages
in 17 seconds
cython==0.29.10
numpy==1.16.4
pandas==0.24.2
scipy==1.1.0
......@@ -63,11 +63,12 @@ class HECSearch:
get_k = self.get_k(n_c, arq_delay_i)
# print(str(get_k) + " " + str(get_k_lim))
k_max = min(get_k, get_k_lim)
n_max_for_k = min(self.n_max, n_c * self.n_p_max)
if k_max == 0:
continue
# print("k_max: " + str(k_max))
for k in [1, k_max]:
n = prrt_utils.estimate_n_for_k(k, min(self.n_max, n_c * self.n_p_max),
n = prrt_utils.estimate_n_for_k(k, n_max_for_k,
self.prrtChannelParameters.loss_rate_fwd,
self.prrtApplicationParameters.max_residual_loss_rate) # Bottleneck
redundancy = n - k
......
......@@ -44,7 +44,7 @@ cpdef int get_k_lim(int smallestK, int biggestK, float loss_rate_fwd, float max_
return get_k_lim(mid_point + 1, biggestK, loss_rate_fwd, max_residual_loss_rate)
cpdef int estimate_n_for_k(k, n_max, loss_rate_fwd, max_residual_loss_rate):
cpdef int estimate_n_for_k(int k, int n_max, float loss_rate_fwd,float max_residual_loss_rate):
cdef int n = k + 1
while residual_packet_erasure_rate(k, n, loss_rate_fwd) > max_residual_loss_rate \
and n <= n_max - step_size:
......
......@@ -10,15 +10,15 @@ from multiprocessing import Pool
# --------------------------------------------------------------
# Generate dataset
ds_all_input = set(os.listdir("../../hecps/code/ML/dataset1/")) # TODO: Adjust dataset dir
ds_all_input = set(os.listdir("/home/ashkan/Documents/hecps/code/ML/data_left_in_small_ds/ds17/")) # TODO: Adjust dataset dir
print(len(ds_all_input))
ds_calculated_output = set(os.listdir("documents/bigdata/"))
ds_calculated_output = set(os.listdir("documents/output/out_ds17"))
ds_calculated_output = {s.replace("out", "in") for s in ds_calculated_output}
print(len(ds_calculated_output))
ds_basename = list(ds_all_input - ds_calculated_output)
print(len(ds_basename))
ds_rel_input_path = "../../hecps/code/ML/dataset1/" # TODO: Adjust dataset dir
ds_rel_output_path = "documents/bigdata/"
ds_rel_input_path = "/home/ashkan/Documents/hecps/code/ML/data_left_in_small_ds/ds17/" # TODO: Adjust dataset dir
ds_rel_output_path = "documents/output/out_ds17"
#----------------------------------------------------------------
# ds_basename = os.listdir("documents/input/")
......@@ -87,31 +87,42 @@ def test_case(dataset_basename):
# 'search': searchAlgorithm,
'time' : 0,
'config': ["INV_PRM_NPM"],
'fec_balance': config[3]}, ignore_index=True, sort=False)
'fec_balance': -1}, ignore_index=True, sort=False)
save_result_to.to_csv(ds_rel_output_path + dataset_basename.replace("in", "out", 1), sep=',', index = False, columns = columns_order)
print(dataset_basename + " finished.")
#--- for testing and profiling ---#
# test_case(ds_basename)
#--- Freeflow --- #
if __name__ == '__main__':
job_started = False
pool = Pool(processes=7) # TODO: Adjust number of cores
while True:
time.sleep(60)
current_DT = datetime.datetime.now()
start_job_at = datetime.datetime(current_DT.year, current_DT.month, current_DT.day, 16, 44, 30) # TODO: Adjust start time
end_job_at = datetime.datetime(current_DT.year, current_DT.month, current_DT.day, 16, 44, 40) # TODO: Adjust end time
pool.map(test_case, ds_basename, chunksize=1)
#--- scheduling --- #
# if __name__ == '__main__':
# pool = Pool(processes=7) # TODO: Adjust number of cores
# pool.imap_unordered(test_case, ds_basename, chunksize=1)
# job_started = False
# while True:
# time.sleep(60)
# current_DT = datetime.datetime.now()
# start_job_at = datetime.datetime(current_DT.year, current_DT.month, current_DT.day, 16, 44, 30) # TODO: Adjust start time
# end_job_at = datetime.datetime(current_DT.year, current_DT.month, current_DT.day, 16, 44, 40) # TODO: Adjust end time
#
# if end_job_at > current_DT > start_job_at:
# if not job_started:
# job_started = True
# someList = pool.imap_unordered(test_case, ds_basename, chunksize=1)
# print("Job has started at: " + str(current_DT))
# else:
# if job_started:
# print("Job has ended at: " + str(current_DT))
# job_started = False
# pool.terminate()
# pool.close()
# sys.exit("Time to go!")
if end_job_at > current_DT > start_job_at:
if not job_started:
job_started = True
someList = pool.imap_unordered(test_case, ds_basename, chunksize=1)
print("Job has started at: " + str(current_DT))
else:
if job_started:
print("Job has ended at: " + str(current_DT))
job_started = False
pool.terminate()
pool.close()
sys.exit("Time to go!")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment