[rules-users] Optaplanner - Issue with real-time, chained and shadow variables

Juan Ignacio Barisich juan.barisich at gmail.com
Fri Nov 1 14:38:39 EDT 2013


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?
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.

<http://drools.46999.n3.nabble.com/file/n4017760/serverlog.zip>I'd
appreciate any ideas on how to resolve this.
Best regards,

Juan Ignacio Barisich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20131101/12970555/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VehicleRoutingBugTest.java
Type: text/x-java
Size: 4562 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20131101/12970555/attachment.bin 


More information about the rules-users mailing list