|
QDpy
|
Score a route and packing and solve exact packing for a fixed tour. More...
Public Member Functions | |
| evaluate (self, tour, packing) | |
| Measure the true travel cost and reward for a feasible route and packing. | |
| solve_packing (self, tour) | |
| Maximize net fitness for a fixed tour using sparse weight states. | |
Score a route and packing and solve exact packing for a fixed tour.
Travel speed decreases linearly with the current carried weight. Pick up items before leaving their cities and include the final edge back to the depot. The objective maximizes packed profit minus the rental cost of travel time. Both tour directions retain their own load order. :param distances: Square finite nonnegative distance matrix. :param items: Sequence of TravelingThiefItem objects. :param capacity: Positive integer weight capacity. :param min_speed: Speed at capacity. :param max_speed: Speed when empty. :param rent: Nonnegative cost per travel-time unit.
Definition at line 67 of file traveling_thief.py.
| qdpy.algorithms.traveling_thief.TravelingThiefProblem.evaluate | ( | self, | |
| tour, | |||
| packing ) |
Measure the true travel cost and reward for a feasible route and packing.
| tour | Permutation of all cities. The final leg returns to the depot. |
| packing | Distinct zero-based item IDs from the input sequence. |
Return the score and archive descriptors for the supplied item IDs.
Definition at line 121 of file traveling_thief.py.
| qdpy.algorithms.traveling_thief.TravelingThiefProblem.solve_packing | ( | self, | |
| tour ) |
Maximize net fitness for a fixed tour using sparse weight states.
| tour | Permutation of all cities. |
Return (solution, item_transitions) for one exact packing solve. Keep the best partial net profit for each reachable weight. Apply the next travel cost once all items at the current city have been considered. Count each candidate item addition that stays within capacity, including candidates discarded by the DP.
Definition at line 147 of file traveling_thief.py.