Package org.eclipse.epsilon.flexmi
Class AttributeStructuralFeatureAllocator.HungarianAllocator
- java.lang.Object
 - 
- org.eclipse.epsilon.flexmi.AttributeStructuralFeatureAllocator.HungarianAllocator
 
 
- 
- Enclosing class:
 - AttributeStructuralFeatureAllocator
 
public class AttributeStructuralFeatureAllocator.HungarianAllocator extends java.lang.ObjectClass 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 arrayvoidcoverZeros()Step 3.1 Loop through all elements, and run colorNeighbors when the element visited is equal to zerovoidcreateAdditionalZeros()Step 4 This step is not always executed.int[]getResult()Get the result by returning an array containing the cell assigned for each rowbooleanoptimization()Overload optimization(int row) methodvoidsubtractColMinimal()Step 2 Subtract from every element the minimum value from its columnvoidsubtractRowMinimal()Step 1 Subtract from every element the minimum value from its row 
 - 
 
- 
- 
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
 
 
 - 
 
 -