romtools.workflows.hybrid_greedy.run_hybrid_greedy#

romtools.workflows.hybrid_greedy.run_hybrid_greedy(fom_model, rom_model_builder, parameter_space, absolute_work_dir, tolerance, initial_sample_size=10, batch_size=5, candidate_pool_size=1000, distance_metric=None, max_concurrent_fom_runs=5, random_seed=1, *, error_functor=None, validation_strategy=None, max_iterations=20, max_fom_samples=None, create_rom_run_directories=True)[source]#

Train with one greedy point and up to batch_size - 1 maximin points.

Initialization draws directly from parameter_space.generate_samples; duplicate/metric-equivalent rows are removed in sampler order. Each later round draws a fresh pool, excludes training-equivalent points, ranks raw error indicators, and completes the batch by maximin selection from the same pool. Ties use candidate order. No parameter normalization is applied. A short pool or remaining FOM budget may shorten a batch.

The four-argument builder receives all accumulated FOM directories, parameter rows, and QoI rows. Production ROMs must implement QoiModelWithErrorEstimate. Indicators rank candidates only; the unchanged space-filling validation strategy controls stopping (default: maximum held-out relative L2 error over five folds). Initial training is validated before any adaptation.

Candidate ROM evaluations are serial and use temporary directories removed after selection, including on failure. Set create_rom_run_directories to False for in-memory models: calls still receive nominal absolute paths, which need not exist. Validation retains its existing directory behavior.

FOM batches use process-isolated execution with independent directories; parallel FOM objects must support multiprocessing spawn serialization. All tasks finish before any rebuild or failure is reported. Failed batches retain FOM files and never enter a ROM build. max_iterations includes initialization; max_fom_samples caps training runs, not custom validation references. Output must be an absent or empty absolute directory. Restart and automatic retries are not supported.

Parameters:
  • fom_model (QoiModel)

  • rom_model_builder (QoiModelBuilderWithTrainingData)

  • parameter_space (ParameterSpace)

  • absolute_work_dir (str)

  • tolerance (float)

  • initial_sample_size (int)

  • batch_size (int)

  • candidate_pool_size (int)

  • distance_metric (Callable | None)

  • max_concurrent_fom_runs (int)

  • random_seed (int)

  • error_functor (Callable | None)

  • validation_strategy (Callable | None)

  • max_iterations (int)

  • max_fom_samples (int | None)

  • create_rom_run_directories (bool)

Return type:

HybridGreedyResult