<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span>&gt;</span> That's comparing apples and oranges.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">&gt; If you have 2 solutions A and B scored using a different score
    function, it's impossible to state whether A is better/worse than B
    based on those scores or the number of violations.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">Well the rules stay the same, only the weight is changed.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">If I have for example a rule (R1) that requires a given skill for a job and a rule (R2) which says someone can only do one job at the time then</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family:
 arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">Solution A) with different weights I get something like 20 violations of R1 and 10 violations of R2</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">Solution B) with equal weights I get something like 5 violations of R1 and 2 violations of R2</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">So B) is better.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">I understand the fact that a business analysis defines the
 weights, that's why they have been different so far.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">1)&nbsp; I just don't know how to get to solution B (which is better than A if you recalculate with the weights of A) with the correct weights applied.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">2) Can you indicate how hard it is to migrate from 5.5.0 to 6.0?</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family:
 arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">Thanks</div><div>&nbsp;</div><div>-----------------<br>http://www.codessentials.com - Your essential software, for free!<br>Follow us at http://twitter.com/#!/Codessentials<br></div>  <div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Geoffrey De Smet &lt;ge0ffrey.spam@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Michiel Vermandel &lt;mvermand@yahoo.com&gt;; Rules Users List &lt;rules-users@lists.jboss.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, June 6, 2013 11:15 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [drools-planner] please advice on IntConstraintOccurrence weight<br>
 </font> </div> <div class="y_msg_container"><br><div id="yiv2642368488">
  

    
  
  <div>
    <br>
    <div class="yiv2642368488moz-cite-prefix">On 06-06-13 10:22, Michiel Vermandel
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div><span>Hi,</span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
        </div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;">(using drools-planner
          5.5.0.Final)</div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
          <span></span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><span>I'm struggling with
            assigning weights to IntConstraintOccurrence in a rule's
            LHS.</span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><span>If I assign different
            weights for different rules (because we think one rule is
            more important than an other)</span></div>
      </div>
    </blockquote>
    The business analysis defines the score weights, it's not our call
    to make which is more important etc.<br>
    One way talk to you your business people and get them to convert
    their knowledge into score weights<br>
    is to ask "if you had to put a price tag on everything, how much
    would violating this constraint cost us?".<br>
    Basically normalize everything to a price.<br>
    <br>
    For example: in nurse rostering, "not giving a nurse her day off
    requests costs the solution 100 $".<br>
    It might seem unethical to put a price tag on a nurse's happiness,
    but reality does it implicitly anyway.<br>
    <br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><span> our end result is far
            worse than when we assign all equal weights.</span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><span>I do not look at the
            total value of hard and soft score but at the number of
            violations.</span></div>
      </div>
    </blockquote>
    That's comparing apples and oranges.<br>
    If you have 2 solutions A and B scored using a different score
    function, it's impossible to state whether A is better/worse than B
    based on those scores or the number of violations.<br>
    <br>
    What you can do is take solution B and grind it through A's score
    function to compare it with score A (or vica versa).<br>
    <br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><span>I can imagine that the
            planner can evolve much easier to a better solution with all
            weights being the same because if not then "transient" moves
            will be made impossible to take.</span></div>
      </div>
    </blockquote>
    Yes, if and only if the more difficult constraints have higher
    weights (otherwise it's the opposite).<br>
    <br>
    But it's a bit absurd. For example in nurse rostering, I could give
    all nurses their day off requests if I didn't have to worry about
    assigning no more than 2 shifts to the same nurse as the same
    time...<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
          <span></span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><span>But how should we then
            implement importance in rules?</span></div>
      </div>
    </blockquote>
    Define your score function as your business needs it. Use the
    techniques described in the 6.0 manual: negative/postive, weights
    and levels.<br>
    <br>
    PS: 6.0.0.Beta3 is out and the new addSoftConstraintMatch() system
    is much faster and easier to use (see the blog post of a few months
    ago).<br>
    <blockquote type="cite">
      <div style="color:#000;background-color:#fff;font-family:arial, helvetica, sans-serif;font-size:10pt;">
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><br>
          <span></span></div>
        <div style="color:rgb(0, 0, 0);font-size:13.3333px;font-family:arial, helvetica, sans-serif;
background-color:transparent;font-style:normal;"><span>Thanks</span></div>
        <div>&nbsp;</div>
        <div>-----------------<br>
          <a rel="nofollow" class="yiv2642368488moz-txt-link-freetext" target="_blank" href="http://www.codessentials.com/">http://www.codessentials.com</a> - Your essential software, for
          free!<br>
          Follow us at <a rel="nofollow" class="yiv2642368488moz-txt-link-freetext" target="_blank" href="http://twitter.com/#!/Codessentials">http://twitter.com/#!/Codessentials</a></div>
      </div>
      <br>
      <fieldset class="yiv2642368488mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
rules-users mailing list
<a rel="nofollow" class="yiv2642368488moz-txt-link-abbreviated" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a rel="nofollow" class="yiv2642368488moz-txt-link-freetext" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
    </blockquote>
    <br>
  </div>

</div><br><br></div> </div> </div>  </div></body></html>