internal Result <LoadIncrementalState> Correct( LoadState state , LoadIncrementalState prediction , StructureInfo info) { Result <LoadIncrementalState> result = new Result <LoadIncrementalState>(); LoadState initialState = state; LoadState currentState = initialState; LoadIncrementalState predictionIncrement = prediction; for (int iteration = 1; iteration <= MaximumIterations; iteration++) { Result <LoadIncrementalState> correction = GetCorrection(currentState, predictionIncrement, info); if (correction.IsSuccess) { predictionIncrement.Add(correction.Value); LoadState newState = currentState.Add(correction.Value); List <double> errors = GetErrors(newState, currentState, info).ToList(); bool convergence = CheckConvergence(errors, Tolerances); currentState = newState; if (convergence) { result.Value = currentState.Substract(initialState); break; } } else { result.Errors.AddRange(correction.Errors); } if (iteration >= MaximumIterations) { result.Errors.Add(new Error(Strings.MaxNumberOfIterationsReached)); } } return(result); }