qpots.tsemo_runner
Python wrapper around the bundled MATLAB TS-EMO implementation.
- class qpots.tsemo_runner.TSEMORunner(func: str, x: list, y: list, lb: list, ub: list, iters: int, batch_number: int)[source]
Bases:
objectRuns the TS-EMO algorithm iteratively using MATLAB.
The TSEMORunner class interfaces with MATLAB’s TS-EMO implementation, allowing users to iteratively optimize a multi-objective function while updating results at each step.
Notes
Requires a working MATLAB installation and the MATLAB Engine API for Python.
Paths to the TS-EMO MATLAB files must be correctly configured.
- tsemo_hypervolume(Y: Tensor, ref_point: Tensor, train_shape: int, iters: int)[source]
Compute the hypervolume and Pareto front for a given set of objective values.
This function applies the Fast Nondominated Partitioning algorithm to evaluate hypervolume improvement over multiple iterations.
- Parameters:
Y (torch.Tensor) – A tensor of objective values, where each row represents a solution’s evaluated objectives.
ref_point (torch.Tensor) – A reference point for hypervolume calculation, typically set to be worse than the worst observed objective values.
train_shape (int) – The number of initial training points. Determines how many points are included in the hypervolume calculation at each step.
iters (int) – The number of iterations the optimization was run for.
- Returns:
hv: A list containing the hypervolume values computed at each iteration.
pf: A tensor representing the Pareto front (set of nondominated solutions).
- Return type:
Tuple[list, torch.Tensor]
- tsemo_run(save_dir: str, rep: int)[source]
Run the TS-EMO algorithm iteratively and save results after each iteration.
- Parameters:
save_dir (str) – The directory where results should be saved.
rep (int) – The repetition number used to differentiate saved files.
- Returns:
X: The updated input design points.
Y: The updated objective function evaluations.
times: The runtime per iteration.
- Return type:
Tuple[np.ndarray, np.ndarray, np.ndarray]
- Raises:
matlab.engine.EngineError – If the MATLAB engine encounters an error while running TS-EMO.