2021年1月23日土曜日

Evaluatorの修正

 EvaluatorをDownloadして、次のコマンドで起動しようとしても、


C:\Users\tak.sugawara\Downloads\evaluator-jar>java -jar evaluator.jar
evaluator.jarにメイン・マニフェスト属性がありません

となって起動できません。jar ファイルの実態は、zipファイルのようですので、zipファイルとして展開するとソースを読むことができます。そこで、メインクラスを拾って、さらに、読み込んでいるライブラリのクラスパスを設定したファイルtest.maniを以下のように設定します。


  
sugatak@DESKTOP-5AQMG4V:~/INRC1$ more test.mani
Main-Class: dds.nrp.core.evaluation.ScheduleEvaluator
Class-Path: /usr/share/java/dom4j.jar
 /usr/share/java/jaxen.jar

次のコマンドでevaluator.jarを修正します。

  
jar uvfm evaluator.jar test.mani

以上で、evaluator.jarの修正が完了しました。試しにsantosさんのサイトから解ファイルを持ってきて動かしてみます。

sugatak@DESKTOP-5AQMG4V:~/INRC1$ java -jar evaluator.jar instances/sprint02.xml solutions/sprint02.xml
Exception in thread "main" java.lang.NullPointerException
        at dds.nrp.core.tools.ScheduleParser.parseScheduleInfo(ScheduleParser.java:96)
        at dds.nrp.core.tools.ScheduleParser.parse(ScheduleParser.java:77)
        at dds.nrp.core.evaluation.ScheduleEvaluator.main(ScheduleEvaluator.java:112)

sugatak@DESKTOP-5AQMG4V:~/INRC1$ java -jar evaluator.jar instances/medium_hidden01.xml solutions/medium_hidden01_tak.xml
Schedule:
=========

Employee  0 |E    |  D  |  D  | L   |     |     |E    |E    | L   | L   | L   |     |     |E    |    N| L   |     |     |E    |E    | L   | L   |    N|     |     |E    |E    |  D  |
Employee  1 |     |     |     |    N|    N|    N|     |     |  D  |E    |E    |    N|    N|     |     |E    |E    |E    |     |     |  D  |E    |E    |E    | L   |     |     |     |
Employee  2 | L   | L   |    N|     |     |     |E    | L   | L   | L   |     | L   | L   |    N|    N|     |     |E    |E    |E    |    N|    N|     |     |E    |E    |E    |E    |
Employee  3 |  D  |  D  |  D  |     |     |     |   DH |   DH |   DH |   DH |   DH |     |     |  D  |   DH |  D  |     |     |   DH |   DH |   DH |   DH |     |   DH |   DH |   DH |   DH |   DH |
Employee  4 |     |     |     | L   |    N|    N|    N|     |     |E    |E    | L   | L   |     |     |E    | L   |    N|    N|    N|     |     |  D  |  D  |E    |     |     |     |
Employee  5 |E    |E    |E    | L   |     |     |E    |E    |E    |E    |E    |     |     |E    |  D  | L   |     |     |E    |E    |E    |  D  |  D  |     |     |E    |E    |E    |
Employee  6 |    N|    N| L   | L   |     |     |E    | L   |    N|     |     |E    |E    |E    |E    |E    |     |     |E    |E    |E    |E    |   DH |     |     |E    |E    |E    |
Employee  7 |     |     |     |  D  |E    |E    |     |     |  D  |  D  |E    | L   | L   |     |E    |  D  |E    | L   |     |     | L   |    N| L   |    N| L   |     |     |     |
Employee  8 |     |     |     |  D  |  D  |  D  |     |     |E    |E    |    N| L   | L   |     |     |E    |  D  |E    | L   | L   |     |     |E    |E    | L   |     |     |     |
Employee  9 | L   |    N| L   |     |     |     | L   | L   |    N| L   |     |E    |E    |  D  |E    | L   |     |     |    N|    N| L   | L   | L   |     |     |  D  |  D  |  D  |
Employee 10 |     |     |     |E    |E    |E    |    N|     |     |     |E    |    N|    N| L   | L   | L   | L   |     |     |     |    N| L   |    N|    N|     |     |     |     |
Employee 11 |     |     |     |E    |E    |E    | L   |     |     |     |    N|    N|    N| L   |     |     |     |    N| L   | L   | L   | L   | L   | L   |     |     |     |     |
Employee 12 |     |     |     |    N| L   | L   | L   |     |     |     |    N| L   | L   | L   |     |     |     |  D  |  D  |  D  |  D  |  D  |E    |E    |     |     |     |     |
Employee 13 |     |     |     |    N| L   | L   |    N|    N|     |     |     |  D  |  D  | L   | L   |    N| L   |     |     |     |    N|    N| L   | L   |     |     |     |     |
Employee 14 |     |     |     |E    | L   | L   | L   |    N|     |     |     |  D  |  D  | L   | L   |    N|    N|     |     |     |E    |E    |E    |  D  |     |     |     |     |
Employee 15 |     |     |     |     |E    |E    | L   |     |     |     |     |E    |E    |E    | L   |     |     |     |     |     | L   | L   | L   | L   |     |     |     |     |
Employee 16 | L   | L   | L   |     |     |     |     |  D  |E    |    N| L   |     |     |     |     |     |  D  | L   | L   | L   |     |     |     |     |  D  | L   | L   |    N|
Employee 17 | L   |    N|    N|     |     |     |     |E    |E    |  D  |  D  |     |     |     |     |     |E    |E    |  D  |  D  |     |     |     |     |    N| L   | L   | L   |
Employee 18 |    N| L   |    N|     |     |     |     | L   | L   |    N| L   |     |     |     |     |     |E    |E    |E    |E    |     |     |     |     |  D  |E    |E    |E    |
Employee 19 | L   | L   | L   |     |     |     |     |E    |    N|    N| L   |     |     |     |     |     | L   | L   | L   | L   |     |     |     |     |    N| L   | L   | L   |
Employee 20 |     |     |     |     |E    |E    |  D  |     |     |     |     |E    |E    |    N|    N|     |     |     |     |     |E    |E    |    N| L   |     |     |     |     |
Employee 21 |E    |E    |E    |     |     |     |     |E    | L   | L   | L   |     |     |     |     |     |    N|    N|    N|    N|     |     |     |     |E    |  D  |  D  |E    |
Employee 22 |     |     |     |     |     |     |E    |    N| L   | L   |     |     |     |     |E    |E    |E    |  D  |     |     |     |     |     |     |E    | L   | L   |    N|
Employee 23 |    N| L   | L   |     |     |     |     |  D  |E    |E    |  D  |     |     |     |     |     | L   | L   | L   | L   |     |     |     |     | L   | L   | L   | L   |
Employee 24 |     |     |     |     |  D  |  D  |  D  | L   |     |     |     |     |     |E    |E    |    N|     |     |     |     |E    |E    |E    |    N|     |     |     |     |
Employee 25 |     |     |     |     |     |     |     |     |     |     |     |E    |E    |    N| L   | L   |    N| L   |     |     |     |     |     |     |     |     |     |     |
Employee 26 |E    |E    |E    |E    | L   | L   |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     | L   | L   |    N|    N| L   |
Employee 27 |E    |E    |E    |E    | L   | L   |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |E    |    N|    N|    N|    N|
Employee 28 |  D  |E    |E    | L   |    N|    N|     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     |E    |E    |    N|    N| L   |
Employee 29 |   DH |   DH |   DH |   DH |   DH |   DH |     |     |     |     |     |   DH |   DH |   DH |  D  |   DH |   DH |   DH |     |     |     |     |     |     |     |     |     |     |

Violations:
===========

    Employee: 22
    ================
    Employee: 23
    ================
    Employee: 24
    ================
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 22, cost = 1
    Employee: 25
    ================
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 55, cost = 1
         Minimum consecutive working weekends: excess = 1 , pos = 139, cost = 5
    Employee: 26
    ================
         Minimum consecutive working weekends: excess = 1 , pos = 26, cost = 5
         Maximum number of assignments: excess = 1 , pos = 139, cost = 3
         Minimum consecutive working weekends: excess = 1 , pos = 139, cost = 5
    Employee: 27
    ================
         Minimum consecutive working weekends: excess = 1 , pos = 26, cost = 5
         Maximum number of assignments: excess = 1 , pos = 139, cost = 3
         Minimum consecutive working weekends: excess = 1 , pos = 139, cost = 5
    Employee: 28
    ================
         Minimum consecutive working weekends: excess = 1 , pos = 29, cost = 5
         Maximum number of assignments: excess = 1 , pos = 139, cost = 3
         Minimum consecutive working weekends: excess = 1 , pos = 139, cost = 5
    Employee: 29
    ================
         Minimum number of consecutive free days: excess = 5 , pos = 28, cost = 15
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 58, cost = 1
         Maximum number of assignments: excess = 3 , pos = 139, cost = 9
    Employee: 10
    ================
    Employee: 11
    ================
    Employee: 12
    ================
    Employee: 13
    ================
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 57, cost = 1
    Employee: 14
    ================
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 57, cost = 1
    Employee: 15
    ================
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 20, cost = 1
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 55, cost = 1
    Employee: 16
    ================
    Employee: 17
    ================
    Employee: 18
    ================
    Employee: 19
    ================
    Employee: 0
    ===============
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 90, cost = 1
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 125, cost = 1
    Employee: 1
    ===============
    Employee: 2
    ===============
         Minimum number of consecutive free days: excess = 1 , pos = 46, cost = 3
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 56, cost = 1
    Employee: 3
    ===============
         Minimum number of consecutive free days: excess = 1 , pos = 108, cost = 3
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 93, cost = 1
    Employee: 4
    ===============
    Employee: 5
    ===============
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 90, cost = 1
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 125, cost = 1
    Employee: 6
    ===============
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 55, cost = 1
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 90, cost = 1
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 125, cost = 1
         Alternative skill: excess = 1 , pos = 22, cost = 10
    Employee: 7
    ===============
         Minimum number of consecutive free days: excess = 1 , pos = 61, cost = 3
    Employee: 8
    ===============
    Employee: 9
    ===============
         Minimum number of consecutive free days: excess = 1 , pos = 46, cost = 3
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 55, cost = 1
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 94, cost = 1
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 127, cost = 1
    Employee: 20
    ================
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 20, cost = 1
         Unwanted pattern: None(Friday)-Any(Saturday)-Any(Sunday): excess = 1 , pos = 55, cost = 1
    Employee: 21
    ================

Penalty:
========
    111

sugatak@DESKTOP-5AQMG4V:~/INRC1$

santosさんの解ファイルで起動しないのは、Competitorタグが定義されていないからです。santosさんのサイトの解ファイルを見る場合には、Competitorタグを適当に追加してください。

私のソリューションファイル(medium_hidden01.xml)も上記のように動くようになりました。自分のソフトの目的関数値と、evaluatorの評価値が一致していないとき、ルールの解釈に齟齬があるか、もしくは、ソフト実装上の不具合があるということになります。実際的には、GUIでソルバーに投げるproblem.jsonを書いている訳ですが、GUIを修正して、一致させるようにします。以上の作業を繰り返し行って初めてCompetitionに対する準備が完了となります。

参考サイト

https://teratail.com/questions/23116

0 件のコメント:

コメントを投稿