Change sets in a optimization loop
進行中I had large problem to solve and, I´m decided to create a methaeuristic for decomposit it.
Basic I have to redefine 2 sets in a loop:
dict_items([(0, [6, 8, 9]), (1, [5, 7]), (2, [10]), (3, [0, 1, 2, 3, 4, 16]), (4, [11, 12]), (5, [18, 26]), (6, [15, 22, 24]), (7, [21, 25]), (8, [13, 14, 17, 19, 20]), (9, [23, 27])])
\ LP format - for model browsing. Use MPS format to capture full model detail.
Maximize
theta[0,0,0] + theta[0,0,1] + theta[0,0,2] + theta[0,0,3] + theta[0,0,4]
+ theta[0,0,5] + theta[0,0,6] + theta[0,0,7] + theta[0,0,8]
+ theta[0,0,9] + theta[0,0,10] + theta[0,1,0] + theta[0,1,1]
+ theta[0,1,2] + theta[0,1,3] + theta[0,1,4] + theta[0,1,5]
+ theta[0,1,6] + theta[0,1,7] + theta[0,1,8] + theta[0,1,9]
+ theta[0,1,10] + theta[0,2,0] + theta[0,2,1] + theta[0,2,2]
+ theta[0,2,3] + theta[0,2,4] + theta[0,2,5] + theta[0,2,6]
+ theta[0,2,7] + theta[0,2,8] + theta[0,2,9] + theta[0,2,10]
+ theta[0,3,0] + theta[0,3,1] + theta[0,3,2] + theta[0,3,3]
+ theta[0,3,4] + theta[0,3,5] + theta[0,3,6] + theta[0,3,7]
+ theta[0,3,8] + theta[0,3,9] + theta[0,3,10] + theta[0,4,0]
+ theta[0,4,1] + theta[0,4,2] + theta[0,4,3] + theta[0,4,4]
+ theta[0,4,5] + theta[0,4,6] + theta[0,4,7] + theta[0,4,8]
+ theta[0,4,9] + theta[0,4,10] + theta[0,5,0] + theta[0,5,1]
+ theta[0,5,2] + theta[0,5,3] + theta[0,5,4] + theta[0,5,5]
+ theta[0,5,6] + theta[0,5,7] + theta[0,5,8] + theta[0,5,9]
+ theta[0,5,10] + theta[0,6,0] + theta[0,6,1] + theta[0,6,2]
+ theta[0,6,3] + theta[0,6,4] + theta[0,6,5] + theta[0,6,6]
+ theta[0,6,7] + theta[0,6,8] + theta[0,6,9] + theta[0,6,10]
+ theta[0,7,0] + theta[0,7,1] + theta[0,7,2] + theta[0,7,3]
+ theta[0,7,4] + theta[0,7,5] + theta[0,7,6] + theta[0,7,7]
+ theta[0,7,8] + theta[0,7,9] + theta[0,7,10] + theta[0,8,0]
+ theta[0,8,1] + theta[0,8,2] + theta[0,8,3] + theta[0,8,4]
+ theta[0,8,5] + theta[0,8,6] + theta[0,8,7] + theta[0,8,8]
+ theta[0,8,9] + theta[0,8,10] + theta[0,9,0] + theta[0,9,1]
+ theta[0,9,2] + theta[0,9,3] + theta[0,9,4] + theta[0,9,5]
+ theta[0,9,6] + theta[0,9,7] + theta[0,9,8] + theta[0,9,9]
+ theta[0,9,10] + theta[1,0,0] + theta[1,0,1] + theta[1,0,2]
+ theta[1,0,3] + theta[1,0,4] + theta[1,0,5] + theta[1,0,6]
+ theta[1,0,7] + theta[1,0,8] + theta[1,0,9] + theta[1,0,10]
+ theta[1,1,0] + theta[1,1,1] + theta[1,1,2] + theta[1,1,3]
+ theta[1,1,4] + theta[1,1,5] + theta[1,1,6] + theta[1,1,7]
+ theta[1,1,8] + theta[1,1,9] + theta[1,1,10] + theta[1,2,0]
+ theta[1,2,1] + theta[1,2,2] + theta[1,2,3] + theta[1,2,4]
+ theta[1,2,5] + theta[1,2,6] + theta[1,2,7] + theta[1,2,8]
+ theta[1,2,9] + theta[1,2,10] + theta[1,3,0] + theta[1,3,1]
+ theta[1,3,2] + theta[1,3,3] + theta[1,3,4] + theta[1,3,5]
+ theta[1,3,6] + theta[1,3,7] + theta[1,3,8] + theta[1,3,9]
+ theta[1,3,10] + theta[1,4,0] + theta[1,4,1] + theta[1,4,2]
+ theta[1,4,3] + theta[1,4,4] + theta[1,4,5] + theta[1,4,6]
+ theta[1,4,7] + theta[1,4,8] + theta[1,4,9] + theta[1,4,10]
+ theta[1,5,0] + theta[1,5,1] + theta[1,5,2] + theta[1,5,3]
+ theta[1,5,4] + theta[1,5,5] + theta[1,5,6] + theta[1,5,7]
+ theta[1,5,8] + theta[1,5,9] + theta[1,5,10] + theta[1,6,0]
+ theta[1,6,1] + theta[1,6,2] + theta[1,6,3] + theta[1,6,4]
+ theta[1,6,5] + theta[1,6,6] + theta[1,6,7] + theta[1,6,8]
+ theta[1,6,9] + theta[1,6,10] + theta[1,7,0] + theta[1,7,1]
+ theta[1,7,2] + theta[1,7,3] + theta[1,7,4] + theta[1,7,5]
+ theta[1,7,6] + theta[1,7,7] + theta[1,7,8] + theta[1,7,9]
+ theta[1,7,10] + theta[1,8,0] + theta[1,8,1] + theta[1,8,2]
+ theta[1,8,3] + theta[1,8,4] + theta[1,8,5] + theta[1,8,6]
+ theta[1,8,7] + theta[1,8,8] + theta[1,8,9] + theta[1,8,10]
+ theta[1,9,0] + theta[1,9,1] + theta[1,9,2] + theta[1,9,3]
+ theta[1,9,4] + theta[1,9,5] + theta[1,9,6] + theta[1,9,7]
+ theta[1,9,8] + theta[1,9,9] + theta[1,9,10] + theta[2,0,0]
+ theta[2,0,1] + theta[2,0,2] + theta[2,0,3] + theta[2,0,4]
+ theta[2,0,5] + theta[2,0,6] + theta[2,0,7] + theta[2,0,8]
+ theta[2,0,9] + theta[2,0,10] + theta[2,1,0] + theta[2,1,1]
+ theta[2,1,2] + theta[2,1,3] + theta[2,1,4] + theta[2,1,5]
+ theta[2,1,6] + theta[2,1,7] + theta[2,1,8] + theta[2,1,9]
+ theta[2,1,10] + theta[2,2,0] + theta[2,2,1] + theta[2,2,2]
+ theta[2,2,3] + theta[2,2,4] + theta[2,2,5] + theta[2,2,6]
+ theta[2,2,7] + theta[2,2,8] + theta[2,2,9] + theta[2,2,10]
+ theta[2,3,0] + theta[2,3,1] + theta[2,3,2] + theta[2,3,3]
+ theta[2,3,4] + theta[2,3,5] + theta[2,3,6] + theta[2,3,7]
+ theta[2,3,8] + theta[2,3,9] + theta[2,3,10] + theta[2,4,0]
+ theta[2,4,1] + theta[2,4,2] + theta[2,4,3] + theta[2,4,4]
+ theta[2,4,5] + theta[2,4,6] + theta[2,4,7] + theta[2,4,8]
+ theta[2,4,9] + theta[2,4,10] + theta[2,5,0] + theta[2,5,1]
+ theta[2,5,2] + theta[2,5,3] + theta[2,5,4] + theta[2,5,5]
+ theta[2,5,6] + theta[2,5,7] + theta[2,5,8] + theta[2,5,9]
+ theta[2,5,10] + theta[2,6,0] + theta[2,6,1] + theta[2,6,2]
+ theta[2,6,3] + theta[2,6,4] + theta[2,6,5] + theta[2,6,6]
+ theta[2,6,7] + theta[2,6,8] + theta[2,6,9] + theta[2,6,10]
+ theta[2,7,0] + theta[2,7,1] + theta[2,7,2] + theta[2,7,3]
+ theta[2,7,4] + theta[2,7,5] + theta[2,7,6] + theta[2,7,7]
+ theta[2,7,8] + theta[2,7,9] + theta[2,7,10] + theta[2,8,0]
+ theta[2,8,1] + theta[2,8,2] + theta[2,8,3] + theta[2,8,4]
+ theta[2,8,5] + theta[2,8,6] + theta[2,8,7] + theta[2,8,8]
+ theta[2,8,9] + theta[2,8,10] + theta[2,9,0] + theta[2,9,1]
+ theta[2,9,2] + theta[2,9,3] + theta[2,9,4] + theta[2,9,5]
+ theta[2,9,6] + theta[2,9,7] + theta[2,9,8] + theta[2,9,9]
+ theta[2,9,10] + theta[3,0,0] + theta[3,0,1] + theta[3,0,2]
+ theta[3,0,3] + theta[3,0,4] + theta[3,0,5] + theta[3,0,6]
+ theta[3,0,7] + theta[3,0,8] + theta[3,0,9] + theta[3,0,10]
+ theta[3,1,0] + theta[3,1,1] + theta[3,1,2] + theta[3,1,3]
+ theta[3,1,4] + theta[3,1,5] + theta[3,1,6] + theta[3,1,7]
+ theta[3,1,8] + theta[3,1,9] + theta[3,1,10] + theta[3,2,0]
+ theta[3,2,1] + theta[3,2,2] + theta[3,2,3] + theta[3,2,4]
+ theta[3,2,5] + theta[3,2,6] + theta[3,2,7] + theta[3,2,8]
+ theta[3,2,9] + theta[3,2,10] + theta[3,3,0] + theta[3,3,1]
+ theta[3,3,2] + theta[3,3,3] + theta[3,3,4] + theta[3,3,5]
+ theta[3,3,6] + theta[3,3,7] + theta[3,3,8] + theta[3,3,9]
+ theta[3,3,10] + theta[3,4,0] + theta[3,4,1] + theta[3,4,2]
+ theta[3,4,3] + theta[3,4,4] + theta[3,4,5] + theta[3,4,6]
+ theta[3,4,7] + theta[3,4,8] + theta[3,4,9] + theta[3,4,10]
+ theta[3,5,0] + theta[3,5,1] + theta[3,5,2] + theta[3,5,3]
+ theta[3,5,4] + theta[3,5,5] + theta[3,5,6] + theta[3,5,7]
+ theta[3,5,8] + theta[3,5,9] + theta[3,5,10] + theta[3,6,0]
+ theta[3,6,1] + theta[3,6,2] + theta[3,6,3] + theta[3,6,4]
+ theta[3,6,5] + theta[3,6,6] + theta[3,6,7] + theta[3,6,8]
+ theta[3,6,9] + theta[3,6,10] + theta[3,7,0] + theta[3,7,1]
+ theta[3,7,2] + theta[3,7,3] + theta[3,7,4] + theta[3,7,5]
+ theta[3,7,6] + theta[3,7,7] + theta[3,7,8] + theta[3,7,9]
+ theta[3,7,10] + theta[3,8,0] + theta[3,8,1] + theta[3,8,2]
+ theta[3,8,3] + theta[3,8,4] + theta[3,8,5] + theta[3,8,6]
+ theta[3,8,7] + theta[3,8,8] + theta[3,8,9] + theta[3,8,10]
+ theta[3,9,0] + theta[3,9,1] + theta[3,9,2] + theta[3,9,3]
+ theta[3,9,4] + theta[3,9,5] + theta[3,9,6] + theta[3,9,7]
+ theta[3,9,8] + theta[3,9,9] + theta[3,9,10] + theta[4,0,0]
+ theta[4,0,1] + theta[4,0,2] + theta[4,0,3] + theta[4,0,4]
+ theta[4,0,5] + theta[4,0,6] + theta[4,0,7] + theta[4,0,8]
+ theta[4,0,9] + theta[4,0,10] + theta[4,1,0] + theta[4,1,1]
+ theta[4,1,2] + theta[4,1,3] + theta[4,1,4] + theta[4,1,5]
+ theta[4,1,6] + theta[4,1,7] + theta[4,1,8] + theta[4,1,9]
+ theta[4,1,10] + theta[4,2,0] + theta[4,2,1] + theta[4,2,2]
+ theta[4,2,3] + theta[4,2,4] + theta[4,2,5] + theta[4,2,6]
+ theta[4,2,7] + theta[4,2,8] + theta[4,2,9] + theta[4,2,10]
+ theta[4,3,0] + theta[4,3,1] + theta[4,3,2] + theta[4,3,3]
+ theta[4,3,4] + theta[4,3,5] + theta[4,3,6] + theta[4,3,7]
+ theta[4,3,8] + theta[4,3,9] + theta[4,3,10] + theta[4,4,0]
+ theta[4,4,1] + theta[4,4,2] + theta[4,4,3] + theta[4,4,4]
+ theta[4,4,5] + theta[4,4,6] + theta[4,4,7] + theta[4,4,8]
+ theta[4,4,9] + theta[4,4,10] + theta[4,5,0] + theta[4,5,1]
+ theta[4,5,2] + theta[4,5,3] + theta[4,5,4] + theta[4,5,5]
+ theta[4,5,6] + theta[4,5,7] + theta[4,5,8] + theta[4,5,9]
+ theta[4,5,10] + theta[4,6,0] + theta[4,6,1] + theta[4,6,2]
+ theta[4,6,3] + theta[4,6,4] + theta[4,6,5] + theta[4,6,6]
+ theta[4,6,7] + theta[4,6,8] + theta[4,6,9] + theta[4,6,10]
+ theta[4,7,0] + theta[4,7,1] + theta[4,7,2] + theta[4,7,3]
+ theta[4,7,4] + theta[4,7,5] + theta[4,7,6] + theta[4,7,7]
+ theta[4,7,8] + theta[4,7,9] + theta[4,7,10] + theta[4,8,0]
+ theta[4,8,1] + theta[4,8,2] + theta[4,8,3] + theta[4,8,4]
+ theta[4,8,5] + theta[4,8,6] + theta[4,8,7] + theta[4,8,8]
+ theta[4,8,9] + theta[4,8,10] + theta[4,9,0] + theta[4,9,1]
+ theta[4,9,2] + theta[4,9,3] + theta[4,9,4] + theta[4,9,5]
+ theta[4,9,6] + theta[4,9,7] + theta[4,9,8] + theta[4,9,9]
-
Hi,
I am not sure that I fully understand your question. Given your snippet, it is not clear what you changed on the model in each iteration of the "for" loop.
Would you like to build and solve a separate model for each key-value pair in your \(\texttt{dict_F_I}\) Python dictionary? Or should the model for the next pair also contain the variables associated with the previous pairs?
If it is the former, you need to instantiate a new model object for each pair inside the loop:
for key, value in dict_F_I.items()
model = gp.Model(f"model_key}")
# Build the model by adding variables/constraint
# Write the model into file and optimizer it
model.write(f"model-{key}.mps")
model.optimize()
# Dispose the model object
model.dispose()Best regards,
Maliheh
0 -
I need to build the large model once and, solved it in each iteration only the variables associated to pair (key, value) of my dictionary. This strategy is based in decoposition. My problem has ten clusters and, I need to solve a cluster for eatch iteration.
It´s possible?
My model has 9MM variables
0 -
I need to build the large model once and, solved it in each iteration only the variables associated to pair (key, value) of my dictionary.
What happens to the variables that are not part of the key-value pair in each iteration? Are you planning to fix these variables to specific values, or remove them from the model?
In each iteration, consider creating a copy of the large model using the Model.copy() method. You can then work on this copied model, either by fixing or removing the variables that are not part of the associated key-value pair. At the end of each iteration, dispose of the copied model and start the next iteration with a fresh copy.
To fix a variable to a specific value, set its lower and upper bounds to that value. To remove a variable from the copied model, use the Model.remove() method.
Note that Gurobi has a partition heuristic that uses large-neighborhood search to improve the current incumbent solution. You can enable using this heuristic when solving your large model by setting the Partition variable attributes and the PartitionPlace solver parameter. While I'm not certain this heuristic will be effective for your large model, it may be worth trying.
Maliheh0 -
%%timeglobal Z1,Z2,Z3,Z4# Build the new objective functionZ1= gp.quicksum(theta[v,l,t] for v in V for l in L for t in T)Z2 = gp.quicksum((ViolaUmin[v,l,t]+ViolaUmax[v,l,t])*PenEqVar[t] for v in V for l in L for t in T)Z3 = gp.quicksum((ViolaWmin[g,t]+ViolaWmax[g,t])*PenEqIdade[t] for g in G for t in T)Z4 = gp.quicksum((ViolaVmax[f,t]*PenMaxVar[t] ) for f in F for t in T)objective = Z1 - (Z2 + Z3 + Z4)model.setObjective(objective,sense=GRB.MAXIMIZE)model.update()for polo, fazendas in dict_F_l.items():print("Copying the original model")copy = model.copy()print("Redefining the sets F and L")# Uptadeting the sets fazendas e polosF = set(fazendas)L = set([polo])print(f'The new set F is: ', F)print(f'The new set L is: ', L)# Atualizando o modelocopy.update()#model.write(f'saida_polo={polo}.lp')print ('\nIniciando laço para o polo', L, 'com fazendas', F,'\n')# Parametrizando os testes computacionaiscopy.setParam("TimeLimit", 3600*0.25)copy.setParam("MIPGap", 0.01)print('Executando o solver...')# Write the model into file and optimizer itcopy.write(f"model-{polo}.mps")# Executa o solvercopy.optimize()if copy.Status == gp.GRB.OPTIMAL:print('Uptadeting X, Y e Z')# Adiciona os resultados da iteração para um array de solução#for l in range(polos+1):for t in range(Tmax+1):for e in E:for f in F:if f in fazendas:for i in I:if x[e,i,f,t].x > 1.E-3:X_eift[e][i][f][t] = x[e,i,f,t].xelse:X_eift[e][i][f][t] = 0if y[e,i,f,t].x > 1.E-3:Y_eift[e][i][f][t] += y[e,i,f,t].xelse:Y_eift[e][i][f][t] = 0if z[e,i,f,t].x > 1.E-3:Z_eift[e][i][f][t] += z[e,i,f,t].xelse:Z_eift[e][i][f][t] = 0print('Updating Theta...')for t in range(Tmax+1):for v in V:if theta[v,polo,t].x > 1.E-3:Theta_vlt[v][polo][t] = theta[v,polo,t].xelse:Theta_vlt[v][polo][t] = 0#coleting the residual value of this iteration for uptade constraint C16for e in E:for f in F:if f in K_e[e]:for t in range(Tmax+1):plantio_realizado[t] += x[e,0,f,t].xprint(f'O plantio total até o polo [{polo}] é:', np.round(plantio_realizado,2))#coleting the residual value of this iteration for uptade constraint C22for t in range(Tmax+1):for e in E:for i in I:for f in F:if f in K_e[e]:if t>1:if i>1:if z[e,i,f,t].x < z[e,i-1,f,t-1].x:estratos_erradicados[t] += x[e,i-1,f,t-1].xarea_estratos_erradicados[t] += y[e,i-1,f,t-1].x#print(f'A área total até o polo [{polo}] é:', np.round(A_polo_max[polo],2))#print(f'A erradicação total até o polo [{polo}] é:', np.round(estratos_erradicados,2 ))print(f'A area erradicada total até o polo [{polo}] é:', np.round(area_estratos_erradicados,2 ))else:print("Infeasible solution, interrupting the iteration")breakproducao[polo] = Z1.getValue()print(f'A produção do polo {polo} foi: {producao[polo]}')desvio_var[polo] = Z2.getValue()print(f'O desvio varietal do polo {polo} foi: {desvio_var[polo]}')desvio_et[polo] = Z3.getValue()print(f'O desvio etario do polo {polo} foi: {desvio_et[polo]}')# Dispose the model objectcopy.dispose()Unfortanelly this strategy don´t work to mee.... I give this error:AttributeError: Unable to retrieve attribute 'x'0
-
Sorry... I believe that the message above is not clear enough...
Unfortanelly this strategy (model.copy) don´t work to mee.... I give this error:AttributeError: Unable to retrieve attribute 'x'Following my methaeuristic codeglobal Z1,Z2,Z3,Z4# Build the new objective functionZ1= gp.quicksum(theta[v,l,t] for v in V for l in L for t in T)Z2 = gp.quicksum((ViolaUmin[v,l,t]+ViolaUmax[v,l,t])*PenEqVar[t] for v in V for l in L for t in T)Z3 = gp.quicksum((ViolaWmin[g,t]+ViolaWmax[g,t])*PenEqIdade[t] for g in G for t in T)Z4 = gp.quicksum((ViolaVmax[f,t]*PenMaxVar[t] ) for f in F for t in T)objective = Z1 - (Z2 + Z3 + Z4)model.setObjective(objective,sense=GRB.MAXIMIZE)model.update()for polo, fazendas in dict_F_l.items():print("Copying the original model")copy = model.copy()print("Redefining the sets F and L")# Uptadeting the sets fazendas e polosF = set(fazendas)L = set([polo])print(f'The new set F is: ', F)print(f'The new set L is: ', L)# Atualizando o modelocopy.update()#model.write(f'saida_polo={polo}.lp')print ('\nIniciando laço para o polo', L, 'com fazendas', F,'\n')# Parametrizando os testes computacionaiscopy.setParam("TimeLimit", 3600*0.25)copy.setParam("MIPGap", 0.01)print('Executando o solver...')# Write the model into file and optimizer itcopy.write(f"model-{polo}.mps")# Executa o solvercopy.optimize()if copy.Status == gp.GRB.OPTIMAL:print('Uptadeting X, Y e Z')# Adiciona os resultados da iteração para um array de solução#for l in range(polos+1):for t in range(Tmax+1):for e in E:for f in F:if f in fazendas:for i in I:if x[e,i,f,t].x > 1.E-3:X_eift[e][i][f][t] = x[e,i,f,t].xelse:X_eift[e][i][f][t] = 0if y[e,i,f,t].x > 1.E-3:Y_eift[e][i][f][t] += y[e,i,f,t].xelse:Y_eift[e][i][f][t] = 0if z[e,i,f,t].x > 1.E-3:Z_eift[e][i][f][t] += z[e,i,f,t].xelse:Z_eift[e][i][f][t] = 0print('Updating Theta...')for t in range(Tmax+1):for v in V:if theta[v,polo,t].x > 1.E-3:Theta_vlt[v][polo][t] = theta[v,polo,t].xelse:Theta_vlt[v][polo][t] = 0#coleting the residual value of this iteration for uptade constraint C16for e in E:for f in F:if f in K_e[e]:for t in range(Tmax+1):plantio_realizado[t] += x[e,0,f,t].xprint(f'O plantio total até o polo [{polo}] é:', np.round(plantio_realizado,2))#coleting the residual value of this iteration for uptade constraint C22for t in range(Tmax+1):for e in E:for i in I:for f in F:if f in K_e[e]:if t>1:if i>1:if z[e,i,f,t].x < z[e,i-1,f,t-1].x:estratos_erradicados[t] += x[e,i-1,f,t-1].xarea_estratos_erradicados[t] += y[e,i-1,f,t-1].x#print(f'A área total até o polo [{polo}] é:', np.round(A_polo_max[polo],2))#print(f'A erradicação total até o polo [{polo}] é:', np.round(estratos_erradicados,2 ))print(f'A area erradicada total até o polo [{polo}] é:', np.round(area_estratos_erradicados,2 ))else:print("Infeasible solution, interrupting the iteration")breakproducao[polo] = Z1.getValue()print(f'A produção do polo {polo} foi: {producao[polo]}')desvio_var[polo] = Z2.getValue()print(f'O desvio varietal do polo {polo} foi: {desvio_var[polo]}')desvio_et[polo] = Z3.getValue()print(f'O desvio etario do polo {polo} foi: {desvio_et[polo]}')# Dispose the model objectcopy.dispose()In my previous code, I only used model.update() instead model.copy()There is any wayout for my issue?0 -
I think you are misunderstanding the relationship between the sets and the model. I will make the following analogy: Let's say you take a photo of yourself wearing a hat. Then you take the hat off. Does the photo magically change - or are you still wearing a hat in the photo? Changing the F and L sets after a model has been created is not going to change the model.
0 -
I see...thank you soo much for this analogy! It's very clear to me now.
There is anyway that is possible to define sets dynamically into the loop? (Uptading all model)
0 -
I have to solve in each iteration a cluster that is in dict_F_l. This dictionary has the cluster key and the values of the farms that I need to solve in each iteration. Thus, in the first iteration:
key =0, values = [6, 8, 9], I only need to solve these farms (6,8,9). And so... onwards...dict_F_l_items(
[(0, [6, 8, 9]), # first iteration
(1, [5, 7]), # second iteration
(2, [10]),
(3, [0, 1, 2, 3, 4, 16]),
(4, [11, 12]),
(5, [18, 26]),
(6, [15, 22, 24]),
(7, [21, 25]),
(8, [13, 14, 17, 19, 20]),
(9, [23, 27])
])
There is any way to solve this values in each iteration?
0
サインインしてコメントを残してください。
コメント
8件のコメント