LoginSignup
10

More than 5 years have passed since last update.

組合せ最適化 - 典型問題 - ビンパッキング問題

Last updated at Posted at 2015-07-10

典型問題と実行方法

ビンパッキング問題

容量$c(\gt 0)$の箱と$n$個の荷物$N=\{1,\dots,n\}$が与えられている。荷物$i \in N$の容量を$w_i(\gt 0)$とする。全ての荷物を詰合わせるのに必要な箱の個数を最小にする詰合わせを求めよ。

実行方法

usage
Signature: binpacking(c, w)
Docstring:
ビンパッキング問題
    列生成法で解く(近似解法)
入力
    c: ビンの大きさ
    w: 荷物の大きさのリスト
出力
    ビンごとの荷物の大きさリスト
python
from ortoolpy import binpacking
binpacking(10, [4, 5, 3, 8, 7, 6, 2, 3])
結果
[[8], [7, 3], [5, 3, 2], [4, 6]]
python
# pandas.DataFrame
from ortoolpy.optimization import BinPacking
BinPacking('data/binpacking.csv', 10)
id size
0 0 8.0
1 1 7.0
2 1 3.0
3 2 5.0
4 2 3.0
5 2 2.0
6 3 4.0
7 3 6.0

データ

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10