Mike, thanks for the detailed reply.  It looks like with your example, that we 
can do this calculation portion with drools.  To answer your question, the 
business entities are hierarchical.  Here is a simplified example:

Student
        Name
        Student Number
        Home Address -> Address Entity
        Email
        ApplicationCol -> Collection of Application Entities

Address
        Street
        City
        Province

Application
        Program 
        Period of Study
        Tuition Cost
        Scholarships
        IfMarried
       Number of Children
        Rent Cost

Assessment Results
        Total Need
        Total Resource
        Total Eligible Loan Amount
                



A second part to the process is a workflow like process that allocates the 
money for the student loan from many grants and loan types.  Here is the high 
level logic:


        For each pre-loan grant fund
                If learner has eligibility for the fund then
                        Determine amount from fund
                        Allocate amount to application
                Endif
        End-for

        Federal portion is minimum of assessed need and number of program weeks 
* federal monthly amount
        Reduce federal portion if beyond lifetime maximums

        Calculate provincial portion as remaining portion of loan amount
        Reduce provincial portion if beyond lifetime maximums

        Do not distribute unless greater than minimum loan amount

        For each not pre-loan grant fund
                If application has eligibility for the fund then
                        Determine amount from fund
                        Allocate amount to application
                Endif
        End-for

        Calculate LRC Remission


It would be nice to keep this flow of logic in one place as this mimics how the 
business does it today, and maintainability is one of the three major 
objectives we are trying to accomplish.  The more I read about drools, the more 
I believe it is not suitable for workflow type process.  What open-source 
workflow products are people using that work well with Drools?

Thanks
Don





        
        
________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anstis, Michael 
(M.)
Sent: Friday, November 09, 2007 2:14 AM
To: Rules Users List
Subject: RE: [rules-users] Rules for Hierarchical Type Calculation Formulas

Are the parameters for the calculations hierarchical in your model or are there 
just many components to each equation? For example:-
 
Rule "Total Resource"
when
$s : Student( $e : employmentEarnings, $ss : scholarships, $a : assets)
then
insert(new TotalResource($s, $e + $ss + $a);
end
 
Rule "Child Care Expenses"
when
$s : Student( $nc : numberOfChildren, $pca : perChildAmount)
then
insert(new ChildCareExpenses($s, $nc * $pca);
end
 
Rule "Total Need"
when
$s : Student( $t : tuition, $la : LivingAllowance, $cce : childCareExpenses)
ChildCareExpenses(student == $s, $cce : amount)
then
insert(new TotalNeed($s, $t + $la + $cce);
end
 
Rule "Total Eligible Loan Amount"
when
$s : Student($maa : maxAllowedAmount)
TotalNeed( student == $s, $n : amount)
TotalResource( student == $s, $r : amount)
then
insert(new TotalEligibleLoanAmount(Math.min($n - $r, $maa));
end
 
Possible? Yes. Performant? Performance depends upon many factors (number of 
students, hardware, subjective definition of performant); but there have been 
many postings suggesting Drools is as quick, if not quicker than other 
commercial engines.
 
There are plenty of ways to skin an apple.
 
With kind regards,
 
Mike

________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Don Cameron
Sent: 08 November 2007 23:28
To: [email protected]
Subject: [rules-users] Rules for Hierarchical Type Calculation Formulas
We have been using a custom rules engine successfully for our 1000+
rules for our student loans application, but these rules are decision
based types rules (if then else).

For assessing loan amounts for our student loan application, we have
over 400+ calculation formulas plus decision logic.  These formulas are
mostly simple:

TotalEligilbleLoanAmount = Min(TotalNeed - TotalResource,
MaxAllowedAmount)
      TotalNeed = Tuition + LivingAllowance + ChildCareExpenses
            ChildCareExpenses = NumberOfChildren * PerChildAmount
      TotalResource = EmploymentEarnings + Scholarships + Assets

(however there are 400+ formulas and the hierarchy gets up to 20 deep)

Is it possible to implement something like this in Drools? Will it be
maintainable and performant?

Thanks
Don



This communication is intended for the use of the recipient to which it is 
addressed, and may contain confidential, personal, and or privileged 
information. Please contact us immediately if you are not the intended 
recipient of this communication, and do not copy, distribute, or take action 
relying on it. Any communication received in error, or subsequent reply, should 
be deleted or destroyed. 

This communication is intended for the use of the recipient to which it is 
addressed, and may contain confidential, personal, and or privileged 
information. Please contact us immediately if you are not the intended 
recipient of this communication, and do not copy, distribute, or take action 
relying on it. Any communication received in error, or subsequent reply, should 
be deleted or destroyed.

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to