Class MaxCoverRanking

java.lang.Object
org.ddolib.examples.maximumcoverage.MaxCoverRanking
All Implemented Interfaces:
Comparator<MaxCoverState>, StateRanking<MaxCoverState>

public class MaxCoverRanking extends Object implements StateRanking<MaxCoverState>
Ranking function for MaxCoverState used in the Maximum Coverage problem.

This class implements StateRanking and orders states based on the number of items they have covered. States covering fewer items are considered "smaller" and ranked lower.

  • Constructor Details

    • MaxCoverRanking

      public MaxCoverRanking()
  • Method Details

    • compare

      public int compare(MaxCoverState o1, MaxCoverState o2)
      Compares two MaxCover states based on the number of items they cover.
      Specified by:
      compare in interface Comparator<MaxCoverState>
      Parameters:
      o1 - the first state
      o2 - the second state
      Returns:
      a negative integer, zero, or a positive integer as the first state covers fewer, equal, or more items than the second state