Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-631

Engine: indictmentMap (reverse of ConstraintMatch's justificationList) for visualization and Guided Local Search

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.Beta8
    • 6.4.0.Final
    • optaplanner-core
    • None
    • NEW
    • NEW

      How much does one entity impact the score? Which are the bad entities?

      Map<Object, List<ConstraintMatch>> indictmentMap = guiScoreDirector.extractIndictmentMap();
      ...
      for (List<ConstraintMatch> matches : indictmentMap.get(myEntity)) {
          for (ConstraintMatch match : matches) {
              System.out.println(match); // Use match.getScoreLevel() and match.getWeightAsNumber() to determine score impact
          }
      }
      
          public Map<Object, List<ConstraintMatch>> extractIndictmentMap() {
              Map<Object, List<ConstraintMatch>> indictmentMap = new HashMap<>();
              for (ConstraintMatchTotal constraintMatchTotal : getConstraintMatchTotals()) {
                  for (ConstraintMatch constraintMatch : constraintMatchTotal.getConstraintMatchSet()) {
                      for (Object justification : constraintMatch.getJustificationList()) {
                          List<ConstraintMatch> indictment = indictmentMap.get(justification);
                          if (indictment == null) {
                              indictment = new ArrayList<>();
                              indictmentMap.put(justification, indictment);
                          }
                          indictment.add(constraintMatch);
                      }
                  }
              }
              return indictmentMap;
          }
      

            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: