Search¶
- class rl4co.models.zoo.common.search.base.SearchBase(env, policy, dataset, batch_size=1, max_iters=100, max_runtime=86400, save_path=None, **kwargs)[source]¶
Bases:
RL4COLitModuleBase class for search algorithms. Search algorithms are used onlin to find better solutions for a given dataset, i.e. given a policy, improve (a part of) its parameters such that the policy performs better on the given dataset.
Note
By default, we use manual optimization to handle the search.
- Parameters:
- on_train_batch_end(outputs, batch, batch_idx)[source]¶
Called when the train batch ends. This can be used for instance for logging or clearing cache.
- Return type:
None
- on_train_batch_start(batch, batch_idx)[source]¶
Called before training (i.e. search) for a new batch begins. This can be used to perform changes to the model or optimizer at the start of each batch.
- setup(stage='fit')[source]¶
Setup the dataset and attributes. The RL4COLitModulebase class automatically loads the data.