Hi everybody
I am using optaplanner in real-time style. My application domain is similar to the "Vehicle Routing" example (
http://docs.jboss.org/drools/release/6.0.0.CR5/optaplanner-docs/html_single/index.html#vehicleRouting). I mean, I am using chained variables and shadow variables. I have a problem while trying to remove a fact (an entity), via a ProblemFactChange:
java.lang.IllegalArgumentException: The entity instance (...) was never added to this ScoreDirector. Usually the cause is that that specific instance was not in your Solution's entities.
The fact removing that I made is like:
solver.addProblemFactChange(new ProblemFactChange() {
@Override
public void doChange(ScoreDirector scoreDirector) {
...
scoreDirector.beforeEntityRemoved(toRemove);
workingSolution.getCustomerList().remove(toRemove);
scoreDirector.afterEntityRemoved(toRemove);
}
});
I think the problem is there. Do you know what I'm doing wrong?