From c9750eeb63be006eec90a990de5bf760b866b982 Mon Sep 17 00:00:00 2001 From: lvjunjie Date: Fri, 17 Jul 2026 10:44:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4ct=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ML/nmWTAI-ML/scripts/compare_single_case.py | 2 +- ML/nmWTAI-ML/scripts/score_pso_candidates.py | 6 +++--- ML/nmWTAI-ML/scripts/validate_autofit_local_ranking.py | 2 +- Src/nmNum/nmCalculation/nmCalculationAutoFitPSO.cpp | 9 ++++----- Src/nmNum/nmSubWxs/nmWxAutomaticFitting.cpp | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ML/nmWTAI-ML/scripts/compare_single_case.py b/ML/nmWTAI-ML/scripts/compare_single_case.py index ebd271a..7ad001c 100644 --- a/ML/nmWTAI-ML/scripts/compare_single_case.py +++ b/ML/nmWTAI-ML/scripts/compare_single_case.py @@ -415,7 +415,7 @@ def predict_surrogate_curve( # 构建参数特征向量 # 顺序必须与训练阶段保持一致 params_vec = np.asarray( - [params.k, params.skin, params.wellboreC, params.phi, params.h, params.Ct, params.Cf], + [params.k, params.skin, params.wellboreC, params.phi, params.h, params.Cf], dtype=np.float32, ).reshape(1, -1) # 将流量制度 schedule 编码成模型输入向量 diff --git a/ML/nmWTAI-ML/scripts/score_pso_candidates.py b/ML/nmWTAI-ML/scripts/score_pso_candidates.py index 2487adc..5ab2bc8 100644 --- a/ML/nmWTAI-ML/scripts/score_pso_candidates.py +++ b/ML/nmWTAI-ML/scripts/score_pso_candidates.py @@ -34,7 +34,7 @@ from src.data.params import Params, Schedule from src.evaluation.autofit_objective import dual_log_objective -PARAM_COLUMNS = ["k", "skin", "wellboreC", "phi", "h", "Ct", "Cf"] +PARAM_COLUMNS = ["k", "skin", "wellboreC", "phi", "h", "Cf"] def parse_args() -> argparse.Namespace: @@ -44,7 +44,7 @@ def parse_args() -> argparse.Namespace: "--candidates", required=True, type=str, - help="候选粒子 CSV,包含 particle_id,k,skin,wellboreC,phi,h,Ct,Cf", + help="候选粒子 CSV,包含 particle_id,k,skin,wellboreC,phi,h,Cf", ) parser.add_argument( "--trace-meta", @@ -127,7 +127,7 @@ def params_from_row(row: dict) -> Params: wellboreC=to_float(row.get("wellboreC")), phi=to_float(row.get("phi")), h=to_float(row.get("h")), - Ct=to_float(row.get("Ct")), + Ct=0.0, Cf=to_float(row.get("Cf")), ) diff --git a/ML/nmWTAI-ML/scripts/validate_autofit_local_ranking.py b/ML/nmWTAI-ML/scripts/validate_autofit_local_ranking.py index a836dd3..ae8ee7a 100644 --- a/ML/nmWTAI-ML/scripts/validate_autofit_local_ranking.py +++ b/ML/nmWTAI-ML/scripts/validate_autofit_local_ranking.py @@ -200,7 +200,7 @@ def predict_surrogate_curve( param_transform = param_feature_transform_from_meta(processed.get("meta", {})) params_vec = np.asarray( - [params.k, params.skin, params.wellboreC, params.phi, params.h, params.Ct, params.Cf], + [params.k, params.skin, params.wellboreC, params.phi, params.h, params.Cf], dtype=np.float32, ).reshape(1, -1) schedule_vec = build_schedule_vector(cfg, schedule).reshape(1, -1) diff --git a/Src/nmNum/nmCalculation/nmCalculationAutoFitPSO.cpp b/Src/nmNum/nmCalculation/nmCalculationAutoFitPSO.cpp index 13c55b8..831fc93 100644 --- a/Src/nmNum/nmCalculation/nmCalculationAutoFitPSO.cpp +++ b/Src/nmNum/nmCalculation/nmCalculationAutoFitPSO.cpp @@ -1277,7 +1277,7 @@ bool nmCalculationAutoFitPSO::writeSurrogateCandidateCsv(const QString& candidat // // 文件位置通常是 ML/nmWTAI-ML/data/temp/pso_screen_candidates__gen.csv。 // 字段顺序必须与 ML 脚本 score_pso_candidates*.py 保持一致: - // particle_id,k,skin,wellboreC,phi,h,Ct,Cf + // particle_id,k,skin,wellboreC,phi,h,Cf // // 这里写的是“完整参数体系”中的关键字段,不是粒子内部紧凑向量。 // 例如用户没有勾选 Cf 时,Cf 会从当前 DataManager 取值写入 CSV。 @@ -1290,7 +1290,7 @@ bool nmCalculationAutoFitPSO::writeSurrogateCandidateCsv(const QString& candidat QTextStream out(&file); // 代理模型只需要这些输入字段;其它参数当前不在训练输入集中。 - out << "particle_id,k,skin,wellboreC,phi,h,Ct,Cf\n"; + out << "particle_id,k,skin,wellboreC,phi,h,Cf\n"; for(int i = 0; i < m_swarm.size(); ++i) { QVector params = buildTraceParameterVector(m_swarm[i].position); @@ -1301,7 +1301,6 @@ bool nmCalculationAutoFitPSO::writeSurrogateCandidateCsv(const QString& candidat << traceParamAt(params, 2) << traceParamAt(params, 3) << traceParamAt(params, 5) - << traceParamAt(params, 6) << traceParamAt(params, 7); out << cols.join(",") << "\n"; } @@ -1899,10 +1898,10 @@ bool nmCalculationAutoFitPSO::isSurrogateRunContextSupported(QString* reason) co return false; } - // 参数 gate:代理输入目前只覆盖 k/skin/wellboreC/phi/h/Ct。 + // 参数 gate:代理输入目前只覆盖 k/skin/wellboreC/phi/h,Cf 作为固定背景参数传入。 // 用户勾选其它参数时,代理无法可靠反映这些参数变化,直接禁用代理筛选。 QVector allowedParamIndices; - allowedParamIndices << 0 << 1 << 2 << 3 << 5 << 6; + allowedParamIndices << 0 << 1 << 2 << 3 << 5; for(int i = 0; i < m_enabledParamIndices.size(); ++i) { if(!allowedParamIndices.contains(m_enabledParamIndices[i])) { diff --git a/Src/nmNum/nmSubWxs/nmWxAutomaticFitting.cpp b/Src/nmNum/nmSubWxs/nmWxAutomaticFitting.cpp index 0a38711..968ef94 100644 --- a/Src/nmNum/nmSubWxs/nmWxAutomaticFitting.cpp +++ b/Src/nmNum/nmSubWxs/nmWxAutomaticFitting.cpp @@ -1261,7 +1261,7 @@ void nmWxAutomaticFitting::updateBestParametersToTable() // 确保某些参数不为负数 if (paramIndex == 0 || paramIndex == 2 || paramIndex == 3 || paramIndex == 5) { - newMin = qMax(newMin, 0.001); + newMin = qMax(newMin, 0.0); } // 确保最小范围,避免范围过小