Hi Stefan,
Thanks for your quick answer. So the clear() will make it null by
Arrays.fill(problemStates,null);
to start with in the next iteration.
What I intend to do is to use a
Map<String, VehicleRoute> jobIdRouteMap;
to record the jobId-route relationship, and update the state as
this.stateManager.putProblemState(
this.stateManager.createStateId("jobRouteMemorizer"),
Map.class,
this.jobIdRouteMap
);
in the finish() of ActivityVisitor, to replace updating the state for each jobId as its associated route.
The purpose is to avoid the error IllegalArgumentExceptions raised by the Capacity.max function, which is also reported in this post in the old mailing list and this post on stackoverflow.
The thing is, it seems jobIdRouteMap is not reset to null (or empty map) and for a ruined job its jobId still has a matched route in the map.
EDIT:
I think I figure it out: I need to do this in the begin() of ActivityVisitor:
this.jobIdRouteMap = this.stateManager.getProblemState(
this.stateManager.createStateId("jobRouteMemorizer"),
Map.class
);
if (this.jobIdRouteMap == null)
this.jobIdRouteMap = new HashMap<>();
EDIT 2:
Another way to avoid the error is to update the state (in the old way, i.e., not using the map) only for those jobs in the relation constraints - so it seems the error occurs when the number of jobIds that need to be updated is large? Just my guess.
Hopefully I have made myself understood. Thanks.
Best regards,
He