ml4co_kit.task.routing.tsp.pctsp
Prize Collecting Traveling Salesman Problem (PCTSP).
The PCTSP requires finding a tour that minimizes the total travel distance plus the penalty for unvisited nodes, while collecting at least a minimum required prize.
Classes
|
- class ml4co_kit.task.routing.tsp.pctsp.PCTSPTask(distance_type: ~ml4co_kit.task.routing.base.DISTANCE_TYPE = DISTANCE_TYPE.EUC_2D, round_type: ~ml4co_kit.task.routing.base.ROUND_TYPE = ROUND_TYPE.NO, precision: ~numpy.float32 | ~numpy.float64 = <class 'numpy.float32'>, threshold: float = 1e-05)[source]
Bases:
RoutingTaskBase- evaluate(sol: ndarray, check_constr: bool = True) float[source]
Evaluate the total cost of the PCTSP solution.
- from_data(depots: ndarray | None = None, points: ndarray | None = None, penalties: ndarray | None = None, prizes: ndarray | None = None, required_prize: float | None = None, sol: ndarray | None = None, ref: bool = False, normalize: bool = False, name: str | None = None)[source]
Create a problem instance from raw data. To be implemented by subclasses.