[Drools Activation-group] / how to set many activation groups

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Drools Activation-group] / how to set many activation groups

jcarpene
Hello,

I am trying to implement some rules that need more that a unique Activation-group.

My case is related to some Voucher codes for online shopping. A simple case works great, by defining an Activation-group to make sure 2 Voucher codes cannot be used at the same time.

But now I need 2 Voucher codes (say Code 1, Code 2) to be compatible (no
activation-group) and a 3rd code (Code 3) to be disabled if Code 1 or Code 2 is used. If I use a XOR group name as an Activation-group, then Code 1 and Code 2 will have a same Activation-group and will be exclusive (which I do not want).

Do you know a way of setting multiple Activation-Groups for example, or any workaround for that case ?


Regards,

Jerome
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] [Drools Activation-group] / how to set many activation groups

salaboy
It seems that you can define a rule to codify what you are explaining. You can change the agenda groups using rules, so you can write a rule that know how and when change the agenda groups for each of your codes.



On Mon, Feb 10, 2014 at 12:16 PM, jcarpene <[hidden email]> wrote:
Hello,

I am trying to implement some rules that need more that a unique
Activation-group.

My case is related to some Voucher codes for online shopping. A simple case
works great, by defining an Activation-group to make sure 2 Voucher codes
cannot be used at the same time.

But now I need 2 Voucher codes (say Code 1, Code 2) to be compatible (no
activation-group) and a 3rd code (Code 3) to be disabled if Code 1 or Code 2
is used. If I use a XOR group name as an Activation-group, then Code 1 and
Code 2 will have a same Activation-group and will be exclusive (which I do
not want).

Do you know a way of setting multiple Activation-Groups for example, or any
workaround for that case ?


Regards,

Jerome




--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Activation-group-how-to-set-many-activation-groups-tp4028033.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



--
 - MyJourney @ http://salaboy.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar
 
 - Salatino "Salaboy" Mauricio -

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] [Drools Activation-group] / how to set many activation groups

laune
On 10/02/2014, Mauricio Salatino <[hidden email]> wrote:
> It seems that you can define a rule to codify what you are explaining. You
> can change the agenda groups using rules, so you can write a rule that know
> how and when change the agenda groups for each of your codes.
>

Please clarify as this sounds as if you can change, programmatically,
the agenda group of a rule. I'm not aware that you can, but maybe this
is just not expressed very well?
-W


>
>
> On Mon, Feb 10, 2014 at 12:16 PM, jcarpene
> <[hidden email]>wrote:
>
>> Hello,
>>
>> I am trying to implement some rules that need more that a unique
>> Activation-group.
>>
>> My case is related to some Voucher codes for online shopping. A simple
>> case
>> works great, by defining an Activation-group to make sure 2 Voucher codes
>> cannot be used at the same time.
>>
>> But now I need 2 Voucher codes (say Code 1, Code 2) to be compatible (no
>> activation-group) and a 3rd code (Code 3) to be disabled if Code 1 or
>> Code
>> 2
>> is used. If I use a XOR group name as an Activation-group, then Code 1
>> and
>> Code 2 will have a same Activation-group and will be exclusive (which I
>> do
>> not want).
>>
>> Do you know a way of setting multiple Activation-Groups for example, or
>> any
>> workaround for that case ?
>>
>>
>> Regards,
>>
>> Jerome
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Drools-Activation-group-how-to-set-many-activation-groups-tp4028033.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
>  - MyJourney @ http://salaboy.com <http://salaboy.wordpress.com>
>  - Co-Founder @ http://www.jugargentina.org
>  - Co-Founder @ http://www.jbug.com.ar
>
>  - Salatino "Salaboy" Mauricio -
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] [Drools Activation-group] / how to set many activation groups

laune
In reply to this post by jcarpene
All rule attributes are (more or less) just ad-hoc shortcuts for certain
scenarios which can, with little effort, be implemented using the
elementary techniques of inference, truth maintenance, fact manipulation
etc.

In fact, not letting rule attributes befuddle your mind will enable
you to design a clean logic. Finally, you proceed to implementation,
and then - only then - it is time to think about applying those
shortcuts.

-W


On 10/02/2014, jcarpene <[hidden email]> wrote:

> Hello,
>
> I am trying to implement some rules that need more that a unique
> Activation-group.
>
> My case is related to some Voucher codes for online shopping. A simple case
> works great, by defining an Activation-group to make sure 2 Voucher codes
> cannot be used at the same time.
>
> But now I need 2 Voucher codes (say Code 1, Code 2) to be compatible (no
> activation-group) and a 3rd code (Code 3) to be disabled if Code 1 or Code
> 2
> is used. If I use a XOR group name as an Activation-group, then Code 1 and
> Code 2 will have a same Activation-group and will be exclusive (which I do
> not want).
>
> Do you know a way of setting multiple Activation-Groups for example, or any
> workaround for that case ?
>
>
> Regards,
>
> Jerome
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-Activation-group-how-to-set-many-activation-groups-tp4028033.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] [Drools Activation-group] / how to set many activation groups

jcarpene
Hi,

thank you for your advice.

However (I have to dive a bit more into Drools I guess), in your opinion, is the best way to rely on Agenda Groups (which could allow me not to fire some rules depending by controlling the agenda) or to build a condition taking a list of "manual" XOR groups to calculate if the Rule is activated or not ?


Regards,

Jerome
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] [Drools Activation-group] / how to set many activation groups

laune
How many different states (based on the validity of vouchers) do you
have during an evaluation cycle? How are rules related to these
states? What controls the transition from one state to another?

Please understand that only a solid analysis can provide sound advice.

-W


On 11/02/2014, jcarpene <[hidden email]> wrote:

> Hi,
>
> thank you for your advice.
>
> However (I have to dive a bit more into Drools I guess), in your opinion,
> is
> the best way to rely on Agenda Groups (which could allow me not to fire
> some
> rules depending by controlling the agenda) or to build a condition taking a
> list of "manual" XOR groups to calculate if the Rule is activated or not ?
>
>
> Regards,
>
> Jerome
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-Activation-group-how-to-set-many-activation-groups-tp4028033p4028066.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] [Drools Activation-group] / how to set many activation groups

jcarpene

Well, we do not really manage states, that is to say each voucher has a Rule which will be executed or not.
All the rules are at the same level.

The evaluation phase fires only the Rules that can be activated at the same time (currently thanks to the Activation-group)
The output is a list of objects (Promotions) which are added to the Basket.

I am thinking of a new Condition which could test some "context" to exclude Rules from activation, but not sure it is the right way ... What do you think ?


Jerome
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] [Drools Activation-group] / how to set many activation groups

laune
I can only let my imagination run wild... Let's say you have n
vouchers. It may be that voucher i blocks voucher j or vice versa, or
voucher i should be preferred against j (not reflexive). These rules
should be evaluated up front, leaving you with a consolidated voucher
set - you can call this "context" - and the promotions can be derived
from that.

I think that the logic for this stage can be expressed by simple
rules, resulting in the insertion of some derived fact(s). Of course,
simple and uniform scenarios like i blocks j for all i != j can be
handled using a rule attribute, but devising a more general mechanism
will prepare you for all contingencies. (You never know what your
markting dptmt will cook up next, don't you?)

-W



On 11/02/2014, jcarpene <[hidden email]> wrote:

>
> Well, we do not really manage states, that is to say each voucher has a
> Rule
> which will be executed or not.
> All the rules are at the same level.
>
> The evaluation phase fires only the Rules that can be activated at the same
> time (currently thanks to the Activation-group)
> The output is a list of objects (Promotions) which are added to the Basket.
>
>
> I am thinking of a new Condition which could test some "context" to exclude
> Rules from activation, but not sure it is the right way ... What do you
> think ?
>
>
> Jerome
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-Activation-group-how-to-set-many-activation-groups-tp4028033p4028074.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users