|
|
|
|
@ -1042,7 +1042,7 @@ void nmCalculationAutoFitLM::writeTraceMetaFile()
|
|
|
|
|
|
|
|
|
|
QTextStream out(&metaFile);
|
|
|
|
|
out << "{\n";
|
|
|
|
|
out << " \"schema_version\": 53,\n";
|
|
|
|
|
out << " \"schema_version\": 54,\n";
|
|
|
|
|
out << " \"strategy\": \"permeability_height_then_joint_lm_shape_then_total\",\n";
|
|
|
|
|
out << " \"height_acceptance\": \"reliable_vertical_loss_decrease; no_shape_or_total_loss_constraint\",\n";
|
|
|
|
|
out << " \"shape_metric\": \"pressure_and_derivative_log_slopes_shared_sampling_grid_lag_round_10_percent_min_1\",\n";
|
|
|
|
|
@ -1051,7 +1051,7 @@ void nmCalculationAutoFitLM::writeTraceMetaFile()
|
|
|
|
|
out << " \"lm_step_policy\": \"same_joint_LM_damping_trust_radius_secant_updates_and_sensitivity_rebuilds_in_both_phases\",\n";
|
|
|
|
|
out << " \"lm_phase_switch\": \"shape_target_reached_or_confirmed_stagnation_or_phase_evaluation_budget_exhausted_then_total_if_iterations_remain; shared_iteration_limit_or_user_stop_or_consecutive_solver_failure_abort\",\n";
|
|
|
|
|
out << " \"lm_phase_budget\": \"shared_max_iterations_including_height; each_LM_phase_retains_max(dimensions+2,20,3*max_iterations)_evaluations\",\n";
|
|
|
|
|
out << " \"lm_effective_improvement\": \"max(0.01,0.02*baseline_stage_error); 3_ineffective_steps_trigger_stagnation_confirmation\",\n";
|
|
|
|
|
out << " \"lm_effective_improvement\": \"max(0.01,0.10*baseline_stage_error); after_sensitivity_rebuild_reset_baseline_to_accepted_probe_error_if_improved_else_rebuild_start_error; reset_ineffective_count_preserving_stagnation_confirmation; 3_ineffective_steps_trigger_stagnation_confirmation\",\n";
|
|
|
|
|
out << " \"iteration_count_scope\": \"height_shape_and_total_share_max_iterations; rejected_and_failed_candidates_count; sensitivity_evaluations_are_not_iterations; trace_iteration_is_zero_based_cumulative\",\n";
|
|
|
|
|
out << " \"total_stage_shape_constraint\": false,\n";
|
|
|
|
|
out << " \"total_parameter_selection\": \"all_valid_free_columns\",\n";
|
|
|
|
|
@ -1843,9 +1843,9 @@ StopReasonLM nmCalculationAutoFitLM::runTrustRegionFitting()
|
|
|
|
|
const double minimumCoordinateStep = 1.0e-5;
|
|
|
|
|
const double minimumTrustRadius = 2.0e-3;
|
|
|
|
|
const double maximumTrustRadius = 0.30;
|
|
|
|
|
// 误差下降至少达到绝对 0.01 且相对当前有效基准 2% 才算有效改善。
|
|
|
|
|
// 误差下降至少达到绝对 0.01 且相对当前有效基准 10% 才算有效改善。
|
|
|
|
|
// 更小的下降仍保留为最佳解,但不能反复清除停滞状态、延长拟合时间。
|
|
|
|
|
const double effectiveRelativeImprovement = 2.0e-2;
|
|
|
|
|
const double effectiveRelativeImprovement = 1.0e-1;
|
|
|
|
|
const double effectiveAbsoluteImprovement = 1.0e-2;
|
|
|
|
|
const int maximumIneffectiveSteps = 3;
|
|
|
|
|
|
|
|
|
|
@ -1989,7 +1989,7 @@ StopReasonLM nmCalculationAutoFitLM::runTrustRegionFitting()
|
|
|
|
|
// 高度调整也占用总迭代额度,仍保留原来的对齐、停滞和可行步长判断。
|
|
|
|
|
while(completedIterations < m_maxIterations && processPauseAndStop()) {
|
|
|
|
|
const double bias = current.breakdown.verticalCommonBias;
|
|
|
|
|
if(!current.breakdown.verticalReliable || qAbs(bias) <= 0.01 || heightStagnation >= 2) break;
|
|
|
|
|
if(!current.breakdown.verticalReliable || qAbs(bias) <= 0.1 || heightStagnation >= 2) break;
|
|
|
|
|
const double k = current.parameters[permeabilityColumn];
|
|
|
|
|
if(k <= 0.0 || m_parameterLower[0] <= 0.0 || m_parameterUpper[0] <= m_parameterLower[0]) break;
|
|
|
|
|
const double logRange = qLn(m_parameterUpper[0]) - qLn(m_parameterLower[0]);
|
|
|
|
|
@ -2047,7 +2047,7 @@ StopReasonLM nmCalculationAutoFitLM::runTrustRegionFitting()
|
|
|
|
|
if(m_shouldStop) heightReason = tr("stopped by user");
|
|
|
|
|
else if(completedIterations >= m_maxIterations) heightReason = getStopReasonDescription(LM_MAX_ITERATIONS);
|
|
|
|
|
else if(!current.breakdown.verticalReliable) heightReason = tr("pressure and derivative height directions conflict");
|
|
|
|
|
else if(current.breakdown.verticalLoss <= 0.01) heightReason = tr("curve height is approximately aligned");
|
|
|
|
|
else if(current.breakdown.verticalLoss <= 0.1) heightReason = tr("curve height is approximately aligned");
|
|
|
|
|
else if(heightStagnation >= 2) heightReason = tr("2 consecutive steps without effective height improvement");
|
|
|
|
|
else if(current.parameters[permeabilityColumn] <= m_parameterLower[0] ||
|
|
|
|
|
current.parameters[permeabilityColumn] >= m_parameterUpper[0]) heightReason = tr("permeability reached its bound");
|
|
|
|
|
@ -2288,6 +2288,10 @@ StopReasonLM nmCalculationAutoFitLM::runTrustRegionFitting()
|
|
|
|
|
restoreEvaluationState(current);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 有更优探针时以接受后的误差为新基准,否则仍为重建起点误差。
|
|
|
|
|
// 重新计数但保留停滞确认状态,确认阶段连续三次改善不足仍会结束。
|
|
|
|
|
effectiveImprovementBaseline = stageError(current);
|
|
|
|
|
consecutiveIneffectiveSteps = 0;
|
|
|
|
|
acceptedSinceRebuild = 0;
|
|
|
|
|
consecutivePoorPredictions = 0;
|
|
|
|
|
consecutiveRejectedSteps = 0;
|
|
|
|
|
@ -2359,8 +2363,7 @@ StopReasonLM nmCalculationAutoFitLM::runTrustRegionFitting()
|
|
|
|
|
stopReason = LM_MAX_ITERATIONS;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// 差分探针不等于 LM 候选;重建后继续按当前阶段求步并真实评价,再确认停滞。
|
|
|
|
|
registerEffectiveImprovement(stageError(current));
|
|
|
|
|
// 重建已设置新基准;后续 LM 候选从该基准累计改善并确认停滞。
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 全程累计迭代;无可行方向、拒绝和求解失败也占用一次额度。
|
|
|
|
|
|