示例#1
0
        public QpProgressReport DetermineProgress(Variables iterate, Residuals residuals, double mu, int count)
        {
            var code = QpTerminationCode.InProgress;

            double residualsNorm = residuals.InfinityNorm();
            double phi           = ComputeMeritFunction(residuals, residualsNorm);

            this.UpdateMeritFunctionHistory(phi, count);

            bool isMuSatisfied    = (mu < Tolerance);
            bool isRnormSatisfied = (residualsNorm < Tolerance * this.dataInfinityNorm);

            if (isMuSatisfied && isRnormSatisfied)
            {
                code = QpTerminationCode.Success;
            }
            else if (count >= MaxIterations)
            {
                code = QpTerminationCode.MaxIterationsExceeded;
            }
            else if (count > 20 && phi >= 1e-8 && phi >= 1e4 * this.phiMinimumHistory[count - 1])
            {
                code = QpTerminationCode.Infeasible;
            }
            else if (count >= 30 && this.phiMinimumHistory[count] >= .5 * this.phiMinimumHistory[count - 30])
            {
                code = QpTerminationCode.Unknown;
            }

            return(includeDetailedReport || code != QpTerminationCode.InProgress ?
                   new QpProgressReport(code, count, phi, iterate.Clone()) :
                   new QpProgressReport(code, count, phi, null));
        }
示例#2
0
 public QpProgressReport(QpTerminationCode status, int iterations, double meritFunction, Variables currentIterate)
 {
     this.solveStatus    = status;
     this.iterations     = iterations;
     this.currentIterate = currentIterate == null ? null : currentIterate.Clone();
     this.meritFunction  = meritFunction;
 }