Class AttributeStructuralFeatureAllocator.HungarianAllocator

  • Enclosing class:
    AttributeStructuralFeatureAllocator

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

      Constructors 
      Constructor Description
      HungarianAllocator​(java.util.List<java.lang.String> attributeValues, java.util.List<java.lang.String> slots)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int[][] cloneMatrix​(int[][] matrix)
      Clone the 2D array
      void coverZeros()
      Step 3.1 Loop through all elements, and run colorNeighbors when the element visited is equal to zero
      void createAdditionalZeros()
      Step 4 This step is not always executed.
      int[] getResult()
      Get the result by returning an array containing the cell assigned for each row
      boolean optimization()
      Overload optimization(int row) method
      void subtractColMinimal()
      Step 2 Subtract from every element the minimum value from its column
      void subtractRowMinimal()
      Step 1 Subtract from every element the minimum value from its row
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HungarianAllocator

        public HungarianAllocator​(java.util.List<java.lang.String> attributeValues,
                                  java.util.List<java.lang.String> slots)
    • Method Detail

      • 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