<div dir="ltr"><div><div><div><div><div><div><div>Hi everybody<br></div>I am using optaplanner in real-time style. My application domain is similar to the "Vehicle Routing" example (<a href="http://docs.jboss.org/drools/release/6.0.0.CR5/optaplanner-docs/html_single/index.html#vehicleRouting">http://docs.jboss.org/drools/release/6.0.0.CR5/optaplanner-docs/html_single/index.html#vehicleRouting</a>). 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:<br>
<br>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.<br><br></div>The fact removing that I made is like:<br>
<br>solver.addProblemFactChange(new ProblemFactChange() {<br><br> @Override<br> public void doChange(ScoreDirector scoreDirector) {<br> ...<br> scoreDirector.beforeEntityRemoved(toRemove);<br>
workingSolution.getCustomerList().remove(toRemove);<br> scoreDirector.afterEntityRemoved(toRemove);<br> }<br> });<br><br></div>I think the problem is there. Do you know what I'm doing wrong?<br>
</div>I have attached a test case based on the "Vehicle Routing". To run it, just put that file into the optaplanner-distribution-6.0.0.CR5/examples/sources/src/test/java/org/optaplanner/examples/vehiclerouting/app/ directory.<br>
<br></div><a href="http://drools.46999.n3.nabble.com/file/n4017760/serverlog.zip" target="_top" rel="nofollow"><span></span></a><span>I'd appreciate any ideas on how to resolve this.</span></div>Best regards,<br><br>
</div>
Juan Ignacio Barisich<br><div><div><div><div><br><br><br><br></div></div></div></div></div>