refactor(nmNum): 清理 LM 冗余代码与 Swi 拟合残留

- 删除无效分支和重复计算,统一中文注释。

- 移除 Swi 参数占位,同步参数索引与拟合记录。
feature/AutoFit-Optimize-20260914
lvjunjie 2 weeks ago
parent b501816f6b
commit 61fc42af7b

@ -13,7 +13,7 @@
#include "nmCalculation_global.h" #include "nmCalculation_global.h"
// 双对数曲线误差分解。预调整使用纵向偏差,形状阶段使用双曲线斜率残差, // 双对数曲线误差分解。预调整使用纵向偏差,形状阶段使用双曲线斜率残差,
// 整体阶段只使用 total 接受候选;两个 LM 目标均联合调整有效参数。 // 总误差部分只使用 total 接受候选;两个 LM 目标均联合调整有效参数。
struct AutoFitObjectiveBreakdownLM { struct AutoFitObjectiveBreakdownLM {
bool valid; bool valid;
double total; double total;
@ -61,7 +61,6 @@ struct AutoFitObjectiveBreakdownLM {
enum StopReasonLM { enum StopReasonLM {
LM_CONTINUE_OPTIMIZATION = 0, LM_CONTINUE_OPTIMIZATION = 0,
LM_TARGET_ACHIEVED = 1, LM_TARGET_ACHIEVED = 1,
LM_TRUE_CONVERGENCE = 2,
LM_LOCAL_OPTIMUM = 3, LM_LOCAL_OPTIMUM = 3,
LM_MAX_ITERATIONS = 4, LM_MAX_ITERATIONS = 4,
LM_USER_STOPPED = 5, LM_USER_STOPPED = 5,
@ -100,7 +99,7 @@ signals:
QVector<QVector<double> > bestData, QVector<QVector<double> > bestData,
int iteration, int iteration,
double fitness); double fitness);
/** @brief 优化迭代结束,开始用当前最优参数生成正式结果。 */ // 优化迭代结束,开始用当前最优参数生成正式结果。
void finalizingStarted(); void finalizingStarted();
void logMessageGenerated(const QString& message); void logMessageGenerated(const QString& message);
@ -130,10 +129,8 @@ private:
void updateReservoirParameters(const QVector<double>& parameters); void updateReservoirParameters(const QVector<double>& parameters);
void updateWellParameters(const QVector<double>& parameters); void updateWellParameters(const QVector<double>& parameters);
QVector<QVector<double> > runSolver();
QVector<QVector<double> > runSolverDll(); QVector<QVector<double> > runSolverDll();
bool runFinalFullSolver(); bool runFinalFullSolver();
void saveOptimizationResult();
void validateAndProtectFinalResult(); void validateAndProtectFinalResult();
QString getStopReasonDescription(StopReasonLM reason) const; QString getStopReasonDescription(StopReasonLM reason) const;
int getEnabledParameterCount() const; int getEnabledParameterCount() const;
@ -177,12 +174,11 @@ private:
AutoFitObjectiveBreakdownLM m_globalBestObjectiveBreakdown; AutoFitObjectiveBreakdownLM m_globalBestObjectiveBreakdown;
QVector<QVector<double> > m_lastEvaluatedLogLogData; QVector<QVector<double> > m_lastEvaluatedLogLogData;
QVector<QVector<double> > m_globalBestLogLogData; QVector<QVector<double> > m_globalBestLogLogData;
mutable AutoFitObjectiveBreakdownLM m_lastObjectiveBreakdown; AutoFitObjectiveBreakdownLM m_lastObjectiveBreakdown;
QVector<QVector<double> > m_userInitialLogLogData; QVector<QVector<double> > m_userInitialLogLogData;
AutoFitObjectiveBreakdownLM m_userInitialObjectiveBreakdown; AutoFitObjectiveBreakdownLM m_userInitialObjectiveBreakdown;
// 参数索引:0 k,1 skin,2 wellboreC,3 phi,4 Swi, // 参数索引:0 k,1 skin,2 wellboreC,3 phi,4 Dfc,5 fractureHalfLength。
// 5 Dfc,6 fractureHalfLength。
QVector<bool> m_parameterSelected; QVector<bool> m_parameterSelected;
QVector<double> m_parameterLower; QVector<double> m_parameterLower;
QVector<double> m_parameterUpper; QVector<double> m_parameterUpper;
@ -200,7 +196,6 @@ private:
int m_successfulEvaluations; int m_successfulEvaluations;
volatile int m_evaluationInProgress; volatile int m_evaluationInProgress;
int m_consecutiveFailures;
int m_maxConsecutiveFailures; int m_maxConsecutiveFailures;
QVector<double> m_userInitialSolution; QVector<double> m_userInitialSolution;

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save