LoginSignup
2
2

More than 5 years have passed since last update.

組合せ最適化 - 典型問題 - 施設配置問題

Last updated at Posted at 2015-07-10

典型問題と実行方法

施設配置問題

顧客(需要地点)の集合$D$と施設の配置可能地点の集合$F$があり、それぞれに容量が与えられる。各顧客$i \in D$は、必ずいずれかの施設$i \in F$に移動する。各施設の容量を満たし、顧客の容量と移動距離の総和を最小にするように、顧客の移動先を求めよ。ただし、施設は、$p$個までしか利用することができない。

実行方法

usage
Signature: facility_location(p, point, cand, func=None)
Docstring:
施設配置問題
    P-メディアン問題:総距離×量の和の最小化
入力
    p: 施設数上限
    point: 顧客位置と量のリスト
    cand: 施設候補位置と容量のリスト
    func: 顧客位置index,施設候補indexを引数とする重み関数
出力
    顧客ごとの施設番号リスト
python
from ortoolpy import facility_location
facility_location(2, [(1, 0, 1), (0, 1, 1), (2, 2, 1)], 
                     [(1, 0, 1), (0, 1, 1), (2, 2, 2)])
結果
[0, 2, 2]
python
# pandas.DataFrame
from ortoolpy.optimization import FacilityLocation
FacilityLocation('data/facility.csv',2)
x y demand capacity id
0 1 0 1.0 1.0 0.0
1 0 1 NaN 1.0 NaN
2 0 1 1.0 NaN 3.0
3 2 2 1.0 2.0 3.0

データ

2
2
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
2
2