13.12. ホットプランニングエンティティーの視覚化

スコアに影響を与える計画エンティティーと問題の事実を強調表示するヒートマップを UI に表示します。

手順

  • ScoreExplanation から Indictment マップを取得します。

    Map<Object, Indictment<HardSoftScore>> indictmentMap = scoreExplanation.getIndictmentMap();
    for (CloudProcess process : cloudBalance.getProcessList()) {
        Indictment<HardSoftScore> indictment = indictmentMap.get(process);
        if (indictment == null) {
            continue;
        }
        // The score impact of that planning entity
        HardSoftScore totalScore = indictment.getScore();
    
        for (ConstraintMatch<HardSoftScore> constraintMatch : indictment.getConstraintMatchSet()) {
            String constraintName = constraintMatch.getConstraintName();
            HardSoftScore score = constraintMatch.getScore();
            ...
        }
    }

    Indictment は、その justification オブジェクトが関係するすべての制約の合計です。複数の Indictment エンティティーが同じ ConstraintMatch を共有できるため、すべての Indictment.getScoreTotal() の合計は全体のスコアとは異なります。

    注記

    制約ストリームと Drools スコア計算は制約一致を自動的にサポートしますが、Java インクリメント演算子によるスコア計算には追加のインターフェイスを実装する必要があります。