I would like to write the following simple model in GurobiPy, which is part of many terms that's belongs to the objective function, I assumed that I have three suppliers are selected and three warehouses are opened, where $QS_{swpt}$, $Q_{whpt}$ and $QU_{whpt}$.are CONTINUOUS decicison variables. $S_{st}$, $W_{wt}$, $G_{gt}$, $O_{ot}$ and $L_{lt}$ are BINARY decision variables, I have tried a toy instance by hand and on GurobiPy but, the results from the latter was wrong, I would like to know a rule of thumb to model such problems, or any resource that explain how to model similar and advanced problems.
$t$ is the time.
$s$ are the suppliers.
$w$ are the warehouses.
$p$ are the products.
$$COF= \sum_ {t}\sum_{s}FS_{st}*S_st+\sum_ {t}\sum_{w}FW_{wt}*W_{wt}+\sum_ {t}\sum_{g}FG_{gt}*G_{gt}$$
$$+\sum_ {t}\sum_{o}FO_{ot}*O_{ot}+\sum_ {t}\sum_{l}FL_{lt}*L_{lt}$$
$$ OCS= \sum_{t}\sum_{s}\sum_{w}\sum_{p}QS_{swpt}(MC_{spt}+TS_{swpt}) $$
$$PCS=\sum_{t}\sum_{s}\sum_{w}\sum_{p}KW_{wpt}*Y_{wt}+QS_{swpt}*c_{spt}$$
$$CIW=\sum_{t}\sum_{s}\sum_{w}\sum_{p}QW_{whpt}*[I_{wt}+HCW_{wt}+TW_{wpht}*(\boldsymbol{1-\bar{p}})]$$
$$SCH=\sum_{t}\sum_{w}\sum_{h}\sum_{p}QU_{whpt}*p_{ht}$$
$Minimize\; Z = COF+OCS+PCS+CIW+SCH$
#Contiuous Decision Variables
QS_swpt= m.addVar(vtype=GRB.CONTINUOUS, name="QS_swpt", lb=0)
QW_whpt= m.addVar(vtype=GRB.CONTINUOUS, name="QW_whpt", lb=0 )
QW_gpt= m.addVar(vtype=GRB.CONTINUOUS, name= "QW_gpt", lb=0)
QU_whpt=m.addVar(vtype=GRB.CONTINUOUS, name= "QU_whpt", lb=0)
#Binary Decision Variables
Y_wt= m.addVar(vtype=GRB.BINARY, name="Y_wt")
S_st=m.addVar(vtype=GRB.BINARY, name="S_st")
W_wt= m.addVar(vtype=GRB.BINARY, name="W_wt")
G_gt=m.addVar(vtype=GRB.BINARY, name="G_gt")
O_ot=m.addVar(vtype=GRB.BINARY, name="O_ot")
L_lt=m.addVar(vtype=GRB.BINARY, name="L_lt")
#Modelling the objective Function.
COF= quicksum(FS_st[s]*S_st for s in FS_st for sp in S for t in Time)\
+ quicksum(FW_wt[w]*W_wt for w in FW_wt for wr in W for t in Time)\
+ quicksum(FG_gt[g]*G_gt for g in FG_gt for gs in G for t in Time)\
+ quicksum(FO_ot[o]*O_ot for o in FO_ot for om in O for t in Time)\
+ quicksum(FL_lt[l]*L_lt for l in FL_lt for lf in L for t in Time)
OCS= quicksum(QS_swpt*(MC_spt[p]) for p in MC_spt for w in W for t in Time )\
+ quicksum(QS_swpt*(TS_swt[s]) for s in TS_swt for w in W for t in Time )
PCS = quicksum(KW_wpt[k]* Y_wt for k in KW_wpt for w in W for t in Time)\
+ quicksum(c_st[c] for c in c_st for w in W for t in Time)
CIW = quicksum(QW_swpt[qs]*(I_wt[i]) for i in I_wt for s in S for qs in QW_swpt for t in Time)\
+ quicksum((QW_whpt[qs]*HCW_wt[hc]) for hc in HCW_wt for s in S for qs in QW_whpt for t in Time )\
+ quicksum(QW_whpt[qw]*(TW_whpt[ts]*(p_bc)) for ts in TW_whpt for w in W for qw in QW_whpt for t in Time)
SCH= quicksum(QU_whpt[qu]*p_ht[ph] for ph in p_ht for u in W for qu in QU_whpt for t in Time)