<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 01-11-13 19:38, Juan Ignacio
Barisich wrote:<br>
</div>
<blockquote
cite="mid:CAFGE-fUwp2e2LeXrXZVU_0=UsgOs3zkHewPudS+W9KzjUVUMEA@mail.gmail.com"
type="cite">
<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 moz-do-not-send="true"
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>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
the remove() method will make no difference because the Customer
"toRemove" instance<br>
is not the same instance as which is in the workingSolution's
Customer list.<br>
<br>
See the CloudBalancing's PRoblemFactChange implementation how to
solve this.<br>
And one of the warnings in the Real-time planning section of the
docs to understand it better:)<br>
<blockquote
cite="mid:CAFGE-fUwp2e2LeXrXZVU_0=UsgOs3zkHewPudS+W9KzjUVUMEA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
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 moz-do-not-send="true"
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
</blockquote>
<br>
</body>
</html>