0

Problem statement: For instance, we have ‘n’ different types of packages which can be utilized multiple times based on requirement. Each package has its own weight and cost. On the other hand, we have ‘m’ number of items that are to be packed into given packages in an optimal way. Optimal way means the total cost of packages used should be minimum. These packages are further placed in bin being an imaginary container.

Constraints:

  1. An item can be placed only in one package.
  2. A bin can accommodate only one package.
  3. Sum of weights of all items in package should not be greater than weight of package.

I have been trying to solve this bin pack problem which has already been solved in PYOMO and PYSCIPOPT . The challenges I faced are designing the constraints and decision variables in a way that has to be given for scipy HiGHS solver. for n=7(packages) and m=34(items), Complexity is growing in designing the constraints. I have come up with 273 constraints and is growing. With PYOMO, declaring constraints and objective function is easier than in SCIPY.

Can anyone tell me I am doing the right way or guide me on how to model the constraints in scipy.

fuglede
  • 17,388
  • 2
  • 54
  • 99
  • This is too broad, but some remarks: All high-lvl APIs produce nearly the same data as you would need for scipy's API. Implication: You can write yourself a wrapper which wraps whatever is working out for your modelling to the low-lvl standard-form like input it's expecting. In this case i don't see the problem though as all 3 constraints are naturally expressed in algebraic-form which leads to trivial numpy/scipy.sparse based expressions. – sascha Dec 09 '21 at 11:26
  • Ah by the way: Make sure the solver @ scipy is supporting your problem. Either make sure it's LP-compatible (total unimodularity) or make sure scipy's HiGHS is already supporting integer-programming. I know, there is lots of active work in the upstream-project, but i'm sceptic about scipy being supporting it yet. (although i don't know) – sascha Dec 09 '21 at 11:28
  • Please provide enough code so others can better understand or reproduce the problem. – Community Dec 15 '21 at 12:34
  • Appears to be duplicated by [this question](https://stackoverflow.com/q/70288933/5085211). – fuglede May 04 '22 at 19:04

0 Answers0