Skip to main content

Swap Full Containers

Evaluates exchanging all objects in the hot container with all objects of another container, for every possible other container. Destination containers are processed in parallel.

Swap full containers move: all objects in the hot container are exchanged with all objects in another container

Parameters

SwapFullContainersMoveTypeSpec takes no parameters. To bound exploration time per hot container, set timePerMove on the LocalSearchSolverSpec.

Behavior

Given the hot container chosen by the common logic:

  1. Pick a different container (the "other container").
  2. Evaluate exchanging all objects between the hot container and the other container.

Every other container is tried and the best full-container swap is selected.

Complexity

Roughly objects * (containers - 1) neighbors are evaluated.

Example

Configure local search to use only the swap full containers move type:

LocalSearchSolverSpec localSearch;
localSearch.moveTypeList()->push_back(
ProblemSolver::makeMoveTypeSpec(SwapFullContainersMoveTypeSpec()));

solver.addSolver(localSearch);

(source)