def objective(model):
    """
    The objective function of the model.

    Parameters
    ----------
    model : pyomo model object
        The pyomo model that the optimization shall be run on.

    Returns
    -------
    dev : float
        The summed squared deviation between the resulting charging load 
        (which is RCL = BCL * (1 - alpha*((OER-BER)/BER)) at each bin) and 
        the target charging load.
    """
    
    dev = 0
    for i in model.t:
        # model.res_charg_load[i] = model.base_charg_load[i] * (1 - model.alpha*(model.opt_elec_rate[i]-model.base_elec_rate[i])/model.base_elec_rate[i])
        # dev += (model.res_charg_load[i] - model.target_charg_load[i])**2
        
        # dev += (model.base_charg_load[i] * (1 - model.alpha*(model.opt_elec_rate[i]-model.base_elec_rate[i])/model.base_elec_rate[i]) - model.target_charg_load[i])**2
        dev += (model.base_charg_load[i] * (1 - model.alpha[i]*(model.opt_elec_rate[i]-model.base_elec_rate[i])/model.base_elec_rate[i]) - model.target_charg_load[i])**2
    
    return dev