



"""simple docstring"""

import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
a_			   =					sys.version_info >= (3, 10)







def 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  Dict=None				,    SCREAMING_SNAKE_CASE__ :  Any=None			):



					"""simple docstring"""





					return field(default_factory=lambda: default				,    metadata=SCREAMING_SNAKE_CASE__			)







@dataclass
class    __lowercase     :







						"""simple docstring"""







						_A		:							int
						_A		:							float
						_A		:							str
						_A		:							bool







@dataclass
class    __lowercase     :







						"""simple docstring"""







						_A		:							int							       =		42
						_A		:							str							       =		field(default="""toto"""					,    metadata={"""help""": """help message"""})







@dataclass
class    __lowercase     :







						"""simple docstring"""







						_A		:							bool							       =		False
						_A		:							bool							       =		True
						_A		:							Optional[bool]							       =		None







class    __lowercase     (					_UpperCAmelCase):







						"""simple docstring"""







						_A		:							int							       =		"""titi"""
						_A		:							str							       =		"""toto"""







class    __lowercase     (					_UpperCAmelCase):







						"""simple docstring"""







						_A		:							int							       =		"""titi"""
						_A		:							Dict							       =		"""toto"""
						_A		:							Tuple							       =		42







@dataclass
class    __lowercase     :







						"""simple docstring"""







						_A		:							BasicEnum							       =		"toto"







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		int 					=					BasicEnum(self.foo       )







@dataclass
class    __lowercase     :







						"""simple docstring"""







						_A		:							MixedTypeEnum							       =		"toto"







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Optional[Any] 					=					MixedTypeEnum(self.foo       )







@dataclass
class    __lowercase     :







						"""simple docstring"""







						_A		:							Optional[int]							       =		None
						_A		:							Optional[float]							       =		field(default=_UpperCAmelCase					,    metadata={"""help""": """help message"""})
						_A		:							Optional[str]							       =		None
						_A		:							Optional[List[str]]							       =		list_field(default=[])
						_A		:							Optional[List[int]]							       =		list_field(default=[])







@dataclass
class    __lowercase     :







						"""simple docstring"""







						_A		:							List[int]							       =		list_field(default=[])
						_A		:							List[int]							       =		list_field(default=[1, 2, 3])
						_A		:							List[str]							       =		list_field(default=["""Hallo""", """Bonjour""", """Hello"""])
						_A		:							List[float]							       =		list_field(default=[0.1, 0.2, 0.3])







@dataclass
class    __lowercase     :







						"""simple docstring"""







						_A		:							List[int]							       =		field()
						_A		:							str							       =		field()
						_A		:							BasicEnum							       =		field()







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		List[Any] 					=					BasicEnum(self.required_enum       )







@dataclass
class    __lowercase     :







						"""simple docstring"""







						_A		:							int
						_A		:							"BasicEnum"							       =		field()
						_A		:							"Optional[bool]"							       =		None
						_A		:							"str"							       =		field(default="""toto"""					,    metadata={"""help""": """help message"""})
						_A		:							"List[str]"							       =		list_field(default=["""Hallo""", """Bonjour""", """Hello"""])


if is_python_no_less_than_3_10:







			@dataclass
			class    __lowercase     :







									"""simple docstring"""







									_A		:							bool							       =		False
									_A		:							bool							       =		True
									_A		:							bool | None							       =		None







			@dataclass
			class    __lowercase     :







									"""simple docstring"""







									_A		:							int | None							       =		None
									_A		:							float | None							       =		field(default=_UpperCAmelCase					,    metadata={"""help""": """help message"""})
									_A		:							str | None							       =		None
									_A		:							list[str] | None							       =		list_field(default=[])
									_A		:							list[int] | None							       =		list_field(default=[])







class    __lowercase     (					unittest.TestCase):







						"""simple docstring"""







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__       ):
											self.assertEqual(len(a._actions       )   ,		len(b._actions       )       )
											for x, y in zip(a._actions   ,		b._actions       ):
																snake_case_					:		List[str] 					=					{k: v for k, v in vars(lowercase__       ).items() if k != """container"""}
																snake_case_					:		Optional[Any] 					=					{k: v for k, v in vars(lowercase__       ).items() if k != """container"""}

																# Choices with mixed type have custom function as "type"
																# So we need to compare results directly for equality
																if xx.get("""choices"""   ,		lowercase__       ) and yy.get("""choices"""   ,		lowercase__       ):
																					for expected_choice in yy["choices"] + xx["choices"]:
																										self.assertEqual(xx["""type"""](lowercase__       )   ,		yy["""type"""](lowercase__       )       )
																					del xx["type"], yy["type"]

																self.assertEqual(lowercase__   ,		lowercase__       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Any 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		str 					=					argparse.ArgumentParser()
											expected.add_argument("""--foo"""   ,		type=lowercase__   ,		required=lowercase__       )
											expected.add_argument("""--bar"""   ,		type=lowercase__   ,		required=lowercase__       )
											expected.add_argument("""--baz"""   ,		type=lowercase__   ,		required=lowercase__       )
											expected.add_argument("""--flag"""   ,		type=lowercase__   ,		default=lowercase__   ,		const=lowercase__   ,		nargs="""?"""       )
											self.argparsersEqual(lowercase__   ,		lowercase__       )

											snake_case_					:		Union[str, Any] 					=					["""--foo""", """1""", """--baz""", """quux""", """--bar""", """0.5"""]
											(snake_case_			)					:		Union[str, Any] 					=					parser.parse_args_into_dataclasses(lowercase__   ,		look_for_args_file=lowercase__       )
											self.assertFalse(example.flag       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		List[str] 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		Union[str, Any] 					=					argparse.ArgumentParser()
											expected.add_argument("""--foo"""   ,		default=42   ,		type=lowercase__       )
											expected.add_argument("""--baz"""   ,		default="""toto"""   ,		type=lowercase__   ,		help="""help message"""       )
											self.argparsersEqual(lowercase__   ,		lowercase__       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Union[str, Any] 					=					argparse.ArgumentParser()
											expected.add_argument("""--foo"""   ,		type=lowercase__   ,		default=lowercase__   ,		const=lowercase__   ,		nargs="""?"""       )
											expected.add_argument("""--baz"""   ,		type=lowercase__   ,		default=lowercase__   ,		const=lowercase__   ,		nargs="""?"""       )
											# A boolean no_* argument always has to come after its "default: True" regular counter-part
											# and its default must be set to False
											expected.add_argument("""--no_baz"""   ,		action="""store_false"""   ,		default=lowercase__   ,		dest="""baz"""       )
											expected.add_argument("""--opt"""   ,		type=lowercase__   ,		default=lowercase__       )

											snake_case_					:		int 					=					[WithDefaultBoolExample]
											if is_python_no_less_than_3_10:
																dataclass_types.append(lowercase__       )

											for dataclass_type in dataclass_types:
																snake_case_					:		Any 					=					HfArgumentParser(lowercase__       )
																self.argparsersEqual(lowercase__   ,		lowercase__       )

																snake_case_					:		int 					=					parser.parse_args([]       )
																self.assertEqual(lowercase__   ,		Namespace(foo=lowercase__   ,		baz=lowercase__   ,		opt=lowercase__       )       )

																snake_case_					:		Optional[int] 					=					parser.parse_args(["""--foo""", """--no_baz"""]       )
																self.assertEqual(lowercase__   ,		Namespace(foo=lowercase__   ,		baz=lowercase__   ,		opt=lowercase__       )       )

																snake_case_					:		Optional[Any] 					=					parser.parse_args(["""--foo""", """--baz"""]       )
																self.assertEqual(lowercase__   ,		Namespace(foo=lowercase__   ,		baz=lowercase__   ,		opt=lowercase__       )       )

																snake_case_					:		Optional[Any] 					=					parser.parse_args(["""--foo""", """True""", """--baz""", """True""", """--opt""", """True"""]       )
																self.assertEqual(lowercase__   ,		Namespace(foo=lowercase__   ,		baz=lowercase__   ,		opt=lowercase__       )       )

																snake_case_					:		Union[str, Any] 					=					parser.parse_args(["""--foo""", """False""", """--baz""", """False""", """--opt""", """False"""]       )
																self.assertEqual(lowercase__   ,		Namespace(foo=lowercase__   ,		baz=lowercase__   ,		opt=lowercase__       )       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Optional[Any] 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		Any 					=					argparse.ArgumentParser()
											expected.add_argument(
											    """--foo"""   ,		default="""toto"""   ,		choices=["""titi""", """toto""", 42]   ,		type=make_choice_type_function(["""titi""", """toto""", 42]       )   ,		)
											self.argparsersEqual(lowercase__   ,		lowercase__       )

											snake_case_					:		Union[str, Any] 					=					parser.parse_args([]       )
											self.assertEqual(args.foo   ,		"""toto"""       )
											snake_case_					:		Dict 					=					parser.parse_args_into_dataclasses([]       )[0]
											self.assertEqual(enum_ex.foo   ,		MixedTypeEnum.toto       )

											snake_case_					:		Optional[Any] 					=					parser.parse_args(["""--foo""", """titi"""]       )
											self.assertEqual(args.foo   ,		"""titi"""       )
											snake_case_					:		int 					=					parser.parse_args_into_dataclasses(["""--foo""", """titi"""]       )[0]
											self.assertEqual(enum_ex.foo   ,		MixedTypeEnum.titi       )

											snake_case_					:		Any 					=					parser.parse_args(["""--foo""", """42"""]       )
											self.assertEqual(args.foo   ,		42       )
											snake_case_					:		List[Any] 					=					parser.parse_args_into_dataclasses(["""--foo""", """42"""]       )[0]
											self.assertEqual(enum_ex.foo   ,		MixedTypeEnum.fourtytwo       )







						def 						__UpperCamelCase							(self       ):







											@dataclass
											class    __lowercase     :







																	"""simple docstring"""







																	_A		:							Literal["titi", "toto", 42]							       =		"toto"
											snake_case_					:		List[Any] 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		Tuple 					=					argparse.ArgumentParser()
											expected.add_argument(
											    """--foo"""   ,		default="""toto"""   ,		choices=("""titi""", """toto""", 42)   ,		type=make_choice_type_function(["""titi""", """toto""", 42]       )   ,		)
											self.argparsersEqual(lowercase__   ,		lowercase__       )

											snake_case_					:		Tuple 					=					parser.parse_args([]       )
											self.assertEqual(args.foo   ,		"""toto"""       )

											snake_case_					:		Optional[int] 					=					parser.parse_args(["""--foo""", """titi"""]       )
											self.assertEqual(args.foo   ,		"""titi"""       )

											snake_case_					:		List[str] 					=					parser.parse_args(["""--foo""", """42"""]       )
											self.assertEqual(args.foo   ,		42       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		str 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		List[str] 					=					argparse.ArgumentParser()
											expected.add_argument("""--foo_int"""   ,		nargs="""+"""   ,		default=[]   ,		type=lowercase__       )
											expected.add_argument("""--bar_int"""   ,		nargs="""+"""   ,		default=[1, 2, 3]   ,		type=lowercase__       )
											expected.add_argument("""--foo_str"""   ,		nargs="""+"""   ,		default=["""Hallo""", """Bonjour""", """Hello"""]   ,		type=lowercase__       )
											expected.add_argument("""--foo_float"""   ,		nargs="""+"""   ,		default=[0.1, 0.2, 0.3]   ,		type=lowercase__       )

											self.argparsersEqual(lowercase__   ,		lowercase__       )

											snake_case_					:		Optional[Any] 					=					parser.parse_args([]       )
											self.assertEqual(
											    lowercase__   ,		Namespace(foo_int=[]   ,		bar_int=[1, 2, 3]   ,		foo_str=["""Hallo""", """Bonjour""", """Hello"""]   ,		foo_float=[0.1, 0.2, 0.3]       )   ,		)

											snake_case_					:		Optional[int] 					=					parser.parse_args("""--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7""".split()       )
											self.assertEqual(lowercase__   ,		Namespace(foo_int=[1]   ,		bar_int=[2, 3]   ,		foo_str=["""a""", """b""", """c"""]   ,		foo_float=[0.1, 0.7]       )       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Dict 					=					argparse.ArgumentParser()
											expected.add_argument("""--foo"""   ,		default=lowercase__   ,		type=lowercase__       )
											expected.add_argument("""--bar"""   ,		default=lowercase__   ,		type=lowercase__   ,		help="""help message"""       )
											expected.add_argument("""--baz"""   ,		default=lowercase__   ,		type=lowercase__       )
											expected.add_argument("""--ces"""   ,		nargs="""+"""   ,		default=[]   ,		type=lowercase__       )
											expected.add_argument("""--des"""   ,		nargs="""+"""   ,		default=[]   ,		type=lowercase__       )

											snake_case_					:		int 					=					[OptionalExample]
											if is_python_no_less_than_3_10:
																dataclass_types.append(lowercase__       )

											for dataclass_type in dataclass_types:
																snake_case_					:		Dict 					=					HfArgumentParser(lowercase__       )

																self.argparsersEqual(lowercase__   ,		lowercase__       )

																snake_case_					:		int 					=					parser.parse_args([]       )
																self.assertEqual(lowercase__   ,		Namespace(foo=lowercase__   ,		bar=lowercase__   ,		baz=lowercase__   ,		ces=[]   ,		des=[]       )       )

																snake_case_					:		Optional[int] 					=					parser.parse_args("""--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3""".split()       )
																self.assertEqual(lowercase__   ,		Namespace(foo=12   ,		bar=3.14   ,		baz="""42"""   ,		ces=["""a""", """b""", """c"""]   ,		des=[1, 2, 3]       )       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		List[Any] 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		Tuple 					=					argparse.ArgumentParser()
											expected.add_argument("""--required_list"""   ,		nargs="""+"""   ,		type=lowercase__   ,		required=lowercase__       )
											expected.add_argument("""--required_str"""   ,		type=lowercase__   ,		required=lowercase__       )
											expected.add_argument(
											    """--required_enum"""   ,		type=make_choice_type_function(["""titi""", """toto"""]       )   ,		choices=["""titi""", """toto"""]   ,		required=lowercase__   ,		)
											self.argparsersEqual(lowercase__   ,		lowercase__       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Union[str, Any] 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		List[str] 					=					argparse.ArgumentParser()
											expected.add_argument("""--foo"""   ,		type=lowercase__   ,		required=lowercase__       )
											expected.add_argument(
											    """--required_enum"""   ,		type=make_choice_type_function(["""titi""", """toto"""]       )   ,		choices=["""titi""", """toto"""]   ,		required=lowercase__   ,		)
											expected.add_argument("""--opt"""   ,		type=lowercase__   ,		default=lowercase__       )
											expected.add_argument("""--baz"""   ,		default="""toto"""   ,		type=lowercase__   ,		help="""help message"""       )
											expected.add_argument("""--foo_str"""   ,		nargs="""+"""   ,		default=["""Hallo""", """Bonjour""", """Hello"""]   ,		type=lowercase__       )
											self.argparsersEqual(lowercase__   ,		lowercase__       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		List[str] 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		Tuple 					=					{
											    """foo""": 12,
											    """bar""": 3.14,
											    """baz""": """42""",
											    """flag""": True,
											}

											snake_case_					:		List[Any] 					=					parser.parse_dict(lowercase__       )[0]
											snake_case_					:		Optional[int] 					=					BasicExample(**lowercase__       )
											self.assertEqual(lowercase__   ,		lowercase__       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		List[str] 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		Tuple 					=					{
											    """foo""": 12,
											    """bar""": 3.14,
											    """baz""": """42""",
											    """flag""": True,
											    """extra""": 42,
											}

											self.assertRaises(lowercase__   ,		parser.parse_dict   ,		lowercase__   ,		allow_extra_keys=lowercase__       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Optional[int] 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		Optional[Any] 					=					{
											    """foo""": 12,
											    """bar""": 3.14,
											    """baz""": """42""",
											    """flag""": True,
											}
											with tempfile.TemporaryDirectory() as tmp_dir:
																snake_case_					:		int 					=					os.path.join(lowercase__   ,		"""temp_json"""       )
																os.mkdir(lowercase__       )
																with open(temp_local_path + """.json"""   ,		"""w+"""       ) as f:
																					json.dump(lowercase__   ,		lowercase__       )
																snake_case_					:		Optional[Any] 					=					parser.parse_yaml_file(Path(temp_local_path + """.json"""       )       )[0]

											snake_case_					:		List[Any] 					=					BasicExample(**lowercase__       )
											self.assertEqual(lowercase__   ,		lowercase__       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		Optional[Any] 					=					HfArgumentParser(lowercase__       )

											snake_case_					:		int 					=					{
											    """foo""": 12,
											    """bar""": 3.14,
											    """baz""": """42""",
											    """flag""": True,
											}
											with tempfile.TemporaryDirectory() as tmp_dir:
																snake_case_					:		Tuple 					=					os.path.join(lowercase__   ,		"""temp_yaml"""       )
																os.mkdir(lowercase__       )
																with open(temp_local_path + """.yaml"""   ,		"""w+"""       ) as f:
																					yaml.dump(lowercase__   ,		lowercase__       )
																snake_case_					:		Any 					=					parser.parse_yaml_file(Path(temp_local_path + """.yaml"""       )       )[0]
											snake_case_					:		Optional[int] 					=					BasicExample(**lowercase__       )
											self.assertEqual(lowercase__   ,		lowercase__       )







						def 						__UpperCamelCase							(self       ):
											snake_case_					:		int 					=					HfArgumentParser(lowercase__       )
											self.assertIsNotNone(lowercase__       )









"""simple docstring"""

import argparse
import copy







def 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  Any			):



					"""simple docstring"""





					snake_case_					:		List[Any] 					=					{}

					with open(SCREAMING_SNAKE_CASE__			) as f:
										for line in f:
															if line.split()[0] not in dict_of_neighbours:
																				snake_case_					:		int 					=					[]
																				_list.append([line.split()[1], line.split()[2]]			)
																				snake_case_					:		Optional[Any] 					=					_list
															else:
																				dict_of_neighbours[line.split()[0]].append(
																				    [line.split()[1], line.split()[2]]			)
															if line.split()[1] not in dict_of_neighbours:
																				snake_case_					:		str 					=					[]
																				_list.append([line.split()[0], line.split()[2]]			)
																				snake_case_					:		Optional[Any] 					=					_list
															else:
																				dict_of_neighbours[line.split()[1]].append(
																				    [line.split()[0], line.split()[2]]			)

					return dict_of_neighbours







def 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  List[Any]				,    SCREAMING_SNAKE_CASE__ :  str			):



					"""simple docstring"""





					with open(SCREAMING_SNAKE_CASE__			) as f:
										snake_case_					:		Optional[Any] 					=					f.read(1			)
					snake_case_					:		Union[str, Any] 					=					start_node

					snake_case_					:		Dict 					=					[]

					snake_case_					:		Union[str, Any] 					=					start_node

					snake_case_					:		Tuple 					=					0
					while visiting not in first_solution:
										snake_case_					:		int 					=					1_0_0_0_0
										for k in dict_of_neighbours[visiting]:
															if int(k[1]			) < int(SCREAMING_SNAKE_CASE__			) and k[0] not in first_solution:
																				snake_case_					:		Union[str, Any] 					=					k[1]
																				snake_case_					:		Any 					=					k[0]

										first_solution.append(SCREAMING_SNAKE_CASE__			)
										snake_case_					:		Tuple 					=					distance_of_first_solution + int(SCREAMING_SNAKE_CASE__			)
										snake_case_					:		List[str] 					=					best_node

					first_solution.append(SCREAMING_SNAKE_CASE__			)

					snake_case_					:		Optional[Any] 					=					0
					for k in dict_of_neighbours[first_solution[-2]]:
										if k[0] == start_node:
															break
										position += 1

					snake_case_					:		int 					=					(
					    distance_of_first_solution
					    + int(dict_of_neighbours[first_solution[-2]][position][1]			)
					    - 1_0_0_0_0
					)
					return first_solution, distance_of_first_solution







def 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  Union[str, Any]				,    SCREAMING_SNAKE_CASE__ :  Optional[int]			):



					"""simple docstring"""





					snake_case_					:		Union[str, Any] 					=					[]

					for n in solution[1:-1]:
										snake_case_					:		str 					=					solution.index(SCREAMING_SNAKE_CASE__			)
										for kn in solution[1:-1]:
															snake_case_					:		Tuple 					=					solution.index(SCREAMING_SNAKE_CASE__			)
															if n == kn:
																				continue

															snake_case_					:		Optional[Any] 					=					copy.deepcopy(SCREAMING_SNAKE_CASE__			)
															snake_case_					:		int 					=					kn
															snake_case_					:		Dict 					=					n

															snake_case_					:		Optional[int] 					=					0

															for k in _tmp[:-1]:
																				snake_case_					:		Dict 					=					_tmp[_tmp.index(SCREAMING_SNAKE_CASE__			) + 1]
																				for i in dict_of_neighbours[k]:
																									if i[0] == next_node:
																														snake_case_					:		Dict 					=					distance + int(i[1]			)
															_tmp.append(SCREAMING_SNAKE_CASE__			)

															if _tmp not in neighborhood_of_solution:
																				neighborhood_of_solution.append(_tmp			)

					snake_case_					:		Optional[Any] 					=					len(neighborhood_of_solution[0]			) - 1

					neighborhood_of_solution.sort(key=lambda SCREAMING_SNAKE_CASE__			: x[index_of_last_item_in_the_list]			)
					return neighborhood_of_solution







def 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  List[str]				,    SCREAMING_SNAKE_CASE__ :  Dict				,    SCREAMING_SNAKE_CASE__ :  List[Any]				,    SCREAMING_SNAKE_CASE__ :  str				,    SCREAMING_SNAKE_CASE__ :  List[Any]			):



					"""simple docstring"""





					snake_case_					:		Dict 					=					1
					snake_case_					:		List[Any] 					=					first_solution
					snake_case_					:		List[Any] 					=					[]
					snake_case_					:		Optional[Any] 					=					distance_of_first_solution
					snake_case_					:		Dict 					=					solution

					while count <= iters:
										snake_case_					:		List[str] 					=					find_neighborhood(SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__			)
										snake_case_					:		List[Any] 					=					0
										snake_case_					:		List[Any] 					=					neighborhood[index_of_best_solution]
										snake_case_					:		Union[str, Any] 					=					len(SCREAMING_SNAKE_CASE__			) - 1

										snake_case_					:		List[str] 					=					False
										while not found:
															snake_case_					:		Tuple 					=					0
															while i < len(SCREAMING_SNAKE_CASE__			):
																				if best_solution[i] != solution[i]:
																									snake_case_					:		Optional[Any] 					=					best_solution[i]
																									snake_case_					:		int 					=					solution[i]
																									break
																				snake_case_					:		List[str] 					=					i + 1

															if [first_exchange_node, second_exchange_node] not in tabu_list and [
															    second_exchange_node,
															    first_exchange_node,
															] not in tabu_list:
																				tabu_list.append([first_exchange_node, second_exchange_node]			)
																				snake_case_					:		Tuple 					=					True
																				snake_case_					:		Dict 					=					best_solution[:-1]
																				snake_case_					:		Tuple 					=					neighborhood[index_of_best_solution][best_cost_index]
																				if cost < best_cost:
																									snake_case_					:		Tuple 					=					cost
																									snake_case_					:		Union[str, Any] 					=					solution
															else:
																				snake_case_					:		str 					=					index_of_best_solution + 1
																				snake_case_					:		Tuple 					=					neighborhood[index_of_best_solution]

										if len(SCREAMING_SNAKE_CASE__			) >= size:
															tabu_list.pop(0			)

										snake_case_					:		List[str] 					=					count + 1

					return best_solution_ever, best_cost







def 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  Optional[Any]=None			):



					"""simple docstring"""





					snake_case_					:		Tuple 					=					generate_neighbours(args.File			)

					snake_case_					,			snake_case_					:		Optional[Any] 					=					generate_first_solution(
					    args.File				,    SCREAMING_SNAKE_CASE__			)

					snake_case_					,			snake_case_					:		Dict 					=					tabu_search(
					    SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__				,    args.Iterations				,    args.Size				,    )

					print(f'Best solution: {best_sol}, with total distance: {best_cost}.'			)


if __name__ == "__main__":
			a_			   =					argparse.ArgumentParser(description='''Tabu Search''')
			parser.add_argument(
			    '''-f''',
			    '''--File''',
			    type=str,
			    help='''Path to the file containing the data''',
			    required=True,
			)
			parser.add_argument(
			    '''-i''',
			    '''--Iterations''',
			    type=int,
			    help='''How many iterations the algorithm should perform''',
			    required=True,
			)
			parser.add_argument(
			    '''-s''', '''--Size''', type=int, help='''Size of the tabu list''', required=True
			)

			# Pass the arguments to main method
			main(parser.parse_args())




