evox.workflows.eval_monitor#

Module Contents#

Classes#

EvalMonitor

Evaluation monitor. Used for both single-objective and multi-objective workflow. Hooked around the evaluation process, can monitor the offspring, their corresponding fitness and keep track of the evaluation count. Moreover, it can also record the best solution or the pareto front on-the-fly.

API#

class evox.workflows.eval_monitor.EvalMonitor(multi_obj: bool = False, full_fit_history: bool = True, full_sol_history: bool = False, full_pop_history: bool = False, topk: int = 1, device: torch.device | None = None)[source]#

Bases: evox.core.Monitor

Evaluation monitor. Used for both single-objective and multi-objective workflow. Hooked around the evaluation process, can monitor the offspring, their corresponding fitness and keep track of the evaluation count. Moreover, it can also record the best solution or the pareto front on-the-fly.

Initialization

Initialize the monitor.

Parameters:
  • multi_obj – Whether the optimization is multi-objective. Defaults to False.

  • full_fit_history – Whether to record the full history of fitness value. Default to True. Setting it to False may reduce memory usage.

  • full_sol_history – Whether to record the full history of solutions. Default to False. Setting it to True may increase memory usage.

  • topk – Only affect Single-objective optimization. The number of elite solutions to record. Default to 1, which will record the best individual.

  • device – The device of the monitor. Defaults to None.

fitness_history: List[torch.Tensor]#

None

solution_history: List[torch.Tensor]#

None

auxiliary: List[Dict[str, torch.Tensor]]#

None

set_config(**config)[source]#
record_auxiliary(aux: Dict[str, torch.Tensor])[source]#
post_ask(candidate_solution: torch.Tensor)[source]#
pre_tell(fitness: torch.Tensor)[source]#
get_latest_fitness() torch.Tensor[source]#

Get the fitness values from the latest iteration.

get_latest_solution() torch.Tensor[source]#

Get the solution from the latest iteration.

get_topk_fitness() torch.Tensor[source]#

Get the topk fitness values so far.

get_topk_solutions() torch.Tensor[source]#

Get the topk solutions so far.

get_best_solution() torch.Tensor[source]#

Get the best solution so far.

get_best_fitness() torch.Tensor[source]#

Get the best fitness value so far.

get_fitness_history() List[torch.Tensor][source]#

Get the full history of fitness values.

get_solution_history() List[torch.Tensor][source]#

Get the full history of solutions.

plot(problem_pf=None, **kwargs)[source]#