添加完整的项目文档README.md

- 提供详细的功能特性说明和算法介绍
- 包含完整的安装和使用指南
- 添加电缆规格配置表格
- 更新输出示例以反映最新功能
- 完善项目结构说明和参数配置
This commit is contained in:
dmy
2026-01-02 01:24:02 +08:00
parent b5718a0cc2
commit d563905f28
3 changed files with 341 additions and 70 deletions

24
main.py
View File

@@ -9,6 +9,7 @@ import networkx as nx
import math
import argparse
import os
from esau_williams import design_with_esau_williams
# 设置matplotlib支持中文显示
plt.rcParams['font.sans-serif'] = ['Microsoft YaHei', 'SimHei', 'Arial']
@@ -1150,9 +1151,32 @@ def compare_design_methods(excel_path=None, n_clusters_override=None):
})
print(f" [Rotational] Cost: ¥{eval_rot['total_cost']:,.2f} | Loss: {eval_rot['total_loss']:.2f} kW")
# --- Run 3: Esau-Williams Algorithm ---
ew_name = f"{name} (Esau-Williams)"
conns_ew, turbines_ew = design_with_esau_williams(
turbines.copy(), substation, max_cable_mw
)
eval_ew = evaluate_design(
turbines, conns_ew, substation, cable_specs=current_specs,
is_offshore=is_offshore, method_name=ew_name
)
comparison_results.append({
'name': ew_name,
'cost': eval_ew['total_cost'],
'loss': eval_ew['total_loss'],
'eval': eval_ew,
'turbines': turbines_ew,
'specs': current_specs
})
print(f" [Esau-Williams] Cost: ¥{eval_ew['total_cost']:,.2f} | Loss: {eval_ew['total_loss']:.2f} kW")
# 记录最佳
if eval_rot['total_cost'] < best_cost:
best_cost = eval_rot['total_cost']
if eval_ew['total_cost'] < best_cost:
best_cost = eval_ew['total_cost']
# best_result 不再需要单独维护,最后遍历 comparison_results 即可
if eval_base['total_cost'] < best_cost: