def _more_optimal(minimize, new_val, old_val):
  """Returns if the new value is more optimal than the old value.

  Args:
    minimize: Bool, True if we are trying to minimize.
    new_val: Float, the new value that we we want to see if more optimal.
    old_val: Float, the old value that we will compare to new_val.

  Returns:
    Boolean that is true if new_val is more optimal than old_val.
  """
  return new_val < old_val if minimize else new_val > old_val