示例#1
0
        //calculates the optimization nodes and generates the related node selector
        private NodeSelector GenerateSelector(OptimizationOptions options)
        {
            List <Vector2D> rightNodes  = new List <Vector2D>(options.RightIntervals);
            Vector2D        currentNode = initialCondition;

            for (int i = 0; i < options.RightIntervals; i++)
            {
                for (int j = 0; j < options.RightIntervalsSpan; j++)
                {
                    currentNode = Iteration(currentNode, discretizer.CalculateRightStep(currentNode));
                }
                rightNodes.Add(currentNode);
            }

            List <Vector2D> leftNodes = new List <Vector2D>(options.LeftIntervals);

            currentNode = initialCondition;
            for (int i = 0; i < options.LeftIntervals; i++)
            {
                for (int j = 0; j < options.LeftIntervalsSpan; j++)
                {
                    currentNode = Iteration(currentNode, discretizer.CalculateLeftStep(currentNode));
                }
                leftNodes.Add(currentNode);
            }

            return(options.SelectorGenerator(initialCondition, rightNodes, leftNodes));
        }