# Decomposition solution

**URL:** <https://discuss.ampl.com/t/decomposition-solution/578>\
**Category:** Support\
**Tags:** modeling\
**Created:** [May 29, 2023, 11:25am UTC](https://discuss.ampl.com/t/decomposition-solution/578 "2023-05-29T11:25:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)\
**Post date:** [May 30, 2023, 3:50pm UTC](https://discuss.ampl.com/t/decomposition-solution/578/2 "2023-05-30T15:50:02Z")

</div>

AMPL will not let you execute `model` `alpdec.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 `model` `alpdec.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.)

---

_[View the full topic](https://discuss.ampl.com/t/decomposition-solution/578)._
