MCPcopy Create free account
hub / github.com/PyVRP/PyVRP / IteratedLocalSearch

Class IteratedLocalSearch

pyvrp/IteratedLocalSearch.py:48–197  ·  view source on GitHub ↗

Creates an IteratedLocalSearch instance. Parameters ---------- data The problem data instance. penalty_manager Penalty manager to use. rng Random number generator. search_method Search method to use. initial_solution Initial s

Source from the content-addressed store, hash-verified

46
47
48class IteratedLocalSearch:
49 """
50 Creates an IteratedLocalSearch instance.
51
52 Parameters
53 ----------
54 data
55 The problem data instance.
56 penalty_manager
57 Penalty manager to use.
58 rng
59 Random number generator.
60 search_method
61 Search method to use.
62 initial_solution
63 Initial solution to start the search with.
64 params
65 Iterated local search parameters to use. If not provided, a default
66 will be used.
67 """
68
69 def __init__(
70 self,
71 data: ProblemData,
72 penalty_manager: PenaltyManager,
73 rng: RandomNumberGenerator,
74 search_method: SearchMethod,
75 initial_solution: Solution,
76 params: IteratedLocalSearchParams = IteratedLocalSearchParams(),
77 ):
78 self._data = data
79 self._pm = penalty_manager
80 self._rng = rng
81 self._search = search_method
82 self._init = initial_solution
83 self._params = params
84
85 def run(
86 self,
87 stop: StoppingCriterion,
88 collect_stats: bool = True,
89 display: bool = False,
90 display_interval: float = 5.0,
91 ) -> Result:
92 """
93 Runs the iterated local search algorithm with the provided stopping
94 criterion. The algorithm uses late acceptance hill-climbing as the
95 acceptance criterion; see [1]_ for details.
96
97 Parameters
98 ----------
99 stop
100 Stopping criterion to use. The algorithm runs until the first time
101 the stopping criterion returns ``True``.
102 collect_stats
103 Whether to collect statistics about the solver's progress. Default
104 ``True``.
105 display

Calls

no outgoing calls