Class MetroOptimizer

java.lang.Object
com.eqixiac.equinix.design.optimizer.MetroOptimizer

public final class MetroOptimizer extends Object
The Metro Optimizer: which set of Equinix metros best serves a DesignSpec.
OptimizationResult result = MetroOptimizer.forSpec(fabric, spec).run();
result.getRecommended();   // the chosen metros, every objective, priced cost lines, constraint verdicts
result.getFrontier();      // every Pareto-optimal trade-off
result.getSensitivity();   // weight ranges, nearest alternative, binding constraints
result.toMarkdown();

The optimizer is an orchestrator. It gathers the facts once (FabricCatalogLoader: metros, measured latencies, cloud reachability), prices with a RateCardCostModel, measures the built-in objectives (BuiltInObjectives) plus any DesignPlugin objectives, applies the built-in constraints (Constraints.forSpec(DesignSpec)) plus plug-in constraints, searches every admissible set of metros with ExhaustiveSolver, analyses the answer's sensitivity, and places the workloads on the chosen set. Every decision lives in those plug-ins.

Design size: constraints.minMetros (or the redundancy tier's minimum, or 1) to constraints.maxMetros (default 3).

  • Field Details

    • DEFAULT_MAX_METROS

      public static final int DEFAULT_MAX_METROS
      Most metros a design may use when the spec sets no maxMetros.
      See Also:
  • Method Details

    • forSpec

      public static MetroOptimizer forSpec(FabricGateway fabric, DesignSpec spec)
      Optimises a spec against live Fabric data (read-only).
      Parameters:
      fabric - the Fabric API
      spec - the design
      Returns:
      a run to configure and run()
    • forContext

      public static MetroOptimizer forContext(CatalogDesignContext context)
      Optimises against prepared facts instead of live Fabric (offline what-ifs, tests, a cached catalogue).
      Parameters:
      context - the facts; its spec is the design
      Returns:
      a run to configure and run()
    • builder

      public static MetroOptimizer.Builder builder(FabricGateway fabric)
      A fluent convenience that assembles a DesignSpec and runs forSpec(FabricGateway, DesignSpec).
      Parameters:
      fabric - the Fabric API
      Returns:
      the builder
    • rateCard

      public MetroOptimizer rateCard(RateCard card)
      Parameters:
      card - the rate card to price with; default RateCard.standardChain(fabric) (live Equinix, then reference figures)
      Returns:
      this run
    • costModel

      public MetroOptimizer costModel(CostModel model)
      Parameters:
      model - a cost model replacing the default RateCardCostModel
      Returns:
      this run
    • currencyConverter

      public MetroOptimizer currencyConverter(CurrencyConverter converter)
      Parameters:
      converter - a currency converter (for example a live FX feed) ranked below rates pinned in the spec and above the default sources; a DesignPlugin.currencyConverter() is used when this is unset
      Returns:
      this run
    • defaultRates

      public MetroOptimizer defaultRates(CurrencyConverter defaults)
      Parameters:
      defaults - replaces the default rate sources (live ECB rates via Frankfurter, then the bundled table), for example CurrencyConverters.bundledOnly() for an offline run
      Returns:
      this run
    • solver

      public MetroOptimizer solver(ExhaustiveSolver exhaustiveSolver)
      Parameters:
      exhaustiveSolver - the solver (for example with another portfolio ceiling)
      Returns:
      this run
    • plugin

      public MetroOptimizer plugin(DesignPlugin plugin)
      Parameters:
      plugin - extra objectives and constraints; DesignPlugin.discover() finds classpath ones
      Returns:
      this run
    • multicloudEnvironments

      public MetroOptimizer multicloudEnvironments(MulticloudEnvironmentCatalog catalog)
      Parameters:
      catalog - the native multicloud environment catalogue (Beta) for the informational finding
      Returns:
      this run
    • run

      public OptimizationResult run()
      Runs the optimisation.
      Returns:
      the result; never null: when nothing is feasible the result says why
      Throws:
      IllegalArgumentException - when the spec has errors (DesignSpec.validate())