[rules-users] Is Drools suitable for preprocessing my Resource Allocation Problem

Vincent LEGENDRE vincent.legendre at eurodecision.com
Mon Dec 10 04:30:00 EST 2012


Hi
I did not get the use case here.

When you write  :
> The Problem : I have an optimisation engine that can allocate some activities
> to some resources, while optimizing some KPIs (Key Performance Indicator).
>
> The optimizer takes as input (among others) a list of forbiden allocations
> that should be generated based on some user-provided rules.

to me you mean "generating an allocation plan".
drools-planner is for you, especially if your users want to define more complex rules.

> As soon as a pair of [Activity,Resource] matches one rule, it should be
> sent as output, and not tested again against other rules.
>
> Also, this is important to note that some rules will match very often,
> while overs will match very rarely (very specific cases).

and here it sounds like a service that has a stream to consume ?
then just write rules, put a session in a separate thread, and send him your stream as input.
You can even use drools-fusion time operators.


> Performance constraints
> Here are some rough hints about the volumetry of the problem :
> * 1000 activities
> * 200 resources
> * 50 rules
>
> I need the forbidden allocations to be generated in under a minute.

is it the due time for you plan ?
or each minute, you need to check 1000a and 200r ?


> For example, I would not generate all possible allocations (200.000) and
> then try to apply each rule on it (50 rules x 200.000).
not 200000 obj, but 200000 binary variables.
Use local search (drools-planner) or other methods (depends on your KPIs).

if stream processing, processing 200.000 objects with 50 rules within a minute is not so hard (depends on rules as W. said).


> Instead, I would try to match the resources and the activities separately
> on each rule (each side of the rule), and then assemble the couples that
> match at least one common rule.

RETE will do that for you


> Also, I would add some counter on each rule that would auto increment upon
> each match, in order to apply first the rules that match often.

If there is a session in a thread, ie maintaining its kownledge over time, 
RETE will do that for you, by propagating only the updates to the matching rules (forward chaining).

If you speak about optimisation using local search, drools-planner will do that for you (by using the previous, may be with adding so custom moves generators).


> QuestionsIs the engine of Drools smart enought for that ? Or is he even
> smarter ?
If the point is to process forbidden associations, yes, drools can be smarter than that.
I whould even say that drools shoud be used only if you want to do to more than that.

> Do you have an example of Drools being used in a similar problem with
> success ?
optim : drools-planner and its cloud balancing sample
real-time stream : look at drools-fusion samples and also drools-expert doc (to get the basis of what rules can do)



More information about the rules-users mailing list