[rules-users] priority based on object properties

Simon Chen simonchennj at gmail.com
Tue Jul 19 09:46:16 EDT 2011


Wolfgang,

How does the offset thing work exactly? Do we set one salience value
for a rule and another offset value based on the fact fields? Or do we
have one expression for salience, in the form of X+Y, where X is a
static numeric value and Y is a formula based on the facts?

It seems to me that the latter case is not much different, because all
activations must be sorted based on the derived salience.

The former case might be useful, as Drools can potentially first
"roughly" sort the activations based on salience values, and then sort
the smaller subsets of activations based on their offset values.

Thanks.
-Simon



2011/7/19 Wolfgang Laun <wolfgang.laun at gmail.com>:
> A rule's salience can be defined with an arbitrary expression which
> may include variables bound to mathced fact fields.
>
> It should be possible to compute the effective salience from a "base"
> salience (according to the rule) plus an offset value derived from
> field values.
>
> -W
>
>
> On 18 July 2011 21:44, Simon Chen <simonchennj at gmail.com> wrote:
>>
>> Hi all,
>>
>> I am curious if we can inform Drools' execution based on properties
>> within objects.
>>
>> In particular, the salience value is defined for each rule, in the
>> sense that rule A has priority over rule B to execute. I am wondering
>> if we can define some kinda of salience metric, such that object X has
>> higher priority than object Y to be executed in the same rule.
>>
>> To give an example, I am (still) playing with implementing shortest
>> path using a few rules. I have a rule for selecting a shortest path on
>> a node (among all the paths received from its neighbors) to a source
>> node, and another rule for propagating the shortest path on a node to
>> neighboring nodes. When I have many nodes in my graph, I found that
>> the paths propagated (via the second rule) are not always the
>> shortest, while Dijkstra's algorithm always "propagate" from the node
>> with the shortest distance to the source. The effect is that my rules
>> are wasting most of the time propagating paths that would be dropped
>> in the end anyway...
>>
>> Any ideas?
>>
>> Thanks.
>> -Simon
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>



More information about the rules-users mailing list