[mypy] Type annotations for searches directory (#5799)

* Update ternary_search.py

* Update mypy.ini

* Update simulated_annealing.py

* Update ternary_search.py

* formatting

* formatting

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py
This commit is contained in:
Rohan R Bharadwaj
2021-11-09 21:18:30 +05:30
committed by GitHub
parent c3d1ff0ebd
commit 745f9e2bc3
3 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,7 @@
# https://en.wikipedia.org/wiki/Simulated_annealing
import math
import random
from typing import Any
from .hill_climbing import SearchProblem
@ -16,7 +17,7 @@ def simulated_annealing(
start_temperate: float = 100,
rate_of_decrease: float = 0.01,
threshold_temp: float = 1,
) -> SearchProblem:
) -> Any:
"""
Implementation of the simulated annealing algorithm. We start with a given state,
find all its neighbors. Pick a random neighbor, if that neighbor improves the