[docs]classConstant(Curriculum):""" Used to to test API without a curriculum. """def__init__(self,default_task,*curriculum_args,require_step_updates=False,**curriculum_kwargs):super().__init__(*curriculum_args,**curriculum_kwargs)self.default_task=self.task_space.encode(default_task)self.require_step_updates=require_step_updates@propertydefrequires_step_updates(self)->bool:returnself.require_step_updates
[docs]defsample(self,k:int=1)->Union[List,Any]:""" Sample k tasks from the curriculum. """return[self.default_taskfor_inrange(k)]
[docs]defupdate_task_progress(self,task,progress,env_id=None)->None:""" Update the curriculum with a task and its success probability upon success or failure. """pass
[docs]defupdate_on_step(self,task,obs,rew,term,trunc,info,progress,env_id=None)->None:""" Update the curriculum with the current step results from the environment. """pass
[docs]defupdate_on_step_batch(self,step_results,env_id=None)->None:""" Update the curriculum with a batch of step results from the environment. """pass
[docs]defupdate_on_episode(self,episode_return,length,task,progress,env_id=None)->None:""" Update the curriculum with episode results from the environment. """pass
def_sample_distribution(self,k:int=1)->Union[List,Any]:""" Returns a sample distribution over the task space. """dist=[1.0/self.num_tasksfor_inrange(self.num_tasks)]dist[self.default_task]=1.0returndist