[rules-users] Drools Planner: Vehicle routing problems

Geoffrey De Smet ge0ffrey.spam at gmail.com
Mon Feb 27 05:10:31 EST 2012



Op 27-02-12 10:46, davidglassborow schreef:
> Hi Ge0ffrey,
>
>> What do you mean by initial solution? The setPlanningProblem() aka "the
>> uninitialed solution"
>> or the solution after the construction heuristic (aka "the initialized
>> solution")
> I mean the initialised solution
>
>> What's "109"?
> Sorry, the number is just the number of milliseconds as returns by the new
> solution event
>
>> Ok, if it's invalid here, it's invalid during the construction heuristic
>> already.
> so at this point the solution is valid, its later steps where I get the
> problem
>
>>> At 127:
>>> D =>   Crew2
>>> A =>   B =>   Crew1
>>> B =>   A =>   B =>   Crew1
>> How is this possible? That means that B is pointing both to A and to Crew1
> ?
>> It's only a single pointer? VrpCustomer.getPreviousAppereance()
> Indeed this is my problem.  There seems to be more than 1 instance of B.
> I've debugged my example code, and then issue seems to be:
>
> https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/vehiclerouting/domain/Job.java#L33
>
> The solver seems to be assigning the visit to be before itself !
>
> If you look at:
>
> https://github.com/davidglassborow/drools-planner/blob/vehicle_routing/drools-planner-examples/src/main/java/org/drools/planner/examples/tsp/domain/Visit.java#L59
>
> you'll see I have added a check to your Visit.java, which doesn't display
> the same problem.
>
> So I'm not sure what is happening, domain objects seems to be cloned and
> assigned to themselves.
Check your Solution's cloning method.

If you clone the Visit, you need to make sure that planning variables of 
each cloned Visit are pointing to the new clones and not the original 
Visits.
See my implementation in TSP.

> I have checked and double-checked the code inline with your TSP example, I'm
> sure it's nothing stupid I've done but can't for the life of me see anything
> wrong.
>
> If you download the branch, and run the VehicleRoutingHelloWorld class,
> you'll see the problem occuring.
>
>> I hacked TSP to do multi TSP (see my google+ image), and it worked
>> without a problem, so there must be a difference somewhere in your code.
> What did you need to change to get that to work ? Was it just a case of
> adding another domicile, and then removing the return to domicile cost rule
> ?
>
> Cheers for the help,
> Dave
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems-tp3772797p3780139.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

-- 
With kind regards,
Geoffrey De Smet





More information about the rules-users mailing list