[rules-users] Using java to score solutions in drools planner

Geoffrey De Smet ge0ffrey.spam at gmail.com
Tue Jan 31 03:38:57 EST 2012


Op 30-01-12 21:22, babsher schreef:
> > From what I have read in the user documentation the DRL format is just one
> way to score a solution.
>   I already have a java library that will develop
> scores for my domain.
>
> Is there a way to skip creating rules and use the existing code I have? Is
> it as simple as just overriding the getScore function in my solution class?
Currently, out-of-the-box, DRL is the only way, but there's been more 
and more demand of providing a plain old java alternative.
Here's the issue: https://issues.jboss.org/browse/JBRULES-3367 
(watch/vote if it's important to you)

It's not that hard to hack it:
- Overwrite SolutionDescriptor and return a dummy WorkingMemory in 
SolutionDescriptor.getWorkingMemory().
- Call your java code in SolutionDescriptor.calculateScore().

Make sure you understand the concept of "delta score calculation", the 
main reason why DRL as score calculation is a good idea:
   
http://docs.jboss.org/drools/release/5.4.0.Beta1/drools-planner-docs/html_single/index.html#deltaBasedScoreCalculation
Not doing delta's kills scalability.

> Thanks,
> Bryan
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Using-java-to-score-solutions-in-drools-planner-tp3701137p3701137.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
>

-- 
With kind regards,
Geoffrey De Smet





More information about the rules-users mailing list