code: def convex_limit(struct_points: np.ndarray) -> int:
      """Given points in order from best to worst,
      Returns the length of the maximum initial segment of points such that quasiconvexity is verified.
      """
      points: tp.List[float] = []
      d = len(struct_points[0])
      if len(struct_points) < 2 * d + 2:
          return len(struct_points) // 2
      for i in range(0, min(2 * d + 2, len(struct_points)), 2):
          points += [struct_points[i]]
      hull = ConvexHull(points[: (d + 1)], incremental=True)
      num_points = len(hull.vertices)
      k = len(points) - 1
      for i in range(num_points, len(points)):
          # We add the ith point.
          hull.add_points(points[i : (i + 1)])
          num_points += 1
          if len(hull.vertices) != num_points:
              return num_points - 1
          for j in range(i + 1, len(points)):
              # We check that the jth point is not in the convex hull;
              # this is ok if the jth point, added in the hull, becomes a vertex.
              hull_copy = copy.deepcopy(hull)
              hull_copy.add_points(points[j : j + 1])
              if len(hull_copy.vertices) != num_points + 1:
                  return num_points - 1
      return k
  
imports: import copy
  import numpy
  from scipy.spatial import ConvexHull
  import nevergrad.common.typing
  from nevergrad.parametrization import parameter
  from nevergrad.parametrization import transforms
  from .None import sequences
  from .None import base
  from .base import IntOrParameter
  from .None import utils
label_desc: Use image node_id 1 for calling a global function with example usage: convex_limit(struct_points) and returns: k, unknown, unknown, unknown