I am trying to solve a facility location problem, where I have a set of customers and a set of potential facility locations. Although, the traditional problem is linear, I transformed some constraints and now I have a non-linear problem.
I know there are non-linear optimization packages for python, such as SciPy, but I do not understand how I should iterate over large sets. Can I just use a for-loop to account for the summations? And how do I account for the 'for all i in I' and 'for all j in J' in the constraint as put in the following example?
Objective: Max: Z=∑_i ∑_j (d_i * p_ij * a_ij * y_j)
Subject to: p_ij=(u_ij * a_ij * y_j)/(∑_j (u_ij * a_ij * y_j)) ∀ i ∈ I, j ∈ J
y_j ∈ {0,1} ∀ j ∈ J
where I is the set of customers, and J is the set of potential facility locations. d, a, and u are given. p and y are defined by the model.
Can someone explain me how to use sets in SciPy? Or please send me an example code with this kind of optimization problem so I can see how it is done.
Thank you!