Package org.apache.sysds.hops.fedplanner

## Class MemoTable

- java.lang.Object
- - org.apache.sysds.hops.fedplanner.MemoTable

    public class MemoTable
    extends Object

Memoization of federated execution alternatives. This memoization data structure is used when generating optimal federated execution plans. The alternative executions are stored as HopRels and the methods of this class are used to add, update, and retrieve the alternatives.

### Constructor Summary

Constructors
`MemoTable()`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `containsHop​(Hop root)` Checks if root hop has been added to memo.
`boolean` `containsHopRel​(HopRel root)` Checks if given HopRel has been added to memo.
`HopRel` `getFederatedOutputAlternative​(Hop root)` Get the federated output alternative for given root hop or throw exception if not found.
`HopRel` `getFederatedOutputAlternativeOrNull​(Hop root)` Get the federated output alternative for given root hop or null if not found.
`List<String>` `getFedOutAlternatives​(Hop root)` Get list of strings representing the different hopRel federated outputs related to root hop.
`List<FTypes.FType>` `getFTypes​(Hop root)` Get all output FTypes of given root from HopRels stored in memo.
`HopRel` `getHopRel​(Hop root, FTypes.FType fType)`
`HopRel` `getLOUTOrNONEAlternative​(Hop root)`
`HopRel` `getMinCostAlternative​(Hop root)` Get the HopRel with minimum cost for given root hop
`boolean` `hasFederatedOutputAlternative​(Hop root)` Checks if any of the federated execution alternatives for the given root hop has federated output.
`void` `put​(Hop root, List<HopRel> hopRels)` Memoize hopRels related to given root.
`String` `toString()`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### MemoTable

    public MemoTable()

### Method Detail

#### getFedOutAlternatives

    public List<String> getFedOutAlternatives​(Hop root)

Get list of strings representing the different hopRel federated outputs related to root hop.

Parameters:
  `root` - for which HopRel fedouts are found
Returns:
  federated output values as strings

#### getMinCostAlternative

    public HopRel getMinCostAlternative​(Hop root)

Get the HopRel with minimum cost for given root hop

Parameters:
  `root` - hop for which minimum cost HopRel is found
Returns:
  HopRel with minimum cost for given hop

#### hasFederatedOutputAlternative

    public boolean hasFederatedOutputAlternative​(Hop root)

Checks if any of the federated execution alternatives for the given root hop has federated output.

Parameters:
  `root` - hop for which execution alternatives are checked
Returns:
  true if root has federated output as an execution alternative

#### getFederatedOutputAlternative

    public HopRel getFederatedOutputAlternative​(Hop root)

Get the federated output alternative for given root hop or throw exception if not found.

Parameters:
  `root` - hop for which federated output HopRel is returned
Returns:
  federated output HopRel for given root hop

#### getFederatedOutputAlternativeOrNull

    public HopRel getFederatedOutputAlternativeOrNull​(Hop root)

Get the federated output alternative for given root hop or null if not found.

Parameters:
  `root` - hop for which federated output HopRel is returned
Returns:
  federated output HopRel for given root hop

#### getLOUTOrNONEAlternative

    public HopRel getLOUTOrNONEAlternative​(Hop root)

#### put

    public void put​(Hop root,
                    List<HopRel> hopRels)

Memoize hopRels related to given root.

Parameters:
  `root` - for which hopRels are added
  `hopRels` - execution alternatives related to the given root

#### containsHop

    public boolean containsHop​(Hop root)

Checks if root hop has been added to memo.

Parameters:
  `root` - hop
Returns:
  true if root has been added to memo.

#### containsHopRel

    public boolean containsHopRel​(HopRel root)

Checks if given HopRel has been added to memo.

Parameters:
  `root` - HopRel
Returns:
  true if root HopRel has been added to memo.

#### getFTypes

    public List<FTypes.FType> getFTypes​(Hop root)

Get all output FTypes of given root from HopRels stored in memo.

Parameters:
  `root` - for which output FTypes are found
Returns:
  list of output FTypes

#### getHopRel

    public HopRel getHopRel​(Hop root,
                            FTypes.FType fType)

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`