Berni
Berni

Reputation: 93

How to add constraints to the same set dynamically in JuMP?

My question is rather simple. I am using JuMP from Julia and I want to add constraints by separation to a model dynamically and I want all them to belong to the same @constraintref. The thing is that I do not know how many constraints I will end up adding. Is there a kind of push! or append function for adding constraints to the same ref?

Upvotes: 1

Views: 738

Answers (1)

mlubin
mlubin

Reputation: 953

If you need to extend the collection, just make your own array (e.g., ConstraintRef[]) and push! to it instead of using @constraintref.

Upvotes: 1

Related Questions