Class MaxCoverRanking
java.lang.Object
org.ddolib.examples.maximumcoverage.MaxCoverRanking
- All Implemented Interfaces:
Comparator<MaxCoverState>,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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompare(MaxCoverState o1, MaxCoverState o2) Compares two MaxCover states based on the number of items they cover.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
MaxCoverRanking
public MaxCoverRanking()
-
-
Method Details
-
compare
Compares two MaxCover states based on the number of items they cover.- Specified by:
comparein interfaceComparator<MaxCoverState>- Parameters:
o1- the first stateo2- 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
-