Class MCPRanking

java.lang.Object
org.ddolib.examples.layered.mcp.MCPRanking
All Implemented Interfaces:
Comparator<MCPState>, StateRanking<MCPState>

public class MCPRanking extends Object implements StateRanking<MCPState>
Class used to compare two states for the MCP problem.
When comparing two states, the best is the one that can generate the biggest benefit, independently of the decisions. That's why we sum the absolute value of each benefit to compare the states.
  • Constructor Details

    • MCPRanking

      public MCPRanking()
      Creates a new instance of this ranking.
  • Method Details

    • rank

      public static int rank(MCPState state)
      Computes the ranking value of a state, defined as the sum of the absolute value of the net benefit of each variable not yet assigned.
      Parameters:
      state - the state to rank
      Returns:
      the ranking value of the state
    • compare

      public int compare(MCPState o1, MCPState o2)
      Specified by:
      compare in interface Comparator<MCPState>