[rules-users] Drools planner & Scala => Multi threading

Geoffrey De Smet ge0ffrey.spam at gmail.com
Sat Feb 6 04:18:42 EST 2010


> And a side question: do you have any plans on implementing multithreading in planner? So that several moves could be explored concurrently? I saw there's an open Jira issue for some time, but it didn't have any timeframe information.

Multi threading is one of my 2 big goals for this year (next to a branch 
and bound implementation which might also have need of the 
whatIsBeingMoved and whereIsItBeingMovedToo concepts).

I've got a bunch in my head, I 'll try to update the JIRA so you can 
follow (and improve?) my thoughts.

https://jira.jboss.org/jira/browse/JBRULES-681

PS: Your hibernate-envers looks really cool, I 'll probably use it at my 
day job :)

With kind regards,
Geoffrey De Smet


Adam Warski schreef:
> Hello,
> 
> I'm using Planner in a Scala program and it almost works without problems; the only one is in implementing the Solution interface, as it uses raw (erased) version of Score, which is normally generic (Score<S extends Score>). Scala generally doesn't like raw types and in most cases it's impossible to extend/implement interfaces which use them. A work-around is to introduce an "adapter" in Java, which you can later extend in Scala:
> 
> public abstract class ScalaSolution implements Solution {
>     public Score getScore() { return getScoreScala(); }
>     public abstract Score<?> getScoreScala();
> 
>     public void setScore(Score score) { setScoreScala(score); }
>     public abstract void setScoreScala(Score<?> score);  
> }
> 
> and then in Scala:
> 
> class Schedule(...) extends ScalaSolution {
>   var score: Score[_] = _
> 
>   def setScoreScala(score: Score[_]) = { this.score = score }
>   def getScoreScala = score
> 
>   ...
> }
> 
> So the fix is to replace the raw Score type with Score<?>. Maybe it would be possible to apply that in the code? I tried it locally and it compiles without problems.
> 
> And a side question: do you have any plans on implementing multithreading in planner? So that several moves could be explored concurrently? I saw there's an open Jira issue for some time, but it didn't have any timeframe information.
> 




More information about the rules-users mailing list