I have an optimization problem where I have several categories and for each category $j$ I have entries $i = 1....m$, I wish to assign some value $x_{ij}$ for each entry of each category but:

  1. I need to assign it in a way that maximizes the sum $\sum_{j} w_i x_i$ for each category $j$
  2. I need to respect some constraints, some are local to each category and some global for the whole problem

    2.1 I need that for each category $j$: $\sum_i x_{ij} < M$ (local for each category)

    2.2 I also need that $\sum_{j}\sum_{i} x_{ij} < N, $ (global category)

N and M are constants that I have for the problem, the main thing I want is that I need to maximize for each category and not across all categories.

I would really appreciate some help on how to do this using python mainly for example scipy or others.

  • 2
    $\begingroup$ Your notation is very unclear. For example, you have $x_{ij}$ in one place and later $x_{i}$. You also have $\sum_{j} w_{i}x_{i}$, where the index of summation doesn't appear inside the sum. $\endgroup$ – Brian Borchers May 23 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.