Package org.apache.sysds.hops.fedplanner

## Class FederatedPlanCostEstimator

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

    public class FederatedPlanCostEstimator
    extends Object

Cost estimator for federated execution plans. Calculates computation, memory access, and network transfer costs for federated operations. Works in conjunction with FederatedMemoTable to evaluate different execution plan variants.

### Constructor Summary

Constructors
`FederatedPlanCostEstimator()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `computeFederatedPlanCost​(FederatedMemoTable.FedPlan currentPlan, FederatedMemoTable memoTable)` Computes total cost of federated plan by: 1.
`static LinkedHashMap<FederatedMemoTable.FedPlan,​Boolean>` `resolveConflictFedPlan​(FederatedMemoTable memoTable, LinkedHashMap<Long,​List<FederatedMemoTable.FedPlan>> conflictFedPlanLinkedMap, double[] cumulativeAdditionalCost)` Resolves conflicts in federated plans where different plans have different FederatedOutput types.

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

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

### Constructor Detail

#### FederatedPlanCostEstimator

    public FederatedPlanCostEstimator()

### Method Detail

#### computeFederatedPlanCost

    public static void computeFederatedPlanCost​(FederatedMemoTable.FedPlan currentPlan,
                                                FederatedMemoTable memoTable)

Computes total cost of federated plan by: 1. Computing current node cost (if not cached) 2. Adding minimum-cost child plans 3. Including network transfer costs when needed

Parameters:
  `currentPlan` - Plan to compute cost for
  `memoTable` - Table containing all plan variants

#### resolveConflictFedPlan

    public static LinkedHashMap<FederatedMemoTable.FedPlan,​Boolean> resolveConflictFedPlan​(FederatedMemoTable memoTable,
                                                                                                 LinkedHashMap<Long,​List<FederatedMemoTable.FedPlan>> conflictFedPlanLinkedMap,
                                                                                                 double[] cumulativeAdditionalCost)

Resolves conflicts in federated plans where different plans have different FederatedOutput types. This function traverses the list of conflicting plans in reverse order to ensure that conflicts are resolved from the bottom-up, allowing for consistent federated output types across the plan. It calculates additional costs for each potential resolution and updates the cumulative additional cost.

Parameters:
  `memoTable` - The FederatedMemoTable containing all federated plan variants.
  `conflictFedPlanLinkedMap` - A map of plan IDs to lists of parent plans with conflicting federated outputs.
  `cumulativeAdditionalCost` - An array to store the cumulative additional cost incurred by resolving conflicts.
Returns:
  A LinkedHashMap of resolved federated plans, marked with a boolean indicating resolution status.