Class TSPLnsMain

java.lang.Object
org.ddolib.examples.tsp.TSPLnsMain

public class TSPLnsMain extends Object
Entry point for solving the Traveling Salesman Problem (TSP) using a Large Neighborhood Search (LNS) approach.

This class reads an instance file describing a TSP problem, constructs an LNS model, and searches for an optimal or near-optimal tour within a time limit. The best solution found is printed to standard output.

Usage:

 java TSPLnsMain [instanceFilePath]
 
  • instanceFilePath (optional): Path to the TSP instance file. If omitted, the default instance located at data/TSP/instance_18_0.xml is used.

The LNS model is configured with:

  • A TSPFastLowerBound for efficient lower bound estimation.
  • A TSPRanking to rank tour decisions during the search.
  • A fixed width heuristic (FixedWidth) with a width of 500 for tree exploration.

The search is limited to 10,000 milliseconds (10 seconds) per iteration, and the best solution found is printed using SolutionPrinter.

This implementation does not include dominance checks.

Version:
1.0
Author:
  • Constructor Details

    • TSPLnsMain

      public TSPLnsMain()
  • Method Details

    • main

      public static void main(String[] args) throws IOException
      Main method to run the TSP LNS solver.
      Parameters:
      args - optional command-line argument:
      • args[0]: path to the TSP instance file (default: data/TSP/instance_18_0.xml)
      Throws:
      IOException - if there is an error reading the instance file.