<div style="text-align:justify"><div><div><div style="font-size:12px;line-height:18px"><font color="#333333" face="'Lucida Grande', Geneva, Verdana, Arial, sans-serif"><div>Hi,</div><div><br></div><div>I'm still in process to model my planning problem and I have some difficulties in defining the correct weight of soft constraints. I have soft constraints with different priorities : C1, C2, C3, ..., Cn where C1 are higher then C2. Currently, I've tried to set different weight for each of them : C1 get higher weight. But it's not sufficient since multiple C2 may balance one C1. What I really need is to set the priority to every soft constraints.</div>
<div><br></div><div>Solution #1 :</div><div>My first thought it to implement a new score definition (HardAndSoftPriorityScoreDefinition) having separate soft score for each priority. The rule may insert ConstraintOccurence by defining the weight and the priority. This solution seems elegant but require effort to implement the score definition, the score calculation, and other things I don't even know about.</div>
<div><br></div><div>Solution #2 :</div><div>The other solution is stated in the Drools Planner User Guide : </div></font></div></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div style="text-align:justify">
<div><div><div style="font-size:12px;line-height:18px"><font color="#333333" face="'Lucida Grande', Geneva, Verdana, Arial, sans-serif"><div>"Most use cases will also weigh their constraints differently, by multiplying the count of each score rule with its weight. For example in freight routing, you can make 5 broken "avoid crossroads" soft constraints count as much as 1 broken "avoid highways at rush hour" soft constraint. This allows your business analysts to easily tweak the score function as they see fit."</div>
</font></div></div></div></div></blockquote><div style="text-align:justify"><div><div><div><font color="#333333" face="'Lucida Grande', Geneva, Verdana, Arial, sans-serif"><div style="font-size:12px;line-height:18px">
Even tough I don't know how to implement this, it's seems much easier to achieve since it's only a rule. Compare to solution #1, it's lack the support of soft constraints with same priority but different weights.</div>
<div style="font-size:12px;line-height:18px"><br></div><div style="font-size:12px;line-height:18px">What is your opinion about both solution.</div><div style="font-size:12px;line-height:18px"><br></div><div style="font-size:12px;line-height:18px">
Is one faster then the other ? </div><div style="font-size:12px;line-height:18px"><br></div><div><span style="font-size:12px;line-height:18px">Is it hard to create a new score definition ?</span></div><div><span style="font-size:12px;line-height:18px"><br>
</span></div><div><span style="font-size:12px;line-height:18px">Did anyone ever did this ? </span></div><div style="font-size:12px;line-height:18px"><br></div></font></div></div></div></div>-- <br>Patrik Dufresne<br>