Class NaiveMCPSolver

java.lang.Object
org.ddolib.examples.layered.mcp.NaiveMCPSolver

public class NaiveMCPSolver extends Object
Naive MCP solver which enumerates all the solution to find the best one. Used for tests.
  • Constructor Details

    • NaiveMCPSolver

      public NaiveMCPSolver(MCPProblem problem)
      Creates a new naive solver for the given MCP instance.
      Parameters:
      problem - the MCP instance to solve
  • Method Details

    • getOptimalSolution

      public static int getOptimalSolution(int[][] matrix)
      Given an adjacency matrix, solves naively the instance of MCP.
      Parameters:
      matrix - the adjacency matrix defining the MCP
      Returns:
      the optimal solution of the MCP
    • best

      public int best()
      Returns the best value found so far.
      Returns:
      the best value found so far
    • bestSolution

      public int[] bestSolution()
      Returns the best solution found so far.
      Returns:
      the best solution found so far
    • maximize

      public void maximize()
      Enumerates all possible partitions and keeps track of the best one.