public Function(PenaltyFunction pf, BarrierFunction bf, Function ff, double penalty) { type = 1; this.pf = pf; this.bf = bf; this.ff = ff; Rank = ff.Rank; this.penalty = penalty; }
static public double[] MethodPenaltyFunctions(Function f, BarrierFunction bf, PenaltyFunction pf, double[] startPos, double startPenalty, double mulFactor = 4, double eps = 0.01) { int k = 0; double penalty = startPenalty; double[] curX = (double[])startPos.Clone(); while (k < 100) { Function omg = new Function(pf, bf, f, penalty); curX = MethodNR(omg, curX, eps); if (penalty * (bf[curX] + pf[curX]) < eps) { return(curX); } penalty *= mulFactor; k++; } return(curX); }