Dear community team,
I am working on the Lagrangian relaxation (DoCplex+colab) to solve the generalized assignment problem by using the subgradient optimization algorithm presented
here. The issue is that, when the program goes into the algorithm procedure, it needs to solve the dualized problem sequentially to update the multipliers. I have tried to update the model and its attributes inside the loop I have defined, but it seems the procedure does not work properly. The template I have tried is as follows:
# subgradient parameters
u = {}
u = duals
iteration= 1
step_size= 0
theta= 2
noimprovement= 0
best_bound= -1000
gamma= {}
norm= 0
upperbound= 19
u_previous= {}
gap=100
counter = 1
deltau = {}
# To clear and close the original model
mdl.clear
mdl.end()
# lagrange relaxation
lr = Model(name='Lagrange')
# Declare variables
...
# lagrangian dual function
...
# KPI
...
# solving the dualized model for the first time
lr.print_information()
m_lr = lr.solve(log_output=True)
kpi_value = lr.kpi_value_by_name("lr_kpi")
s_lr= m.display()
print()
print("KPI ======================================================")
print()
print(kpi_value)
print()
print("Variables ================================================")
print()
...
print()
print("---------- solve the lagrangian dual problem -------------")
# solve the lagrangian dual problem
for iter in range(iteration):
print()
while(counter == 1):
print("iter: ", iter+1)
print("-------------------------------------------------------")
# updating upper bound
...
# updating theta
...
# calculating step size
...
# calculating norm
...
# updating multipliers
...
# calculating alg. gap
...
print("Converged")
counter = 0
u.update
m_lr.update
m_lr = lr.solve(log_output=True)
kpi_value = lr.kpi_value_by_name("lr_kpi")
s_lr= m_lr.display()
When I run the notebook to solve the model, it cannot update the LR model and its attributes as I said.
Also, by removing the defined loop, the multipliers and other required parameters are correctly calculated in the first step and this is where I have to update the Lagrangian dual function by new multipliers. Indeed, I have provided a minimal reproducible example here. I was wondering if, where I am doing wrong and how to fix that?
Best regards
------------------------------
Abbas Omidi
------------------------------
#DecisionOptimization