nip.parameters.update_schedule.AlternatingPeriodicUpdateSchedule#
- class nip.parameters.update_schedule.AlternatingPeriodicUpdateSchedule(period: int, first_agent_num_rounds: int, first_agent: bool = True)[source]#
A periodic schedule for alternating updates between two agents.
This schedule is to be used in pairs, where one agent is updated in the first part of the cycle and the other agent is updated in the second part of the cycle.
The first agent is updated for the first
first_agent_num_iterations
iterations of each cycle. The second agent is updated for the remaining iterations of the cycle.The first agent should have a schedule with
first_agent=True
, and the second agent should have a schedule withfirst_agent=False
.- Parameters:
Methods Summary
__init__
(period, first_agent_num_rounds[, ...])__repr__
()Return repr(self).
Get the constructor arguments of the schedule as a dictionary.
_get_param_class_from_dict
(param_dict)Try to get the parameter class from a dictionary of serialised parameters.
from_dict
(params_dict[, ignore_extra_keys])Create an agent update schedule from a dictionary.
to_dict
()Convert the agent update schedule to a dictionary.
Methods
- _get_arguments_dict() dict [source]#
Get the constructor arguments of the schedule as a dictionary.
- Returns:
arguments (dict) – A dictionary of the arguments of the schedule.
- classmethod _get_param_class_from_dict(param_dict: dict) type[ParameterValue] | None [source]#
Try to get the parameter class from a dictionary of serialised parameters.
- Parameters:
param_dict (dict) – A dictionary of parameters, which may have come from a
to_dict
method. This dictionary may contain a_type
key, which is used to determine the class of the parameter.- Returns:
param_class (type[ParameterValue] | None) – The class of the parameter, if it can be determined.
- Raises:
ValueError – If the class specified in the dictionary is not a valid parameter class.
- classmethod from_dict(params_dict: dict, ignore_extra_keys: bool = False) AgentUpdateSchedule [source]#
Create an agent update schedule from a dictionary.