You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Introduces Type enum (SHIPMENT, PICKUP_SERVICE, DELIVERY_SERVICE, BREAK_SERVICE)
- Replaces instanceof type checks with semantic getType() method
- Maintains backward compatibility with default implementation
- Improves code readability and type safety
- Makes adding new job types more straightforward
Part of ongoing effort to reduce type checking and improve domain model clarity.
Copy file name to clipboardexpand all lines: jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/JobInsertionCostsCalculatorBuilder.java
+1-1
Original file line number
Diff line number
Diff line change
@@ -260,7 +260,7 @@ public JobInsertionCostsCalculator build() {
260
260
261
261
privatevoidcheckServicesOnly() {
262
262
for (Jobj : vrp.getJobs().values()) {
263
-
if (jinstanceofShipment) {
263
+
if (j.getJobType().isShipment()) {
264
264
thrownewUnsupportedOperationException("currently the 'insert-on-route-level' option is only available for services (i.e. service, pickup, delivery), \n" +
265
265
"if you want to deal with shipments switch to option 'local-level' by either setting bestInsertionBuilder.setLocalLevel() or \n"
266
266
+ "by omitting the xml-tag '<level forwardLooking=2 memory=1>route</level>' when defining your insertionStrategy in algo-config.xml file");
Copy file name to clipboardexpand all lines: jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrentFast.java
@@ -218,7 +217,7 @@ public Builder addJob(Job job) {
218
217
publicBuilderaddJob(AbstractJobjob) {
219
218
if (tentativeJobs.containsKey(job.getId()))
220
219
thrownewIllegalArgumentException("The vehicle routing problem already contains a service or shipment with id " + job.getId() + ". Please make sure you use unique ids for all services and shipments.");
221
-
if (!(jobinstanceofService || jobinstanceofShipment))
220
+
if (!(jobinstanceofService || job.getJobType().isShipment()))
222
221
thrownewIllegalArgumentException("Job must be either a service or a shipment.");
Copy file name to clipboardexpand all lines: jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/constraint/ServiceLoadRouteLevelConstraint.java
0 commit comments