LoginSignup
3
1

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_without_capacity(p, point, cand=None, func=None)
Docstring:
容量制約なし施設配置問題
    P-メディアン問題:総距離の和の最小化
入力
    p: 施設数上限
    point: 顧客位置のリスト
    cand: 施設候補位置のリスト(Noneの場合、pointと同じ)
    func: 顧客位置index,施設候補indexを引数とする重み関数
出力
    顧客ごとの施設番号リスト
python
from ortoolpy import facility_location_without_capacity
facility_location_without_capacity(2, [(1, 0), (0, 1), (2, 2)])
結果
[1, 1, 2]
python
# pandas.DataFrame
from ortoolpy.optimization import FacilityLocationWithoutCapacity
FacilityLocationWithoutCapacity('data/facility.csv',2)
x y demand capacity id
0 1 0 1.0 1.0 1.0
1 0 1 NaN 1.0 NaN
2 0 1 1.0 NaN 1.0
3 2 2 1.0 2.0 3.0

データ

3
1
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
3
1