public Rosenbrock() { Function = x => 100 * Math.Pow(x[1] - Math.Pow(x[0], 2), 2) + Math.Pow(1 - x[0], 2); Gradients = new List <Func <Vector, double> > { x => - 400 * x[0] * (x[1] - Math.Pow(x[0], 2)) - 2 * (1 - x[0]), x => 200 * (x[1] - Math.Pow(x[0], 2)), }; var hessianDerivativesRow1 = new List <Func <Vector, double> > { x => - 400 * (x[1] - Math.Pow(x[0], 2)) + 800 * Math.Pow(x[0], 2) + 2, x => - 400 * x[0], }; var hessianDerivativesRow2 = new List <Func <Vector, double> > { x => - 400 * x[0], x => 200 }; var hessianDerivatives = new List <List <Func <Vector, double> > > { hessianDerivativesRow1, hessianDerivativesRow2, }; Hessian = new Hessian(hessianDerivatives); }
public Function4() { Function = x => Math.Pow(x[0] - 3, 2) + Math.Pow(x[1], 2); Gradients = new List <Func <Vector, double> > { x => 2 * (x[0] - 3), x => 2 * x[1], }; var hessianDerivativesRow1 = new List <Func <Vector, double> > { x => 2, x => 0, }; var hessianDerivativesRow2 = new List <Func <Vector, double> > { x => 0, x => 2, }; var hessianDerivatives = new List <List <Func <Vector, double> > > { hessianDerivativesRow1, hessianDerivativesRow2, }; Hessian = new Hessian(hessianDerivatives); }
public Function2() { Function = x => Math.Pow(x[0] - 4, 2) + 4 * Math.Pow(x[1] - 2, 2); Gradients = new List <Func <Vector, double> > { x => 2 * (x[0] - 4), x => 8 * (x[1] - 2), }; var hessianDerivativesRow1 = new List <Func <Vector, double> > { x => 2, x => 0, }; var hessianDerivativesRow2 = new List <Func <Vector, double> > { x => 0, x => 8, }; var hessianDerivatives = new List <List <Func <Vector, double> > > { hessianDerivativesRow1, hessianDerivativesRow2, }; Hessian = new Hessian(hessianDerivatives); }