
'''simple docstring'''





from ....configuration_utils import PretrainedConfig
from ....utils import logging


lowerCamelCase      =logging.get_logger(__name__)

lowerCamelCase      ={
    """CarlCochet/trajectory-transformer-halfcheetah-medium-v2""": (
        """https://huggingface.co/CarlCochet/trajectory-transformer-halfcheetah-medium-v2/resolve/main/config.json"""
    ),
    # See all TrajectoryTransformer models at https://huggingface.co/models?filter=trajectory_transformer
}




class 				_lowerCamelCase (      snake_case_ ):





     """simple docstring"""







     SCREAMING_SNAKE_CASE_		   =  """trajectory_transformer"""
     SCREAMING_SNAKE_CASE_		   =  ["""past_key_values"""]
     SCREAMING_SNAKE_CASE_		   =  {
         """hidden_size""": """n_embd""",
         """num_attention_heads""": """n_head""",
         """num_hidden_layers""": """n_layer""",
     }






     def __init__(							self						,						__SCREAMING_SNAKE_CASE=1_0_0						,						__SCREAMING_SNAKE_CASE=5						,						__SCREAMING_SNAKE_CASE=1						,						__SCREAMING_SNAKE_CASE=1						,						__SCREAMING_SNAKE_CASE=2_4_9						,						__SCREAMING_SNAKE_CASE=6						,						__SCREAMING_SNAKE_CASE=1_7						,						__SCREAMING_SNAKE_CASE=2_5						,						__SCREAMING_SNAKE_CASE=4						,						__SCREAMING_SNAKE_CASE=4						,						__SCREAMING_SNAKE_CASE=1_2_8						,						__SCREAMING_SNAKE_CASE=0.1						,						__SCREAMING_SNAKE_CASE=0.1						,						__SCREAMING_SNAKE_CASE=0.1						,						__SCREAMING_SNAKE_CASE=0.0006						,						__SCREAMING_SNAKE_CASE=5_1_2						,						__SCREAMING_SNAKE_CASE=0.02						,						__SCREAMING_SNAKE_CASE=1e-12						,						__SCREAMING_SNAKE_CASE=1						,						__SCREAMING_SNAKE_CASE=True						,						__SCREAMING_SNAKE_CASE=1						,						__SCREAMING_SNAKE_CASE=5_0_2_5_6						,						__SCREAMING_SNAKE_CASE=5_0_2_5_6						,						**__SCREAMING_SNAKE_CASE						,						)  ->   int:




           """simple docstring"""







           UpperCamelCase__    :   Any					=				vocab_size
           UpperCamelCase__    :   Dict					=				action_weight
           UpperCamelCase__    :   str					=				reward_weight
           UpperCamelCase__    :   str					=				value_weight
           UpperCamelCase__    :   Dict					=				max_position_embeddings
           UpperCamelCase__    :   Optional[Any]					=				block_size
           UpperCamelCase__    :   Optional[int]					=				action_dim
           UpperCamelCase__    :   Optional[int]					=				observation_dim
           UpperCamelCase__    :   str					=				transition_dim
           UpperCamelCase__    :   Union[str, Any]					=				learning_rate
           UpperCamelCase__    :   Dict					=				n_layer
           UpperCamelCase__    :   List[Any]					=				n_head
           UpperCamelCase__    :   Optional[int]					=				n_embd
           UpperCamelCase__    :   Optional[Any]					=				embd_pdrop
           UpperCamelCase__    :   int					=				attn_pdrop
           UpperCamelCase__    :   List[Any]					=				resid_pdrop
           UpperCamelCase__    :   Dict					=				initializer_range
           UpperCamelCase__    :   Any					=				layer_norm_eps
           UpperCamelCase__    :   Tuple					=				kaiming_initializer_range
           UpperCamelCase__    :   Dict					=				use_cache
           super().__init__(pad_token_id=__SCREAMING_SNAKE_CASE						,						bos_token_id=__SCREAMING_SNAKE_CASE						,						eos_token_id=__SCREAMING_SNAKE_CASE						,						**__SCREAMING_SNAKE_CASE  )




class 				_lowerCamelCase :





     """simple docstring"""







     def __init__(							self  )  ->   Tuple:




           """simple docstring"""







           UpperCamelCase__    :   Union[str, Any]					=				''''''
           UpperCamelCase__    :   int					=				''''''
           UpperCamelCase__    :   Optional[int]					=				[]






     def    __SCREAMING_SNAKE_CASE			(							self						,						__SCREAMING_SNAKE_CASE						,						__SCREAMING_SNAKE_CASE  )  ->   int:




           """simple docstring"""







           if m == -1:
                 return n + 1
           elif n == -1:
                 return m + 1
           elif self.dp[m][n] > -1:
                 return self.dp[m][n]
           else:
                 if self.worda[m] == self.worda[n]:
                       UpperCamelCase__    :   Union[str, Any]					=				self.__min_dist_top_down_dp(m - 1						,						n - 1  )
                 else:
                       UpperCamelCase__    :   int					=				self.__min_dist_top_down_dp(__SCREAMING_SNAKE_CASE						,						n - 1  )
                       UpperCamelCase__    :   Tuple					=				self.__min_dist_top_down_dp(m - 1						,						__SCREAMING_SNAKE_CASE  )
                       UpperCamelCase__    :   Optional[Any]					=				self.__min_dist_top_down_dp(m - 1						,						n - 1  )
                       UpperCamelCase__    :   Optional[int]					=				1 + min(__SCREAMING_SNAKE_CASE						,						__SCREAMING_SNAKE_CASE						,						__SCREAMING_SNAKE_CASE  )

                 return self.dp[m][n]






     def    __SCREAMING_SNAKE_CASE			(							self						,						__SCREAMING_SNAKE_CASE						,						__SCREAMING_SNAKE_CASE  )  ->   int:




           """simple docstring"""







           UpperCamelCase__    :   Union[str, Any]					=				worda
           UpperCamelCase__    :   Any					=				worda
           UpperCamelCase__    :   List[str]					=				[[-1 for _ in range(len(__SCREAMING_SNAKE_CASE  )  )] for _ in range(len(__SCREAMING_SNAKE_CASE  )  )]

           return self.__min_dist_top_down_dp(len(__SCREAMING_SNAKE_CASE  ) - 1						,						len(__SCREAMING_SNAKE_CASE  ) - 1  )






     def    __SCREAMING_SNAKE_CASE			(							self						,						__SCREAMING_SNAKE_CASE						,						__SCREAMING_SNAKE_CASE  )  ->   int:




           """simple docstring"""







           UpperCamelCase__    :   int					=				worda
           UpperCamelCase__    :   List[str]					=				worda
           UpperCamelCase__    :   int					=				len(__SCREAMING_SNAKE_CASE  )
           UpperCamelCase__    :   Optional[Any]					=				len(__SCREAMING_SNAKE_CASE  )
           UpperCamelCase__    :   int					=				[[0 for _ in range(n + 1  )] for _ in range(m + 1  )]

           for i in range(m + 1  ):
                 for j in range(n + 1  ):
                       if i == 0:  # first string is empty
                             UpperCamelCase__    :   List[Any]					=				j
                       elif j == 0:  # second string is empty
                             UpperCamelCase__    :   Union[str, Any]					=				i
                       elif worda[i - 1] == worda[j - 1]:  # last characters are equal
                             UpperCamelCase__    :   List[Any]					=				self.dp[i - 1][j - 1]
                       else:
                             UpperCamelCase__    :   Union[str, Any]					=				self.dp[i][j - 1]
                             UpperCamelCase__    :   str					=				self.dp[i - 1][j]
                             UpperCamelCase__    :   Union[str, Any]					=				self.dp[i - 1][j - 1]
                             UpperCamelCase__    :   List[Any]					=				1 + min(__SCREAMING_SNAKE_CASE						,						__SCREAMING_SNAKE_CASE						,						__SCREAMING_SNAKE_CASE  )
           return self.dp[m][n]


if __name__ == "__main__":
    lowerCamelCase      =EditDistance()

    print("****************** Testing Edit Distance DP Algorithm ******************")
    print()

    lowerCamelCase      =input("Enter the first string: ").strip()
    lowerCamelCase      =input("Enter the second string: ").strip()

    print()
    print(F'''The minimum edit distance is: {solver.min_dist_top_down(Sa, Sa)}''')
    print(F'''The minimum edit distance is: {solver.min_dist_bottom_up(Sa, Sa)}''')
    print()
    print("*************** End of Testing Edit Distance DP Algorithm ***************")


