Package org.ddolib.examples.tsp
Class TSPState
java.lang.Object
org.ddolib.examples.tsp.TSPState
Represents a state in the Traveling Salesman Problem (TSP).
A TSPState captures the current situation of the tour:
current– the set of nodes currently being considered as the current location. In most cases, this is a singleton, but during state merging (relaxation), it may contain multiple nodes.toVisit– the set of nodes that have not yet been visited.
This class provides methods to handle singleton nodes, and overrides equals, hashCode,
and toString for proper use in collections and debugging.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
TSPState
Constructs a new TSPState.- Parameters:
current- the current node(s)toVisit- the nodes that have not yet been visited
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
singleton
Creates a BitSet containing only the specified singleton value.- Parameters:
singletonValue- the value to set- Returns:
- a BitSet with a single bit set
-
toString
-