public Function(BarrierFunction bf, Function ff, double penalty) { type = 2; this.bf = bf; this.ff = ff; Rank = ff.Rank; this.penalty = penalty; }
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[] MethodBarrierFunctions(Function f, BarrierFunction bf, double[] startPos, double startPenalty = 1, double mulFactor = 0.1, double eps = 0.01) { int k = 0; double penalty = startPenalty; double[] curX = (double[])startPos.Clone(); while (k < 100) { Function omg = new Function(bf, f, penalty); curX = MethodNR(omg, curX, eps); if (Abs(penalty / bf[curX]) < eps) { return(curX); } penalty *= mulFactor; k++; } return(curX); }