Class AttributeStructuralFeatureAllocator.HungarianAllocator

java.lang.Object
org.eclipse.epsilon.flexmi.AttributeStructuralFeatureAllocator.HungarianAllocator
Enclosing class:
AttributeStructuralFeatureAllocator

public class AttributeStructuralFeatureAllocator.HungarianAllocator extends Object
Class implementing the Hungarian algorithm for attribute to feature allocation Adapted from https://github.com/amirbawab/Hungarian-Algorithm
  • Constructor Details

  • Method Details

    • subtractRowMinimal

      public void subtractRowMinimal()
      Step 1 Subtract from every element the minimum value from its row
    • subtractColMinimal

      public void subtractColMinimal()
      Step 2 Subtract from every element the minimum value from its column
    • coverZeros

      public void coverZeros()
      Step 3.1 Loop through all elements, and run colorNeighbors when the element visited is equal to zero
    • createAdditionalZeros

      public void createAdditionalZeros()
      Step 4 This step is not always executed. (Check the algorithm in the constructor) Create additional zeros, by coloring the minimum value of uncovered cells (cells not colored by any line)
    • optimization

      public boolean optimization()
      Overload optimization(int row) method
      Returns:
      true
    • getResult

      public int[] getResult()
      Get the result by returning an array containing the cell assigned for each row
      Returns:
      Array of rows where each array index represent the row number, and the value at each index is the column assigned to the corresponding row
    • cloneMatrix

      public int[][] cloneMatrix(int[][] matrix)
      Clone the 2D array
      Returns:
      A copy of the 2D array