def greedy_set_cover(universe, subsets, costs):
elements = set(e for s in subsets.keys() for e in subsets[s])<EOL>if elements != universe:<EOL><INDENT>return None<EOL><DEDENT>covered = set()<EOL>cover_sets = []<EOL>while covered != universe:<EOL><INDENT>min_cost_elem_ratio = float("<STR_LIT>")<EOL>min_set = None<EOL>for s, elements in subsets.items():<EOL><INDENT>new_elements = len(elements - covered)<EOL>if new_elements != <NUM_LIT:0>:<EOL><INDENT>cost_elem_ratio = costs[s] / new_elements<EOL>if cost_elem_ratio < min_cost_elem_ratio:<EOL><INDENT>min_cost_elem_ratio = cost_elem_ratio<EOL>min_set = s<EOL><DEDENT><DEDENT><DEDENT>cover_sets.append(min_set)<EOL>covered |= subsets[min_set]<EOL><DEDENT>return cover_sets<EOL>
Approximate greedy algorithm for set-covering. Can be used on large
    inputs - though not an optimal solution.

    Args:
        universe (list): Universe of elements
        subsets (dict): Subsets of U {S1:elements,S2:elements}
        costs (dict): Costs of each subset in S - {S1:cost, S2:cost...}