I am creating a model and defining the variables as:
x_vars={(i,j,d+dth):trial_mod.binary_var(name='x_{0}_{1}_{2}'.format(i,j,d+dth)) for d in range(len(p_id)) for i in n_id for j in p_id[d]}
z_vars={(i,j,k,d+dth):trial_mod.binary_var(name='z_{0}_{1}_{2}_{3}'.format(i,j,k,d+dth)) for d in range(len(p_id)) for i in n_id for j in ([0]+p_id[d]) for k in (p_id[d]+['t']) if j!=k}
y_vars={(j,d+dth):trial_mod.continuous_var(name='y_{0}_{1}'.format(j,d+dth)) for d in range(len(p_id)) for j in p_id[d]}
u_vars={(i,d+dth):trial_mod.continuous_var(name='u_{0}_{1}'.format(i,d+dth)) for d in range(len(p_id)) for i in n_id}
v_vars={(i,d+dth):trial_mod.continuous_var(name='v_{0}_{1}'.format(i,d+dth)) for d in range(len(p_id)) for i in n_id}
Then I define the dictionary for the initial solution as P1_soln={}.
Then add the initial solution as
#----u_vars, v_vars, and x_vars----#
for d in range(len(p_id)):
for i in n_id:
P1_soln[u_vars[i,d+dth]]=u_vars[i,d+dth]'s initial_value
P1_soln[v_vars[i,d+dth]]=v_vars[i,d+dth]'s initial_value
for j in p_id[d]:
P1_soln[x_vars[i,j,d+dth]]=x_vars[i,j,d+dth]'s initial_value
#----z_vars----#
for d in range(len(p_id)):
for i in n_id:
for j in [0]+p_id[d]:
for k in p_id[d]+['t']:
if j!=k:
P1_soln[z_vars[i,j,k,d+dth]]=z_vars[i,j,k,d+dth]'s initial_value
#----y_vars----#
for d in range(len(p_id)):
for j in p_id[d]:
P1_soln[y_vars[j,d+dth]]=y_vars[j,d+dth]'s initial_value
Then I feed the initial solution using the command:
trial_mod.add_mip_start(P1_soln)
And, it gives the error as
AttributeError: 'dict' object has no attribute 'as_mip_start'
-------------------------------------------------------------------------------------------------------
I request the community please help me to resolve this issue.
Thanks in Advance.