Hi Evert, Op 24-03-11 15:10, Evert Penninckx schreef: > Hi > > General question on the drools planner. If I'm not mistaken, I see three > ways to impose hard constraints: > > 1. Generate violations in the scoring DRL. This is the normal way for hard constraints. > 2. Check them in isMoveDoable This is a really bad idea. Take a look in the latest snapshot/hudson reference manual in the section about "Delta Score calculation" to understand why. https://hudson.jboss.org/hudson/view/Drools%20jBPM/job/drools-planner/lastSuccessfulBuild/artifact/ > 3. Do not create moves in the MoveFactory which cause hard constraints to be > broken. Then they are called "build-in hard constraints". It's quite difficult to do this right, but as SimpleTravelingTournamentApp vs SmartTravelingTournamentApp proves, this can be definitely worth doing, because the smart one is a lot better.
See "tip and tricks" section in the reference manual. But still, in my experience, making some constraints "build-in hard constraints" is a short term gain, but a possible long term loss, because you're limiting the freedom of moves. But this is use case specific. Generally, in my experience, I prefer just mixing in course-grained moves together with the fine-grained moves first, before experimenting with build-in hard constraints. > For safety I would always add a check in the DRL (1) in combination with 2 > or 3 if possible. > I assume that checks in isMoveDoable are more expensive in terms of > performance and should only be put there if they can vary with each > solution. > > Does this make sense? > > > Evert > > -- > View this message in context: > http://drools-java-rules-engine.46999.n3.nabble.com/planner-Hard-constraints-in-drl-MoveFactory-or-isMoveDoable-tp2725305p2725305.html > Sent from the Drools - User mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > -- With kind regards, Geoffrey De Smet _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
