Class Simplex

    • Method Detail

      • equalSidesAlongAxes

        public static Simplex equalSidesAlongAxes​(int dim,
                                                  double sideLength)
        Builds simplex with the given side length.
        Parameters:
        dim - Space dimensions.
        sideLength - Length of the sides of the hypercube.
        Returns:
        a new instance.
      • alongAxes

        public static Simplex alongAxes​(double[] steps)
        The start configuration for simplex is built from a box parallel to the canonical axes of the space. The simplex is the subset of vertices of a box parallel to the canonical axes. It is built as the path followed while traveling from one vertex of the box to the diagonally opposite vertex moving only along the box edges. The first vertex of the box will be located at the origin of the coordinate system. To be used for simplex-based optimization, the simplex must be translated so that its first vertex will be the initial guess. For example, in dimension 3 a simplex has 4 vertices. Setting the steps to (1, 10, 2) and the start point to (1, 1, 1) would imply the initial simplex would be:
        1. (1, 1, 1),
        2. (2, 1, 1),
        3. (2, 11, 1),
        4. (2, 11, 3).
        Parameters:
        steps - Steps along the canonical axes representing box edges. They may be negative but not zero.
        Returns:
        a new instance.
        Throws:
        ZeroException - if one of the steps is zero.
      • getDimension

        public int getDimension()
        Returns the space dimension.
        Returns:
        the dimension of the simplex.
      • getSize

        public int getSize()
        Returns the number of vertices.
        Returns:
        the size of the simplex.
      • evaluate

        public Simplex evaluate​(MultivariateFunction function,
                                Comparator<PointValuePair> comparator)
        Evaluates the (non-evaluated) simplex points and returns a new instance with vertices sorted from best to worst.
        Parameters:
        function - Evaluation function.
        comparator - Comparator for sorting vertices, from best to worst.
        Returns:
        a new instance in which the vertices are sorted according to the given comparator.
      • get

        public PointValuePair get​(int index)
        Retrieves a copy of the simplex point stored at index.
        Parameters:
        index - Location.
        Returns:
        the point at location index.