Solver parameters for PyVRP's iterated local search algorithm. Parameters ---------- ils Iterated local search parameters. penalty Penalty parameters. neighbourhood Neighbourhood parameters. node_ops Node operators to use in the search.
| 30 | |
| 31 | |
| 32 | class SolveParams: |
| 33 | """ |
| 34 | Solver parameters for PyVRP's iterated local search algorithm. |
| 35 | |
| 36 | Parameters |
| 37 | ---------- |
| 38 | ils |
| 39 | Iterated local search parameters. |
| 40 | penalty |
| 41 | Penalty parameters. |
| 42 | neighbourhood |
| 43 | Neighbourhood parameters. |
| 44 | node_ops |
| 45 | Node operators to use in the search. |
| 46 | route_ops |
| 47 | Route operators to use in the search. |
| 48 | display_interval |
| 49 | Time (in seconds) between iteration logs. Default 5s. |
| 50 | perturbation |
| 51 | Perturbation parameters. |
| 52 | """ |
| 53 | |
| 54 | def __init__( |
| 55 | self, |
| 56 | ils: IteratedLocalSearchParams = IteratedLocalSearchParams(), |
| 57 | penalty: PenaltyParams = PenaltyParams(), |
| 58 | neighbourhood: NeighbourhoodParams = NeighbourhoodParams(), |
| 59 | node_ops: list[type[NodeOperator]] = NODE_OPERATORS, |
| 60 | route_ops: list[type[RouteOperator]] = ROUTE_OPERATORS, |
| 61 | display_interval: float = 5.0, |
| 62 | perturbation: PerturbationParams = PerturbationParams(), |
| 63 | ): |
| 64 | self._ils = ils |
| 65 | self._penalty = penalty |
| 66 | self._neighbourhood = neighbourhood |
| 67 | self._node_ops = node_ops |
| 68 | self._route_ops = route_ops |
| 69 | self._display_interval = display_interval |
| 70 | self._perturbation = perturbation |
| 71 | |
| 72 | def __eq__(self, other: object) -> bool: |
| 73 | return ( |
| 74 | isinstance(other, SolveParams) |
| 75 | and self.ils == other.ils |
| 76 | and self.penalty == other.penalty |
| 77 | and self.neighbourhood == other.neighbourhood |
| 78 | and self.node_ops == other.node_ops |
| 79 | and self.route_ops == other.route_ops |
| 80 | and self.display_interval == other.display_interval |
| 81 | and self.perturbation == other.perturbation |
| 82 | ) |
| 83 | |
| 84 | @property |
| 85 | def ils(self): |
| 86 | return self._ils |
| 87 | |
| 88 | @property |
| 89 | def penalty(self): |
no outgoing calls