def cost_objective(model):
    """
    The cost objective calculates the total cost.
    The total_cost_per_year = discount_factor * price_increment * how_much_bought_from_whom * load_hours
    :param model: model reference
    :return: Total cost
    """
    starting_year = 2009
    costs = []
    for year in model.YEARS:
        index = year-starting_year
        for supplier in model.SUPPLIER:
            for block in model.BLOCKS:
                cost = model.discount_factor[year] * \
                       pow(model.cost_increase[supplier], index) * \
                       model.buy[year, supplier, block] * \
                       model.supply_cost[supplier, block] * \
                       model.load_hours[block]

                costs.append(cost)

    return sum(costs)