<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 &quot;Vehicle Routing&quot; 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&#39;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&#39;m doing wrong?<br>

</div>I have attached a test case based on the &quot;Vehicle Routing&quot;. 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&#39;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>