Создайте тот же набор с другим именем в Pyomo

Я пытаюсь создать несколько одинаковых наборов с разными именами. Я пытался что-то вроде этого:

model.j=model.i

что-то, что я видел в документации по Pyomo в главе операций (4.2), но когда я запускаю программу, я получаю следующую ошибку:

RuntimeError: Attempting to re-assign the component 'i' to the same
block under a different name (j).

This behavior is not supported by Pyomo; components must have a
single owning block (or model), and a component may not appear
multiple times in a block.  If you want to re-name or move this
component, use the block del_component() and add_component() methods.

1 ответ

Способ сделать это - инициализировать один набор другим

model.j = Set(initialize=model.i)
Другие вопросы по тегам