evox.core.components
#
模块内容#
类#
API#
- class evox.core.components.Algorithm[源代码]#
Bases:
evox.core.module.ModuleBase
,abc.ABC
所有算法的基类
Notice
如果子类定义了
step
的trace_impl
方法,即使不需要添加任何特殊内容,由于 Python 对象模型的限制,其对应的init_step
方法必须被覆盖重写。初始化
初始化 ModuleBase。
- 参数:
*args -- 可变长度参数列表,传递给父类的初始化函数。
**kwargs -- 任意关键字参数,传递给父类初始化器。
Attributes: static_names (list): A list to store static member names.
- class evox.core.components.Problem[源代码]#
Bases:
evox.core.module.ModuleBase
,abc.ABC
所有问题的基类
初始化
初始化 ModuleBase。
- 参数:
*args -- 可变长度参数列表,传递给父类的初始化函数。
**kwargs -- 任意关键字参数,传递给父类初始化器。
Attributes: static_names (list): A list to store static member names.
- class evox.core.components.Workflow(*args, **kwargs)[源代码]#
Bases:
evox.core.module.ModuleBase
,abc.ABC
工作流的基类。
初始化
初始化 ModuleBase。
- 参数:
*args -- 可变长度参数列表,传递给父类的初始化函数。
**kwargs -- 任意关键字参数,传递给父类初始化器。
Attributes: static_names (list): A list to store static member names.
- class evox.core.components.Monitor(*args, **kwargs)[源代码]#
Bases:
evox.core.module.ModuleBase
,abc.ABC
监视器基类。
监视器用于监控进化过程。它们包含一组回调,这些回调将在工作流执行的特定时刻被调用。Monitor 本身位于主工作流之外,因此不需要 jit。
要实现一个监视器,您需要实现自己的回调并重写 hooks 方法。hooks 方法应返回一个字符串列表,这些字符串是回调的名称。目前支持的回调有:
post_ask
、pre_eval
、post_eval
和pre_tell
。初始化
初始化 ModuleBase。
- 参数:
*args -- 可变长度参数列表,传递给父类的初始化函数。
**kwargs -- 任意关键字参数,传递给父类初始化器。
Attributes: static_names (list): A list to store static member names.
- set_config(**config) evox.core.components.Monitor [源代码]#
根据
config
设置静态变量。- 参数:
config -- 配置。
- 返回:
此模块。
- record_auxiliary(aux: Dict[str, torch.Tensor]) None [源代码]#
Record the auxiliary information.
- 参数:
aux -- The auxiliary information.
- post_ask(candidate_solution: torch.Tensor) None [源代码]#
解决方案转换前执行的钩子函数。
- 参数:
candidate_solution -- 种群(候选解)的初始演化状态