o
    c²“iç  ã                   @   s2  d Z ddlZddlZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zeeeeeee	e
edœ	Zdddddddddddœ
Zd ed!efd"d#„Zi d$d%“d&d%“d'd(“d)d*“d+d,“d-d.“d/d0“d1d2“d3d2“d4d5“d6d7“d8d7“d9d:“d;d<“d=d>“d?d@“dAd@“dBdCi¥ZdDefdEdF„ZdGefdHdI„ZdS )Jz;Registry of algorithm names for tune.Tuner(trainable=[..]).é    Nc                  C   ó(   dd l m  m  m}  | j| j ¡ fS ©Nr   )Úray.rllib.algorithms.appoÚrllibÚ
algorithmsÚappoÚAPPOÚget_default_config)r   © r
   úQ/home/ubuntu/.local/lib/python3.10/site-packages/ray/rllib/algorithms/registry.pyÚ_import_appo   ó   r   c                  C   r   r   )Úray.rllib.algorithms.bcr   r   ÚbcÚBCr	   )r   r
   r
   r   Ú
_import_bc   r   r   c                  C   r   r   )Úray.rllib.algorithms.cqlr   r   ÚcqlÚCQLr	   )r   r
   r
   r   Ú_import_cql   r   r   c                  C   r   r   )Úray.rllib.algorithms.dqnr   r   ÚdqnÚDQNr	   )r   r
   r
   r   Ú_import_dqn   r   r   c                  C   r   r   )Úray.rllib.algorithms.dreamerv3r   r   Ú	dreamerv3Ú	DreamerV3r	   )r   r
   r
   r   Ú_import_dreamerv3   r   r   c                  C   r   r   )Úray.rllib.algorithms.impalar   r   ÚimpalaÚIMPALAr	   )r   r
   r
   r   Ú_import_impala%   r   r!   c                  C   r   r   )Úray.rllib.algorithms.marwilr   r   ÚmarwilÚMARWILr	   )r#   r
   r
   r   Ú_import_marwil+   r   r%   c                  C   r   r   )Úray.rllib.algorithms.ppor   r   ÚppoÚPPOr	   )r'   r
   r
   r   Ú_import_ppo1   r   r)   c                  C   r   r   )Úray.rllib.algorithms.sacr   r   ÚsacÚSACr	   )r+   r
   r
   r   Ú_import_sac7   r   r-   )	r   r   r   r   r   r    r$   r(   r,   r   r   r   r   r   r    r$   r(   r,   )
r   r   r   r   r   ÚImpalar    r$   r(   r,   ÚalgÚreturnc                 C   s†   | t v rt |  ƒ d S | dkrddlm} |jS | dkr$ddlm} |S | dkr0ddlm} |S | dkr<dd	lm} |S td
 	| ¡ƒ‚)Nr   Úscript)Úscript_runnerÚ__fake)Ú_MockTrainerÚ__sigmoid_fake_data)Ú_SigmoidFakeDataÚ__parameter_tuning)Ú_ParameterTuningTrainerzUnknown algorithm {}.)
Ú
ALGORITHMSÚray.tuner2   ÚScriptRunnerÚray.rllib.algorithms.mockr4   r6   r8   Ú	ExceptionÚformat)r/   r2   r4   r6   r8   r
   r
   r   Ú_get_algorithm_classX   s   r?   ÚAPPOTF1Policyzappo.appo_tf_policyÚAPPOTF2PolicyÚAPPOTorchPolicyzappo.appo_torch_policyÚCQLTFPolicyzcql.cql_tf_policyÚCQLTorchPolicyzcql.cql_torch_policyÚDQNTFPolicyzdqn.dqn_tf_policyÚDQNTorchPolicyzdqn.dqn_torch_policyÚImpalaTF1Policyzimpala.impala_tf_policyÚImpalaTF2PolicyÚImpalaTorchPolicyzimpala.impala_torch_policyÚMARWILTF1Policyzmarwil.marwil_tf_policyÚMARWILTF2PolicyÚMARWILTorchPolicyzmarwil.marwil_torch_policyÚSACTFPolicyzsac.sac_tf_policyÚSACTorchPolicyzsac.sac_torch_policyÚPPOTF1Policyzppo.ppo_tf_policyÚPPOTF2PolicyÚPPOTorchPolicyzppo.ppo_torch_policyÚpolicy_classc                 C   s    t  dd| j¡}|tv r|S dS )zäReturns a string name for the provided policy class.

    Args:
        policy_class: RLlib policy class, e.g. A3CTorchPolicy, DQNTFPolicy, etc.

    Returns:
        A string name uniquely mapped to the given policy class.
    z_traced$Ú N)ÚreÚsubÚ__name__ÚPOLICIES)rR   Únamer
   r
   r   Úget_policy_class_nameŠ   s   rY   rX   c                 C   s:   | t vrdS t |  }t d| ¡}t|| ƒsdS t|| ƒS )z±Return an actual policy class given the string name.

    Args:
        name: string name of the policy class.

    Returns:
        Actual policy class for the given name.
    Nzray.rllib.algorithms.)rW   Ú	importlibÚimport_moduleÚhasattrÚgetattr)rX   ÚpathÚmoduler
   r
   r   Úget_policy_classŸ   s   	

r`   )Ú__doc__rZ   rT   r   r   r   r   r   r!   r%   r)   r-   r9   ÚALGORITHMS_CLASS_TO_NAMEÚstrÚtyper?   rW   rY   r`   r
   r
   r
   r   Ú<module>   s’    ÷öÿþýüûúùø	÷
öõôóòñðïî