[rules-users] Hibernate Configuration with Drools 5.4

Sangram Jethy sangram.jy at gmail.com
Tue Jun 19 07:27:25 EDT 2012


Hi Laun

Tnks for dis wonderfl solution ...I guess our performance issue is solved
as of now..But I got a small query over it.

1) When 10k records were there in the DT, the DT was to compile and all
these 10k rules now stays in the production memory.And we were inserting a
single fact in working memory.
2) But in the approach suggested by you , we got the single rule in the
production memory but now we have 10k facts to be in working memory.But we
get a performance enhancement.

Does it means the size and  speed of working memory is more than to
production memory? Else what is the reason of this performance enhancement?

Regards

On Tue, Jun 19, 2012 at 4:24 PM, Wolfgang Laun <wolfgang.laun at gmail.com>wrote:

> On 19/06/2012, zeeshan <zeeshan.spring at gmail.com> wrote:
> > Hi Laune,
> >
> >
> >
> > Thanks very much for your response.  We would like to try and implement
> > Option 3.
> >
> > We assume that the implementation involves setting up individual rows in
> > the
> > excel as a collection of objects and using the From keyword to look up
> the
> > output value/row we want based on the input parameter values.
>
> Huh? You leave the Excel data as it is except for throwing away the
> header lines.
>
> >  Is it
> > possible for you to share the relevant code you have created to implement
> > this option?
>
> This is the rule:
>
> rule calculatePremium
> when
> $pfc: PremiumCalculatorFactBean( $age: age,
>                          $policyTerm: policyTerm,
>                          $interestRate: interestRate,
>                          $gender: gender,
>                          $smokingStatus: smokingStatus,
>                          $channel: channel,
>                          premiumRate == 0.0 )
> $p: Premium( age == $age,
>        policyTerm == $policyTerm,
>        interestRate == $interestRate,
>        gender == $gender,
>        smokingStatus == $smokingStatus,
>        channel == $channel )
> then
>   modify( $pfc ){ setPremiumRate( $p.getPremiumRate() ) }
> end
>
>
> And a few lines of Java code:
>
>    private void makeRates( String csvPath ) throws Exception {
>        File f = new File( csvPath );
>        InputStream is = new FileInputStream( f );
>        Reader rdr = new InputStreamReader( is );
>        LineNumberReader lnrdr = new LineNumberReader( rdr );
>
>        String line;
>        while( (line = lnrdr.readLine()) != null ){
>            if( line.charAt(0) == '"' ) continue;
>            String[] tokens = line.split( ";" );
>            if( tokens.length != 7 ) continue;
>            int age = Integer.parseInt( tokens[0] );
>            int policyTerm  = Integer.parseInt( tokens[1] );
>            int interestRate = Integer.parseInt( tokens[2] );
>            String gender = tokens[3].substring( 1, 2 );
>            String smokingStatus = tokens[4].substring( 1, 2 );
>            int channel = Integer.parseInt( tokens[5] );
>            double premiumRate = Double.parseDouble( tokens[6] );
>
>            Premium p = new Premium( age, policyTerm, interestRate,
> gender, smokingStatus, channel, premiumRate );
>            kSession.insert( p );
>        }
>        close( rdr );
>    }
>
> -W
>
>
> >
> > Thanks !
> >
> >
> > --
> > View this message in context:
> >
> http://drools.46999.n3.nabble.com/Hibernate-Configuration-with-Drools-5-4-tp4017981p4018051.html
> > Sent from the Drools: User forum mailing list archive at Nabble.com.
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120619/078dcf4f/attachment.html 


More information about the rules-users mailing list