def compute_res_util_score(res, hw_info):
    """Compute a score for the current design utilization.

    We put different weights for different types of resource.
    URAM, DSP, BRAM18K: 0.3
    LUT: 0.2
    FF: 0.1
    """
    score = 0
    if "FF" in res:
        score += 0.1 * float(int(res["FF"])) / hw_info["FF"]
    if "LUT" in res:
        score += 0.2 * float(int(res["LUT"])) / hw_info["LUT"]
    if "BRAM18K" in res:
        score += 0.3 * float(int(res["BRAM18K"])) / hw_info["BRAM18K"]
    if "DSP" in res:
        score += 0.3 * float(int(res["DSP"])) / hw_info["DSP"]
    if "URAM" in res:
        score += 0.3 * float(int(res["URAM"])) / hw_info["URAM"]

    return score