class_docstr: Class for managing optimisation of the pareto front. That is, given the
  current best known pareto front, this class runs an optimisation process
  that attempts to bring it closer to the actual pareto front.
  
  Currently this is fairly basic and only handles pareto optimisation that
  works by reducing the test case in the shortlex order. We expect it will
  grow more powerful over time.
class_docstr_tok: ["Class","for","managing","optimisation","of","the","pareto","front",".","That","is",",","given","the","current","best","known","pareto","front",",","this","class","runs","an","optimisation","process","that","attempts","to","bring","it","closer","to","the","actual","pareto","front",".","Currently","this","is","fairly","basic","and","only","handles","pareto","optimisation","that","works","by","reducing","the","test","case","in","the","shortlex","order",".","We","expect","it","will","grow","more","powerful","over","time","."]
code: def run(self):
      seen = set()
  
      # We iterate backwards through the pareto front, using the shrinker to
      # (hopefully) replace each example with a smaller one. Note that it's
      # important that we start from the end for two reasons: Firstly, by
      # doing it this way we ensure that any new front members we discover
      # during optimisation will also get optimised (because they will be
      # inserted into the part of the front that we haven't visited yet),
      # and secondly we generally expect that we will not finish this process
      # in a single run, because it's relatively expensive in terms of our
      # example budget, and by starting from the end we ensure that each time
      # we run the tests we improve the pareto front because we work on the
      # bits that we haven't covered yet.
      i = len(self.front) - 1
      prev = None
      while i >= 0 and not self.__engine.interesting_examples:
          assert self.front
          i = min(i, len(self.front) - 1)
          target = self.front[i]
          if target.buffer in seen:
              i -= 1
              continue
          assert target is not prev
          prev = target
  
          def allow_transition(source, destination):
              """Shrink to data that strictly pareto dominates the current
              best value we've seen, which is the current target of the
              shrinker.
  
              Note that during shrinking we may discover other smaller
              examples that this function will reject and will get added to
              the front. This is fine, because they will be processed on
              later iterations of this loop."""
              if (
                  dominance(destination, source)
                  == DominanceRelation.LEFT_DOMINATES
              ):
                  # If ``destination`` dominates ``source`` then ``source``
                  # must be dominated in the front - either ``destination`` is in
                  # the front, or it was not added to it because it was
                  # dominated by something in it.,
                  try:
                      self.front.front.remove(source)
                  except ValueError:
                      pass
                  return True
              return False
  
          shrunk = self.__engine.shrink(
              target, allow_transition=allow_transition
          )
          seen.add(shrunk.buffer)
  
          # Note that the front may have changed shape arbitrarily when
          # we ran the shrinker. If it didn't change shape then this is
          # i - 1. If it did change shape then this is the largest value
          # in the front which is smaller than the previous target, so
          # is the correct place to resume from. In particular note that the
          # size of the front might have grown because of slippage during the
          # shrink, but all of the newly introduced elements will be smaller
          # than `target`, so will be covered by this iteration.
          i = self.front.front.bisect_left(target)
  
file_path: catboost/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/pareto.py
imports: from enum import Enum
  from sortedcontainers import SortedList
  from hypothesis.internal.conjecture.data import ConjectureData, ConjectureResult, Status
  from hypothesis.internal.conjecture.junkdrawer import LazySequenceCopy, swap
  from hypothesis.internal.conjecture.shrinker import sort_key
label_desc: Use image node_id 2 for calling the ParetoOptimiser obj's underlying member method code with example usage: obj.run() and returns: False, True