/// Create a Simplex by finding the optimum in each direction /// starting from the initial value.. public override void InitializeIterations() { double[] v = new double[_result.Length]; for (int i = 0; i < _result.Length; i++) { v[i] = 0; } VectorProjectedFunction projection = new VectorProjectedFunction(_f, _result, v); OneVariableFunctionOptimizer unidimensionalFinder = new OneVariableFunctionOptimizer(projection, _pointFactory); unidimensionalFinder.DesiredPrecision = this.DesiredPrecision; _simplex = new OptimizingVector[_result.Length + 1]; try { for (int i = 0; i < _result.Length; i++) { v[i] = 1; projection.SetDirection(v); v[i] = 0; unidimensionalFinder.InitialValue = 0; unidimensionalFinder.Evaluate(); _simplex[i] = _pointFactory.CreateVector( projection.ArgumentAt( unidimensionalFinder.Result), _f); } } catch (DhbIllegalDimension) { }; _simplex[_result.Length] = _pointFactory.CreateVector(_result, _f); SortPoints(_simplex); }
public override void InitializeIterations() { _projections = new VectorProjectedFunction[_result.Length]; double[] v = new double[_result.Length]; // for (int i = 0; i < _projections.Length; i++) // v[i] = 0; for (int i = 0; i < _projections.Length; i++) { v[i] = 1; _projections[i] = new VectorProjectedFunction(_f, _result, v); v[i] = 0; } _unidimensionalFinder = new OneVariableFunctionOptimizer( _projections[0], _pointFactory); _unidimensionalFinder.DesiredPrecision = this.DesiredPrecision; }