Hi everyone! i have a model with a set aircraft:={1…N}, which describe an aircraft landing problem. My objective is to decompose the problem into subproblems that are easier to solve individually. I want to create subsets of aircraft, solving smaller subproblems separately and then combining the solutions, reducing the overall computational complexity and obtain good solutions more quickly. To do this, i have implemented this algorithm which iteratively generates the subsets ‘aircraft-relaxed’ and, for each subset, solve the new model ALP_red (this model is equal to the initial one, but instead of set aircraft, it uses set aircraft_red, for each variables and constraints). The problem is that AMPL gives me an error if i put the model ALP_red inside the for cycle. How can I solve this problem, in order to achieve my goal?
Attached the initial model ALP_model, the new model ALP_model_red, and the file .run which represents my algorithm (decmat.run)
Thank you for your help!
Best regards, Andrea

AMPL will not let you execute modelalpdec.mod inside your for loop. That would cause all of your model definition statements to be executed again at every pass though the loop — but AMPL only allows a set, param, var, etc. to be defined once.

Instead, you should move modelalpdec.mod so that it comes before the loop, and then inside the loop you should only change the model’s set and param data.

If you still have trouble after you make this change, then upload all of your revised files here. (ALP_model.mod and alpdec.mod did not upload properly, so even if you do not change them, you should try uploading them again.)

But if I put alpdec.mod outside the for loop I can’t solve cyclically the subproblems for each set aircraft_red I generate. I need to resolve my model for each aircraft_red and not for the initial aircraft set, and then combining the solutions to obtain good solutions more quickly. I uploaded the models in .run format but they are actually .mod files.
Thank you for your help!

You should read alpdec.mod before the loop. Then in each pass through the loop, because you compute new members for the set aircraft_red, AMPL will solve a new optimization problem.

There is maybe another problem that you are having. In decmat.run, you read ALP_model.mod, and then later you read alpdec.mod. But there seems to be a lot of duplication between these model files:

ALP_model.mod has variables x, alfa, beta, etc. indexed over set aircraft, and then various objectives and constraints using set aircraft for indexing.

alpdec.mod has variables x_sub, alfa_sub, beta_sub etc. that are the same as the ones in ALP_model.mod, except with indexing over set aircraft_red. Also the objective and constraints are the same, except that they use the “_sub” variables and they use aircraft_red rather than aircraft.

It looks like you want to use just the set and param definitions from ALP_model.mod, and just the variable, objective, and constraint definitions from alpdec.mod, along with the definition: