opthub-org / problem-machine-scheduling

0 stars 0 forks source link

Docker Image化 #8

Open TakatoKinoshita opened 11 months ago

TakatoKinoshita commented 11 months ago

とりあえず #2 が終わってからでいい気がする

NaokiHamada commented 11 months ago

2 が終わってからでOKです。

現状すでにDockerfileがあるので、READMEに記載されたビルドコマンド打つだけでimage化できます。 最終的にはCIでビルドしてDockerHubにpushしたいですね。

TakatoKinoshita commented 11 months ago

2 が終わったのでとりあえずイメージをビルドして実行してみたところ...

 docker run -it opthub/machine-scheduling:latest
{"schedule": [1,2,3,4,5,6,7,8,8,9], "timeout": 500}
[message.c:247] ERROR: cannot open log file <Log/Log1696496225.log> for writing
SCIP version 8.0.4 [precision: 8 byte] [memory: block] [mode: optimized] [LP solver: Soplex 6.0.4] [GitHash: a8e51afd1e]
Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB)

External libraries:
(中略)
written solution information to file <test.sol>

{"objective": null, "constraint": null, "error": "Traceback (most recent call last):\n  File \"/work/problem.py\", line 213, in <module>\n    main()\n  File \"/work/problem.py\", line 199, in main\n    obj, const, exe_time = evaluat
ion(schedule, timeout)\n                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/work/problem.py\", line 126, in evaluation\n    num = int(val[0][4:])\n          ^^^^^^^^^^^^^^^\nValueError: invalid literal for int() with
 base 10: ''\n"}

エラーと思われる箇所: https://github.com/opthub-org/machine-scheduling/blob/cc1fde2c364718896054ce39e413ae2a76406d2c/problem.py#L123-L128 の126行目に

ValueError: invalid literal for int() with base 10: ''
TakatoKinoshita commented 11 months ago

事前定義済みのワーク数と検証用のデフォルトのワーク数 (= 5) が違うために起きている?

事前定義済みのワーク数を取得していると思われる箇所 https://github.com/opthub-org/machine-scheduling/blob/cc1fde2c364718896054ce39e413ae2a76406d2c/problem.py#L108-L110

検証用のワーク数を取得している箇所 https://github.com/opthub-org/machine-scheduling/blob/cc1fde2c364718896054ce39e413ae2a76406d2c/problem.py#L190-L191

TakatoKinoshita commented 11 months ago

どうやら事前定義済みのワーク数は8っぽかったので手元で修正し,ビルドして

docker run -it opthub/machine-scheduling:latest   
{"schedule": [1,2,3,4,5,6,7,8,9,1,1,1,1,1,1,1], "timeout": 500}

を実行しても https://github.com/opthub-org/machine-scheduling/issues/8#issuecomment-1748447391 と同様のエラー

TakatoKinoshita commented 11 months ago

松崎さんの修正コードで動きました!

docker run -it opthub/machine-scheduling:latest
{"schedule": [1,2,3,4,5,6,7,8,9,1,1,1,1,1,1,1], "timeout": 500}                                                               
[message.c:247] ERROR: cannot open log file <Log/Log1696575148.log> for writing                                            
SCIP version 8.0.4 [precision: 8 byte] [memory: block] [mode: optimized] [LP solver: Soplex 6.0.4] [GitHash: a8e51afd1e]   
Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB)                                                                        

External libraries:
(中略)
written solution information to file <test.sol>

{"objective": 7118.0, "constraint": [0.0, 0.0, 0.0, 0.0, 0.0, 1077.0, 2454.0, 3884.0], "error": null, "info": {"exe_time": 4.316053289017873}}
TakatoKinoshita commented 11 months ago

気になるポイント:

TakatoKinoshita commented 11 months ago

メモ: constraintinfoに入れる

TakatoKinoshita commented 11 months ago

imageに問題全部入りにして,環境変数でオプションとして切り替える方式
imageは1つ
問題を自作したい場合は,ローカルファイルをマウント

TakatoKinoshita commented 11 months ago

おおよそ完了.
残りタスク: