5

R lpsolve パッケージを使用して輸送モデルを最適化しています。コードは正常に実行されますが、膨大な数のノードとパスがあるため、実行に時間がかかります。コードを Hadoop クラスターで実行する予定です。

コードに加える必要がある変更について教えてください。グローバルな最小値ではなくローカルな最小値になってしまう可能性があるため、hadoop クラスターで最適化を実行することは不可能かもしれないと思います。

インターネットで「lpsolve hadoop」などの用語を検索しましたが、何も役に立ちませんでした。

私が見るべき資料や例を教えてください。====================================更新1=========== =========================== 私が抱えていた元の問題はここにあります。

問題をさらに単純化し、現在解決している問題は次のとおりです。

Excelで作成したRコードと入力データファイルを添付します。実際のシナリオでは、入力データ ファイルは SQL を使用して生成され、長さは 30,000 行を超えます。

ここに画像の説明を入力

私の入力Excelファイル:

startlink   endlink link_dsc    lnk_type    cons_type   cost    equality_const  fpc_const   max_const
"source","-","-","0"    "vmi1","MM1","VMI","1"  source_to_VMI   supply  equality supply 0   100 null    null
"vmi1","MM1","VMI","0"  "cust1","MM1","SHIP_CUST_1d_AIR","1"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","1"  "cust1","MM1","SHIP_CUST_1d_AIR","2"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","2"  "cust1","MM1","SHIP_CUST_1d_AIR","3"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","3"  "cust1","MM1","SHIP_CUST_1d_AIR","4"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","4"  "cust1","MM1","SHIP_CUST_1d_AIR","5"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","5"  "cust1","MM1","SHIP_CUST_1d_AIR","6"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","6"  "cust1","MM1","SHIP_CUST_1d_AIR","7"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","7"  "cust1","MM1","SHIP_CUST_1d_AIR","8"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","8"  "cust1","MM1","SHIP_CUST_1d_AIR","9"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","9"  "cust1","MM1","SHIP_CUST_1d_AIR","10"   vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","0"  "vmi1","MM1","VMI","1"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","1"  "vmi1","MM1","VMI","2"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","2"  "vmi1","MM1","VMI","3"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","3"  "vmi1","MM1","VMI","4"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","4"  "vmi1","MM1","VMI","5"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","5"  "vmi1","MM1","VMI","6"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","6"  "vmi1","MM1","VMI","7"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","7"  "vmi1","MM1","VMI","8"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","8"  "vmi1","MM1","VMI","9"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","9"  "vmi1","MM1","VMI","10" vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi1","MM1","VMI","10" "SINK","-","-","100"    vmi_to_sink esacpe  null    100 null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","1"    "cust1","MM1","CUST","1"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","2"    "cust1","MM1","CUST","2"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","3"    "cust1","MM1","CUST","3"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","4"    "cust1","MM1","CUST","4"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","5"    "cust1","MM1","CUST","5"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","6"    "cust1","MM1","CUST","6"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","7"    "cust1","MM1","CUST","7"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","8"    "cust1","MM1","CUST","8"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","9"    "cust1","MM1","CUST","9"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_1d_AIR","10"   "cust1","MM1","CUST","10"   shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","CUST","4"    "SINK","-","-","100"    cust_to_sink    flow    demand  0   null    null    50
"vmi1","MM1","VMI","0"  "cust1","MM1","SHIP_CUST_2d_AIR","2"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","1"  "cust1","MM1","SHIP_CUST_2d_AIR","3"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","2"  "cust1","MM1","SHIP_CUST_2d_AIR","4"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","3"  "cust1","MM1","SHIP_CUST_2d_AIR","5"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","4"  "cust1","MM1","SHIP_CUST_2d_AIR","6"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","5"  "cust1","MM1","SHIP_CUST_2d_AIR","7"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","6"  "cust1","MM1","SHIP_CUST_2d_AIR","8"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","7"  "cust1","MM1","SHIP_CUST_2d_AIR","9"    vmi_to_shipcust flow    null    5   null    null    null
"vmi1","MM1","VMI","8"  "cust1","MM1","SHIP_CUST_2d_AIR","10"   vmi_to_shipcust flow    null    5   null    null    null
"cust1","MM1","SHIP_CUST_2d_AIR","2"    "cust1","MM1","CUST","2"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_2d_AIR","3"    "cust1","MM1","CUST","3"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_2d_AIR","4"    "cust1","MM1","CUST","4"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_2d_AIR","5"    "cust1","MM1","CUST","5"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_2d_AIR","6"    "cust1","MM1","CUST","6"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_2d_AIR","7"    "cust1","MM1","CUST","7"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_2d_AIR","8"    "cust1","MM1","CUST","8"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_2d_AIR","9"    "cust1","MM1","CUST","9"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM1","SHIP_CUST_2d_AIR","10"   "cust1","MM1","CUST","10"   shipcust_to_cust    flow    null    0   null    null    null
"source","-","-","0"    "vmi2","MM2","VMI","2"  source_to_VMI   supply  equality supply 0   50  null    null
"vmi2","MM2","VMI","0"  "cust1","MM2","SHIP_CUST_1d_AIR","1"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","1"  "cust1","MM2","SHIP_CUST_1d_AIR","2"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","2"  "cust1","MM2","SHIP_CUST_1d_AIR","3"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","3"  "cust1","MM2","SHIP_CUST_1d_AIR","4"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","4"  "cust1","MM2","SHIP_CUST_1d_AIR","5"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","5"  "cust1","MM2","SHIP_CUST_1d_AIR","6"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","6"  "cust1","MM2","SHIP_CUST_1d_AIR","7"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","7"  "cust1","MM2","SHIP_CUST_1d_AIR","8"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","8"  "cust1","MM2","SHIP_CUST_1d_AIR","9"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","9"  "cust1","MM2","SHIP_CUST_1d_AIR","10"   vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","0"  "vmi2","MM2","VMI","1"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","1"  "vmi2","MM2","VMI","2"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","2"  "vmi2","MM2","VMI","3"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","3"  "vmi2","MM2","VMI","4"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","4"  "vmi2","MM2","VMI","5"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","5"  "vmi2","MM2","VMI","6"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","6"  "vmi2","MM2","VMI","7"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","7"  "vmi2","MM2","VMI","8"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","8"  "vmi2","MM2","VMI","9"  vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","9"  "vmi2","MM2","VMI","10" vmi_to_vmi_inv  flow    null    0   null    null    null
"vmi2","MM2","VMI","10" "SINK","-","-","100"    vmi_to_sink esacpe  null    100 null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","1"    "cust1","MM2","CUST","1"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","2"    "cust1","MM2","CUST","2"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","3"    "cust1","MM2","CUST","3"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","4"    "cust1","MM2","CUST","4"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","5"    "cust1","MM2","CUST","5"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","6"    "cust1","MM2","CUST","6"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","7"    "cust1","MM2","CUST","7"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","8"    "cust1","MM2","CUST","8"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","9"    "cust1","MM2","CUST","9"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_1d_AIR","10"   "cust1","MM2","CUST","10"   shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","CUST","9"    "SINK","-","-","100"    cust_to_sink    flow    demand  0   null    null    10
"vmi2","MM2","VMI","0"  "cust1","MM2","SHIP_CUST_2d_AIR","2"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","1"  "cust1","MM2","SHIP_CUST_2d_AIR","3"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","2"  "cust1","MM2","SHIP_CUST_2d_AIR","4"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","3"  "cust1","MM2","SHIP_CUST_2d_AIR","5"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","4"  "cust1","MM2","SHIP_CUST_2d_AIR","6"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","5"  "cust1","MM2","SHIP_CUST_2d_AIR","7"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","6"  "cust1","MM2","SHIP_CUST_2d_AIR","8"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","7"  "cust1","MM2","SHIP_CUST_2d_AIR","9"    vmi_to_shipcust flow    null    1.4 null    null    null
"vmi2","MM2","VMI","8"  "cust1","MM2","SHIP_CUST_2d_AIR","10"   vmi_to_shipcust flow    null    1.4 null    null    null
"cust1","MM2","SHIP_CUST_2d_AIR","2"    "cust1","MM2","CUST","2"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_2d_AIR","3"    "cust1","MM2","CUST","3"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_2d_AIR","4"    "cust1","MM2","CUST","4"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_2d_AIR","5"    "cust1","MM2","CUST","5"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_2d_AIR","6"    "cust1","MM2","CUST","6"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_2d_AIR","7"    "cust1","MM2","CUST","7"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_2d_AIR","8"    "cust1","MM2","CUST","8"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_2d_AIR","9"    "cust1","MM2","CUST","9"    shipcust_to_cust    flow    null    0   null    null    null
"cust1","MM2","SHIP_CUST_2d_AIR","10"   "cust1","MM2","CUST","10"   shipcust_to_cust    flow    null    0   null    null    null
"vmi1","MM1","VMI","0"  "cust3","MM1","SHIP_CUST_1d_AIR","1"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","1"  "cust3","MM1","SHIP_CUST_1d_AIR","2"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","2"  "cust3","MM1","SHIP_CUST_1d_AIR","3"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","3"  "cust3","MM1","SHIP_CUST_1d_AIR","4"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","4"  "cust3","MM1","SHIP_CUST_1d_AIR","5"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","5"  "cust3","MM1","SHIP_CUST_1d_AIR","6"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","6"  "cust3","MM1","SHIP_CUST_1d_AIR","7"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","7"  "cust3","MM1","SHIP_CUST_1d_AIR","8"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","8"  "cust3","MM1","SHIP_CUST_1d_AIR","9"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","9"  "cust3","MM1","SHIP_CUST_1d_AIR","10"   vmi_to_shipcust flow    null    15  null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","1"    "cust3","MM1","CUST","1"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","2"    "cust3","MM1","CUST","2"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","3"    "cust3","MM1","CUST","3"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","4"    "cust3","MM1","CUST","4"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","5"    "cust3","MM1","CUST","5"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","6"    "cust3","MM1","CUST","6"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","7"    "cust3","MM1","CUST","7"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","8"    "cust3","MM1","CUST","8"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","9"    "cust3","MM1","CUST","9"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_1d_AIR","10"   "cust3","MM1","CUST","10"   shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","CUST","6"    "SINK","-","-","100"    cust_to_sink    flow    demand  0   null    null    5
"vmi1","MM1","VMI","0"  "cust3","MM1","SHIP_CUST_2d_AIR","2"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","1"  "cust3","MM1","SHIP_CUST_2d_AIR","3"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","2"  "cust3","MM1","SHIP_CUST_2d_AIR","4"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","3"  "cust3","MM1","SHIP_CUST_2d_AIR","5"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","4"  "cust3","MM1","SHIP_CUST_2d_AIR","6"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","5"  "cust3","MM1","SHIP_CUST_2d_AIR","7"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","6"  "cust3","MM1","SHIP_CUST_2d_AIR","8"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","7"  "cust3","MM1","SHIP_CUST_2d_AIR","9"    vmi_to_shipcust flow    null    15  null    null    null
"vmi1","MM1","VMI","8"  "cust3","MM1","SHIP_CUST_2d_AIR","10"   vmi_to_shipcust flow    null    15  null    null    null
"cust3","MM1","SHIP_CUST_2d_AIR","2"    "cust3","MM1","CUST","2"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_2d_AIR","3"    "cust3","MM1","CUST","3"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_2d_AIR","4"    "cust3","MM1","CUST","4"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_2d_AIR","5"    "cust3","MM1","CUST","5"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_2d_AIR","6"    "cust3","MM1","CUST","6"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_2d_AIR","7"    "cust3","MM1","CUST","7"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_2d_AIR","8"    "cust3","MM1","CUST","8"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_2d_AIR","9"    "cust3","MM1","CUST","9"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM1","SHIP_CUST_2d_AIR","10"   "cust3","MM1","CUST","10"   shipcust_to_cust    flow    null    0   null    null    null
"vmi2","MM2","VMI","0"  "cust3","MM2","SHIP_CUST_1d_AIR","1"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","1"  "cust3","MM2","SHIP_CUST_1d_AIR","2"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","2"  "cust3","MM2","SHIP_CUST_1d_AIR","3"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","3"  "cust3","MM2","SHIP_CUST_1d_AIR","4"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","4"  "cust3","MM2","SHIP_CUST_1d_AIR","5"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","5"  "cust3","MM2","SHIP_CUST_1d_AIR","6"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","6"  "cust3","MM2","SHIP_CUST_1d_AIR","7"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","7"  "cust3","MM2","SHIP_CUST_1d_AIR","8"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","8"  "cust3","MM2","SHIP_CUST_1d_AIR","9"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","9"  "cust3","MM2","SHIP_CUST_1d_AIR","10"   vmi_to_shipcust flow    null    1.8 null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","1"    "cust3","MM2","CUST","1"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","2"    "cust3","MM2","CUST","2"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","3"    "cust3","MM2","CUST","3"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","4"    "cust3","MM2","CUST","4"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","5"    "cust3","MM2","CUST","5"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","6"    "cust3","MM2","CUST","6"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","7"    "cust3","MM2","CUST","7"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","8"    "cust3","MM2","CUST","8"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","9"    "cust3","MM2","CUST","9"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_1d_AIR","10"   "cust3","MM2","CUST","10"   shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","CUST","8"    "SINK","-","-","100"    cust_to_sink    flow    demand  0   null    null    7
"vmi2","MM2","VMI","0"  "cust3","MM2","SHIP_CUST_2d_AIR","2"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","1"  "cust3","MM2","SHIP_CUST_2d_AIR","3"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","2"  "cust3","MM2","SHIP_CUST_2d_AIR","4"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","3"  "cust3","MM2","SHIP_CUST_2d_AIR","5"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","4"  "cust3","MM2","SHIP_CUST_2d_AIR","6"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","5"  "cust3","MM2","SHIP_CUST_2d_AIR","7"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","6"  "cust3","MM2","SHIP_CUST_2d_AIR","8"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","7"  "cust3","MM2","SHIP_CUST_2d_AIR","9"    vmi_to_shipcust flow    null    1.8 null    null    null
"vmi2","MM2","VMI","8"  "cust3","MM2","SHIP_CUST_2d_AIR","10"   vmi_to_shipcust flow    null    1.8 null    null    null
"cust3","MM2","SHIP_CUST_2d_AIR","2"    "cust3","MM2","CUST","2"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_2d_AIR","3"    "cust3","MM2","CUST","3"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_2d_AIR","4"    "cust3","MM2","CUST","4"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_2d_AIR","5"    "cust3","MM2","CUST","5"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_2d_AIR","6"    "cust3","MM2","CUST","6"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_2d_AIR","7"    "cust3","MM2","CUST","7"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_2d_AIR","8"    "cust3","MM2","CUST","8"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_2d_AIR","9"    "cust3","MM2","CUST","9"    shipcust_to_cust    flow    null    0   null    null    null
"cust3","MM2","SHIP_CUST_2d_AIR","10"   "cust3","MM2","CUST","10"   shipcust_to_cust    flow    null    0   null    null    null
"SINK","-","-","100"    "source","-","-","0"    closed_loop flow    null    0   null    null    null

私の R コードは次のとおりです。上記の csv データを取得して、ファイル C:/dumy_network.csv に貼り付ける必要があります。

私の R コードはあまり効率的ではないかもしれませんが、目的には役立ちます!

library("lpSolve", lib.loc="C:/Users/njog/Documents/R/win-library/3.0")

#get the data from CSV file
mydata <- read.csv("C:/dumy_network.csv", header=TRUE)

#build list of nodes (no repetition)
nodes=unique(c(as.character(mydata$startlink),as.character(mydata$endlink)))
#list of all links
links=mydata[,1:2]
#cost of moving material on each link - optimization problem objective coefficients
cost=mydata$cost

#decision variable is flow on each link. Objective is to minimize product of (cost on each link*flow on the link). Therefore, count of decision variable is equal to count of links.

#constraints matrix: for each node in nodes, incoming quantity should be equal to outgoing quantity. 

constraints=matrix(0,sum(mydata$max_const!='null')+sum(mydata$equality_const!='null')+length(nodes),length(mydata$endlink))

for (i in 1:length(nodes) ) {
  constraints[i,]=t(1*(nodes[i]==links[,1])-1*(nodes[i]==links[,2]))
}

#get constraints for equality constraints- in some cases we have to ship material exactly same as this quanity.
constraint1=matrix(mydata$equality_const,1,length(mydata$equality_const))
constraint1[constraint1=="null"]=0
constraint1=as.numeric(constraint1)
constraint1_length=which(constraint1!=0)

constraint1_final=matrix(0,length(constraint1_length),length(mydata$equality_const))

for (i in 1:length(constraint1_length) ) {
  constraint1_final[i,constraint1_length[i]]=1
}
start=length(nodes)+1
end=length(nodes)+length(constraint1_length)
constraints[start:end,]=constraint1_final

#get constraints for maxconstraints - in some cases we cannot ship material exceeding this quanity.
constraint2=matrix(mydata$max_const,1,length(mydata$max_const))
constraint2[constraint2=="null"]=0
constraint2=as.numeric(constraint2)
constraint2_length=which(constraint2!=0)

constraint2_final=matrix(0,length(constraint2_length),length(mydata$max_const))

for (i in 1:length(constraint2_length) ) {
  constraint2_final[i,constraint2_length[i]]=1
}
start=end+1
end=end+length(constraint2_length)
constraints[start:end,]=constraint2_final


#building direction of constraints
direction=c(rep("=",length(nodes)),rep("=",sum(mydata$equality_const!='null')),rep("<=",sum(mydata$max_const!='null')))

#building right hand side of constraints
b1=as.numeric(as.character(mydata$equality_const[constraint1_length]))
b2=as.numeric(as.character(mydata$max_const[constraint2_length]))
b=c(rep(0,length(nodes)),b1,b2)

res = lpSolve::lp('min', cost, constraints, direction, b,  all.int = TRUE)
res$solution

answers1=data.frame(res$solution)
mydata=cbind(mydata,answers1)

====================================更新2=========== =========================== 答えが得られないので、私の質問を単純化しようとしています:

ページの例のセクションでは、簡単な問題を示します。Mapreduce を使用して解決する方法を知っている人はいますか? 私は同様の問題を抱えているとしましょうが、膨大な数の変数と制約がある場合、より高速な処理を実現する方法はありますか?

4

1 に答える 1

2

つまり、線形計画法 (lp) を大規模に実行したいのですが、ソルバーのパフォーマンスに満足していません。

アプローチ

以下のアプローチを提案します。

ソルバー

このソルバーを使用する必要がありますか?
- Gurobi
- Mosek
- CPlex _

並列実行

並列処理を実現するための弱いアプローチは、プロセスを並列に実行することです。一度に複数の最適化を開始できますか? (ここでは、Hadoop で簡単な実行タスクを作成できます)

入力の改善

それに応じてデータを渡すと、ソルバーのパフォーマンスが大幅に向上します (疎行列など)。

あなたのコードでは、を使用しますlpSolve::lplpSolver 5.6.7 の CRAN ページとそのPDFによると、トランスポートの問題には特別なモードがありますlpSolve:lp.transport。(私は R を使用したことがなく、構文に慣れていません。私は Matlab の「愛好家」です。)

最新の研究

たぶん、学問にいくらかのエネルギーが費やされます。sciencedirect.comで論文 (数ドル) が見つかるかもしれません。

ハードウェア

CPU が高速であるほど、ソリューション (回答) を取得する速度が速くなります。お客様の環境 (OS、CPU) に関する洞察を提供していただけませんか?

最終的な考え

数値最適化は数学と密接に関連しており、「それほど多くのプログラミングを必要としない」ため、 quant.stackexchange.comで質問を提起しようとしましたか。

パラレルモード

CLPを使用します。一部の同僚によると、フラグを設定するか、別の実装を使用してソルバーを並行して実行できます (1 つの問題が多くのコアで実行されます)。SYMPHONYをご覧ください。




あなたの環境(OS、CPU)に関する情報を提供していただけませんか?

私の賞金

Quora で、Hadoop はデータ処理に優れ、I/O が高速であり、最適化や計算用に特別に設計されていないという答えを見つけることができます: Quora

私に賞金を授与したくない場合は、お知らせください。

+100 の報奨金がありません

調査を行ったにもかかわらず、報奨金を受け取っていません... このスレッドは、あなたが必要な詳細を提供しないところまで来ており、私たちが解決する必要があります - これは決してうまくいきません!

于 2014-04-13T13:05:15.610 に答える