コード例 #1
0
def get_random_count_cover(data: OrderedDictType[_T1, List[_T2]], seed: int,
                           chars: Dict[int,
                                       int], count: int) -> OrderedSet[_T1]:
    available_set = values_to_set(data)
    greedy_selected = sort_random_set_cover(data=available_set, seed=seed)
    result, _ = get_until_sum_set(greedy_selected,
                                  until_values=chars,
                                  until_value=count)
    return result
コード例 #2
0
def get_random_seconds_cover(data: OrderedDictType[_T1, List[_T2]], seed: int,
                             durations_s: Dict[int, float],
                             seconds: float) -> OrderedSet[_T1]:
    available_set = values_to_set(data)
    greedy_selected = sort_random_set_cover(data=available_set, seed=seed)
    result, _ = get_until_sum_set(greedy_selected,
                                  until_values=durations_s,
                                  until_value=seconds)
    return result
コード例 #3
0
def get_random_cover_default(data: OrderedDictType[_T1, _T2],
                             seed: int) -> OrderedSet[_T1]:
    available_set = values_to_set(data)
    result = sort_random_set_cover(data=available_set, seed=seed)
    return result
コード例 #4
0
def get_random_percent_cover(data: OrderedDictType[_T1, List[_T2]], seed: int,
                             percent: float) -> OrderedSet[_T1]:
    available_set = values_to_set(data)
    greedy_selected = sort_random_set_cover(data=available_set, seed=seed)
    result = get_first_percent(greedy_selected, percent)
    return result
コード例 #5
0
def get_random_iterations_cover(data: OrderedDictType[_T1, List[_T2]],
                                seed: int, iterations: int) -> OrderedSet[_T1]:
    available_set = values_to_set(data)
    greedy_selected = sort_random_set_cover(data=available_set, seed=seed)
    result = greedy_selected[:iterations]
    return result
コード例 #6
0
def cover_symbols(data: OrderedDictType[_T1, List[_T2]], symbols: Set[_T2]) -> OrderedSet[_T1]:
  available_set = values_to_set(data)
  result = cover_default(data=available_set, to_cover=symbols)
  return result
コード例 #7
0
def greedy_default(data: OrderedDictType[_T1, List[_T2]]) -> OrderedSet[_T1]:
  # maybe own method in greedy_methods
  available_set = values_to_set(data)
  result = sort_greedy(data=available_set)
  return result
コード例 #8
0
def greedy_epochs(data: OrderedDictType[_T1, List[_T2]], epochs: int) -> OrderedSet[_T1]:
  available_set = values_to_set(data)
  result = sort_greedy_epochs(data=available_set, epochs=epochs)
  return result
コード例 #9
0
def greedy_count(data: OrderedDictType[_T1, List[_T2]], chars: Dict[int, int], total_count: int) -> OrderedSet[_T1]:
  available_set = values_to_set(data)
  result = sort_greedy_until(
    data=available_set, until_values=chars, until_value=total_count)
  return result
コード例 #10
0
def greedy_seconds(data: OrderedDictType[_T1, List[_T2]], durations_s: Dict[int, float], seconds: float) -> OrderedSet[_T1]:
  available_set = values_to_set(data)
  result = sort_greedy_until(
    data=available_set, until_values=durations_s, until_value=seconds)
  return result
コード例 #11
0
def greedy_cover(data: OrderedDictType[_T1, List[_T2]], already_covered: OrderedDictType[_T1, List[_T2]]) -> OrderedSet[_T1]:
  available_set = values_to_set(data)
  already_covered_set = values_to_set(already_covered)
  already_covered_units = {x for y in already_covered_set.values() for x in y}
  result = get_greedy_cover(data=available_set, already_covered=already_covered_units)
  return result