C++ Search Layer

This section documents the C++ search layer implementations.

class Search

Manages and executes various search algorithms.

This class uses the strategy pattern to implement management and execution of different search algorithms, supporting multiple search strategies such as CBNS (Component-based Neighborhood Search), DLAS (Dynamic Late Acceptance Search), CHNS (Component-based Hybrid Neighborhood Search), and BCLS (Betweenness centrality-based Late-acceptance Search).

run(self: Search) SearchResult

Run search algorithm.

Returns:

  • SearchResult – Search result containing optimal solution and objective function value.

  • Throws

  • ——

  • std::runtime_error – If search strategy is not set.

set_strategy(self: Search, strategy: str) None

Set search strategy.

Parameters:
  • strategyName – Strategy name, such as “CBNS”, “DLAS”, “CHNS”, or “BCLS”.

  • Throws

  • ------

  • std::invalid_argument – If strategy name does not exist.

class SearchResult

Result container for search algorithms.

Stores the outcome of a search algorithm, including the found solution and its objective value. Supports move semantics for efficiency.

property obj_value
property solution
class SearchStrategy

Search strategy interface.

All concrete search algorithms need to implement this interface.

execute(self: SearchStrategy) SearchResult

Concrete Strategies

class CBNSStrategy

Component-based Neighborhood Search strategy.

CBNS (Component-Based Neighborhood Search) strategy searches for optimal solutions by operating on connected components of the graph.

execute(self: CBNSStrategy) SearchResult
class CHNSStrategy

Component-based Hybrid Neighborhood Search strategy.

CHNS (Component-Based Hybrid Neighborhood Search) strategy combines two heuristic methods for search.

execute(self: CHNSStrategy) SearchResult
class DLASStrategy

Diversified Late Acceptance Search strategy.

DLAS (Diversified Late Acceptance Search) strategy uses historical cost acceptance criteria to search for optimal solutions.

execute(self: DLASStrategy) SearchResult
class BCLSStrategy

Betweenness centrality-based late-acceptance search strategy.

BCLS (Betweenness centrality-based late-acceptance search) strategy uses node betweenness centrality to guide the search.

execute(self: BCLSStrategy) SearchResult