forked from UNN/2026-rff_mp
Удалить SmirnovaVYu/docs/data/main.py
This commit is contained in:
parent
b5ddddbcff
commit
bfc98b1c4b
|
|
@ -1,53 +0,0 @@
|
|||
from config import N, REPEATS, HASH_TABLE_SIZE
|
||||
from data_generator import generate_test_data, get_names_for_operations
|
||||
from experiment import run_single_experiment
|
||||
from results_analyzer import save_to_csv, plot_results, print_analysis, save_report_md
|
||||
|
||||
|
||||
def main():
|
||||
print(f"Количество записей: {N}")
|
||||
print(f"Количество повторов: {REPEATS}")
|
||||
print(f"Размер хеш-таблицы: {HASH_TABLE_SIZE}")
|
||||
print()
|
||||
|
||||
records, records_shuffled, records_sorted = generate_test_data(N)
|
||||
names_to_find, names_to_delete = get_names_for_operations(records)
|
||||
|
||||
experiments = [
|
||||
('linkedlist', 'случайный', records_shuffled),
|
||||
('linkedlist', 'отсортированный', records_sorted),
|
||||
('hashtable', 'случайный', records_shuffled),
|
||||
('hashtable', 'отсортированный', records_sorted),
|
||||
('bst', 'случайный', records_shuffled),
|
||||
('bst', 'отсортированный', records_sorted),
|
||||
]
|
||||
|
||||
results = []
|
||||
|
||||
for struct_type, mode, data_records in experiments:
|
||||
print(f"Тестирование: {struct_type} - {mode}")
|
||||
|
||||
params = {'size': HASH_TABLE_SIZE} if struct_type == 'hashtable' else None
|
||||
|
||||
result = run_single_experiment(
|
||||
struct_type, mode, data_records,
|
||||
names_to_find, names_to_delete,
|
||||
REPEATS, params
|
||||
)
|
||||
|
||||
results.append(result)
|
||||
|
||||
print(f" Insert: {result['insert_mean']:.4f} ± {result['insert_std']:.4f} sec")
|
||||
print(f" Find: {result['find_mean']:.4f} ± {result['find_std']:.4f} sec")
|
||||
print(f" Delete: {result['delete_mean']:.4f} ± {result['delete_std']:.4f} sec")
|
||||
print()
|
||||
|
||||
save_to_csv(results) # docs/data/results.csv
|
||||
plot_results(results) # docs/performance_chart.png
|
||||
save_report_md(results) # docs/report.md
|
||||
print_analysis(results)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Reference in New Issue
Block a user