On 01-11-13 19:38, Juan Ignacio Barisich wrote:
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);
the remove() method will make no difference because the Customer "toRemove" instance
is not the same instance as which is in the workingSolution's Customer list.

See the CloudBalancing's PRoblemFactChange implementation how to solve this.
And one of the warnings in the Real-time planning section of the docs to understand it better:)
                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.

I'd appreciate any ideas on how to resolve this.
Best regards,

Juan Ignacio Barisich






_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to