def objective_rule(model): Workers_Cost = model.Ca * (model.alpha_put + model.alpha_pick) + \ model.Cb * sum((model.beta_put[t] + model.beta_pick[t]) for t in model.TIMES) MHE_Cost = summation(model.MHE_cost) Tech_Cost = summation(model.Cth_put, model.theta_put) + \ summation(model.Cth_pick, model.theta_pick) Holding_Cost = sum(model.C_hp[p] * model.y_pt[p,t] for p in model.PRODUCTS for t in model.TIMES) Holding_Cost += sum(model.C_hq[q] * model.X_osq[s,q] * model.tau_sq[s,q] for s in model.STORES for q in model.FASHION) Holding_Cost += sum(model.C_hsp[s,p] * model.y_spt[s,p,t] for s in model.STORES for p in model.PRODUCTS for t in model.TIMES) Holding_Cost += sum(model.C_hsq[s,q] * model.y_sqt[s,q,t] for s in model.STORES for q in model.FASHION for t in model.TIMES) Fixed_Shipping_Cost = sum(model.C_fv[v] * model.n_vt[v,t] for v in model.VENDORS for t in model.TIMES) Fixed_Shipping_Cost += sum(model.C_fs[s] * model.n_st[s,t] for s in model.STORES for t in model.TIMES) Var_Shipping_Cost = sum(model.C_vv[v] * model.W_p[p] * model.x_vpt[v,p,t] for v, p in model.OMEGA_P for t in model.TIMES) Var_Shipping_Cost += sum(model.C_vv[v] * model.W_q[q] * model.X_ivq[v,q] * model.rho_vqt[v,q,t] for v, q in model.OMEGA_Q for t in model.TIMES) Var_Shipping_Cost += sum(model.C_vs[s] * model.W_p[p] * model.x_spt[s,p,t] for s in model.STORES for p in model.PRODUCTS for t in model.TIMES) Var_Shipping_Cost += sum(model.C_vs[s] * model.W_q[q] * model.X_osq[s,q] * model.rho_sqt[s,q,t] for s in model.STORES for q in model.FASHION for t in model.TIMES) FS_Expr = (Workers_Cost + MHE_Cost + Tech_Cost + Holding_Cost + Fixed_Shipping_Cost + Var_Shipping_Cost) return FS_Expr
def objective(model): """Abstract representation of our model objective.""" obj = pyomo.summation(model.c, model.x) return obj
def obj_rule(m): return pyomo.summation(m.costs)
def res_co2_emission_rule(m): return (pyomo.summation(m.co2_pro_out) * m.weight <= m.commodity.loc['Global', 'CO2', 'Env']['max'])
def obj_rule(m): return pyomo.summation(m.flow) # == short for sum{a1,a2} flow[a1,a2]
def res_co2_emission_rule(m): return pyomo.summation(m.co2_pro_out) <= \ m.commodity.loc['CO2','Env']['max']
def obj_rule(m): """ Return sum of total costs over all cost types. Simply calculates the sum of m.costs over all m.cost_types. """ return pyomo.summation(m.costs)
def constraint4_rule(model): expr = model.gamma * model.A_put - \ summation(model.Lambda_put, model.zeta_put) return (None, expr, 0)
def constraint7_rule(model): expr = model.gamma * model.A_pick - \ summation(model.Lambda_pick, model.zeta_pick) return (None, expr, 0)
def constraint2_rule(model): return (summation(model.theta_pick), 1)
def constraint1_rule(model): return (summation(model.theta_put), 1)
def objectiveB_rule(model): expr = model.Ca * (model.alpha_put + model.alpha_pick) + \ summation(model.Cth_put, model.theta_put) + \ summation(model.Cth_pick, model.theta_pick) return (expr, model.FirstStageCost)