static void execute() { Data func1Data = new Data(@"C:\Users\Sergey\Desktop\Lab5\1_func.txt"); GradientMethod.Input input = new GradientMethod.Input(); func1Data.ReadInputWithoutSecondOrderDerivatives(ref input); GradientMethod.Answer answer; answer = new QuickestDestcent(input).GetAnswer(); showAnswer("Quickest Destcent method", answer); answer = new DestcentByCoordinatesMethod(input).GetAnswer(); showAnswer("Destcent By Coordinates Method", answer); Data func2Data = new Data(@"C:\Users\Sergey\Desktop\Lab5\rosenbrok.txt"); func2Data.ReadFullInput(ref input); answer = new ClassicalNutonMethod(input).GetAnswer(); showAnswer("Classical Nuton method", answer); answer = new ModifiedNutonMethod(input).GetAnswer(); showAnswer("Modified Nuton method", answer); }
public void ReadFullInput(ref GradientMethod.Input input) { int index = 0; input.epsilon = readEpsilon(ref index); int variablesCount = readVaribleCount(ref index); string[] variables = readVariables(ref index, variablesCount); string mainFunc = readFunctionName(ref index); input.mainFunc = new Func(mainFunc, "M", variables); input.firstOrderDerivatives = readFirstOrderDerivatives(ref index, variables); input.vectorX0 = readStartVector(ref index, variablesCount); input.secondOrderDerivatives = readSecondOrderDerivatives(ref index, variables); }